33 #include "libmesh/zero_function.h"
34 #include "libmesh/dirichlet_boundaries.h"
35 #include "libmesh/dof_map.h"
36 #include "libmesh/fem_system.h"
48 std::string var_str =
"Physics/"+
_physics_name+
"/bc_variables";
51 this->
read_bc_data( input, id_str, bc_str, var_str, val_str );
65 if( bc_type ==
"no_slip" )
68 else if( bc_type ==
"prescribed_vel" )
71 else if( bc_type ==
"parabolic_profile" )
74 else if( bc_type ==
"general_velocity" )
94 const std::string& bc_id_string,
96 const std::string& bc_vars,
97 const std::string& bc_value,
114 int n_vel_comps = input.vector_variable_size(
"Physics/"+
_physics_name+
"/bound_vel_"+bc_id_string);
115 if( n_vel_comps != 3 )
117 std::cerr <<
"Error: Must specify 3 velocity components when inputting"
119 <<
" prescribed velocities. Found " << n_vel_comps
120 <<
" velocity components."
126 input(
"Physics/"+
_physics_name+
"/bound_vel_"+bc_id_string, 0.0, 0 ),
130 input(
"Physics/"+
_physics_name+
"/bound_vel_"+bc_id_string, 0.0, 1 ),
135 input(
"Physics/"+
_physics_name+
"/bound_vel_"+bc_id_string, 0.0, 2 ),
145 if( input.vector_variable_size(
"Physics/"+
_physics_name+
"/parabolic_profile_coeffs_"+bc_id_string) != 6 )
147 std::cerr <<
"Error: Must specify 6 components when inputting"
149 <<
" coefficients for a parabolic profile. Found "
150 << input.vector_variable_size(
"Physics/"+
_physics_name+
"/parabolic_profile_"+bc_id_string)
156 libMesh::Real a = input(
"Physics/"+
_physics_name+
"/parabolic_profile_coeffs_"+bc_id_string, 0.0, 0 );
157 libMesh::Real b = input(
"Physics/"+
_physics_name+
"/parabolic_profile_coeffs_"+bc_id_string, 0.0, 1 );
158 libMesh::Real c = input(
"Physics/"+
_physics_name+
"/parabolic_profile_coeffs_"+bc_id_string, 0.0, 2 );
159 libMesh::Real d = input(
"Physics/"+
_physics_name+
"/parabolic_profile_coeffs_"+bc_id_string, 0.0, 3 );
160 libMesh::Real e = input(
"Physics/"+
_physics_name+
"/parabolic_profile_coeffs_"+bc_id_string, 0.0, 4 );
161 libMesh::Real f = input(
"Physics/"+
_physics_name+
"/parabolic_profile_coeffs_"+bc_id_string, 0.0, 5 );
163 std::string var = input(
"Physics/"+
_physics_name+
"/parabolic_profile_var_"+bc_id_string,
"DIE!" );
167 std::cerr <<
"Error: Mush specify a variable name to which apply parabolic profile through parabolic_profile_var input option." << std::endl;
175 std::tr1::shared_ptr<libMesh::FunctionBase<libMesh::Number> > func(
new ParabolicProfile(a,b,c,d,e,f) );
180 std::string fix_var = input(
"Physics/"+
_physics_name+
"/parabolic_profile_fix_"+bc_id_string,
"DIE!" );
182 if( fix_var ==
"DIE!" )
184 std::cerr <<
"Error: Mush specify a variable name to fix for parabolic profile through parabolic_profile_fix input option." << std::endl;
192 std::tr1::shared_ptr<libMesh::FunctionBase<libMesh::Number> >
193 func_fix(
new libMesh::ZeroFunction<libMesh::Number>() );
215 bc_vars, bc_value, input );
223 libMesh::DofMap& dof_map,
227 int dim = system->get_mesh().mesh_dimension();
239 std::set<BoundaryID> dbc_ids;
240 dbc_ids.insert(bc_id);
242 std::vector<VariableIndex> dbc_vars;
243 dbc_vars.push_back(u_var);
244 dbc_vars.push_back(v_var);
246 dbc_vars.push_back(w_var);
248 libMesh::ZeroFunction<libMesh::Number> zero;
250 libMesh::DirichletBoundary no_slip_dbc(dbc_ids,
254 dof_map.add_dirichlet_boundary( no_slip_dbc );
259 std::set<BoundaryID> dbc_ids;
260 dbc_ids.insert(bc_id);
262 std::vector<VariableIndex> dbc_vars;
268 dbc_vars.push_back(u_var);
269 libMesh::ConstFunction<libMesh::Number>
272 libMesh::DirichletBoundary vel_dbc(dbc_ids,
276 dof_map.add_dirichlet_boundary( vel_dbc );
281 dbc_vars.push_back(v_var);
282 libMesh::ConstFunction<libMesh::Number>
285 libMesh::DirichletBoundary vel_dbc(dbc_ids,
289 dof_map.add_dirichlet_boundary( vel_dbc );
294 dbc_vars.push_back(w_var);
295 libMesh::ConstFunction<libMesh::Number>
298 libMesh::DirichletBoundary vel_dbc(dbc_ids,
302 dof_map.add_dirichlet_boundary( vel_dbc );
316 std::set<BoundaryID> dbc_ids;
317 dbc_ids.insert(bc_id);
319 std::vector<VariableIndex> dbc_vars;
320 dbc_vars.push_back(u_var);
322 libMesh::ZeroFunction<libMesh::Number> zero;
324 libMesh::DirichletBoundary no_slip_dbc( dbc_ids,
328 dof_map.add_dirichlet_boundary( no_slip_dbc );
334 std::cerr <<
"Invalid BCType " << bc_type << std::endl;
unsigned int VariableIndex
More descriptive name of the type used for variable indices.
VariableIndex w_var() const
virtual void read_bc_data(const GetPot &input, const std::string &id_str, const std::string &bc_str, const std::string &var_str, const std::string &val_str)
Simple helper class to setup general Dirichlet boundary conditions.
PrimitiveFlowVariables _flow_vars
libMesh::boundary_id_type BoundaryID
More descriptive name of the type used for boundary ids.
void attach_dirichlet_bound_func(const GRINS::DBCContainer &dirichlet_bc)
virtual void init_bc_data(const libMesh::FEMSystem &system)
Override this method to initialize any system-dependent data.
void set_dirichlet_bc_value(GRINS::BoundaryID bc_id, libMesh::Real value, int component=0)
void add_var_name(const GRINS::VariableName &var)
Add variables that are constrained by the Dirichlet bc.
virtual void init(libMesh::FEMSystem *system)
virtual void init_bc_types(const GRINS::BoundaryID bc_id, const std::string &bc_id_string, const int bc_type, const std::string &bc_vars, const std::string &bc_value, const GetPot &input)
virtual void user_init_dirichlet_bcs(libMesh::FEMSystem *system, libMesh::DofMap &dof_map, GRINS::BoundaryID bc_id, GRINS::BCType bc_type) const
virtual void init_bc_types(const GRINS::BoundaryID bc_id, const std::string &bc_id_string, const int bc_type, const std::string &bc_vars, const std::string &bc_value, const GetPot &input)
virtual ~IncompressibleNavierStokesBCHandling()
virtual int string_to_int(const std::string &bc_type_in) const
VariableIndex u_var() const
virtual int string_to_int(const std::string &bc_type_in) const
IncompressibleNavierStokesBCHandling()
Base class for reading and handling boundary conditions for physics classes.
VariableIndex v_var() const
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.
void set_dirichlet_bc_type(GRINS::BoundaryID bc_id, int bc_type)
libMesh::Real get_dirichlet_bc_value(GRINS::BoundaryID bc_id, int component=0) const
std::string _physics_name