28 strcpy(err_fname,
"errors");
29 strcpy(cons_fname,
"conservation");
30 strcpy(fc_fname,
"function_counts");
34 strcat(err_fname,
"_");
35 strcat(cons_fname,
"_");
41 strcat(err_fname,index);
42 strcat(cons_fname,index);
43 strcat(fc_fname,index);
46 strcat(err_fname,
".dat");
47 strcat(cons_fname,
".dat");
48 strcat(fc_fname,
".dat");
53 out = fopen(err_fname,
"w");
54 for (d=0; d<
m_sims_sg[n].solver.ndims; d++) fprintf(out,
"%4d ",
m_sims_sg[n].solver.dim_global[d]);
55 for (d=0; d<
m_sims_sg[n].solver.ndims; d++) fprintf(out,
"%4d ",
m_sims_sg[n].mpi.iproc[d]);
56 fprintf(out,
"%1.16E ",
m_sims_sg[n].solver.dt);
58 fprintf(out,
"%1.16E %1.16E\n",solver_runtime,main_runtime);
61 out = fopen(cons_fname,
"w");
62 for (d=0; d<
m_sims_sg[n].solver.ndims; d++) fprintf(out,
"%4d ",
m_sims_sg[n].solver.dim_global[d]);
63 for (d=0; d<
m_sims_sg[n].solver.ndims; d++) fprintf(out,
"%4d ",
m_sims_sg[n].mpi.iproc[d]);
64 fprintf(out,
"%1.16E ",
m_sims_sg[n].solver.dt);
65 for (d=0; d<
m_sims_sg[n].solver.nvars; d++) fprintf(out,
"%1.16E ",
m_sims_sg[n].solver.ConservationError[d]);
69 out = fopen(fc_fname,
"w");
70 fprintf(out,
"%d\n",
m_sims_sg[n].solver.n_iter);
71 fprintf(out,
"%d\n",
m_sims_sg[n].solver.count_hyp);
72 fprintf(out,
"%d\n",
m_sims_sg[n].solver.count_par);
73 fprintf(out,
"%d\n",
m_sims_sg[n].solver.count_sou);
75 fprintf(out,
"%d\n",
m_sims_sg[n].solver.count_RHSFunction);
76 fprintf(out,
"%d\n",
m_sims_sg[n].solver.count_IFunction);
77 fprintf(out,
"%d\n",
m_sims_sg[n].solver.count_IJacobian);
78 fprintf(out,
"%d\n",
m_sims_sg[n].solver.count_IJacFunction);
84 printf(
"Computed errors for sparse grids domain %d:\n", n);
85 printf(
" L1 Error: %1.16E\n",
m_sims_sg[n].solver.error[0]);
86 printf(
" L2 Error: %1.16E\n",
m_sims_sg[n].solver.error[1]);
87 printf(
" Linf Error: %1.16E\n",
m_sims_sg[n].solver.error[2]);
89 if (!strcmp(
m_sims_sg[n].solver.ConservationCheck,
"yes")) {
90 printf(
"Conservation Errors:\n");
91 for (d=0; d<
m_sims_sg[n].solver.nvars; d++) printf(
"\t%1.16E\n",
m_sims_sg[n].solver.ConservationError[d]);
101 strcpy(err_fname,
"errors_fg");
102 strcat(err_fname,
".dat");
107 out = fopen(err_fname,
"w");
112 fprintf(out,
"%1.16E %1.16E\n",solver_runtime,main_runtime);
117 printf(
"Computed errors for full grid solution:\n");
125 printf(
"Solver runtime (in seconds): %1.16E\n",solver_runtime);
126 printf(
"Total runtime (in seconds): %1.16E\n",main_runtime);
Some basic definitions and macros.
void WriteErrors(double, double)
#define _MAX_STRING_SIZE_
std::vector< SimulationObject > m_sims_sg
void GetStringFromInteger(int, char *, int)
Some common functions used here and there (C++ declarations)
SimulationObject * m_sim_fg