44 #include "libmesh/dof_map.h"
45 #include "libmesh/getpot.h"
50 std::vector<SharedPtr<NeumannBCContainer> >& neumann_bcs )
54 std::string warning =
"WARNING: Specifying boundary conditions in the\n";
55 warning +=
" Physics sections is DEPRECATED! Please\n";
56 warning +=
" update your input file to new the newer\n";
57 warning +=
" style. See the examples for an illustration.\n";
62 libMesh::DofMap& dof_map = system.get_dof_map();
66 std::set<std::string> basic_physics;
69 std::set<std::string> vel_and_temp_physics;
72 std::set<std::string> reacting_physics;
76 physics_iter != physics_list.end();
79 std::string physics_name = physics_iter->first;
82 std::string section_name =
"Physics/"+physics_name;
84 if( basic_physics.find( raw_physics_name ) != basic_physics.end() )
98 if( (vel_and_temp_physics.find( raw_physics_name ) != vel_and_temp_physics.end()) ||
99 (reacting_physics.find( raw_physics_name ) != reacting_physics.end()) )
124 if( reacting_physics.find( raw_physics_name ) != reacting_physics.end() )
133 "species_bc_variables",
141 const std::string& bc_type_str,
142 std::string& var_section )
144 if( bc_type_str == std::string(
"bc_types") )
163 else if( bc_type_str == std::string(
"vel_bc_types") )
166 else if( bc_type_str == std::string(
"temp_bc_types") )
169 else if( bc_type_str == std::string(
"species_bc_types") )
180 const std::string& raw_physics_name,
181 const std::string& section_name,
182 const std::string& bc_id_str,
183 const std::string& bc_type_str,
184 const std::string& bc_value_str,
185 const std::string& bc_var_str,
186 libMesh::DofMap& dof_map,
187 std::vector<SharedPtr<NeumannBCContainer> >& neumann_bcs )
189 unsigned int num_ids = input.vector_variable_size(section_name+
"/"+bc_id_str);
190 unsigned int num_types = input.vector_variable_size(section_name+
"/"+bc_type_str);
192 if( num_ids != num_types )
193 libmesh_error_msg(
"Error: Must specify equal number of boundary ids and boundary conditions");
195 for(
unsigned int i = 0; i < num_ids; i++ )
198 std::string bc_type = input(section_name+
"/"+bc_type_str, std::string(
"DIE!"), i );
199 bc_type +=
"_old_style";
201 BoundaryID bc_id = input(section_name+
"/"+bc_id_str, -1, i );
205 if( bc_type == std::string(
"periodic_old_style") )
212 std::set<BoundaryID> bc_ids;
213 bc_ids.insert(bc_id);
215 std::string variable_group_name;
219 variable_group_name );
221 libmesh_assert(fe_var_ptr);
224 std::vector<std::string> var_names;
230 if( bc_type ==
"axisymmetric_old_style" )
231 bc_type = variable_group_name+
"_"+bc_type;
236 if( bc_type == std::string(
"parsed_dirichlet_old_style") ||
237 bc_type == std::string(
"constant_dirichlet_old_style") ||
238 bc_type == std::string(
"parsed_fem_dirichlet_old_style") ||
239 bc_type == std::string(
"parsed_neumann_old_style") )
242 var_names.resize(1, input(section_name+
"/"+bc_var_str, std::string(
"DIE!"), i ) );
248 this->set_dirichlet_bc_factory_old_style_quantities<libMesh::FunctionBase<libMesh::Number> >
249 ( bc_value_str, i, var_names );
250 this->set_dirichlet_bc_factory_old_style_quantities<libMesh::FEMFunctionBase<libMesh::Number> >
251 ( bc_value_str, i, var_names );
254 section_name, bc_type, dof_map );
259 this->set_neumann_bc_factory_old_style_quantities<libMesh::FunctionBase<libMesh::Number> >
260 ( bc_value_str, i, var_names );
261 this->set_neumann_bc_factory_old_style_quantities<libMesh::FEMFunctionBase<libMesh::Number> >
262 ( bc_value_str, i, var_names );
265 section_name, bc_type, neumann_bcs );
268 libmesh_error_msg(
"ERROR: Invalid bc_type "+bc_type+
"!");
297 const std::string& section,
299 libMesh::DofMap& dof_map )
301 std::string wall_input = section+
"/periodic_wall_";
302 wall_input += StringUtilities::T_to_string<BoundaryID>(bc_id);
304 if( input.have_variable(wall_input) )
306 libMesh::boundary_id_type invalid_bid =
307 std::numeric_limits<libMesh::boundary_id_type>::max();
309 libMesh::boundary_id_type slave_id = invalid_bid;
310 libMesh::boundary_id_type master_id = invalid_bid;
312 if( input.vector_variable_size(wall_input) != 2 )
313 libmesh_error_msg(
"ERROR: "+wall_input+
" must have only 2 components!");
317 if( input(wall_input,invalid_bid,0) == bc_id )
318 slave_id = input(wall_input,invalid_bid,1);
320 slave_id = input(wall_input,invalid_bid,0);
322 std::string offset_input = section+
"/periodic_offset_";
323 offset_input += StringUtilities::T_to_string<BoundaryID>(bc_id);
325 if( !input.have_variable(offset_input) )
326 libmesh_error_msg(
"ERROR: Could not find "+offset_input+
"!");
328 unsigned int n_comps = input.vector_variable_size(offset_input);
330 libMesh::Real invalid_real = std::numeric_limits<libMesh::Real>::max();
332 libMesh::RealVectorValue offset_vector;
333 for(
unsigned int i = 0; i < n_comps; i++ )
334 offset_vector(i) = input(offset_input,invalid_real,i);
337 offset_vector, dof_map );
341 template<
typename FunctionType>
343 unsigned int value_idx,
344 const std::vector<std::string>& var_names )
351 template<
typename FunctionType>
353 unsigned int value_idx,
354 const std::vector<std::string>& )
362 template void OldStyleBCBuilder::set_dirichlet_bc_factory_old_style_quantities<libMesh::FunctionBase<libMesh::Number> >(
const std::string&,
unsigned int,
const std::vector<std::string>& );
363 template void OldStyleBCBuilder::set_dirichlet_bc_factory_old_style_quantities<libMesh::FEMFunctionBase<libMesh::Number> >(
const std::string&,
unsigned int,
const std::vector<std::string>& );
364 template void OldStyleBCBuilder::set_neumann_bc_factory_old_style_quantities<libMesh::FunctionBase<libMesh::Number> >(
const std::string&,
unsigned int,
const std::vector<std::string>& );
365 template void OldStyleBCBuilder::set_neumann_bc_factory_old_style_quantities<libMesh::FEMFunctionBase<libMesh::Number> >(
const std::string&,
unsigned int,
const std::vector<std::string>& );
static PhysicsName heat_transfer()
void construct_dbc_core(const GetPot &input, MultiphysicsSystem &system, const std::set< BoundaryID > &bc_ids, const FEVariablesBase &fe_var, const std::string §ion, const std::string &bc_type, libMesh::DofMap &dof_map)
void construct_nbc_core(const GetPot &input, MultiphysicsSystem &system, const std::set< BoundaryID > &bc_ids, const FEVariablesBase &fe_var, const std::string §ion, const std::string &bc_type, std::vector< SharedPtr< NeumannBCContainer > > &neumann_bcs)
static void set_var_names_old_style(const std::vector< std::string > &var_names)
static void set_value_var_old_style(const std::string &value_var)
Input variable for parsing old style.
static PhysicsName reacting_low_mach_navier_stokes()
void build_vel_and_temp_physics(std::set< std::string > &physics_names)
static std::string temperature_section()
static PhysicsName spalart_allmaras()
static std::string displacement_section()
libMesh::boundary_id_type BoundaryID
More descriptive name of the type used for boundary ids.
bool is_dirichlet_bc_type(const std::string &bc_type)
static PhysicsName low_mach_navier_stokes()
#define grins_warning(message)
static PhysicsName elastic_cable()
void set_neumann_bc_factory_old_style_quantities(const std::string &bc_value_str, unsigned int value_idx, const std::vector< std::string > &var_names)
void add_periodic_bc_to_dofmap(libMesh::boundary_id_type master_id, libMesh::boundary_id_type slave_id, const libMesh::RealVectorValue &offset_vector, libMesh::DofMap &dof_map)
void construct_bcs_old_style(const GetPot &input, MultiphysicsSystem &system, const std::string &raw_physics_name, const std::string §ion_name, const std::string &bc_id_str, const std::string &bc_type_str, const std::string &bc_value_str, const std::string &bc_var_str, libMesh::DofMap &dof_map, std::vector< SharedPtr< NeumannBCContainer > > &neumann_bcs)
static void set_value_var_old_style(const std::string &value_var)
Input variable for parsing old style.
static PhysicsName elastic_membrane()
void set_dirichlet_bc_factory_old_style_quantities(const std::string &bc_value_str, unsigned int value_idx, const std::vector< std::string > &var_names)
static std::string extract_physics(const std::string &full_name)
Extract the physics name from the full_name.
static std::string velocity_section()
static FEVariablesBase & get_variable(const std::string &var_name)
void build_reacting_physics(std::set< std::string > &physics_names)
static std::string species_mass_fractions_section()
static void set_value_index_old_style(unsigned int idx)
Input variable index for parsing old style.
static PhysicsName convection_diffusion()
void build_periodic_bc(const GetPot &input, const std::string §ion_name, BoundaryID bc_id, libMesh::DofMap &dof_map)
Interface with libMesh for solving Multiphysics problems.
const FEVariablesBase * determine_variable_group(const std::string &raw_physics_name, const std::string &bc_type_str, std::string &var_section)
Determine the FEVariable type from the raw_physics_name.
std::map< std::string, SharedPtr< GRINS::Physics > > PhysicsList
Container for GRINS::Physics object pointers.
static PhysicsName incompressible_navier_stokes()
static PhysicsName stokes()
void build_basic_physics(std::set< std::string > &physics_names)
static std::string single_var_section()
static PhysicsName axisymmetric_heat_transfer()
static std::string turbulence_section()
const std::vector< std::string > & active_var_names() const
Return the var names that are active from this class.
static PhysicsName heat_conduction()
bool is_neumann_bc_type(const std::string &bc_type)
std::map< std::string, SharedPtr< GRINS::Physics > >::const_iterator PhysicsListIter
Iterator for PhysicsList.
const PhysicsList & get_physics_list() const
static void set_value_index_old_style(unsigned int idx)
Input variable index for parsing old style.
virtual void build_bcs(const GetPot &input, MultiphysicsSystem &system, std::vector< SharedPtr< NeumannBCContainer > > &neumann_bcs)