void user_post_process ( double  time,
size_t  dimension,
size_t  num_points,
double  y[] 
)

! Function where the user enters computes quantities of interest from the solution.

Parameters:
time: Time during simulation
dimension: Dimension of the internal space (space where the random variables are defined).
num_points: Number of quadrature points in each dimension
y[]: C style vector that contains quadrature points and weights. Could also contain the moments if called with moments.

As before for the quadrature points-weights the sequence is [ W_0,...,W_{num_points-1},x_{0,0},...,x_{0,num_points-1},x_{1,0},...,x_{1,num_points-1},...,x_{dimension-1,0},...,x_{dimension,num_points-1}] For the moments the order is per the moment sequence computed from the selective graded lexicographic ordering as described in the file valid_dtuple_set.h. The quadrature points-weights are used if called as quad_pts.post_process_quadpts, for objects of class quadpts. The moments are used if called as moments.post_process_moments for the moments object. Examples of use of this function is given in the examples section.

! Function where the user enters computes quantities of interest from the solution.

External function to compute user defined post processor routines.

Author:
Rochan R. Upadhyay
Parameters:
time: Time during simulation
y: C style vector that contains quadrature points and weights. Contains the moments if called with moments.

In this example the moments equations are solved and this function is called by passing the moments at a particular time. The quantities of interest are chosen to be the non-dimensional scaled moments that become independent of time when the distribution becomes self preserving.

Date:
10/12/2010

! Function where the user enters computes quantities of interest from the solution.

External function to compute user defined post processor routines.

Author:
Rochan R. Upadhyay
Parameters:
time: Time during simulation
y: C style vector that contains quadrature points and weights. Contains the moments if called with moments.

In this example the moments equations are solved and this function is called by passing the quadrature points at a particular time. The quantities of interest in this example are the first four moments. Therefore there is a step where the quadrature weights-points are converted to moments.

Date:
10/12/2010

! Function where the user enters computes quantities of interest from the solution.

External function to compute user defined post processor routines.

Author:
Rochan R. Upadhyay
Parameters:
time: Time during simulation
y: C style vector that contains quadrature points and weights. Contains the moments if called with moments.

Not used in this example.

Date:
10/12/2010

! Function where the user enters computes quantities of interest from the solution.

External function to compute user defined post processor routines.

Author:
Rochan R. Upadhyay
Parameters:
time: Time during simulation
y: C style vector that contains quadrature points and weights. Contains the moments if called with moments.

Not used in this example.

Date:
05/19/2011

Open a file called output.txt

 FILE *fp;       
       fp = fopen("output.txt", "a");
       if(fp == NULL) {
       perror("failed to open output.txt");
       return;
       } 

If verbose mode then print to stdout as well. Note that the vectors in this example contain the moments in the order [M_0, M_1, ..., M_{tot}]. The scaled moments that are being printed out are : (M_2/M_0)*(M_0/M_1)^2, (M_3/M_0)*(M_0/M_1)^3, (M_4/M_0)*(M_0/M_1)^4, (M53/M_0)*(M_0/M_1)^5

 if(verbose_mode == 1){
    printf("%.5e %10.5e %10.5e %10.5e %10.5e \n",  
                time, (y[2]/y[0])*pow(y[0]/y[1],2.0),
                (y[3]/y[0])*pow(y[0]/y[1],3.0),
                (y[4]/y[0])*pow(y[0]/y[1],4.0),
                (y[5]/y[0])*pow(y[0]/y[1],5.0));} 

Print to the same to file output.txt. Note that new lines are added to this file as time progresses. This also means that before a new simulation is started, the file output.txt must be deleted. Otherwise new lines are added at the bottom of the existing file.

 fprintf(fp,"%.5e %10.5e %10.5e %10.5e %10.5e \n",  
                time, (y[2]/y[0])*pow(y[0]/y[1],2.0),
                (y[3]/y[0])*pow(y[0]/y[1],3.0),
                (y[4]/y[0])*pow(y[0]/y[1],4.0),
                (y[5]/y[0])*pow(y[0]/y[1],5.0)); 

fclose(fp);

Return control to the calling routines.

 return;    
 } 

Open a file called output.txt

 FILE *fp;       
       fp = fopen("output.txt", "a");
       if(fp == NULL) {
       perror("failed to open output.txt");
       return;
       } 

Print to stdout. Note that the vectors in this example contain the quadrature weights+points in the order [ W_0,...,W_{num_points-1},x_{0,0},...,x_{0,num_points-1}]. The moments are computed and printed out.

Declare and then compute moments from incoming data.

 size_t itot = dimension*num_points + num_points;
 !double moms[itot];    
 for ( size_t i = 0; i < itot; i++ ){
 moms[i] = 0.0;
 for ( size_t j = 0; j < num_points; j++ ){
 moms[i] += y[j]*pow(y[j+num_points],(int) i);} 

Print to first four moments stdout if verbose mode is chosen.

 if(verbose_mode == 1){
 printf("%.5e %10.5e %10.5e %10.5e %10.5e \n",  
         time, moms[0],moms[1],moms[2],moms[3]);} 

Print to the same to file output.txt. Note that new lines are added to this file as time progresses. This also means that before a new simulation is started, the file output.txt must be deleted. Otherwise new lines are added at the bottom of the existing file.

 fprintf(fp,"%.5e %10.5e %10.5e %10.5e %10.5e \n",  
                time, moms[0],moms[1],moms[2],moms[3]);

fclose(fp);

Return control to the calling routines.

 return;    
 } 

Open a file called output.txt

 FILE *fp;       
       fp = fopen("output.txt", "a");
       if(fp == NULL) {
       perror("failed to open output.txt");
       return;
       } 

Print to stdout. Note that the vectors in this example contain the quadrature weights+points in the order [ W_0,...,W_{num_points-1},x_{0,0},...,x_{0,num_points-1}]. The moments are computed and printed out.

Declare and then compute multivariate moments from incoming data. We compute the pure (unmixed) moments 0 to 5 for each variable.

 double moms1[6];
 double moms2[6];
 int index;        
 for ( size_t i = 0; i < 6; i++ ){
 index = i;
 moms1[i] = 0.0;
 moms2[i] = 0.0;
 for ( size_t j = 0; j < num_points; j++ ){
 moms1[i] += y[j]*pow(y[j+num_points],index);
 moms2[i] += y[j]*pow(y[j+2*num_points],index);}} 

Print to stdout.

 printf("%.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e \n",  
              time,moms1[0],moms1[1],moms1[2],moms1[3],moms1[4],moms1[5],moms2[0],moms2[1],moms2[2],moms2[3],moms2[4],moms2[5]); 

Print to the same to file output.txt. Note that new lines are added to this file as time progresses. This also means that before a new simulation is started, the file output.txt must be deleted. Otherwise new lines are added at the bottom of the existing file.

 fprintf(fp,"%.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e \n",  
                time,moms1[0],moms1[1],moms1[2],moms1[3],moms1[4],moms1[5],moms2[0],moms2[1],moms2[2],moms2[3],moms2[4],moms2[5]);

fclose(fp);

Return control to the calling routines.

 return;    
 } 

Open a file called output.txt

 FILE *fp;       
       fp = fopen("output.txt", "a");
       if(fp == NULL) {
       perror("failed to open output.txt");
       return;
       } 

If verbose mode then print to stdout as well. Note that the vectors in this example contain the moments in the order [M_0, M_1, ..., M_{tot}]. The scaled moments that are being printed out are : (M_2/M_0)*(M_0/M_1)^2, (M_3/M_0)*(M_0/M_1)^3, (M_4/M_0)*(M_0/M_1)^4, (M53/M_0)*(M_0/M_1)^5

 if(verbose_mode == 1){
    printf("%.5e %10.5e %10.5e %10.5e %10.5e \n",  
                time, (y[2]/y[0])*pow(y[0]/y[1],2.0),
                (y[3]/y[0])*pow(y[0]/y[1],3.0),
                (y[4]/y[0])*pow(y[0]/y[1],4.0),
                (y[5]/y[0])*pow(y[0]/y[1],5.0));} 

Print to the same to file output.txt. Note that new lines are added to this file as time progresses. This also means that before a new simulation is started, the file output.txt must be deleted. Otherwise new lines are added at the bottom of the existing file.

 fprintf(fp,"%.5e %10.5e %10.5e %10.5e %10.5e \n",  
                time, (y[2]/y[0])*pow(y[0]/y[1],2.0),
                (y[3]/y[0])*pow(y[0]/y[1],3.0),
                (y[4]/y[0])*pow(y[0]/y[1],4.0),
                (y[5]/y[0])*pow(y[0]/y[1],5.0)); 

fclose(fp);

Return control to the calling routines.

 return;    
 } 

Open a file called output.txt

 FILE *fp;       
       fp = fopen("output.txt", "a");
       if(fp == NULL) {
       perror("failed to open output.txt");
       return;
       } 

Print to stdout. Note that the vectors in this example contain the quadrature weights+points in the order [ W_0,...,W_{num_points-1},x_{0,0},...,x_{0,num_points-1}]. The moments are computed and printed out.

Declare and then compute moments from incoming data.

 size_t itot = dimension*num_points + num_points;
 !double moms[itot];    
 for ( size_t i = 0; i < itot; i++ ){
 moms[i] = 0.0;
 for ( size_t j = 0; j < num_points; j++ ){
 moms[i] += y[j]*pow(y[j+num_points],(int) i);} 

Print to first four moments stdout if verbose mode is chosen.

 if(verbose_mode == 1){
 printf("%.5e %10.5e %10.5e %10.5e %10.5e \n",  
         time, moms[0],moms[1],moms[2],moms[3]);} 

Print to the same to file output.txt. Note that new lines are added to this file as time progresses. This also means that before a new simulation is started, the file output.txt must be deleted. Otherwise new lines are added at the bottom of the existing file.

 fprintf(fp,"%.5e %10.5e %10.5e %10.5e %10.5e \n",  
                time, moms[0],moms[1],moms[2],moms[3]);

fclose(fp);

Return control to the calling routines.

 return;    
 } 

Open a file called output.txt

 FILE *fp;       
       fp = fopen("output.txt", "a");
       if(fp == NULL) {
       perror("failed to open output.txt");
       return;
       } 

Print to stdout. Note that the vectors in this example contain the quadrature weights+points in the order [ W_0,...,W_{num_points-1},x_{0,0},...,x_{0,num_points-1}]. The moments are computed and printed out.

Declare and then compute multivariate moments from incoming data. We compute the pure (unmixed) moments 0 to 5 for each variable.

 double moms1[6];
 double moms2[6];
 int index;        
 for ( size_t i = 0; i < 6; i++ ){
 index = i;
 moms1[i] = 0.0;
 moms2[i] = 0.0;
 for ( size_t j = 0; j < num_points; j++ ){
 moms1[i] += y[j]*pow(y[j+num_points],index);
 moms2[i] += y[j]*pow(y[j+2*num_points],index);}} 

Print to stdout.

 printf("%.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e \n",  
              time,moms1[0],moms1[1],moms1[2],moms1[3],moms1[4],moms1[5],moms2[0],moms2[1],moms2[2],moms2[3],moms2[4],moms2[5]); 

Print to the same to file output.txt. Note that new lines are added to this file as time progresses. This also means that before a new simulation is started, the file output.txt must be deleted. Otherwise new lines are added at the bottom of the existing file.

 fprintf(fp,"%.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e \n",  
                time,moms1[0],moms1[1],moms1[2],moms1[3],moms1[4],moms1[5],moms2[0],moms2[1],moms2[2],moms2[3],moms2[4],moms2[5]);

fclose(fp);

Return control to the calling routines.

 return;    
 } 

Open a file called output.txt

 FILE *fp;       
       fp = fopen("output.txt", "a");
       if(fp == NULL) {
       perror("failed to open output.txt");
       return;
       } 

Print to stdout. Note that the vectors in this example contain the moments in the order [ M_0,...,M_{2*num_points-1}]. The moments are printed out.

Print to first six moments stdout if verbose mode is chosen.

 if(verbose_mode == 1){
 printf("%.5e %10.5e %10.5e %10.5e %10.5e,%10.5e %10.5e \n",  
         time, y[0],y[1],y[2],y[3],y[4],y[5]);} 

Print to the same to file output.txt. Note that new lines are added to this file as time progresses. This also means that before a new simulation is started, the file output.txt must be deleted. Otherwise new lines are added at the bottom of the existing file.

 fprintf(fp,"%.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e \n",  
                time, y[0],y[1],y[2],y[3],y[4],y[5]);

fclose(fp);

Return control to the calling routines.

 return;    
 } 

Open a file called output.txt

 FILE *fp;       
       fp = fopen("output.txt", "a");
       if(fp == NULL) {
       perror("failed to open output.txt");
       return;
       } 

If verbose mode then print to stdout as well. Note that the vectors in this example contain the moments in the order [M_0, M_1, ..., M_{tot}]. The scaled moments that are being printed out are : (M_2/M_0)*(M_0/M_1)^2, (M_3/M_0)*(M_0/M_1)^3, (M_4/M_0)*(M_0/M_1)^4, (M53/M_0)*(M_0/M_1)^5

 if(verbose_mode == 1){
    printf("%.5e %10.5e %10.5e %10.5e %10.5e \n",  
                time, (y[2]/y[0])*pow(y[0]/y[1],2.0),
                (y[3]/y[0])*pow(y[0]/y[1],3.0),
                (y[4]/y[0])*pow(y[0]/y[1],4.0),
                (y[5]/y[0])*pow(y[0]/y[1],5.0));} 

Print to the same to file output.txt. Note that new lines are added to this file as time progresses. This also means that before a new simulation is started, the file output.txt must be deleted. Otherwise new lines are added at the bottom of the existing file.

 fprintf(fp,"%.5e %10.5e %10.5e %10.5e %10.5e \n",  
                time, (y[2]/y[0])*pow(y[0]/y[1],2.0),
                (y[3]/y[0])*pow(y[0]/y[1],3.0),
                (y[4]/y[0])*pow(y[0]/y[1],4.0),
                (y[5]/y[0])*pow(y[0]/y[1],5.0)); 

fclose(fp);

Return control to the calling routines.

 return;    
 } 

Open a file called output.txt

 FILE *fp;       
       fp = fopen("output.txt", "a");
       if(fp == NULL) {
       perror("failed to open output.txt");
       return;
       } 

Print to stdout. Note that the vectors in this example contain the quadrature weights+points in the order [ W_0,...,W_{num_points-1},x_{0,0},...,x_{0,num_points-1}]. The moments are computed and printed out.

Declare and then compute moments from incoming data.

 size_t itot = dimension*num_points + num_points;
 !double moms[itot];    
 for ( size_t i = 0; i < itot; i++ ){
 moms[i] = 0.0;
 for ( size_t j = 0; j < num_points; j++ ){
 moms[i] += y[j]*pow(y[j+num_points],(int) i);} 

Print to first four moments stdout if verbose mode is chosen.

 if(verbose_mode == 1){
 printf("%.5e %10.5e %10.5e %10.5e %10.5e \n",  
         time, moms[0],moms[1],moms[2],moms[3]);} 

Print to the same to file output.txt. Note that new lines are added to this file as time progresses. This also means that before a new simulation is started, the file output.txt must be deleted. Otherwise new lines are added at the bottom of the existing file.

 fprintf(fp,"%.5e %10.5e %10.5e %10.5e %10.5e \n",  
                time, moms[0],moms[1],moms[2],moms[3]);

fclose(fp);

Return control to the calling routines.

 return;    
 } 

Open a file called output.txt

 FILE *fp;       
       fp = fopen("output.txt", "a");
       if(fp == NULL) {
       perror("failed to open output.txt");
       return;
       } 

Print to stdout. Note that the vectors in this example contain the quadrature weights+points in the order [ W_0,...,W_{num_points-1},x_{0,0},...,x_{0,num_points-1}]. The moments are computed and printed out.

Declare and then compute multivariate moments from incoming data. We compute the pure (unmixed) moments 0 to 5 for each variable.

 double moms1[6];
 double moms2[6];
 int index;        
 for ( size_t i = 0; i < 6; i++ ){
 index = i;
 moms1[i] = 0.0;
 moms2[i] = 0.0;
 for ( size_t j = 0; j < num_points; j++ ){
 moms1[i] += y[j]*pow(y[j+num_points],index);
 moms2[i] += y[j]*pow(y[j+2*num_points],index);}} 

Print to stdout.

 printf("%.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e \n",  
              time,moms1[0],moms1[1],moms1[2],moms1[3],moms1[4],moms1[5],moms2[0],moms2[1],moms2[2],moms2[3],moms2[4],moms2[5]); 

Print to the same to file output.txt. Note that new lines are added to this file as time progresses. This also means that before a new simulation is started, the file output.txt must be deleted. Otherwise new lines are added at the bottom of the existing file.

 fprintf(fp,"%.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e \n",  
                time,moms1[0],moms1[1],moms1[2],moms1[3],moms1[4],moms1[5],moms2[0],moms2[1],moms2[2],moms2[3],moms2[4],moms2[5]);

fclose(fp);

Return control to the calling routines.

 return;    
 } 

Open a file called output.txt

 FILE *fp;       
       fp = fopen("output.txt", "a");
       if(fp == NULL) {
       perror("failed to open output.txt");
       return;
       } 

Print to stdout. Note that the vectors in this example contain the moments in the order [ M_0,...,M_{2*num_points-1}]. The moments are printed out.

Print to first six moments stdout if verbose mode is chosen.

 if(verbose_mode == 1){
 printf("%.5e %10.5e %10.5e %10.5e %10.5e,%10.5e %10.5e \n",  
         time, y[0],y[1],y[2],y[3],y[4],y[5]);} 

Print to the same to file output.txt. Note that new lines are added to this file as time progresses. This also means that before a new simulation is started, the file output.txt must be deleted. Otherwise new lines are added at the bottom of the existing file.

 fprintf(fp,"%.5e %10.5e %10.5e %10.5e %10.5e %10.5e %10.5e \n",  
                time, y[0],y[1],y[2],y[3],y[4],y[5]);

fclose(fp);

Return control to the calling routines.

 return;    
 } 

All Classes Files Functions Variables Typedefs Friends Defines