241 const GetPot & command_line = grins.get_command_line();
243 const GetPot & inputfile = grins.get_input_file();
246 inputfile.have_variable(
"mesh-1d");
247 inputfile.have_variable(
"data-1d");
248 inputfile.have_variable(
"soln-data");
249 inputfile.have_variable(
"vars");
250 inputfile.have_variable(
"norms");
251 inputfile.have_variable(
"tol");
253 const libMesh::LibMeshInit & libmesh_init = grins.get_libmesh_init();
256 libMesh::SerialMesh mesh(libmesh_init.comm());
258 std::string oned_mesh = command_line(
"mesh-1d",
"DIE!");
259 mesh.read(oned_mesh);
262 libMesh::EquationSystems equation_systems (mesh);
264 std::string oned_data = command_line(
"data-1d",
"DIE!");
265 equation_systems.read(oned_data, libMesh::XdrMODE::READ,
266 libMesh::EquationSystems::READ_HEADER |
267 libMesh::EquationSystems::READ_DATA |
268 libMesh::EquationSystems::READ_ADDITIONAL_DATA);
271 libMesh::System & turbulent_bc_system = equation_systems.get_system<libMesh::System>(
"flow");
275 turbulent_bc_system.update();
278 equation_systems.print_info();
281 libMesh::UniquePtr<libMesh::MeshFunction> turbulent_bc_values;
283 libMesh::UniquePtr<libMesh::NumericVector<libMesh::Number> > turbulent_bc_soln = libMesh::NumericVector<libMesh::Number>::build(equation_systems.comm());
285 std::vector<libMesh::Number> flow_soln;
287 turbulent_bc_system.update_global_solution(flow_soln);
289 turbulent_bc_soln->init(turbulent_bc_system.solution->size(),
true, libMesh::SERIAL);
291 (*turbulent_bc_soln) = flow_soln;
293 std::vector<unsigned int>turbulent_bc_system_variables;
294 turbulent_bc_system_variables.push_back(0);
295 turbulent_bc_system_variables.push_back(1);
297 turbulent_bc_values = libMesh::UniquePtr<libMesh::MeshFunction>
298 (
new libMesh::MeshFunction(equation_systems,
300 turbulent_bc_system.get_dof_map(),
301 turbulent_bc_system_variables ));
303 turbulent_bc_values->init();
322 libMesh::ExactSolution exact_sol(*es);
324 libMesh::EquationSystems es_ref( es->get_mesh() );
327 std::string solution_file = command_line(
"soln-data",
"DIE!");
328 es_ref.read( solution_file, libMesh::XdrMODE::DECODE,
329 libMesh::EquationSystems::READ_HEADER |
330 libMesh::EquationSystems::READ_DATA |
331 libMesh::EquationSystems::READ_ADDITIONAL_DATA);
333 exact_sol.attach_reference_solution( &es_ref );
336 unsigned int n_vars = command_line.vector_variable_size(
"vars");
337 std::vector<std::string> vars(n_vars);
338 for(
unsigned int v = 0; v < n_vars; v++ )
340 vars[v] = command_line(
"vars",
"DIE!", v);
344 unsigned int n_norms = command_line.vector_variable_size(
"norms");
345 std::vector<std::string> norms(n_norms);
346 for(
unsigned int n = 0; n < n_norms; n++ )
348 norms[n] = command_line(
"norms",
"DIE!", n);
349 if( norms[n] != std::string(
"L2") &&
350 norms[n] != std::string(
"H1") )
352 std::cerr <<
"ERROR: Invalid norm input " << norms[n] << std::endl
353 <<
" Valid values are: L2" << std::endl
354 <<
" H1" << std::endl;
361 for(
unsigned int v = 0; v < n_vars; v++ )
363 exact_sol.compute_error(system_name, vars[v]);
368 double tol = command_line(
"tol", 1.0e-10);
371 for(
unsigned int v = 0; v < n_vars; v++ )
373 for(
unsigned int n = 0; n < n_norms; n++ )
375 test_error_norm( exact_sol, system_name, vars[v], norms[n], tol, return_flag );
SharedPtr< libMesh::EquationSystems > get_equation_system()
const std::string & get_multiphysics_system_name() const
void test_error_norm(libMesh::ExactSolution &exact_sol, const std::string &system_name, const std::string &var, const std::string &norm, const double tol, int &return_flag)
static void set_turb_bc_values(libMesh::MeshFunction *turbulent_bc_values)
Class to encapsulate initializing and running GRINS Simulation.