FNFT
|
Slow forward scattering. More...
#include "fnft__akns_discretization.h"
#include <stdio.h>
#include <string.h>
#include "fnft__errwarn.h"
#include "fnft__misc.h"
Go to the source code of this file.
Functions | |
FNFT_INT | fnft__akns_scatter_matrix (FNFT_UINT const D, FNFT_COMPLEX const *const q, FNFT_COMPLEX const *const r, FNFT_REAL const eps_t, FNFT_UINT const K, FNFT_COMPLEX const *const lambda, FNFT_COMPLEX *const result, FNFT_INT *const W, fnft__akns_discretization_t discretization, fnft__akns_pde_t const PDE, FNFT_UINT const vanilla_flag, FNFT_UINT const derivative_flag) |
Computes the scattering matrix and its derivative. | |
FNFT_INT | akns_scatter_bound_states (FNFT_UINT const D, FNFT_COMPLEX const *const q, FNFT_COMPLEX const *const r, FNFT_REAL const *const T, FNFT_UINT const K, FNFT_COMPLEX const *const bound_states, FNFT_COMPLEX *const a_vals, FNFT_COMPLEX *const aprime_vals, FNFT_COMPLEX *const b_vals, FNFT_INT *Ws, fnft__akns_discretization_t const discretization, fnft__akns_pde_t const PDE, FNFT_UINT const vanilla_flag, FNFT_UINT const skip_b_flag) |
Computes \(a(\lambda)\), \( a'(\lambda) = \frac{\partial a(\lambda)}{\partial \lambda}\) and \(b(\lambda)\) for complex values \(\lambda\) assuming that they are very close to the true bound-states. | |
Slow forward scattering.
FNFT_INT akns_scatter_bound_states | ( | FNFT_UINT const | D, |
FNFT_COMPLEX const *const | q, | ||
FNFT_COMPLEX const *const | r, | ||
FNFT_REAL const *const | T, | ||
FNFT_UINT const | K, | ||
FNFT_COMPLEX const *const | bound_states, | ||
FNFT_COMPLEX *const | a_vals, | ||
FNFT_COMPLEX *const | aprime_vals, | ||
FNFT_COMPLEX *const | b_vals, | ||
FNFT_INT * | Ws, | ||
fnft__akns_discretization_t const | discretization, | ||
fnft__akns_pde_t const | PDE, | ||
FNFT_UINT const | vanilla_flag, | ||
FNFT_UINT const | skip_b_flag | ||
) |
Computes \(a(\lambda)\), \( a'(\lambda) = \frac{\partial a(\lambda)}{\partial \lambda}\) and \(b(\lambda)\) for complex values \(\lambda\) assuming that they are very close to the true bound-states.
The function performs slow direct scattering and is primarily based on the references
[in] | D | Number of samples |
[in] | q | Array of length D, contains samples \( q_n\) for \(n=0,1,\dots,D-1\) in ascending order (i.e., \( q_0, q_1, \dots, q_{D-1} \)). The values should be specifically precalculated based on the chosen discretization. |
[in] | r | Array of length D, contains samples \( r_n\) for \(n=0,1,\dots,D-1\) in ascending order (i.e., \( r_0, r_1, \dots, r_{D-1} \)). The values should be specifically precalculated based on the chosen discretization. |
[in] | T | Array of length 2, contains the position in time of the first and of the last sample. It should be T[0]<T[1]. |
[in] | K | Number of bound-states. |
[in] | bound_states | Array of length K, contains the bound-states \(\lambda\). |
[out] | a_vals | Array of length K, contains the values of \(a(\lambda)\). |
[out] | aprime_vals | Array of length K, contains the values of \( a'(\lambda) = \frac{\partial a(\lambda)}{\partial \lambda}\). |
[out] | b_vals | Array of length K, contains the values of \(b(\lambda)\). The \(b(\lambda)\) are calculated using the criterion from Prins and Wahls, " Soliton Phase Shift Calculation for the Korteweg–De Vries Equation,". |
[in,out] | Ws | Pass an array of size K. Upon exit, it contains scaling factors that arise due to an internal normalization of the scattering process (to deal with potential overflow issues). The returned values for a and a_prime still have to be multiplied with corresponding power of two (i.e. POW(2, Ws[i])) to obtain the final values. Note that this is not required for the values of b. No normalization is carried out if NULL is passed. |
[in] | discretization | The type of discretization to be used. Should be of type fnft__akns_discretization_t. Not all akns_discretization_t discretizations are supported. Check fnft_nse_discretization_t for list of supported types. |
[in] | PDE | The partial differential equation for which the calculation has to be done. Should be of type fnft__akns_pde_t. |
[in] | vanilla_flag | For calculations for the KdV equation, pass 1 for the original mapping to the AKNS framework with r=-1. Pass 0 for the alternative mapping with q=-1. Unused for NSE. |
[in] | skip_b_flag | If set to 1 the routine will not compute \(b(\lambda)\). |
FNFT_INT fnft__akns_scatter_matrix | ( | FNFT_UINT const | D, |
FNFT_COMPLEX const *const | q, | ||
FNFT_COMPLEX const *const | r, | ||
FNFT_REAL const | eps_t, | ||
FNFT_UINT const | K, | ||
FNFT_COMPLEX const *const | lambda, | ||
FNFT_COMPLEX *const | result, | ||
FNFT_INT *const | W, | ||
fnft__akns_discretization_t | discretization, | ||
fnft__akns_pde_t const | PDE, | ||
FNFT_UINT const | vanilla_flag, | ||
FNFT_UINT const | derivative_flag | ||
) |
Computes the scattering matrix and its derivative.
The function computes the scattering matrix and the derivative of the scattering matrix with respect to \(\lambda\). The function performs slow direct scattering and is primarily based on the reference Boffetta and Osborne (J. Comput. Physics 1992 ).
[in] | D | Number of samples |
[in] | q | Array of length D, contains samples \( q_n\) for \(n=0,1,\dots,D-1\) in ascending order (i.e., \( q_0, q_1, \dots, q_{D-1} \)). The values should be specifically precalculated based on the chosen discretization. |
[in,out] | r | Array of length D, contains samples \( r_n\) for \(n=0,1,\dots,D-1\) in ascending order (i.e., \( r_0, r_1, \dots, r_{D-1} \)). The values should be specifically precalculated based on the chosen discretization. |
[in] | eps_t | Step-size, eps_t \(= (T[1]-T[0])/(D-1) \). |
[in] | K | Number of values of \(\lambda\). |
[in] | lambda | Array of length K, contains the values of \(\lambda\). |
[out] | result | Array of length K*8 or K*4, If derivative_flag=0 returns [S11(lambda[0]) S12(lambda[0]) S21(lambda[0]) S22(lambda[0]) S11(lambda[1]) ... S22(lambda[K-1]] in result where S = [S11, S12; S21, S22] is the scattering matrix computed using the chosen discretization. If derivative_flag=1 returns [S11 S12 S21 S22 S11' S12' S21' S22'] in result where S11' is the derivative of S11 w.r.t to \(\lambda\). Should be preallocated with size 4*K or 8*K accordingly. |
[in,out] | W | Pass an array of size K. Upon exit, it contains scaling factors that arise due to an internal normalization of the scattering matrix (to deal with potential overflow issues). The result has to be scaled by the power of 2 to obtain the final values. No normalization is carried out if NULL is passed. |
[in] | discretization | The type of discretization to be used. Should be of type fnft__akns_discretization_t. Not all akns_discretization_t discretizations are supported. Check fnft__akns_discretization_t for list of supported types. |
[in] | PDE | Partial differential equation of type fnft__akns_pde_t. |
[in] | vanilla_flag | For calculations for the KdV equation, pass 1 for the original mapping to the AKNS framework with r=-1. Pass 0 for the alternative mapping with q=-1. Unused for NSE. |
[in] | derivative_flag | Should be set to either 0 or 1. If set to 1 the derivatives [S11' S12' S21' S22'] are calculated. result should be preallocated with size 8*K if flag is set to 1. |