39 double sum = 0.0, global_sum = 0.0;
40 static const double tolerance = 1e-15;
46 double error[6] = {0,0,0,0,0,0}, *Uerr;
55 double sol_norm[3] = {0.0,0.0,0.0};
58 solver->ghosts,solver->index,solver->u);
60 sol_norm[0] = global_sum/((double)solver->npoints_global);
63 solver->ghosts,solver->index,solver->u);
65 sol_norm[1] = sqrt(global_sum/((
double)solver->npoints_global));
67 sum =
ArrayMaxnD (solver->nvars,solver->ndims,solver->dim_local,
68 solver->ghosts,solver->index,solver->u);
70 sol_norm[2] = global_sum;
74 solver->ghosts,solver->index,Uerr);
76 error[0] = global_sum/((double)solver->npoints_global);
79 solver->ghosts,solver->index,Uerr);
81 error[1] = sqrt(global_sum/((
double)solver->npoints_global));
83 sum =
ArrayMaxnD (solver->nvars,solver->ndims,solver->dim_local,
84 solver->ghosts,solver->index,Uerr);
86 error[2] = global_sum;
89 _ArrayAXBY_(TS->Udot[0],1.0,solver->u,-1.0,uex,size);
93 solver->ghosts,solver->index,TS->Udot[0]);
95 error[3] = global_sum/((double)solver->npoints_global);
98 solver->ghosts,solver->index,TS->Udot[0]);
100 error[4] = sqrt(global_sum/((
double)solver->npoints_global));
102 sum =
ArrayMaxnD (solver->nvars,solver->ndims,solver->dim_local,
103 solver->ghosts,solver->index,TS->Udot[0]);
105 error[5] = global_sum;
106 }
else error[3] = error[4] = error[5] = -1;
108 if ( (sol_norm[0] > tolerance)
109 && (sol_norm[1] > tolerance)
110 && (sol_norm[2] > tolerance) ) {
111 error[0] /= sol_norm[0];
112 error[1] /= sol_norm[1];
113 error[2] /= sol_norm[2];
115 error[3] /= sol_norm[0];
116 error[4] /= sol_norm[1];
117 error[5] /= sol_norm[2];
124 out = fopen(
"glm_err.dat",
"w");
125 fprintf(out,
"%1.16E %1.16E %1.16E %1.16E ",TS->dt,error[0],error[1],error[2]);
126 fprintf(out,
"%1.16E %1.16E %1.16E\n",error[3],error[4],error[5]);
128 printf(
"Estimated time integration errors (GLM-GEE time-integration):-\n");
129 printf(
" L1 Error : %1.16E\n",error[0]);
130 printf(
" L2 Error : %1.16E\n",error[1]);
131 printf(
" Linfinity Error : %1.16E\n",error[2]);
Structure of variables/parameters and function pointers for time integration.
MPI related function definitions.
#define _ArrayAXBY_(z, a, x, b, y, size)
int MPISum_double(double *, double *, int, void *)
long sum(const std::vector< int > &a_iv)
Contains function declarations for time integration.
int TimeError(void *s, void *m, double *uex)
#define _ArraySubtract1D_(x, a, b, size)
INLINE double ArraySumAbsnD(int, int, int *, int, int *, double *)
Structure containing all solver-specific variables and functions.
int MPIMax_double(double *, double *, int, void *)
#define _ArrayAXPY_(x, a, y, size)
Contains structure definition for hypar.
char time_scheme[_MAX_STRING_SIZE_]
INLINE double ArrayMaxnD(int, int, int *, int, int *, double *)
Structure of MPI-related variables.
#define _ArrayScale1D_(x, a, size)
Structure containing the parameters for the General Linear Methods with Global Error Estimators (GLM-...
int npoints_local_wghosts
INLINE double ArraySumSquarenD(int, int, int *, int, int *, double *)
Contains macros and function definitions for common array operations.