GRINS-0.8.0
List of all members | Public Member Functions | Protected Member Functions
GRINS::PrescribedMoleFractionsDirichletOldStyleBCFactory Class Reference

#include <prescribed_vector_value_dirichlet_old_style_bc_factory.h>

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

Public Member Functions

 PrescribedMoleFractionsDirichletOldStyleBCFactory (const std::string &bc_type_name)
 
- Public Member Functions inherited from GRINS::PrescribedSpeciesDirichletOldStyleBCFactory
 PrescribedSpeciesDirichletOldStyleBCFactory (const std::string &bc_type_name)
 
- Public Member Functions inherited from GRINS::PrescribedVectorValueDirichletOldStyleBCFactory
 PrescribedVectorValueDirichletOldStyleBCFactory (const std::string &bc_type_name)
 
 ~PrescribedVectorValueDirichletOldStyleBCFactory ()
 
- Public Member Functions inherited from GRINS::DirichletBCFactoryFunctionOldStyleBase< libMesh::FunctionBase< libMesh::Number > >
 DirichletBCFactoryFunctionOldStyleBase (const std::string &bc_type_name)
 
 ~DirichletBCFactoryFunctionOldStyleBase ()
 
- Public Member Functions inherited from GRINS::DirichletBCFactoryFunctionBase< libMesh::FunctionBase< libMesh::Number > >
 DirichletBCFactoryFunctionBase (const std::string &bc_type_name)
 
 ~DirichletBCFactoryFunctionBase ()
 
- Public Member Functions inherited from GRINS::DirichletBCFactoryAbstract
 DirichletBCFactoryAbstract (const std::string &bc_type_name)
 
 ~DirichletBCFactoryAbstract ()
 
- Public Member Functions inherited from GRINS::BCFactoryAbstract< libMesh::DirichletBoundary >
 BCFactoryAbstract (const std::string &bc_type_name)
 
 ~BCFactoryAbstract ()
 
- Public Member Functions inherited from GRINS::FactoryWithGetPot< libMesh::DirichletBoundary >
 FactoryWithGetPot (const std::string &name)
 
 ~FactoryWithGetPot ()
 
- Public Member Functions inherited from GRINS::FactoryAbstract< libMesh::DirichletBoundary >
virtual ~FactoryAbstract ()
 

Protected Member Functions

virtual void add_funcs (const GetPot &input, MultiphysicsSystem &system, const std::string &input_string, const std::vector< std::string > &var_names, libMesh::CompositeFunction< libMesh::Number > &composite_func) const
 
template<typename ChemistryType >
void convert_mole_fracs_and_add_to_func (const GetPot &input, const std::vector< libMesh::Number > &species_mole_fracs, const SpeciesMassFractionsVariable &species_fe_var, libMesh::CompositeFunction< libMesh::Number > &composite_func) const
 
- Protected Member Functions inherited from GRINS::PrescribedSpeciesDirichletOldStyleBCFactory
virtual std::string var_input_string ()
 
- Protected Member Functions inherited from GRINS::PrescribedVectorValueDirichletOldStyleBCFactory
virtual libMesh::UniquePtr< libMesh::FunctionBase< libMesh::Number > > build_func (const GetPot &input, MultiphysicsSystem &system, std::vector< std::string > &var_names, const std::string &section)
 Builds the FunctionBase object for boundary condition. More...
 
- Protected Member Functions inherited from GRINS::DirichletBCFactoryFunctionOldStyleBase< libMesh::FunctionBase< libMesh::Number > >
virtual void check_state () const
 Helper function. More...
 
virtual void reset_state ()
 Helper function. More...
 
virtual const std::vector< std::string > & get_var_names () const
 Helper function that can be overridded in subclasses. More...
 
- Protected Member Functions inherited from GRINS::DirichletBCFactoryFunctionBase< libMesh::FunctionBase< libMesh::Number > >
libMesh::UniquePtr< libMesh::DirichletBoundary > make_dirichlet_boundary (const std::set< BoundaryID > &bc_ids, const libMesh::System &system, libMesh::UniquePtr< libMesh::FunctionBase< libMesh::Number > > &func, const std::vector< VariableIndex > &var_indices)
 Dispatch, based on FunctionType, to the correct DirchletBoundary construction. More...
 
- Protected Member Functions inherited from GRINS::DirichletBCFactoryAbstract
void check_for_vars (const GetPot &input, const std::string &section, const std::vector< std::string > &var_names, std::set< std::string > *vars_found=NULL)
 Helper function. More...
 
- Protected Member Functions inherited from GRINS::BCFactoryAbstract< libMesh::DirichletBoundary >
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
 
- Protected Member Functions inherited from GRINS::FactoryAbstract< libMesh::DirichletBoundary >
 FactoryAbstract (const std::string &name)
 Constructor is protected. Use the build() method to construct Base objects. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GRINS::DirichletBCFactoryFunctionOldStyleBase< libMesh::FunctionBase< libMesh::Number > >
static void set_value_var_old_style (const std::string &value_var)
 Input variable for parsing old style. More...
 
static void set_value_index_old_style (unsigned int idx)
 Input variable index for parsing old style. More...
 
static void set_var_names_old_style (const std::vector< std::string > &var_names)
 
- Static Public Member Functions inherited from GRINS::BCFactoryAbstract< libMesh::DirichletBoundary >
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< libMesh::DirichletBoundary >
static void set_getpot (const GetPot &input)
 
- Static Public Member Functions inherited from GRINS::FactoryAbstract< libMesh::DirichletBoundary >
static libMesh::UniquePtr< libMesh::DirichletBoundary > build (const std::string &name)
 Use this method to build objects of type Base. More...
 
- Static Protected Member Functions inherited from GRINS::FactoryAbstract< libMesh::DirichletBoundary >
static FactoryAbstract< libMesh::DirichletBoundary > & 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< libMesh::DirichletBoundary > * > & factory_map ()
 
- Static Protected Attributes inherited from GRINS::DirichletBCFactoryFunctionOldStyleBase< libMesh::FunctionBase< libMesh::Number > >
static std::string _value_var_old_style
 
static unsigned int _value_idx_old_style
 
static const std::vector< std::string > * _var_names_old_style
 
- Static Protected Attributes inherited from GRINS::BCFactoryAbstract< libMesh::DirichletBoundary >
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< libMesh::DirichletBoundary >
static const GetPot * _input
 We store only a raw pointer here because we can't make a copy. More...
 

Detailed Description

Definition at line 109 of file prescribed_vector_value_dirichlet_old_style_bc_factory.h.

Constructor & Destructor Documentation

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

Member Function Documentation

void GRINS::PrescribedMoleFractionsDirichletOldStyleBCFactory::add_funcs ( const GetPot &  input,
MultiphysicsSystem system,
const std::string &  input_string,
const std::vector< std::string > &  var_names,
libMesh::CompositeFunction< libMesh::Number > &  composite_func 
) const
protectedvirtual

Reimplemented from GRINS::PrescribedVectorValueDirichletOldStyleBCFactory.

Definition at line 94 of file prescribed_vector_value_dirichlet_old_style_bc_factory.C.

References GRINS::PhysicsFactoryHelper::parse_thermochemistry_model(), GRINS::PhysicsNaming::reacting_low_mach_navier_stokes(), and GRINS::VariablesParsing::species_mass_fractions_section().

106  {
107  const unsigned int n_vars = var_names.size();
108 
109  // Parse in all the species mole fracs that are in the input
110  std::vector<libMesh::Number> species_mole_fracs(n_vars);
111  libMesh::Number invalid_num = std::numeric_limits<libMesh::Number>::max();
112 
113  if( input.vector_variable_size(input_string) != n_vars )
114  libmesh_error_msg("ERROR: Expected "+StringUtilities::T_to_string<unsigned int>(n_vars)+" components in "+input_string);
115 
116  for(unsigned int v = 0; v < n_vars; v++ )
117  species_mole_fracs[v] = input(input_string,invalid_num,v);
118 
119  // Make sure mole fracs sum to 1
120  libMesh::Number sum = 0.0;
121  for(unsigned int v = 0; v < n_vars; v++ )
122  sum += species_mole_fracs[v];
123 
124  libMesh::Number tol = std::numeric_limits<libMesh::Number>::epsilon()*10;
125  if( std::abs(sum-1.0) > tol )
126  libmesh_error_msg("ERROR: Mole fractions do not sum to 1! Found sum = "+StringUtilities::T_to_string<libMesh::Number>(sum));
127 
128 
129  // To avoid compiler warnings without GRINS or Cantera
130 #if defined(GRINS_HAVE_ANTIOCH) || defined(GRINS_HAVE_CANTERA)
131  // This only makes sense for SpeciesMassFractionsVariable in the
132  // VariableWarehouse. This call will error out if it's not there.
133  const SpeciesMassFractionsVariable& species_fe_var =
134  GRINSPrivate::VariableWarehouse::get_variable_subclass<SpeciesMassFractionsVariable>
136 #endif
137 
138  std::string thermochem_lib;
141  thermochem_lib );
142 
143  if( thermochem_lib == "cantera" )
144  {
145 #ifdef GRINS_HAVE_CANTERA
146  this->convert_mole_fracs_and_add_to_func<CanteraMixture>(input,
147  species_mole_fracs,
148  species_fe_var,
149  composite_func);
150 #else
151  libmesh_error_msg("Error: Cantera not enabled in this configuration. Reconfigure using --with-cantera option.");
152 #endif
153  }
154  else if( thermochem_lib == "antioch" )
155  {
156 #ifdef GRINS_HAVE_ANTIOCH
157  this->convert_mole_fracs_and_add_to_func<AntiochChemistry>(input,
158  species_mole_fracs,
159  species_fe_var,
160  composite_func);
161 #else
162  libmesh_error_msg("Error: Antioch not enabled in this configuration. Reconfigure using --with-antioch option.");
163 #endif
164  }
165  else
166  libmesh_error_msg("ERROR: Invalid thermochemistry library "+thermochem_lib+"!");
167  }
static void parse_thermochemistry_model(const GetPot &input, const std::string &physics, std::string &model)
Determine thermochemistry model type.
static PhysicsName reacting_low_mach_navier_stokes()
static std::string species_mass_fractions_section()
template<typename ChemistryType >
template void GRINS::PrescribedMoleFractionsDirichletOldStyleBCFactory::convert_mole_fracs_and_add_to_func< AntiochChemistry > ( const GetPot &  input,
const std::vector< libMesh::Number > &  species_mole_fracs,
const SpeciesMassFractionsVariable species_fe_var,
libMesh::CompositeFunction< libMesh::Number > &  composite_func 
) const
protected
Todo:
We should have a ChemsitryWarehouse or something to just grab this from one place instead of rebuilding.

Definition at line 172 of file prescribed_vector_value_dirichlet_old_style_bc_factory.C.

References GRINS::ChemistryBuilder::build_chemistry(), GRINS::SpeciesMassFractionsVariable::material(), and GRINS::SpeciesMassFractionsVariable::species().

175  {
176  const std::string& material = species_fe_var.material();
177 
180  ChemistryBuilder chem_builder;
181  libMesh::UniquePtr<ChemistryType> chem_ptr;
182  chem_builder.build_chemistry(input,material,chem_ptr);
183 
184  const ChemistryType & chem = *chem_ptr;
185 
186  const unsigned int n_vars = species_mole_fracs.size();
187  // Compute M
188  libMesh::Real M = 0.0;
189  for( unsigned int s = 0; s < n_vars; s++ )
190  M += species_mole_fracs[s]*chem.M(s);
191 
192  // Convert mole fractions to mass fractions and add to function
193  for( unsigned int s = 0; s < n_vars; s++ )
194  {
195  libMesh::Number species_mass_fracs =species_mole_fracs[s]*chem.M(s)/M;
196 
197  std::vector<VariableIndex> var_idx(1,species_fe_var.species(s));
198 
199  libMesh::ConstFunction<libMesh::Number> const_func(species_mass_fracs);
200  composite_func.attach_subfunction(const_func,var_idx);
201  }
202  }

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