26 #include "grins_config.h"
37 #include "libmesh/exact_solution.h"
40 #ifdef GRINS_HAVE_GRVY
52 virtual std::map< GRINS::PhysicsName, GRINS::NBCContainer >
build_neumann( libMesh::EquationSystems& equation_system );
65 {
return libMesh::Point(0.0,0.0,0.0); }
68 {
return libMesh::Point(0.0,0.0,0.0); }
72 {
return libMesh::Point(0.0,0.0,0.0); }
76 int main(
int argc,
char* argv[])
78 #ifdef GRINS_USE_GRVY_TIMERS
79 GRVY::GRVY_Timer_Class grvy_timer;
80 grvy_timer.Init(
"GRINS Timer");
87 std::cerr <<
"Error: Must specify libMesh input file and solution file." << std::endl;
92 std::string libMesh_input_filename = argv[1];
95 GetPot libMesh_inputfile( libMesh_input_filename );
97 #ifdef GRINS_USE_GRVY_TIMERS
98 grvy_timer.BeginTimer(
"Initialize Solver");
102 libMesh::LibMeshInit libmesh_init(argc, argv);
110 libmesh_init.comm() );
112 #ifdef GRINS_USE_GRVY_TIMERS
113 grvy_timer.EndTimer(
"Initialize Solver");
116 grins.attach_grvy_timer( &grvy_timer );
123 std::tr1::shared_ptr<libMesh::EquationSystems> es = grins.get_equation_system();
128 libMesh::ExactSolution exact_sol(*es);
130 libMesh::EquationSystems es_ref( es->get_mesh() );
133 std::string solution_file = std::string(argv[2]);
134 es_ref.read( solution_file );
136 exact_sol.attach_reference_solution( &es_ref );
139 exact_sol.compute_error(
"GRINS",
"u");
140 exact_sol.compute_error(
"GRINS",
"v");
142 if( (es->get_mesh()).mesh_dimension() == 3 )
143 exact_sol.compute_error(
"GRINS",
"w");
145 exact_sol.compute_error(
"GRINS",
"p");
146 exact_sol.compute_error(
"GRINS",
"T");
148 double u_l2error = exact_sol.l2_error(
"GRINS",
"u");
149 double u_h1error = exact_sol.h1_error(
"GRINS",
"u");
151 double v_l2error = exact_sol.l2_error(
"GRINS",
"v");
152 double v_h1error = exact_sol.h1_error(
"GRINS",
"v");
154 double p_l2error = exact_sol.l2_error(
"GRINS",
"p");
155 double p_h1error = exact_sol.h1_error(
"GRINS",
"p");
157 double T_l2error = exact_sol.l2_error(
"GRINS",
"T");
158 double T_h1error = exact_sol.h1_error(
"GRINS",
"T");
160 double w_l2error = 0.0,
163 if( (es->get_mesh()).mesh_dimension() == 3 )
165 w_l2error = exact_sol.l2_error(
"GRINS",
"w");
166 w_h1error = exact_sol.h1_error(
"GRINS",
"w");
175 if( u_l2error > tol || u_h1error > tol ||
176 v_l2error > tol || v_h1error > tol ||
177 w_l2error > tol || w_h1error > tol ||
178 p_l2error > tol || p_h1error > tol ||
179 T_l2error > tol || T_h1error > tol )
183 std::cout <<
"Tolerance exceeded for thermally driven flow test." << std::endl
184 <<
"tolerance = " << tol << std::endl
185 <<
"u l2 error = " << u_l2error << std::endl
186 <<
"u h1 error = " << u_h1error << std::endl
187 <<
"v l2 error = " << v_l2error << std::endl
188 <<
"v h1 error = " << v_h1error << std::endl
189 <<
"w l2 error = " << w_l2error << std::endl
190 <<
"w h1 error = " << w_h1error << std::endl
191 <<
"p l2 error = " << p_l2error << std::endl
192 <<
"p h1 error = " << p_h1error << std::endl
193 <<
"T l2 error = " << T_l2error << std::endl
194 <<
"T h1 error = " << T_h1error << std::endl;
203 std::map< std::string, GRINS::NBCContainer > nbcs;
207 if(
_input(
"Physics/enabled_physics",
"DIE!", 1) != std::string(
"HeatTransfer") )
214 const libMesh::System& system = es.get_system(
"GRINS");
217 std::tr1::shared_ptr<GRINS::NeumannFuncObj> func(
new ZeroFluxBC );
224 nbcs.insert( std::pair< std::string, GRINS::NBCContainer >(
"HeatTransfer", nbc_container ) );
unsigned int VariableIndex
More descriptive name of the type used for variable indices.
virtual libMesh::Point derivative(const AssemblyContext &, const CachedValues &, const unsigned int, const VariableIndex)
If needed, returns the derivative with respect to other variables in the system.
virtual std::map< GRINS::PhysicsName, GRINS::NBCContainer > build_neumann(libMesh::EquationSystems &equation_system)
Builds all Neumann boundary condition function objects needed.
Object for constructing boundary condition function objects.
virtual ~ThermallyDrivenFlowTestBCFactory()
void add_var_func_pair(VariableIndex var, std::tr1::shared_ptr< NeumannFuncObj > func)
Add boundary id and corresponding functor object to be applied on that boundary.
Simple helper class to setup general Neumann boundary conditions.
ThermallyDrivenFlowTestBCFactory(const GetPot &input)
virtual libMesh::Point value(const AssemblyContext &, const CachedValues &, const unsigned int)
Returns the value of the implemented Neumann boundary condition.
int main(int argc, char *argv[])
void set_bc_id(BoundaryID bc_id)
Add variable for which this boundary condition is to be applied.
virtual libMesh::Point derivative(const AssemblyContext &, const CachedValues &, const unsigned int)
Returns the derivative with respect to the primary variable of the implemented Neumann boundary condi...
Base class for general, non-constant Neumann boundary conditions.
void attach_bc_factory(std::tr1::shared_ptr< BoundaryConditionsFactory > bc_factory)