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]);
int npoints_local_wghosts
#define _ArrayAXBY_(z, a, x, b, y, size)
int TimeError(void *, void *, double *)
INLINE double ArraySumAbsnD(int, int, int *, int, int *, double *)
Structure of variables/parameters and function pointers for time integration.
MPI related function definitions.
int MPISum_double(double *, double *, int, void *)
#define _ArrayScale1D_(x, a, size)
int MPIMax_double(double *, double *, int, void *)
#define _ArraySubtract1D_(x, a, b, size)
Structure containing the parameters for the General Linear Methods with Global Error Estimators (GLM-...
INLINE double ArraySumSquarenD(int, int, int *, int, int *, double *)
char time_scheme[_MAX_STRING_SIZE_]
long sum(const std::vector< int > &a_iv)
Contains structure definition for hypar.
Contains function declarations for time integration.
Contains macros and function definitions for common array operations.
Structure of MPI-related variables.
INLINE double ArrayMaxnD(int, int, int *, int, int *, double *)
#define _ArrayAXPY_(x, a, y, size)
Structure containing all solver-specific variables and functions.