int main ( int  argc,
char **  argv 
)

Main program for the Fokker-Planck example problem.

Parameters:
argc: reads the different command line options
**argvreads the different options.

For example, the program is run as ./Fokker_Planck 1 4 Fokker_Planck.input. This sets dimension = 1 , number of quadrature points = 4, Fokker_Planck.input as the input file to be read. Note selective glex as the moment ordering option is not used for the univariate example.

 int main (int argc, char **argv)
     { 

Declare variable solver_params as an object of the inputs class. solver_params can then access the member function input_reader that reads the input file

 inputs solver_params 

Declare as extern variables defined elsewhere in inputs.c. num_steps : total number of time steps, print_interval : intervals at which output is to be printed, dt : time step, tau : time scale, mu : mean of initial normal distribution, std : standard deviation of initial normal distribution

 extern int num_steps, print_interval;
 extern double dt;
 extern double mu, std; 
 extern matrix_int dtuple_set; 

Invoke the the input_reader function which is a member of the inputs class of which solver_params is declared to be a member. The argv[3] is the third variable in the command line options when running the example.

 solver_params.input_reader(argv[3]); 

Declare the dimension of the problem. atoi(argv[1]) assigns the first variable in the command line options to dimension.

 size_t dimension = atoi(argv[1]); 

Declare the number of quadrature points to be used in the problem. atoi(argv[2]) assigns the second variable in the command line options to num_points.

 size_t num_points = atoi(argv[2]); 

The total number of moments required for the chosen dimension and num_points.

 size_t itot = num_points + dimension*num_points; 

Declare the moment vectors and the equivalent quadrature-weights+points vectors. moms is an object of the moments class and quadwts is an object of the quadrature-weights+points class. Both are intialized with the size of the problem itot.

 moments moms(itot);
 quadpts quadwts(itot); 

Initial conditions for moments (in this example, normal with given mean and standard deviation read in from the input file.

 moms = moms.univariate_gaussian_raw(dimension, num_points, mu, std); 

Compute quadrature points from the moments using the zeros of the Gauss-Hermite polynomials.

 quadwts = moms.get_quadpts_univariate_Gaussian(dimension, num_point);  

Set containing indices for a valid moment set (trivial for a univariate distribution). The argv[4] is the fourth variable entered in the command line. Only glex option is supported at present.

 dtuple_set = valid_dtuple_set(dimension, num_points, argv[4]);  

In this example we choose to solve the quadrature points and weights. The function solve is called with the dimension, the number of quadrature points num_points, the time step dt, the number of steps num_steps, the interval to print print_interval. dimension, num_points can be changed in the command line. This example only works with dimension = 1. The other variables can be changed in the input file.

 quadpts.solve ( dimension, num_points, dt, num_steps, print_interval );  

Exit the program

 return 0; 
  } 

 All Classes Files Functions Variables Typedefs Friends Defines