GRINS-0.7.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 ()
 

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 SpeciesMassFractionsFEVariables &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
 

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 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 93 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().

105  {
106  const unsigned int n_vars = var_names.size();
107 
108  // Parse in all the species mole fracs that are in the input
109  std::vector<libMesh::Number> species_mole_fracs(n_vars);
110  libMesh::Number invalid_num = std::numeric_limits<libMesh::Number>::max();
111 
112  if( input.vector_variable_size(input_string) != n_vars )
113  libmesh_error_msg("ERROR: Expected "+StringUtilities::T_to_string<unsigned int>(n_vars)+" components in "+input_string);
114 
115  for(unsigned int v = 0; v < n_vars; v++ )
116  species_mole_fracs[v] = input(input_string,invalid_num,v);
117 
118  // Make sure mole fracs sum to 1
119  libMesh::Number sum = 0.0;
120  for(unsigned int v = 0; v < n_vars; v++ )
121  sum += species_mole_fracs[v];
122 
123  libMesh::Number tol = std::numeric_limits<libMesh::Number>::epsilon()*10;
124  if( std::abs(sum-1.0) > tol )
125  libmesh_error_msg("ERROR: Mole fractions do not sum to 1! Found sum = "+StringUtilities::T_to_string<libMesh::Number>(sum));
126 
127 
128  // To avoid compiler warnings without GRINS or Cantera
129 #if defined(GRINS_HAVE_ANTIOCH) || defined(GRINS_HAVE_CANTERA)
130  // This only makes sense for SpeciesMassFractionsFEVariables in the
131  // VariableWarehouse. This call will error out if it's not there.
132  const SpeciesMassFractionsFEVariables& species_fe_var =
133  GRINSPrivate::VariableWarehouse::get_variable_subclass<SpeciesMassFractionsFEVariables>
135 #endif
136 
137  std::string thermochem_lib;
140  thermochem_lib );
141 
142  if( thermochem_lib == "cantera" )
143  {
144 #ifdef GRINS_HAVE_CANTERA
145  this->convert_mole_fracs_and_add_to_func<CanteraMixture>(input,
146  species_mole_fracs,
147  species_fe_var,
148  composite_func);
149 #else
150  libmesh_error_msg("Error: Cantera not enabled in this configuration. Reconfigure using --with-cantera option.");
151 #endif
152  }
153  else if( thermochem_lib == "antioch" )
154  {
155 #ifdef GRINS_HAVE_ANTIOCH
156  this->convert_mole_fracs_and_add_to_func<AntiochChemistry>(input,
157  species_mole_fracs,
158  species_fe_var,
159  composite_func);
160 #else
161  libmesh_error_msg("Error: Antioch not enabled in this configuration. Reconfigure using --with-antioch option.");
162 #endif
163  }
164  else
165  libmesh_error_msg("ERROR: Invalid thermochemistry library "+thermochem_lib+"!");
166  }
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 SpeciesMassFractionsFEVariables 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 171 of file prescribed_vector_value_dirichlet_old_style_bc_factory.C.

References GRINS::SpeciesMassFractionsFEVariables::material(), and GRINS::SpeciesMassFractionsFEVariables::species().

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

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

Generated on Thu Jun 2 2016 21:52:32 for GRINS-0.7.0 by  doxygen 1.8.10