16 #define __FUNCT__ "PetscTimeError" 25 ierr = TSGetApplicationContext(ts,&context); CHKERRQ(ierr);
27 fprintf(stderr,
"Error in PetscError: Null context!\n");
32 int nsims( context->
nsims );
35 ierr = TSGetTimeStep(ts,&dt); CHKERRQ(ierr);
37 ierr = TSGetType(ts,&time_scheme); CHKERRQ(ierr);
39 ierr = TSGetSolution(ts,&Y); CHKERRQ(ierr);
41 for (
int ns = 0; ns < nsims; ns++) {
49 if (std::string(time_scheme) == std::string(TSGLEE)) {
52 ierr = VecDuplicate(Y,&Z); CHKERRQ(ierr);
53 ierr = TSGetTimeError(ts,0,&Z);CHKERRQ(ierr);
54 for (
int ns = 0; ns < nsims; ns++) {
61 ierr = VecDestroy(&Z); CHKERRQ(ierr);
63 for (
int ns = 0; ns < nsims; ns++) {
75 double sol_norm[3] = {0.0,0.0,0.0};
90 sol_norm[2] = global_sum;
106 error[2] = global_sum;
111 error[0] /= sol_norm[0];
112 error[1] /= sol_norm[1];
113 error[2] /= sol_norm[2];
118 std::string fname =
"glm_err";
121 sprintf(idx_string,
"%3d", ns);
122 fname += (
"_" + std::string(idx_string));
127 out = fopen(fname.c_str(),
"w");
128 fprintf(out,
"%1.16E %1.16E %1.16E %1.16E ",dt,error[0],error[1],error[2]);
131 printf(
"Estimated time integration errors (GLM-GEE time-integration) for simulation domain %d:-\n",
134 printf(
"Estimated time integration errors (GLM-GEE time-integration):-\n");
136 printf(
" L1 Error : %1.16E\n",error[0]);
137 printf(
" L2 Error : %1.16E\n",error[1]);
138 printf(
" Linfinity Error : %1.16E\n",error[2]);
int PetscTimeError(TS ts)
Structure defining a simulation.
C++ declarations for MPI-related functions.
int MPISum_double(double *, double *, int, void *)
long sum(const std::vector< int > &a_iv)
INLINE double ArraySumAbsnD(int, int, int *, int, int *, double *)
Structure containing all solver-specific variables and functions.
int MPIMax_double(double *, double *, int, void *)
Structure containing the variables for time-integration with PETSc.
INLINE double ArrayMaxnD(int, int, int *, int, int *, double *)
Structure of MPI-related variables.
int npoints_local_wghosts
INLINE double ArraySumSquarenD(int, int, int *, int, int *, double *)
Contains macros and function definitions for common array operations.
int TransferVecFromPETSc(double *const, const Vec, void *, const int, const int)