244 #ifdef GRINS_USE_GRVY_TIMERS
245 GRVY::GRVY_Timer_Class grvy_timer;
246 grvy_timer.Init(
"GRINS Timer");
253 std::cerr <<
"Error: Must specify libMesh input file." << std::endl;
258 std::string libMesh_input_filename = argv[1];
261 GetPot libMesh_inputfile( libMesh_input_filename );
263 #ifdef GRINS_USE_GRVY_TIMERS
264 grvy_timer.BeginTimer(
"Initialize Solver");
268 libMesh::LibMeshInit libmesh_init(argc, argv);
271 libMesh::SerialMesh mesh(libmesh_init.comm());
273 GetPot command_line(argc,argv);
275 std::string oned_mesh = command_line(
"mesh-1d",
"DIE!");
276 mesh.read(oned_mesh);
279 libMesh::EquationSystems equation_systems (mesh);
281 std::string oned_data = command_line(
"data-1d",
"DIE!");
282 equation_systems.read(oned_data, libMesh::XdrMODE::READ,
283 libMesh::EquationSystems::READ_HEADER |
284 libMesh::EquationSystems::READ_DATA |
285 libMesh::EquationSystems::READ_ADDITIONAL_DATA);
288 libMesh::System & turbulent_bc_system = equation_systems.get_system<libMesh::System>(
"flow");
292 turbulent_bc_system.update();
295 equation_systems.print_info();
298 libMesh::UniquePtr<libMesh::MeshFunction> turbulent_bc_values;
300 libMesh::UniquePtr<libMesh::NumericVector<libMesh::Number> > turbulent_bc_soln = libMesh::NumericVector<libMesh::Number>::build(equation_systems.comm());
302 std::vector<libMesh::Number> flow_soln;
304 turbulent_bc_system.update_global_solution(flow_soln);
306 turbulent_bc_soln->init(turbulent_bc_system.solution->size(),
true, libMesh::SERIAL);
308 (*turbulent_bc_soln) = flow_soln;
310 std::vector<unsigned int>turbulent_bc_system_variables;
311 turbulent_bc_system_variables.push_back(0);
312 turbulent_bc_system_variables.push_back(1);
314 turbulent_bc_values = libMesh::UniquePtr<libMesh::MeshFunction>
315 (
new libMesh::MeshFunction(equation_systems,
317 turbulent_bc_system.get_dof_map(),
318 turbulent_bc_system_variables ));
320 turbulent_bc_values->init();
328 libmesh_init.comm() );
330 #ifdef GRINS_USE_GRVY_TIMERS
331 grvy_timer.EndTimer(
"Initialize Solver");
334 grins.attach_grvy_timer( &grvy_timer );
341 GRINS::SharedPtr<libMesh::EquationSystems> es = grins.get_equation_system();
347 libMesh::ExactSolution exact_sol(*es);
349 libMesh::EquationSystems es_ref( es->get_mesh() );
352 std::string solution_file = command_line(
"soln-data",
"DIE!");
353 es_ref.read( solution_file, libMesh::XdrMODE::DECODE,
354 libMesh::EquationSystems::READ_HEADER |
355 libMesh::EquationSystems::READ_DATA |
356 libMesh::EquationSystems::READ_ADDITIONAL_DATA);
358 exact_sol.attach_reference_solution( &es_ref );
361 unsigned int n_vars = command_line.vector_variable_size(
"vars");
362 std::vector<std::string> vars(n_vars);
363 for(
unsigned int v = 0; v < n_vars; v++ )
365 vars[v] = command_line(
"vars",
"DIE!", v);
369 unsigned int n_norms = command_line.vector_variable_size(
"norms");
370 std::vector<std::string> norms(n_norms);
371 for(
unsigned int n = 0; n < n_norms; n++ )
373 norms[n] = command_line(
"norms",
"DIE!", n);
374 if( norms[n] != std::string(
"L2") &&
375 norms[n] != std::string(
"H1") )
377 std::cerr <<
"ERROR: Invalid norm input " << norms[n] << std::endl
378 <<
" Valid values are: L2" << std::endl
379 <<
" H1" << std::endl;
383 const std::string& system_name = grins.get_multiphysics_system_name();
386 for(
unsigned int v = 0; v < n_vars; v++ )
388 exact_sol.compute_error(system_name, vars[v]);
393 double tol = command_line(
"tol", 1.0e-10);
396 for(
unsigned int v = 0; v < n_vars; v++ )
398 for(
unsigned int n = 0; n < n_norms; n++ )
400 test_error_norm( exact_sol, system_name, vars[v], norms[n], tol, return_flag );
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)