GRINS-0.6.0
Public Member Functions | Protected Types | Protected Attributes | Static Protected Attributes | Private Types | Private Member Functions | List of all members
GRINS::SolidMechanicsBCHandling Class Reference

#include <solid_mechanics_bc_handling.h>

Inheritance diagram for GRINS::SolidMechanicsBCHandling:
Inheritance graph
[legend]
Collaboration diagram for GRINS::SolidMechanicsBCHandling:
Collaboration graph
[legend]

Public Member Functions

 SolidMechanicsBCHandling (const std::string &physics_name, const GetPot &input)
 
virtual ~SolidMechanicsBCHandling ()
 
virtual int string_to_int (const std::string &bc_type_in) const
 
virtual void init_bc_data (const libMesh::FEMSystem &system)
 Override this method to initialize any system-dependent data. More...
 
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 user_apply_neumann_bcs (AssemblyContext &context, const GRINS::CachedValues &cache, const bool request_jacobian, const GRINS::BoundaryID bc_id, const GRINS::BCType bc_type) const
 
void attach_neumann_bound_func (GRINS::NBCContainer &neumann_bcs)
 
void attach_dirichlet_bound_func (const GRINS::DBCContainer &dirichlet_bc)
 
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)
 
virtual void apply_neumann_bcs (AssemblyContext &context, const GRINS::CachedValues &cache, const bool request_jacobian, const GRINS::BoundaryID bc_id) const
 
virtual void init_dirichlet_bc_func_objs (libMesh::FEMSystem *system) const
 
virtual void init_periodic_bcs (libMesh::FEMSystem *system) const
 
void set_dirichlet_bc_type (GRINS::BoundaryID bc_id, int bc_type)
 
void set_neumann_bc_type (GRINS::BoundaryID bc_id, int bc_type)
 
void set_dirichlet_bc_value (GRINS::BoundaryID bc_id, libMesh::Real value, int component=0)
 
void set_neumann_bc_value (GRINS::BoundaryID bc_id, const libMesh::Point &q_in)
 
libMesh::Real get_dirichlet_bc_value (GRINS::BoundaryID bc_id, int component=0) const
 
const libMesh::Point & get_neumann_bc_value (GRINS::BoundaryID bc_id) const
 
std::tr1::shared_ptr< GRINS::NeumannFuncObjget_neumann_bound_func (GRINS::BoundaryID bc_id, GRINS::VariableIndex var_id) const
 
std::tr1::shared_ptr< GRINS::NeumannFuncObjget_neumann_bound_func (GRINS::BoundaryID bc_id, GRINS::VariableIndex var_id)
 
virtual void init_dirichlet_bcs (libMesh::FEMSystem *system) const
 
GRINS::BCType get_dirichlet_bc_type (const GRINS::BoundaryID bc_id) const
 
bool is_axisymmetric () const
 

Protected Types

enum  BC_BASE {
  PERIODIC = -5, CONSTANT_DIRICHLET, PARSED_DIRICHLET, PARSED_FEM_DIRICHLET,
  AXISYMMETRIC
}
 

Protected Attributes

SolidMechanicsVariables _disp_vars
 
std::vector< std::pair< BoundaryID, BCType > > _dirichlet_bc_map
 Map between boundary id and Dirichlet boundary condition type. More...
 
std::map< GRINS::BoundaryID, GRINS::BCType_neumann_bc_map
 Map between boundary id and Neumann boundary condition type. More...
 
std::map< GRINS::BoundaryID, libMesh::Point > _dirichlet_values
 Stash prescribed Dirichlet boundary values. More...
 
std::map< GRINS::BoundaryID, libMesh::Point > _q_values
 Stash prescribed boundary fluxes. More...
 
std::map< GRINS::BoundaryID, GRINS::NBCContainer_neumann_bound_funcs
 
std::vector< GRINS::DBCContainer_dirichlet_bound_funcs
 
GRINS::BoundaryConditions _bound_conds
 Object that stashes generic boundary condition types. More...
 
std::vector< GRINS::PBCContainer_periodic_bcs
 
unsigned int _num_periodic_bcs
 
std::string _physics_name
 

Static Protected Attributes

static bool _axisymmetric = false
 Flag to cache whether or not there is an axisymmetric boundary present. More...
 

Private Types

enum  SOLIDS_BC_TYPES {
  PINNED =1, CONSTANT_DISPLACEMENT, ROLLER_X, ROLLER_Y,
  ROLLER_Z, SYMMETRY_YZ, SYMMETRY_XZ, SYMMETRY_XY,
  CONSTANT_TRACTION
}
 

Private Member Functions

 SolidMechanicsBCHandling ()
 

Detailed Description

Definition at line 35 of file solid_mechanics_bc_handling.h.

Member Enumeration Documentation

enum GRINS::BCHandlingBase::BC_BASE
protectedinherited

Constructor & Destructor Documentation

GRINS::SolidMechanicsBCHandling::SolidMechanicsBCHandling ( const std::string &  physics_name,
const GetPot &  input 
)

Definition at line 37 of file solid_mechanics_bc_handling.C.

References GRINS::BCHandlingBase::_physics_name, and GRINS::BCHandlingBase::read_bc_data().

39  : BCHandlingBase(physics_name),
40  _disp_vars(input)
41  {
42  std::string id_str = "Physics/"+_physics_name+"/bc_ids";
43  std::string bc_str = "Physics/"+_physics_name+"/bc_types";
44  std::string var_str = "Physics/"+_physics_name+"/bc_variables";
45  std::string val_str = "Physics/"+_physics_name+"/bc_values";
46 
47  this->read_bc_data( input, id_str, bc_str, var_str, val_str );
48 
49  return;
50  }
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)
GRINS::SolidMechanicsBCHandling::~SolidMechanicsBCHandling ( )
virtual

Definition at line 52 of file solid_mechanics_bc_handling.C.

53  {
54  return;
55  }
GRINS::SolidMechanicsBCHandling::SolidMechanicsBCHandling ( )
private

Member Function Documentation

void GRINS::BCHandlingBase::apply_neumann_bcs ( AssemblyContext context,
const GRINS::CachedValues cache,
const bool  request_jacobian,
const GRINS::BoundaryID  bc_id 
) const
virtualinherited

Definition at line 234 of file bc_handling_base.C.

References GRINS::BCHandlingBase::_neumann_bc_map, and GRINS::BCHandlingBase::user_apply_neumann_bcs().

238  {
239  std::map< BoundaryID, BCType>::const_iterator
240  bc_map_it = _neumann_bc_map.find( bc_id );
241 
242  /* We assume that if you didn't put a boundary id in, then you didn't want to
243  set a boundary condition on that boundary. */
244  if( bc_map_it != _neumann_bc_map.end() )
245  {
246  this->user_apply_neumann_bcs( context, cache, request_jacobian,
247  bc_id, bc_map_it->second );
248  }
249  return;
250  }
std::map< GRINS::BoundaryID, GRINS::BCType > _neumann_bc_map
Map between boundary id and Neumann boundary condition type.
virtual void user_apply_neumann_bcs(AssemblyContext &context, const GRINS::CachedValues &cache, const bool request_jacobian, const GRINS::BoundaryID bc_id, const GRINS::BCType bc_type) const
void GRINS::BCHandlingBase::attach_dirichlet_bound_func ( const GRINS::DBCContainer dirichlet_bc)
inherited
void GRINS::BCHandlingBase::attach_neumann_bound_func ( GRINS::NBCContainer neumann_bcs)
inherited

Definition at line 61 of file bc_handling_base.C.

References GRINS::BCHandlingBase::_neumann_bound_funcs, and GRINS::NBCContainer::get_bc_id().

Referenced by GRINS::Physics::attach_neumann_bound_func().

62  {
63  _neumann_bound_funcs.insert( std::make_pair( neumann_bcs.get_bc_id(), neumann_bcs ) );
64  return;
65  }
BoundaryID get_bc_id() const
Definition: nbc_container.C:46
std::map< GRINS::BoundaryID, GRINS::NBCContainer > _neumann_bound_funcs
GRINS::BCType GRINS::BCHandlingBase::get_dirichlet_bc_type ( const GRINS::BoundaryID  bc_id) const
inlineinherited

Definition at line 207 of file bc_handling_base.h.

References GRINS::BCHandlingBase::_dirichlet_bc_map.

208  {
209  BCType bc_type_out = -100;
210 
211  for( std::vector<std::pair<BoundaryID,BCType> >::const_iterator it = _dirichlet_bc_map.begin();
212  it != _dirichlet_bc_map.end(); it++ )
213  {
214  if( it->first == bc_id ) bc_type_out = it->second;
215  }
216 
217  libmesh_assert_not_equal_to( bc_type_out, -100 );
218 
219  return bc_type_out;
220  }
std::vector< std::pair< BoundaryID, BCType > > _dirichlet_bc_map
Map between boundary id and Dirichlet boundary condition type.
int BCType
Definition: bc_types.h:32
libMesh::Real GRINS::BCHandlingBase::get_dirichlet_bc_value ( GRINS::BoundaryID  bc_id,
int  component = 0 
) const
inherited
const libMesh::Point & GRINS::BCHandlingBase::get_neumann_bc_value ( GRINS::BoundaryID  bc_id) const
inlineinherited

Definition at line 185 of file bc_handling_base.h.

References GRINS::BCHandlingBase::_q_values.

Referenced by GRINS::AxisymmetricHeatTransferBCHandling::user_apply_neumann_bcs(), GRINS::HeatTransferBCHandling::user_apply_neumann_bcs(), and user_apply_neumann_bcs().

186  {
187  return (_q_values.find(bc_id))->second;
188  }
std::map< GRINS::BoundaryID, libMesh::Point > _q_values
Stash prescribed boundary fluxes.
std::tr1::shared_ptr< GRINS::NeumannFuncObj > GRINS::BCHandlingBase::get_neumann_bound_func ( GRINS::BoundaryID  bc_id,
GRINS::VariableIndex  var_id 
) const
inlineinherited

Definition at line 192 of file bc_handling_base.h.

References GRINS::BCHandlingBase::_neumann_bound_funcs.

Referenced by GRINS::AxisymmetricHeatTransferBCHandling::user_apply_neumann_bcs(), and GRINS::HeatTransferBCHandling::user_apply_neumann_bcs().

194  {
195  return ((_neumann_bound_funcs.find(bc_id))->second).get_func(var_id);
196  }
std::map< GRINS::BoundaryID, GRINS::NBCContainer > _neumann_bound_funcs
std::tr1::shared_ptr< GRINS::NeumannFuncObj > GRINS::BCHandlingBase::get_neumann_bound_func ( GRINS::BoundaryID  bc_id,
GRINS::VariableIndex  var_id 
)
inlineinherited

Definition at line 200 of file bc_handling_base.h.

References GRINS::BCHandlingBase::_neumann_bound_funcs.

202  {
203  return ((_neumann_bound_funcs.find(bc_id))->second).get_func(var_id);
204  }
std::map< GRINS::BoundaryID, GRINS::NBCContainer > _neumann_bound_funcs
void GRINS::SolidMechanicsBCHandling::init_bc_data ( const libMesh::FEMSystem &  system)
virtual

Override this method to initialize any system-dependent data.

Override this method to, for example, cache a System variable number. This is called before any of the other init methods in this class. By default, does nothing.

Reimplemented from GRINS::BCHandlingBase.

Definition at line 97 of file solid_mechanics_bc_handling.C.

References _disp_vars, and GRINS::SolidMechanicsVariables::init().

98  {
99  _disp_vars.init(const_cast<libMesh::FEMSystem*>(&system));
100 
101  return;
102  }
void init(libMesh::FEMSystem *system)
Initialize System variables.
void GRINS::SolidMechanicsBCHandling::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

Reimplemented from GRINS::BCHandlingBase.

Definition at line 104 of file solid_mechanics_bc_handling.C.

References _disp_vars, GRINS::BCHandlingBase::_physics_name, CONSTANT_DISPLACEMENT, CONSTANT_TRACTION, GRINS::SolidMechanicsVariables::have_v(), GRINS::SolidMechanicsVariables::have_w(), GRINS::BCHandlingBase::init_bc_types(), PINNED, ROLLER_X, ROLLER_Y, ROLLER_Z, GRINS::BCHandlingBase::set_dirichlet_bc_type(), GRINS::BCHandlingBase::set_dirichlet_bc_value(), GRINS::BCHandlingBase::set_neumann_bc_type(), GRINS::BCHandlingBase::set_neumann_bc_value(), SYMMETRY_XY, SYMMETRY_XZ, and SYMMETRY_YZ.

110  {
111  switch(bc_type)
112  {
113  case(PINNED):
114  {
115  this->set_dirichlet_bc_type( bc_id, bc_type );
116  }
117  break;
118 
119  case(CONSTANT_DISPLACEMENT):
120  {
121  this->set_dirichlet_bc_type( bc_id, bc_type );
122 
123  int n_disp_comps = input.vector_variable_size("Physics/"+_physics_name+"/displacement_"+bc_id_string);
124 
125  if( _disp_vars.have_v() )
126  {
127  if( n_disp_comps < 2 )
128  {
129  std::cerr << "Error: Must specify at least 2 displacement components for 2-D problem." << std::endl;
130  libmesh_error();
131  }
132  }
133 
134  if( _disp_vars.have_w() )
135  {
136  if( n_disp_comps < 3 )
137  {
138  std::cerr << "Error: Must specify 3 displacement components for 3-D problem." << std::endl;
139  libmesh_error();
140  }
141  }
142 
143  for( int i = 0; i < n_disp_comps; i++ )
144  {
145  this->set_dirichlet_bc_value( bc_id,
146  input("Physics/"+_physics_name+"/displacement_"+bc_id_string, 0.0, i ),
147  i );
148  }
149  }
150  break;
151 
152  case(ROLLER_X):
153  case(ROLLER_Y):
154  case(ROLLER_Z):
155  case(SYMMETRY_YZ):
156  case(SYMMETRY_XZ):
157  case(SYMMETRY_XY):
158  {
159  this->set_dirichlet_bc_type( bc_id, bc_type );
160  }
161  break;
162 
163  case(CONSTANT_TRACTION):
164  {
165  this->set_neumann_bc_type( bc_id, bc_type );
166 
167  libMesh::Gradient t_in;
168 
169  int num_t_components = input.vector_variable_size("Physics/"+_physics_name+"/traction_"+bc_id_string);
170 
171  if( num_t_components < 3 )
172  {
173  std::cerr << "Error: Expecting 3 components when specifying traction!" << std::endl
174  << " Found " << num_t_components << " components." << std::endl;
175  libmesh_error();
176  }
177 
178  for( int i = 0; i < num_t_components; i++ )
179  {
180  t_in(i) = input("Physics/"+_physics_name+"/traction_"+bc_id_string, 0.0, i );
181  }
182 
183  this->set_neumann_bc_value( bc_id, t_in );
184  }
185  break;
186 
187  default:
188  {
189  // Call base class to detect any physics-common boundary conditions
190  BCHandlingBase::init_bc_types( bc_id, bc_id_string, bc_type,
191  bc_vars, bc_value, input );
192  }
193 
194  }// End switch(bc_type)
195 
196  return;
197  }
void set_dirichlet_bc_value(GRINS::BoundaryID bc_id, libMesh::Real value, int component=0)
void set_neumann_bc_value(GRINS::BoundaryID bc_id, const libMesh::Point &q_in)
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)
void set_neumann_bc_type(GRINS::BoundaryID bc_id, int bc_type)
void set_dirichlet_bc_type(GRINS::BoundaryID bc_id, int bc_type)
void GRINS::BCHandlingBase::init_dirichlet_bc_func_objs ( libMesh::FEMSystem *  system) const
virtualinherited

Definition at line 116 of file bc_handling_base.C.

References GRINS::BCHandlingBase::_dirichlet_bound_funcs.

Referenced by GRINS::Physics::init_bcs().

117  {
118  libMesh::DofMap& dof_map = system->get_dof_map();
119 
120  for( std::vector< DBCContainer >::const_iterator
121  it = _dirichlet_bound_funcs.begin();
122  it != _dirichlet_bound_funcs.end();
123  it++ )
124  {
125  // First, get variable names. We convert them to variable ids,
126  // both to tell the DirichletBoundary what variables to
127  // project and to tell the CompositeFunction what remapping to
128  // do.
129  std::vector<VariableName> var_names = (*it).get_var_names();
130 
131  std::vector<VariableIndex> dbc_vars;
132 
133  for( std::vector<VariableName>::const_iterator name = var_names.begin();
134  name != var_names.end();
135  name++ )
136  {
137  dbc_vars.push_back( system->variable_number( *name ) );
138  }
139 
140  // Get bc_id's
141  std::set<BoundaryID> bc_ids = (*it).get_bc_ids();
142 
143  // Get Dirichlet bc functor
144  std::tr1::shared_ptr<libMesh::FunctionBase<libMesh::Number> >
145  func = (*it).get_func();
146 
147  // Remap indices as necessary
148  if (func.get())
149  {
151  remapped_func.attach_subfunction(*func, dbc_vars);
152 
153  // Now create DirichletBoundary object and give it to libMesh
154  // libMesh makes it own copy of the DirichletBoundary so we can
155  // let this one die.
156  libMesh::DirichletBoundary dbc( bc_ids, dbc_vars,
157  remapped_func );
158 
159  dof_map.add_dirichlet_boundary( dbc );
160  }
161  else
162  {
163  // Get Dirichlet bc functor
164  const std::string& func_string = (*it).get_fem_func_string();
165 
166  libmesh_assert_not_equal_to(func_string, "");
167 
168  // Need to belatedly create Dirichlet functor since we
169  // didn't have a System object handy until now.
170  libMesh::ParsedFEMFunction<libMesh::Number>
171  func(*system, func_string);
172 
173  libMesh::CompositeFEMFunction<libMesh::Number> remapped_func;
174  remapped_func.attach_subfunction(func, dbc_vars);
175 
176  // Now create DirichletBoundary object and give it to libMesh
177  // libMesh makes it own copy of the DirichletBoundary so we can
178  // let this one die.
179  libMesh::DirichletBoundary dbc( bc_ids, dbc_vars,
180  *system,
181  remapped_func );
182 
183  dof_map.add_dirichlet_boundary( dbc );
184  }
185  }
186 
187  return;
188  }
std::vector< GRINS::DBCContainer > _dirichlet_bound_funcs
void GRINS::BCHandlingBase::init_dirichlet_bcs ( libMesh::FEMSystem *  system) const
virtualinherited

Reimplemented in GRINS::ReactingLowMachNavierStokesBCHandling< Chemistry >, and GRINS::LowMachNavierStokesBCHandling.

Definition at line 190 of file bc_handling_base.C.

References GRINS::BCHandlingBase::_dirichlet_bc_map, and GRINS::BCHandlingBase::user_init_dirichlet_bcs().

Referenced by GRINS::Physics::init_bcs().

191  {
192  libMesh::DofMap& dof_map = system->get_dof_map();
193 
194  for( std::vector<std::pair<BoundaryID,BCType> >::const_iterator it = _dirichlet_bc_map.begin();
195  it != _dirichlet_bc_map.end(); it++ )
196  {
197  this->user_init_dirichlet_bcs( system, dof_map, it->first, it->second );
198  }
199 
200  return;
201  }
virtual void user_init_dirichlet_bcs(libMesh::FEMSystem *system, libMesh::DofMap &dof_map, GRINS::BoundaryID bc_id, GRINS::BCType bc_type) const
std::vector< std::pair< BoundaryID, BCType > > _dirichlet_bc_map
Map between boundary id and Dirichlet boundary condition type.
void GRINS::BCHandlingBase::init_periodic_bcs ( libMesh::FEMSystem *  system) const
virtualinherited

Definition at line 203 of file bc_handling_base.C.

References GRINS::BCHandlingBase::_num_periodic_bcs, and GRINS::BCHandlingBase::_periodic_bcs.

Referenced by GRINS::Physics::init_bcs().

204  {
205  /* Consistency check required to make sure user actually set periodic bc data.
206  This is needed because of the way we parse periodic boundary conditions. */
207  if( _periodic_bcs.size() != _num_periodic_bcs/2 )
208  {
209  std::cerr << "==========================================================" << std::endl
210  << "Error: Inconsistency in perioidic boundary conditions." << std::endl
211  << " There were " << _num_periodic_bcs << " deteced but " << std::endl
212  << " only " << _periodic_bcs.size() << " pairs of data " << std::endl
213  << " were set." << std::endl
214  << "==========================================================" << std::endl;
215  libmesh_error();
216  }
217 
218  libMesh::DofMap& dof_map = system->get_dof_map();
219 
220  for( std::vector< PBCContainer >::const_iterator it = _periodic_bcs.begin();
221  it != _periodic_bcs.end();
222  it++ )
223  {
224  libMesh::PeriodicBoundary bc( it->get_offset_vector() );
225  bc.myboundary = it->get_master_bcid();
226  bc.pairedboundary = it->get_slave_bcid();
227 
228  dof_map.add_periodic_boundary( bc );
229  }
230 
231  return;
232  }
std::vector< GRINS::PBCContainer > _periodic_bcs
unsigned int _num_periodic_bcs
bool GRINS::BCHandlingBase::is_axisymmetric ( ) const
inlineinherited
void GRINS::BCHandlingBase::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 
)
virtualinherited

Definition at line 73 of file bc_handling_base.C.

References GRINS::BCHandlingBase::init_bc_types(), and GRINS::BCHandlingBase::string_to_int().

Referenced by GRINS::AxisymmetricHeatTransferBCHandling::AxisymmetricHeatTransferBCHandling(), GRINS::HeatTransferBCHandling::HeatTransferBCHandling(), GRINS::IncompressibleNavierStokesBCHandling::IncompressibleNavierStokesBCHandling(), GRINS::LowMachNavierStokesBCHandling::LowMachNavierStokesBCHandling(), GRINS::ReactingLowMachNavierStokesBCHandling< Chemistry >::ReactingLowMachNavierStokesBCHandling(), SolidMechanicsBCHandling(), and GRINS::SpalartAllmarasBCHandling::SpalartAllmarasBCHandling().

77  {
78  int num_ids = input.vector_variable_size(id_str);
79  int num_bcs = input.vector_variable_size(bc_str);
80  // int num_vars = input.vector_variable_size(var_str);
81  // int num_vals = input.vector_variable_size(val_str);
82 
83  if( num_ids != num_bcs )
84  {
85  std::cerr << "Error: Must specify equal number of boundary ids and boundary conditions"
86  << std::endl;
87  libmesh_error();
88  }
89 
90  for( int i = 0; i < num_ids; i++ )
91  {
92  int bc_id = input(id_str, -1, i );
93  std::string bc_type_in = input(bc_str, "NULL", i );
94 
95  int bc_type = this->string_to_int( bc_type_in );
96 
97  std::stringstream ss;
98  ss << bc_id;
99  std::string bc_id_string = ss.str();
100 
101  std::string bc_val = input(val_str, std::string(""), i );
102 
103  std::string bc_vars = input(var_str, std::string(""), i );
104 
105  this->init_bc_types( bc_id, bc_id_string, bc_type, bc_vars, bc_val, input );
106  }
107 
108  return;
109  }
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 int string_to_int(const std::string &bc_type_in) const
void GRINS::BCHandlingBase::set_dirichlet_bc_type ( GRINS::BoundaryID  bc_id,
int  bc_type 
)
inherited

Definition at line 252 of file bc_handling_base.C.

References GRINS::BCHandlingBase::_dirichlet_bc_map.

Referenced by GRINS::AxisymmetricHeatTransferBCHandling::init_bc_types(), GRINS::HeatTransferBCHandling::init_bc_types(), GRINS::LowMachNavierStokesBCHandling::init_bc_types(), GRINS::SpalartAllmarasBCHandling::init_bc_types(), GRINS::IncompressibleNavierStokesBCHandling::init_bc_types(), and init_bc_types().

253  {
254  _dirichlet_bc_map.push_back( std::make_pair(bc_id, bc_type) );
255  return;
256  }
std::vector< std::pair< BoundaryID, BCType > > _dirichlet_bc_map
Map between boundary id and Dirichlet boundary condition type.
void GRINS::BCHandlingBase::set_dirichlet_bc_value ( GRINS::BoundaryID  bc_id,
libMesh::Real  value,
int  component = 0 
)
inherited

Definition at line 264 of file bc_handling_base.C.

References GRINS::BCHandlingBase::_dirichlet_values.

Referenced by GRINS::AxisymmetricHeatTransferBCHandling::init_bc_types(), GRINS::HeatTransferBCHandling::init_bc_types(), GRINS::LowMachNavierStokesBCHandling::init_bc_types(), GRINS::IncompressibleNavierStokesBCHandling::init_bc_types(), and init_bc_types().

267  {
268  _dirichlet_values[bc_id](component) = value;
269  return;
270  }
std::map< GRINS::BoundaryID, libMesh::Point > _dirichlet_values
Stash prescribed Dirichlet boundary values.
void GRINS::BCHandlingBase::set_neumann_bc_type ( GRINS::BoundaryID  bc_id,
int  bc_type 
)
inherited

Definition at line 258 of file bc_handling_base.C.

References GRINS::BCHandlingBase::_neumann_bc_map.

Referenced by GRINS::AxisymmetricHeatTransferBCHandling::init_bc_types(), GRINS::HeatTransferBCHandling::init_bc_types(), GRINS::LowMachNavierStokesBCHandling::init_bc_types(), and init_bc_types().

259  {
260  _neumann_bc_map[bc_id] = bc_type;
261  return;
262  }
std::map< GRINS::BoundaryID, GRINS::BCType > _neumann_bc_map
Map between boundary id and Neumann boundary condition type.
void GRINS::BCHandlingBase::set_neumann_bc_value ( GRINS::BoundaryID  bc_id,
const libMesh::Point &  q_in 
)
inherited

Definition at line 278 of file bc_handling_base.C.

References GRINS::BCHandlingBase::_q_values.

Referenced by GRINS::AxisymmetricHeatTransferBCHandling::init_bc_types(), GRINS::HeatTransferBCHandling::init_bc_types(), GRINS::LowMachNavierStokesBCHandling::init_bc_types(), and init_bc_types().

279  {
280  _q_values[bc_id] = q_in;
281  }
std::map< GRINS::BoundaryID, libMesh::Point > _q_values
Stash prescribed boundary fluxes.
int GRINS::SolidMechanicsBCHandling::string_to_int ( const std::string &  bc_type_in) const
virtual

Reimplemented from GRINS::BCHandlingBase.

Definition at line 57 of file solid_mechanics_bc_handling.C.

References CONSTANT_DISPLACEMENT, CONSTANT_TRACTION, PINNED, ROLLER_X, ROLLER_Y, ROLLER_Z, GRINS::BCHandlingBase::string_to_int(), SYMMETRY_XY, SYMMETRY_XZ, and SYMMETRY_YZ.

58  {
59  int bc_type_out;
60 
61  if( bc_type == "pinned" )
62  bc_type_out = PINNED;
63 
64  else if( bc_type == "constant_displacement" )
65  bc_type_out = CONSTANT_DISPLACEMENT;
66 
67  else if( bc_type == "roller_x" )
68  bc_type_out = ROLLER_X;
69 
70  else if( bc_type == "roller_y" )
71  bc_type_out = ROLLER_Y;
72 
73  else if( bc_type == "roller_z" )
74  bc_type_out = ROLLER_Z;
75 
76  else if( bc_type == "yz_symmetry" )
77  bc_type_out = SYMMETRY_YZ;
78 
79  else if( bc_type == "xz_symmetry" )
80  bc_type_out = SYMMETRY_XZ;
81 
82  else if( bc_type == "xy_symmetry" )
83  bc_type_out = SYMMETRY_XY;
84 
85  else if( bc_type == "constant_traction" )
86  bc_type_out = CONSTANT_TRACTION;
87 
88  else
89  {
90  // Call base class to detect any physics-common boundary conditions
91  bc_type_out = BCHandlingBase::string_to_int( bc_type );
92  }
93 
94  return bc_type_out;
95  }
virtual int string_to_int(const std::string &bc_type_in) const
void GRINS::SolidMechanicsBCHandling::user_apply_neumann_bcs ( AssemblyContext context,
const GRINS::CachedValues cache,
const bool  request_jacobian,
const GRINS::BoundaryID  bc_id,
const GRINS::BCType  bc_type 
) const
virtual

Reimplemented from GRINS::BCHandlingBase.

Definition at line 433 of file solid_mechanics_bc_handling.C.

References GRINS::BCHandlingBase::_bound_conds, _disp_vars, GRINS::BCHandlingBase::_physics_name, GRINS::BoundaryConditions::apply_neumann_normal(), CONSTANT_TRACTION, GRINS::BCHandlingBase::get_neumann_bc_value(), GRINS::SolidMechanicsVariables::have_v(), GRINS::SolidMechanicsVariables::have_w(), GRINS::SolidMechanicsVariables::u_var(), GRINS::SolidMechanicsVariables::v_var(), and GRINS::SolidMechanicsVariables::w_var().

438  {
439  switch( bc_type )
440  {
441  case(CONSTANT_TRACTION):
442  {
443  const libMesh::Point& traction = this->get_neumann_bc_value(bc_id);
444 
445  _bound_conds.apply_neumann_normal( context, _disp_vars.u_var(), 1.0, traction(0) );
446 
447  if( _disp_vars.have_v() )
448  _bound_conds.apply_neumann_normal( context, _disp_vars.v_var(), 1.0, traction(1) );
449 
450  if( _disp_vars.have_w() )
451  _bound_conds.apply_neumann_normal( context, _disp_vars.w_var(), 1.0, traction(2) );
452  }
453  break;
454 
455  default:
456  {
457  std::cerr << "Error: Invalid Neumann BC type for " << _physics_name
458  << std::endl;
459  libmesh_error();
460  }
461 
462  } // switch( bc_type )
463 
464  return;
465  }
void apply_neumann_normal(AssemblyContext &context, const VariableIndex var, const libMesh::Real sign, const FEShape &value) const
Applies Neumann boundary conditions for the constant case.
const libMesh::Point & get_neumann_bc_value(GRINS::BoundaryID bc_id) const
GRINS::BoundaryConditions _bound_conds
Object that stashes generic boundary condition types.
void GRINS::SolidMechanicsBCHandling::user_init_dirichlet_bcs ( libMesh::FEMSystem *  system,
libMesh::DofMap &  dof_map,
GRINS::BoundaryID  bc_id,
GRINS::BCType  bc_type 
) const
virtual

Reimplemented from GRINS::BCHandlingBase.

Definition at line 199 of file solid_mechanics_bc_handling.C.

References _disp_vars, CONSTANT_DISPLACEMENT, GRINS::BCHandlingBase::get_dirichlet_bc_value(), GRINS::SolidMechanicsVariables::have_v(), GRINS::SolidMechanicsVariables::have_w(), PINNED, ROLLER_X, ROLLER_Y, ROLLER_Z, SYMMETRY_XY, SYMMETRY_XZ, SYMMETRY_YZ, GRINS::SolidMechanicsVariables::u_var(), GRINS::SolidMechanicsVariables::u_var_name(), GRINS::SolidMechanicsVariables::v_var(), GRINS::SolidMechanicsVariables::v_var_name(), GRINS::SolidMechanicsVariables::w_var(), and GRINS::SolidMechanicsVariables::w_var_name().

203  {
204  VariableIndex u_var = _disp_vars.u_var();
205  libmesh_assert(system->has_variable(_disp_vars.u_var_name()));
206 
207  VariableIndex v_var;
208  if( _disp_vars.have_v() )
209  {
210  v_var = _disp_vars.v_var();
211  libmesh_assert(system->has_variable(_disp_vars.v_var_name()));
212  }
213 
214  VariableIndex w_var;
215  if( _disp_vars.have_w() )
216  {
217  w_var = _disp_vars.w_var();
218  libmesh_assert(system->has_variable(_disp_vars.w_var_name()));
219  }
220 
221  switch( bc_type )
222  {
223  case(PINNED):
224  {
225  std::set<BoundaryID> dbc_ids;
226  dbc_ids.insert(bc_id);
227 
228  std::vector<VariableIndex> dbc_vars;
229  dbc_vars.push_back(u_var);
230 
231  if( _disp_vars.have_v() )
232  dbc_vars.push_back(v_var);
233 
234  if( _disp_vars.have_w() )
235  dbc_vars.push_back(w_var);
236 
237  libMesh::ZeroFunction<libMesh::Number> zero;
238 
239  libMesh::DirichletBoundary no_slip_dbc(dbc_ids,
240  dbc_vars,
241  &zero );
242 
243  dof_map.add_dirichlet_boundary( no_slip_dbc );
244  }
245  break;
246 
247  case(CONSTANT_DISPLACEMENT):
248  {
249  std::set<BoundaryID> dbc_ids;
250  dbc_ids.insert(bc_id);
251 
252  std::vector<VariableIndex> dbc_vars;
253 
254  // This is inefficient, but it shouldn't matter because
255  // everything gets cached on the libMesh side so it should
256  // only affect performance at startup.
257  {
258  dbc_vars.push_back(u_var);
259  libMesh::ConstFunction<libMesh::Number>
260  disp_func( this->get_dirichlet_bc_value(bc_id,0) );
261 
262  libMesh::DirichletBoundary disp_dbc(dbc_ids,
263  dbc_vars,
264  &disp_func );
265 
266  dof_map.add_dirichlet_boundary( disp_dbc );
267  dbc_vars.clear();
268  }
269 
270  if( _disp_vars.have_v() )
271  {
272  dbc_vars.push_back(v_var);
273  libMesh::ConstFunction<libMesh::Number>
274  disp_func( this->get_dirichlet_bc_value(bc_id,1) );
275 
276  libMesh::DirichletBoundary disp_dbc(dbc_ids,
277  dbc_vars,
278  &disp_func );
279 
280  dof_map.add_dirichlet_boundary( disp_dbc );
281  dbc_vars.clear();
282  }
283 
284  if( _disp_vars.have_w() )
285  {
286  dbc_vars.push_back(w_var);
287  libMesh::ConstFunction<libMesh::Number>
288  disp_func( this->get_dirichlet_bc_value(bc_id,2) );
289 
290  libMesh::DirichletBoundary disp_dbc(dbc_ids,
291  dbc_vars,
292  &disp_func );
293 
294  dof_map.add_dirichlet_boundary( disp_dbc );
295  }
296  }
297  break;
298 
299  // Roller is free to move in the x-direction, so pin y and z-directions
300  case(ROLLER_X):
301  {
302  std::set<BoundaryID> dbc_ids;
303  dbc_ids.insert(bc_id);
304 
305  std::vector<VariableIndex> dbc_vars;
306 
307  if( _disp_vars.have_v() )
308  dbc_vars.push_back(v_var);
309 
310  if( _disp_vars.have_w() )
311  dbc_vars.push_back(w_var);
312 
313  libMesh::ZeroFunction<libMesh::Number> zero;
314 
315  libMesh::DirichletBoundary no_slip_dbc(dbc_ids,
316  dbc_vars,
317  &zero );
318 
319  dof_map.add_dirichlet_boundary( no_slip_dbc );
320  }
321  break;
322 
323  // Roller is free to move in the y-direction, so pin x and z-directions
324  case(ROLLER_Y):
325  {
326  std::set<BoundaryID> dbc_ids;
327  dbc_ids.insert(bc_id);
328 
329  std::vector<VariableIndex> dbc_vars;
330  dbc_vars.push_back(u_var);
331 
332  if( _disp_vars.have_w() )
333  dbc_vars.push_back(w_var);
334 
335  libMesh::ZeroFunction<libMesh::Number> zero;
336 
337  libMesh::DirichletBoundary no_slip_dbc(dbc_ids,
338  dbc_vars,
339  &zero );
340 
341  dof_map.add_dirichlet_boundary( no_slip_dbc );
342  }
343  break;
344 
345  // Roller is free to move in the z-direction, so pin x and y-directions
346  case(ROLLER_Z):
347  {
348  std::set<BoundaryID> dbc_ids;
349  dbc_ids.insert(bc_id);
350 
351  std::vector<VariableIndex> dbc_vars;
352  dbc_vars.push_back(u_var);
353  dbc_vars.push_back(v_var);
354 
355  libMesh::ZeroFunction<libMesh::Number> zero;
356 
357  libMesh::DirichletBoundary no_slip_dbc(dbc_ids,
358  dbc_vars,
359  &zero );
360 
361  dof_map.add_dirichlet_boundary( no_slip_dbc );
362  }
363  break;
364 
365  // Symmetric about YZ-plane so pin x-direction
366  case(SYMMETRY_YZ):
367  {
368  std::set<BoundaryID> dbc_ids;
369  dbc_ids.insert(bc_id);
370 
371  std::vector<VariableIndex> dbc_vars;
372  dbc_vars.push_back(u_var);
373 
374  libMesh::ZeroFunction<libMesh::Number> zero;
375 
376  libMesh::DirichletBoundary no_slip_dbc(dbc_ids,
377  dbc_vars,
378  &zero );
379 
380  dof_map.add_dirichlet_boundary( no_slip_dbc );
381  }
382  break;
383 
384  // Symmetric about XZ-plane so pin y-direction
385  case(SYMMETRY_XZ):
386  {
387  std::set<BoundaryID> dbc_ids;
388  dbc_ids.insert(bc_id);
389 
390  std::vector<VariableIndex> dbc_vars;
391  dbc_vars.push_back(v_var);
392 
393  libMesh::ZeroFunction<libMesh::Number> zero;
394 
395  libMesh::DirichletBoundary no_slip_dbc(dbc_ids,
396  dbc_vars,
397  &zero );
398 
399  dof_map.add_dirichlet_boundary( no_slip_dbc );
400  }
401  break;
402 
403  // Symmetric about XY-plane so pin z-direction
404  case(SYMMETRY_XY):
405  {
406  std::set<BoundaryID> dbc_ids;
407  dbc_ids.insert(bc_id);
408 
409  std::vector<VariableIndex> dbc_vars;
410  dbc_vars.push_back(w_var);
411 
412  libMesh::ZeroFunction<libMesh::Number> zero;
413 
414  libMesh::DirichletBoundary no_slip_dbc(dbc_ids,
415  dbc_vars,
416  &zero );
417 
418  dof_map.add_dirichlet_boundary( no_slip_dbc );
419  }
420  break;
421 
422  default:
423  {
424  std::cerr << "Invalid BCType " << bc_type << std::endl;
425  libmesh_error();
426  }
427 
428  }// end switch
429 
430  return;
431  }
unsigned int VariableIndex
More descriptive name of the type used for variable indices.
Definition: var_typedefs.h:40
const std::string & w_var_name() const
const std::string & v_var_name() const
const std::string & u_var_name() const
libMesh::Real get_dirichlet_bc_value(GRINS::BoundaryID bc_id, int component=0) const

Member Data Documentation

bool GRINS::BCHandlingBase::_axisymmetric = false
staticprotectedinherited

Flag to cache whether or not there is an axisymmetric boundary present.

Definition at line 170 of file bc_handling_base.h.

Referenced by GRINS::BCHandlingBase::is_axisymmetric(), and GRINS::BCHandlingBase::string_to_int().

GRINS::BoundaryConditions GRINS::BCHandlingBase::_bound_conds
protectedinherited

Object that stashes generic boundary condition types.

Todo:
Move this so that only one object is needed. Perhaps make static?

Definition at line 156 of file bc_handling_base.h.

Referenced by GRINS::AxisymmetricHeatTransferBCHandling::user_apply_neumann_bcs(), GRINS::HeatTransferBCHandling::user_apply_neumann_bcs(), and user_apply_neumann_bcs().

std::vector<std::pair<BoundaryID,BCType> > GRINS::BCHandlingBase::_dirichlet_bc_map
protectedinherited

Map between boundary id and Dirichlet boundary condition type.

We need to keep this around because the libMesh::DirichletBoundary objects can't be created until we init the variables. We use a vector of pairs so that the boundary condition functors get added to the libMesh::DofMap in the same order as in the input file.

Definition at line 137 of file bc_handling_base.h.

Referenced by GRINS::BCHandlingBase::get_dirichlet_bc_type(), GRINS::LowMachNavierStokesBCHandling::init_dirichlet_bcs(), GRINS::BCHandlingBase::init_dirichlet_bcs(), and GRINS::BCHandlingBase::set_dirichlet_bc_type().

std::vector< GRINS::DBCContainer > GRINS::BCHandlingBase::_dirichlet_bound_funcs
protectedinherited
std::map< GRINS::BoundaryID, libMesh::Point > GRINS::BCHandlingBase::_dirichlet_values
protectedinherited

Stash prescribed Dirichlet boundary values.

Definition at line 143 of file bc_handling_base.h.

Referenced by GRINS::BCHandlingBase::set_dirichlet_bc_value().

SolidMechanicsVariables GRINS::SolidMechanicsBCHandling::_disp_vars
protected
std::map< GRINS::BoundaryID, GRINS::BCType> GRINS::BCHandlingBase::_neumann_bc_map
protectedinherited

Map between boundary id and Neumann boundary condition type.

Definition at line 140 of file bc_handling_base.h.

Referenced by GRINS::BCHandlingBase::apply_neumann_bcs(), and GRINS::BCHandlingBase::set_neumann_bc_type().

std::map< GRINS::BoundaryID, GRINS::NBCContainer > GRINS::BCHandlingBase::_neumann_bound_funcs
protectedinherited
unsigned int GRINS::BCHandlingBase::_num_periodic_bcs
protectedinherited
std::vector< GRINS::PBCContainer > GRINS::BCHandlingBase::_periodic_bcs
protectedinherited
std::string GRINS::BCHandlingBase::_physics_name
protectedinherited
std::map< GRINS::BoundaryID, libMesh::Point > GRINS::BCHandlingBase::_q_values
protectedinherited

Stash prescribed boundary fluxes.

Definition at line 146 of file bc_handling_base.h.

Referenced by GRINS::BCHandlingBase::get_neumann_bc_value(), and GRINS::BCHandlingBase::set_neumann_bc_value().


The documentation for this class was generated from the following files:

Generated on Mon Jun 22 2015 21:32:24 for GRINS-0.6.0 by  doxygen 1.8.9.1