172 #ifdef GRINS_USE_GRVY_TIMERS
173 GRVY::GRVY_Timer_Class grvy_timer;
174 grvy_timer.Init(
"GRINS Timer");
181 std::cerr <<
"Error: Must specify libMesh input file." << std::endl;
186 std::string libMesh_input_filename = argv[1];
189 GetPot libMesh_inputfile( libMesh_input_filename );
191 #ifdef GRINS_USE_GRVY_TIMERS
192 grvy_timer.BeginTimer(
"Initialize Solver");
196 libMesh::LibMeshInit libmesh_init(argc, argv);
199 libMesh::SerialMesh mesh(libmesh_init.comm());
201 GetPot command_line(argc,argv);
203 std::string oned_mesh = command_line(
"mesh-1d",
"DIE!");
204 mesh.read(oned_mesh);
207 libMesh::EquationSystems equation_systems (mesh);
209 std::string oned_data = command_line(
"data-1d",
"DIE!");
210 equation_systems.read(oned_data, libMesh::XdrMODE::READ,
211 libMesh::EquationSystems::READ_HEADER |
212 libMesh::EquationSystems::READ_DATA |
213 libMesh::EquationSystems::READ_ADDITIONAL_DATA);
216 libMesh::System & turbulent_bc_system = equation_systems.get_system<libMesh::System>(
"flow");
220 turbulent_bc_system.update();
223 equation_systems.print_info();
226 libMesh::AutoPtr<libMesh::MeshFunction> turbulent_bc_values;
228 libMesh::AutoPtr<libMesh::NumericVector<libMesh::Number> > turbulent_bc_soln = libMesh::NumericVector<libMesh::Number>::build(equation_systems.comm());
230 std::vector<libMesh::Number> flow_soln;
232 turbulent_bc_system.update_global_solution(flow_soln);
234 turbulent_bc_soln->init(turbulent_bc_system.solution->size(),
true, libMesh::SERIAL);
236 (*turbulent_bc_soln) = flow_soln;
238 std::vector<unsigned int>turbulent_bc_system_variables;
239 turbulent_bc_system_variables.push_back(0);
240 turbulent_bc_system_variables.push_back(1);
242 turbulent_bc_values = libMesh::AutoPtr<libMesh::MeshFunction>
243 (
new libMesh::MeshFunction(equation_systems,
245 turbulent_bc_system.get_dof_map(),
246 turbulent_bc_system_variables ));
248 turbulent_bc_values->init();
252 std::tr1::shared_ptr<TurbulentBCFactory> bc_factory(
new TurbulentBCFactory(turbulent_bc_values.get()) );
258 libmesh_init.comm() );
260 #ifdef GRINS_USE_GRVY_TIMERS
261 grvy_timer.EndTimer(
"Initialize Solver");
264 grins.attach_grvy_timer( &grvy_timer );
271 std::tr1::shared_ptr<libMesh::EquationSystems> es = grins.get_equation_system();
277 libMesh::ExactSolution exact_sol(*es);
279 libMesh::EquationSystems es_ref( es->get_mesh() );
282 std::string solution_file = command_line(
"soln-data",
"DIE!");
283 es_ref.read( solution_file );
285 exact_sol.attach_reference_solution( &es_ref );
288 unsigned int n_vars = command_line.vector_variable_size(
"vars");
289 std::vector<std::string> vars(n_vars);
290 for(
unsigned int v = 0; v < n_vars; v++ )
292 vars[v] = command_line(
"vars",
"DIE!", v);
296 unsigned int n_norms = command_line.vector_variable_size(
"norms");
297 std::vector<std::string> norms(n_norms);
298 for(
unsigned int n = 0; n < n_norms; n++ )
300 norms[n] = command_line(
"norms",
"DIE!", n);
301 if( norms[n] != std::string(
"L2") &&
302 norms[n] != std::string(
"H1") )
304 std::cerr <<
"ERROR: Invalid norm input " << norms[n] << std::endl
305 <<
" Valid values are: L2" << std::endl
306 <<
" H1" << std::endl;
310 const std::string& system_name = grins.get_multiphysics_system_name();
313 for(
unsigned int v = 0; v < n_vars; v++ )
315 exact_sol.compute_error(system_name, vars[v]);
320 double tol = command_line(
"tol", 1.0e-10);
323 for(
unsigned int v = 0; v < n_vars; v++ )
325 for(
unsigned int n = 0; n < n_norms; n++ )
327 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)
void attach_bc_factory(std::tr1::shared_ptr< BoundaryConditionsFactory > bc_factory)