45 <<
" coarsemesh coarsesolution finemesh finesolution [outputdiff]" << std::endl;
50 coarse_mesh.read(argv[1]);
51 libMesh::out <<
"Loaded coarse mesh " << argv[1] << std::endl;
52 coarse_es.read(argv[2]);
53 libMesh::out <<
"Loaded coarse solution " << argv[2] << std::endl;
54 fine_mesh.read(argv[3]);
55 libMesh::out <<
"Loaded fine mesh " << argv[3] << std::endl;
56 fine_es.read(argv[4]);
57 libMesh::out <<
"Loaded fine solution " << argv[4] << std::endl;
60 exact_sol.attach_reference_solution(&fine_es);
62 std::vector<std::string> sysnames;
63 sysnames.reserve(coarse_es.n_systems());
65 for (
unsigned int i = 0; i != coarse_es.n_systems(); ++i)
66 if (fine_es.has_system(coarse_es.get_system(i).name()))
67 sysnames.push_back(coarse_es.get_system(i).name());
70 << coarse_es.get_system(i).name()
71 <<
" not found in fine solution!" << std::endl;
73 for (
unsigned int i = 0; i != fine_es.n_systems(); ++i)
74 if (!coarse_es.has_system(fine_es.get_system(i).name()))
76 << fine_es.get_system(i).name()
77 <<
" not found in coarse solution!" << std::endl;
79 if (!coarse_es.n_systems() && !fine_es.n_systems())
80 libMesh::out <<
"No systems found in fine or coarse solution!"
85 const std::string sysname = sysnames[i];
86 const System & coarse_sys = coarse_es.get_system(sysname);
87 const System & fine_sys = fine_es.get_system(sysname);
89 for (
unsigned int j = 0; j != coarse_sys.
n_vars(); ++j)
96 <<
" variable " << varname
97 <<
" not found in coarse solution!" << std::endl;
102 exact_sol.compute_error(sysname, varname);
104 libMesh::out <<
"Errors in system " << sysname <<
", variable " << varname <<
":" << std::endl;
105 libMesh::out <<
"L2 error: " << exact_sol.l2_error(sysname, varname)
108 libMesh::out <<
"H1 error: " << exact_sol.h1_error(sysname, varname)
111 libMesh::out <<
"H2 error: " << exact_sol.h2_error(sysname, varname)
116 for (
unsigned int j = 0; j != fine_sys.
n_vars(); ++j)
123 <<
" variable " << varname
124 <<
" not found in fine solution!" << std::endl;
130 libMesh::out <<
"No variables found in fine or coarse solution system "
131 << sysname <<
'!' << std::endl;
136 libMesh::out <<
"Writing diff solution " << argv[5] << std::endl;
140 const std::string sysname = sysnames[i];
141 const System & coarse_sys = coarse_es.get_system(sysname);
142 const System & fine_sys = fine_es.get_system(sysname);
144 std::unique_ptr<NumericVector<Number>> fine_solution = fine_sys.
solution->clone();
147 std::vector<unsigned int>
150 for (
unsigned int j = 0; j != fine_sys.
n_vars(); ++j)
161 coarse_solution.
init();
163 coarse_solution.enable_out_of_mesh_mode(oom_value);
166 *fine_sys.
solution -= *fine_solution;