void BCBuilder::construct_dbc_core( const GetPot& input, MultiphysicsSystem& system, const std::set<BoundaryID>& bc_ids, const FEVariablesBase& fe_var, const std::string& section, const std::string& bc_type, libMesh::DofMap& dof_map ) { // Give the BC factory access to the System DirichletBCFactoryAbstract::set_system( system ); // Give the BC factory access to the GetPot object DirichletBCFactoryAbstract::set_getpot(input); // Set the boundary id. This gets reset each time inside the factory. DirichletBCFactoryAbstract::set_bc_ids( bc_ids ); // Set the FEVariable. This gets reset each time inside the factory. DirichletBCFactoryAbstract::set_fe_var( fe_var ); // Tell the DirichletBCFactory where to parse the value of the BC, // if it needs to DirichletBCFactoryAbstract::set_section( section ); libMesh::UniquePtr<libMesh::DirichletBoundary> dbc = DirichletBCFactoryAbstract::build( bc_type ); dof_map.add_dirichlet_boundary( *dbc ); }
void PracticeBCHandling::user_init_dirichlet_bcs( libMesh::FEMSystem* /*system*/, libMesh::DofMap& dof_map, BoundaryID bc_id, BCType bc_type ) const{ std::set<BoundaryID> dbc_ids; dbc_ids.insert(bc_id); std::vector<VariableIndex> dbc_vars; dbc_vars.push_back(_c_var); if(_has_zc) dbc_vars.push_back(_zc_var); if(_has_fc) dbc_vars.push_back(_fc_var); if(_has_auxc) dbc_vars.push_back(_aux_c_var); if(_has_auxzc) dbc_vars.push_back(_aux_zc_var); if(_has_auxfc) dbc_vars.push_back(_aux_fc_var); libMesh::ConstFunction<libMesh::Number> c_func(this->get_dirichlet_bc_value(bc_id)); libMesh::DirichletBoundary c_dbc( dbc_ids, dbc_vars, &c_func ); dof_map.add_dirichlet_boundary( c_dbc ); }
void HeatTransferBCHandling::user_init_dirichlet_bcs( libMesh::FEMSystem* /*system*/, libMesh::DofMap& dof_map, BoundaryID bc_id, BCType bc_type ) const { switch( bc_type ) { case(ISOTHERMAL_WALL): { std::set<BoundaryID> dbc_ids; dbc_ids.insert(bc_id); std::vector<VariableIndex> dbc_vars; dbc_vars.push_back(_temp_vars.T_var()); libMesh::ConstFunction<libMesh::Number> t_func(this->get_dirichlet_bc_value(bc_id)); libMesh::DirichletBoundary t_dbc( dbc_ids, dbc_vars, &t_func ); dof_map.add_dirichlet_boundary( t_dbc ); } break; default: { std::cerr << "Error: Invalid Dirichlet BC type for " << _physics_name << std::endl; libmesh_error(); } }// end switch return; }
void BCBuilder::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 ) { libMesh::PeriodicBoundary bc( offset_vector ); bc.myboundary = master_id; bc.pairedboundary = slave_id; dof_map.add_periodic_boundary( bc ); }
void SolidMechanicsBCHandling::user_init_dirichlet_bcs( libMesh::FEMSystem* system, libMesh::DofMap& dof_map, BoundaryID bc_id, BCType bc_type ) const { VariableIndex u_var = _disp_vars.u_var(); libmesh_assert(system->has_variable(_disp_vars.u_var_name())); VariableIndex v_var; if( _disp_vars.have_v() ) { v_var = _disp_vars.v_var(); libmesh_assert(system->has_variable(_disp_vars.v_var_name())); } VariableIndex w_var; if( _disp_vars.have_w() ) { w_var = _disp_vars.w_var(); libmesh_assert(system->has_variable(_disp_vars.w_var_name())); } switch( bc_type ) { case(PINNED): { std::set<BoundaryID> dbc_ids; dbc_ids.insert(bc_id); std::vector<VariableIndex> dbc_vars; dbc_vars.push_back(u_var); if( _disp_vars.have_v() ) dbc_vars.push_back(v_var); if( _disp_vars.have_w() ) dbc_vars.push_back(w_var); libMesh::ZeroFunction<libMesh::Number> zero; libMesh::DirichletBoundary no_slip_dbc(dbc_ids, dbc_vars, &zero ); dof_map.add_dirichlet_boundary( no_slip_dbc ); } break; case(CONSTANT_DISPLACEMENT): { std::set<BoundaryID> dbc_ids; dbc_ids.insert(bc_id); std::vector<VariableIndex> dbc_vars; // This is inefficient, but it shouldn't matter because // everything gets cached on the libMesh side so it should // only affect performance at startup. { dbc_vars.push_back(u_var); libMesh::ConstFunction<libMesh::Number> disp_func( this->get_dirichlet_bc_value(bc_id,0) ); libMesh::DirichletBoundary disp_dbc(dbc_ids, dbc_vars, &disp_func ); dof_map.add_dirichlet_boundary( disp_dbc ); dbc_vars.clear(); } if( _disp_vars.have_v() ) { dbc_vars.push_back(v_var); libMesh::ConstFunction<libMesh::Number> disp_func( this->get_dirichlet_bc_value(bc_id,1) ); libMesh::DirichletBoundary disp_dbc(dbc_ids, dbc_vars, &disp_func ); dof_map.add_dirichlet_boundary( disp_dbc ); dbc_vars.clear(); } if( _disp_vars.have_w() ) { dbc_vars.push_back(w_var); libMesh::ConstFunction<libMesh::Number> disp_func( this->get_dirichlet_bc_value(bc_id,2) ); libMesh::DirichletBoundary disp_dbc(dbc_ids, dbc_vars, &disp_func ); dof_map.add_dirichlet_boundary( disp_dbc ); } } break; // Roller is free to move in the x-direction, so pin y and z-directions case(ROLLER_X): { std::set<BoundaryID> dbc_ids; dbc_ids.insert(bc_id); std::vector<VariableIndex> dbc_vars; if( _disp_vars.have_v() ) dbc_vars.push_back(v_var); if( _disp_vars.have_w() ) dbc_vars.push_back(w_var); libMesh::ZeroFunction<libMesh::Number> zero; libMesh::DirichletBoundary no_slip_dbc(dbc_ids, dbc_vars, &zero ); dof_map.add_dirichlet_boundary( no_slip_dbc ); } break; // Roller is free to move in the y-direction, so pin x and z-directions case(ROLLER_Y): { std::set<BoundaryID> dbc_ids; dbc_ids.insert(bc_id); std::vector<VariableIndex> dbc_vars; dbc_vars.push_back(u_var); if( _disp_vars.have_w() ) dbc_vars.push_back(w_var); libMesh::ZeroFunction<libMesh::Number> zero; libMesh::DirichletBoundary no_slip_dbc(dbc_ids, dbc_vars, &zero ); dof_map.add_dirichlet_boundary( no_slip_dbc ); } break; // Roller is free to move in the z-direction, so pin x and y-directions case(ROLLER_Z): { std::set<BoundaryID> dbc_ids; dbc_ids.insert(bc_id); std::vector<VariableIndex> dbc_vars; dbc_vars.push_back(u_var); dbc_vars.push_back(v_var); libMesh::ZeroFunction<libMesh::Number> zero; libMesh::DirichletBoundary no_slip_dbc(dbc_ids, dbc_vars, &zero ); dof_map.add_dirichlet_boundary( no_slip_dbc ); } break; // Symmetric about YZ-plane so pin x-direction case(SYMMETRY_YZ): { std::set<BoundaryID> dbc_ids; dbc_ids.insert(bc_id); std::vector<VariableIndex> dbc_vars; dbc_vars.push_back(u_var); libMesh::ZeroFunction<libMesh::Number> zero; libMesh::DirichletBoundary no_slip_dbc(dbc_ids, dbc_vars, &zero ); dof_map.add_dirichlet_boundary( no_slip_dbc ); } break; // Symmetric about XZ-plane so pin y-direction case(SYMMETRY_XZ): { std::set<BoundaryID> dbc_ids; dbc_ids.insert(bc_id); std::vector<VariableIndex> dbc_vars; dbc_vars.push_back(v_var); libMesh::ZeroFunction<libMesh::Number> zero; libMesh::DirichletBoundary no_slip_dbc(dbc_ids, dbc_vars, &zero ); dof_map.add_dirichlet_boundary( no_slip_dbc ); } break; // Symmetric about XY-plane so pin z-direction case(SYMMETRY_XY): { std::set<BoundaryID> dbc_ids; dbc_ids.insert(bc_id); std::vector<VariableIndex> dbc_vars; dbc_vars.push_back(w_var); libMesh::ZeroFunction<libMesh::Number> zero; libMesh::DirichletBoundary no_slip_dbc(dbc_ids, dbc_vars, &zero ); dof_map.add_dirichlet_boundary( no_slip_dbc ); } break; default: { std::cerr << "Invalid BCType " << bc_type << std::endl; libmesh_error(); } }// end switch return; }