GRINS-0.8.0
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
GRINS::NeumannBCFactoryAbstract Class Referenceabstract

#include <neumann_bc_factory_abstract.h>

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

Public Member Functions

 NeumannBCFactoryAbstract (const std::string &bc_type_name)
 
 ~NeumannBCFactoryAbstract ()
 
virtual libMesh::UniquePtr< NeumannBCContainercreate ()
 Creates NeumannBCContainer for this Factory object. More...
 
- Public Member Functions inherited from GRINS::BCFactoryAbstract< NeumannBCContainer >
 BCFactoryAbstract (const std::string &bc_type_name)
 
 ~BCFactoryAbstract ()
 
- Public Member Functions inherited from GRINS::FactoryWithGetPot< NeumannBCContainer >
 FactoryWithGetPot (const std::string &name)
 
 ~FactoryWithGetPot ()
 
- Public Member Functions inherited from GRINS::FactoryAbstract< NeumannBCContainer >
virtual ~FactoryAbstract ()
 

Protected Member Functions

virtual SharedPtr< NeumannBCAbstractbuild_neumann_func (const GetPot &input, MultiphysicsSystem &system, const FEVariablesBase &fe_var, const std::string &section)=0
 Builds the NeumannBCAbstract object for Neumann boundary conditions. More...
 
void check_for_flux (const GetPot &input, const std::string &section, const std::vector< std::string > &var_names)
 Checks that the flux variable has been set. More...
 
- Protected Member Functions inherited from GRINS::BCFactoryAbstract< NeumannBCContainer >
void check_for_multiple_expressions (const GetPot &input, const std::string &section, const std::string &var_name) const
 Ensure that there is only one expression for the [Section/var_name] variable. More...
 
void build_var_indices (const MultiphysicsSystem &system, const std::vector< std::string > &var_names, std::vector< VariableIndex > &var_indices) const
 
virtual void check_state () const
 Helper function to reduce code duplication. More...
 
virtual void reset_state ()
 Helper function to redue code duplication. More...
 
- Protected Member Functions inherited from GRINS::FactoryAbstract< NeumannBCContainer >
 FactoryAbstract (const std::string &name)
 Constructor is protected. Use the build() method to construct Base objects. More...
 

Protected Attributes

bool _is_homogeneous
 Track if this is a homogeneous Neumann boundary condition. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GRINS::BCFactoryAbstract< NeumannBCContainer >
static void set_system (MultiphysicsSystem &system)
 
static void set_bc_ids (const std::set< BoundaryID > &bc_ids)
 Boundary id for the current boundary condition section. More...
 
static void set_fe_var (const FEVariablesBase &fe_var)
 Active variable for the current boundary condition. More...
 
static void set_section (const std::string &section)
 Sets the current section of the input file. More...
 
static bool have_bc_type (const std::string &bc_type)
 
- Static Public Member Functions inherited from GRINS::FactoryWithGetPot< NeumannBCContainer >
static void set_getpot (const GetPot &input)
 
- Static Public Member Functions inherited from GRINS::FactoryAbstract< NeumannBCContainer >
static libMesh::UniquePtr< NeumannBCContainerbuild (const std::string &name)
 Use this method to build objects of type Base. More...
 
- Static Protected Member Functions inherited from GRINS::FactoryAbstract< NeumannBCContainer >
static FactoryAbstract< NeumannBCContainer > & get_factory (const std::string &name)
 Helper method that looks up the factory and returns it if present, or error if it's not. More...
 
static DerivedType & get_factory_subclass (const std::string &name)
 Like get_factory, but will downcast to DerivedType. More...
 
static std::map< std::string, FactoryAbstract< NeumannBCContainer > * > & factory_map ()
 
- Static Protected Attributes inherited from GRINS::BCFactoryAbstract< NeumannBCContainer >
static MultiphysicsSystem_system
 We store only a raw pointer here because we can't make a copy. More...
 
static const std::set< BoundaryID > * _bc_ids
 BoundaryID for constructing a particular boundary condition. More...
 
static const FEVariablesBase_fe_var
 The FEVariablesBase class associated with the boundary condition being built. More...
 
static std::string _section
 
- Static Protected Attributes inherited from GRINS::FactoryWithGetPot< NeumannBCContainer >
static const GetPot * _input
 We store only a raw pointer here because we can't make a copy. More...
 

Detailed Description

Definition at line 42 of file neumann_bc_factory_abstract.h.

Constructor & Destructor Documentation

GRINS::NeumannBCFactoryAbstract::NeumannBCFactoryAbstract ( const std::string &  bc_type_name)
inline

Definition at line 45 of file neumann_bc_factory_abstract.h.

46  : BCFactoryAbstract<NeumannBCContainer>(bc_type_name),
47  _is_homogeneous(false)
48  {}
bool _is_homogeneous
Track if this is a homogeneous Neumann boundary condition.
GRINS::NeumannBCFactoryAbstract::~NeumannBCFactoryAbstract ( )
inline

Definition at line 50 of file neumann_bc_factory_abstract.h.

50 {};

Member Function Documentation

virtual SharedPtr<NeumannBCAbstract> GRINS::NeumannBCFactoryAbstract::build_neumann_func ( const GetPot &  input,
MultiphysicsSystem system,
const FEVariablesBase fe_var,
const std::string &  section 
)
protectedpure virtual

Builds the NeumannBCAbstract object for Neumann boundary conditions.

Subclasses should override this function to build the NeumannBCAbstract object that corresponds to the variables passed in var_names. The FEVariableBase object corresponds to the variable associated with this boundary condition, e.g. Velocity. The section arguments corresponds to the section to parse for the flux in the input file, e.g. input(section+"/"+flux). Note that for Variables with more than one component, the flux input should be a vector the size of the var_names object, even if one of the components is zero.

Implemented in GRINS::HomogeneousNeumannBCFactory, GRINS::ParsedFunctionNeumannOldStyleBCFactory< FunctionType >, GRINS::CatalyticWallNeumannBCFactoryBase< ImplType >, GRINS::CatalyticWallNeumannBCOldStyleFactoryBase< ImplType >, GRINS::ParsedFunctionNeumannBCFactory< FunctionType >, GRINS::CatalyticWallNeumannBCFactoryBase< GasSolidCatalyticWallNeumannBCFactoryImpl >, GRINS::CatalyticWallNeumannBCFactoryBase< GasRecombinationCatalyticWallNeumannBCFactoryImpl >, GRINS::CatalyticWallNeumannBCOldStyleFactoryBase< GasSolidCatalyticWallNeumannBCFactoryImpl >, and GRINS::CatalyticWallNeumannBCOldStyleFactoryBase< GasRecombinationCatalyticWallNeumannBCFactoryImpl >.

Referenced by create().

void GRINS::NeumannBCFactoryAbstract::check_for_flux ( const GetPot &  input,
const std::string &  section,
const std::vector< std::string > &  var_names 
)
protected

Checks that the flux variable has been set.

Check for both the presence of [section/flux] and that the size is the same as var_names. For example, if we are setting a traction vector for Displacement variables, then the input flux vector (traction) should have the name number of components as var_names.

Definition at line 58 of file neumann_bc_factory_abstract.C.

Referenced by GRINS::ParsedFunctionNeumannBCFactory< FunctionType >::build_neumann_func().

60  {
61  if( !input.have_variable(flux_input) )
62  libmesh_error_msg("ERROR: Could not find input specification for "+flux_input+"!");
63 
64  unsigned int flux_size = input.vector_variable_size(flux_input);
65  if( flux_size != var_names.size() )
66  {
67  std::string error_msg = "ERROR: Mismatch in size between flux input and variables size!\n";
68  error_msg += " Found flux size = "+StringUtilities::T_to_string<unsigned int>(flux_size)+"\n";
69  error_msg += " Found variables size = "+StringUtilities::T_to_string<unsigned int>(var_names.size())+"\n";
70  libmesh_error_msg(error_msg);
71  }
72  }
libMesh::UniquePtr< NeumannBCContainer > GRINS::NeumannBCFactoryAbstract::create ( )
virtual

Creates NeumannBCContainer for this Factory object.

This method will handle the creation and population of all aspects of the NeumannBCContainer except the function object that is used to evaluate the flux, the NeumannBCAbstract object. The construction of NeumannBCAbstract subclasses is deferred to subclasses of this factory and should be implemented in the build_neumann_func method.

Note that an empty libMesh::UniquePtr<NeumannBCContainer> may be returned from create() if the parsed boundary condition type is a homogeneous one. This is allowed since we force the user to specify boundary conditions for every Variable, for every boundary in the hopes of reducing input file errors at runtime.

Implements GRINS::FactoryAbstract< NeumannBCContainer >.

Definition at line 33 of file neumann_bc_factory_abstract.C.

References GRINS::BCFactoryAbstract< NeumannBCContainer >::_bc_ids, GRINS::BCFactoryAbstract< NeumannBCContainer >::_fe_var, GRINS::FactoryWithGetPot< NeumannBCContainer >::_input, _is_homogeneous, GRINS::BCFactoryAbstract< NeumannBCContainer >::_section, GRINS::BCFactoryAbstract< NeumannBCContainer >::_system, build_neumann_func(), GRINS::BCFactoryAbstract< NeumannBCContainer >::check_state(), and GRINS::BCFactoryAbstract< NeumannBCContainer >::reset_state().

34  {
35  libMesh::UniquePtr<NeumannBCContainer> container;
36 
37  // Only build the container if the Neumann BC is *not* homogeneous
38  // Otherwise, we just return and empty (NULL) UniquePtr.
39  if(!_is_homogeneous)
40  {
41  // Make sure all necessary state has been setup
42  this->check_state();
43 
44  SharedPtr<NeumannBCAbstract>
45  func = this->build_neumann_func( *_input, *_system, *_fe_var, this->_section );
46 
47  libmesh_assert(func);
48 
49  container.reset(new NeumannBCContainer(*_bc_ids,*_fe_var,func));
50 
51  // Reset state for error checking during next construction
52  this->reset_state();
53  }
54 
55  return container;
56  }
virtual void reset_state()
Helper function to redue code duplication.
static const std::set< BoundaryID > * _bc_ids
BoundaryID for constructing a particular boundary condition.
bool _is_homogeneous
Track if this is a homogeneous Neumann boundary condition.
static const GetPot * _input
We store only a raw pointer here because we can't make a copy.
virtual SharedPtr< NeumannBCAbstract > build_neumann_func(const GetPot &input, MultiphysicsSystem &system, const FEVariablesBase &fe_var, const std::string &section)=0
Builds the NeumannBCAbstract object for Neumann boundary conditions.
virtual void check_state() const
Helper function to reduce code duplication.
static MultiphysicsSystem * _system
We store only a raw pointer here because we can't make a copy.
static const FEVariablesBase * _fe_var
The FEVariablesBase class associated with the boundary condition being built.

Member Data Documentation

bool GRINS::NeumannBCFactoryAbstract::_is_homogeneous
protected

Track if this is a homogeneous Neumann boundary condition.

If so, then we literally do nothing: don't create a NeumannBCAbstract object, don't create a NeumannBCContainer, etc. Default is false, so subclasses have to opt-in appropriately.

Definition at line 74 of file neumann_bc_factory_abstract.h.

Referenced by create(), and GRINS::HomogeneousNeumannBCFactory::HomogeneousNeumannBCFactory().


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

Generated on Tue Dec 19 2017 12:47:31 for GRINS-0.8.0 by  doxygen 1.8.9.1