26 #include "grins_config.h"
38 #include "libmesh/exact_solution.h"
41 #ifdef GRINS_HAVE_GRVY
47 const libMesh::Parameters&,
53 const libMesh::Parameters&,
67 std::multimap< GRINS::PhysicsName, GRINS::DBCContainer >
build_dirichlet( );
70 int main(
int argc,
char* argv[])
73 #ifdef GRINS_USE_GRVY_TIMERS
74 GRVY::GRVY_Timer_Class grvy_timer;
75 grvy_timer.Init(
"GRINS Timer");
82 std::cerr <<
"Error: Must specify libMesh input file." << std::endl;
87 std::string libMesh_input_filename = argv[1];
90 GetPot libMesh_inputfile( libMesh_input_filename );
92 #ifdef GRINS_USE_GRVY_TIMERS
93 grvy_timer.BeginTimer(
"Initialize Solver");
97 libMesh::LibMeshInit libmesh_init(argc, argv);
107 libmesh_init.comm() );
109 #ifdef GRINS_USE_GRVY_TIMERS
110 grvy_timer.EndTimer(
"Initialize Solver");
113 grins.attach_grvy_timer( &grvy_timer );
120 std::tr1::shared_ptr<libMesh::EquationSystems> es = grins.get_equation_system();
123 libMesh::ExactSolution exact_sol(*es);
129 exact_sol.compute_error(
"GRINS",
"u");
131 double l2error = exact_sol.l2_error(
"GRINS",
"u");
132 double h1error = exact_sol.h1_error(
"GRINS",
"u");
136 if( l2error > 1.0e-9 || h1error > 1.0e-9 )
140 std::cout <<
"Tolerance exceeded for velocity in Poiseuille test." << std::endl
141 <<
"l2 error = " << l2error << std::endl
142 <<
"h1 error = " << h1error << std::endl;
146 exact_sol.compute_error(
"GRINS",
"p");
148 l2error = exact_sol.l2_error(
"GRINS",
"p");
149 h1error = exact_sol.h1_error(
"GRINS",
"p");
151 if( l2error > 2.0e-9 || h1error > 2.0e-9 )
155 std::cout <<
"Tolerance exceeded for pressure in Poiseuille test." << std::endl
156 <<
"l2 error = " << l2error << std::endl
157 <<
"h1 error = " << h1error << std::endl;
174 std::multimap< GRINS::PhysicsName, GRINS::DBCContainer > mymap;
183 const libMesh::Parameters& ,
185 const std::string& var )
187 const double x = p(0);
188 const double y = p(1);
190 libMesh::Number f = 0;
192 if( var ==
"u" ) f = 4*y*(1-y);
193 else if( var ==
"p" ) f = 120.0 + (80.0-120.0)/5.0*x;
194 else libmesh_assert(
false);
201 const libMesh::Parameters& ,
203 const std::string& var)
205 const double y = p(1);
213 g(1) = 4*(1-y) - 4*y;
222 g(0) = (80.0-120.0)/5.0;
const PhysicsName incompressible_navier_stokes
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 &)
int main(int argc, char *argv[])
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)