26 #include "grins_config.h"
37 #include "libmesh/exact_solution.h"
40 #ifdef GRINS_HAVE_GRVY
46 const libMesh::Parameters&,
52 const libMesh::Parameters&,
66 std::multimap< GRINS::PhysicsName, GRINS::DBCContainer >
build_dirichlet( );
69 int main(
int argc,
char* argv[])
72 #ifdef GRINS_USE_GRVY_TIMERS
73 GRVY::GRVY_Timer_Class grvy_timer;
74 grvy_timer.Init(
"GRINS Timer");
81 std::cerr <<
"Error: Must specify libMesh input file." << std::endl;
86 std::string libMesh_input_filename = argv[1];
89 GetPot libMesh_inputfile( libMesh_input_filename );
91 #ifdef GRINS_USE_GRVY_TIMERS
92 grvy_timer.BeginTimer(
"Initialize Solver");
96 libMesh::LibMeshInit libmesh_init(argc, argv);
106 libmesh_init.comm() );
108 #ifdef GRINS_USE_GRVY_TIMERS
109 grvy_timer.EndTimer(
"Initialize Solver");
112 grins.attach_grvy_timer( &grvy_timer );
119 std::tr1::shared_ptr<libMesh::EquationSystems> es = grins.get_equation_system();
122 libMesh::ExactSolution exact_sol(*es);
128 exact_sol.compute_error(
"GRINS",
"u");
130 double l2error = exact_sol.l2_error(
"GRINS",
"u");
131 double h1error = exact_sol.h1_error(
"GRINS",
"u");
135 if( l2error > 1.0e-9 || h1error > 1.0e-9 )
139 std::cout <<
"Tolerance exceeded for velocity in Poiseuille test." << std::endl
140 <<
"l2 error = " << l2error << std::endl
141 <<
"h1 error = " << h1error << std::endl;
145 exact_sol.compute_error(
"GRINS",
"p");
147 l2error = exact_sol.l2_error(
"GRINS",
"p");
148 h1error = exact_sol.h1_error(
"GRINS",
"p");
150 if( l2error > 1.0e-9 || h1error > 1.0e-9 )
154 std::cout <<
"Tolerance exceeded for pressure in Poiseuille test." << std::endl
155 <<
"l2 error = " << l2error << std::endl
156 <<
"h1 error = " << h1error << std::endl;
173 std::multimap< GRINS::PhysicsName, GRINS::DBCContainer > mymap;
175 mymap.insert( std::pair<GRINS::PhysicsName, GRINS::DBCContainer >(
GRINS::stokes, cont) );
182 const libMesh::Parameters& ,
184 const std::string& var )
186 const double x = p(0);
187 const double y = p(1);
189 libMesh::Number f = 0.0;
191 if( var ==
"u" ) f = 4*y*(1-y);
192 if( var ==
"p" ) f = 120.0 + (80.0-120.0)/5.0*x;
199 const libMesh::Parameters& ,
201 const std::string& var)
203 const double y = p(1);
211 g(1) = 4*(1-y) - 4*y;
220 g(0) = (80.0-120.0)/5.0;
int main(int argc, char *argv[])
Object for constructing boundary condition function objects.
Simple helper class to setup general Dirichlet boundary conditions.
BoundaryConditionsFactory()
void add_var_name(const GRINS::VariableName &var)
Add variables that are constrained by the Dirichlet bc.
libMesh::Gradient exact_derivative(const libMesh::Point &p, const libMesh::Parameters &, const std::string &, const std::string &)
libMesh::Number exact_solution(const libMesh::Point &p, const libMesh::Parameters &, const std::string &, const std::string &)
void add_bc_id(const GRINS::BoundaryID bc_id)
Add boundary id's for which this Dirichlet bc is to be applied.
void set_func(std::tr1::shared_ptr< libMesh::FunctionBase< libMesh::Number > > func)
Add the Dirichlet bc functor.
std::multimap< GRINS::PhysicsName, GRINS::DBCContainer > build_dirichlet()
Builds all required libMesh::DirichletBoundary objects and adds them to DofMap.
void attach_bc_factory(std::tr1::shared_ptr< BoundaryConditionsFactory > bc_factory)