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

#include <gas_solid_catalytic_wall_neumann_bc_factory_impl.h>

Public Member Functions

 GasSolidCatalyticWallNeumannBCFactoryImpl ()
 
 ~GasSolidCatalyticWallNeumannBCFactoryImpl ()
 
SharedPtr< NeumannBCAbstractbuild_catalytic_wall (const GetPot &input, const std::string &reaction, SharedPtr< CatalycityBase > &gamma_ptr, const std::vector< VariableIndex > &species_vars, const std::string &material, VariableIndex T_var, libMesh::Real p0, const std::string &thermochem_lib)
 
void parse_reactants_and_product (const std::string &reaction, std::string &gas_reactant, std::string &solid_reactant, std::string &product) const
 

Protected Member Functions

template<typename ChemistryType >
void build_wall_ptr (SharedPtr< ChemistryType > &chem_ptr, SharedPtr< CatalycityBase > &gamma_ptr, const std::string &gas_reactant, const std::string &solid_reactant, const std::string &product, const std::vector< VariableIndex > &species_vars, VariableIndex T_var, libMesh::Real p0, SharedPtr< NeumannBCAbstract > &catalytic_wall)
 

Detailed Description

Definition at line 37 of file gas_solid_catalytic_wall_neumann_bc_factory_impl.h.

Constructor & Destructor Documentation

GRINS::GasSolidCatalyticWallNeumannBCFactoryImpl::GasSolidCatalyticWallNeumannBCFactoryImpl ( )
inline

Definition at line 41 of file gas_solid_catalytic_wall_neumann_bc_factory_impl.h.

41 {}
GRINS::GasSolidCatalyticWallNeumannBCFactoryImpl::~GasSolidCatalyticWallNeumannBCFactoryImpl ( )
inline

Definition at line 43 of file gas_solid_catalytic_wall_neumann_bc_factory_impl.h.

43 {}

Member Function Documentation

SharedPtr< NeumannBCAbstract > GRINS::GasSolidCatalyticWallNeumannBCFactoryImpl::build_catalytic_wall ( const GetPot &  input,
const std::string &  reaction,
SharedPtr< CatalycityBase > &  gamma_ptr,
const std::vector< VariableIndex > &  species_vars,
const std::string &  material,
VariableIndex  T_var,
libMesh::Real  p0,
const std::string &  thermochem_lib 
)
Todo:
Update the API for the catalytic walls to take a unique_ptr to avoid this garbage.
Todo:
Update the API for the catalytic walls to take a unique_ptr to avoid this garbage.

Definition at line 46 of file gas_solid_catalytic_wall_neumann_bc_factory_impl.C.

References GRINS::ChemistryBuilder::build_chemistry().

56  {
57  std::string gas_reactant;
58  std::string solid_reactant;
59  std::string product;
60  this->parse_reactants_and_product(reaction,gas_reactant,solid_reactant,product);
61 
62  // Now construct the Neumann BC
63  SharedPtr<NeumannBCAbstract> catalytic_wall;
64 
65  ChemistryBuilder chem_builder;
66 
67  if( thermochem_lib == "cantera" )
68  {
69 #ifdef GRINS_HAVE_CANTERA
70  libMesh::UniquePtr<CanteraMixture> chem_uptr;
71  chem_builder.build_chemistry(input,material,chem_uptr);
72 
74  SharedPtr<CanteraMixture> chem_ptr(chem_uptr.release());
75 
76  this->build_wall_ptr<CanteraMixture>(chem_ptr,gamma_ptr,gas_reactant,solid_reactant,
77  product,species_vars,T_var,p0,catalytic_wall);
78 #else
79  libmesh_error_msg("Error: Cantera not enabled in this configuration. Reconfigure using --with-cantera option.");
80 #endif
81  }
82  else if( thermochem_lib == "antioch" )
83  {
84 #ifdef GRINS_HAVE_ANTIOCH
85  libMesh::UniquePtr<AntiochChemistry> chem_uptr;
86  chem_builder.build_chemistry(input,material,chem_uptr);
87 
89  SharedPtr<AntiochChemistry> chem_ptr(chem_uptr.release());
90 
91  this->build_wall_ptr<AntiochChemistry>(chem_ptr,gamma_ptr,gas_reactant,solid_reactant,
92  product,species_vars,T_var,p0,catalytic_wall);
93 #else
94  libmesh_error_msg("Error: Antioch not enabled in this configuration. Reconfigure using --with-antioch option.");
95 #endif
96  }
97  else
98  libmesh_error_msg("ERROR: Invalid thermochemistry library "+thermochem_lib+"!");
99 
100  return catalytic_wall;
101  }
void parse_reactants_and_product(const std::string &reaction, std::string &gas_reactant, std::string &solid_reactant, std::string &product) const
template<typename ChemistryType >
void GRINS::GasSolidCatalyticWallNeumannBCFactoryImpl::build_wall_ptr ( SharedPtr< ChemistryType > &  chem_ptr,
SharedPtr< CatalycityBase > &  gamma_ptr,
const std::string &  gas_reactant,
const std::string &  solid_reactant,
const std::string &  product,
const std::vector< VariableIndex > &  species_vars,
VariableIndex  T_var,
libMesh::Real  p0,
SharedPtr< NeumannBCAbstract > &  catalytic_wall 
)
inlineprotected

Definition at line 63 of file gas_solid_catalytic_wall_neumann_bc_factory_impl.h.

72  {
73  catalytic_wall.reset( new GasSolidCatalyticWall<ChemistryType>
74  ( chem_ptr,
75  gamma_ptr,
76  species_vars,
77  T_var,
78  p0,
79  chem_ptr->species_index(gas_reactant),
80  chem_ptr->species_index(solid_reactant),
81  chem_ptr->species_index(product) ) );
82  }
void GRINS::GasSolidCatalyticWallNeumannBCFactoryImpl::parse_reactants_and_product ( const std::string &  reaction,
std::string &  gas_reactant,
std::string &  solid_reactant,
std::string &  product 
) const

Definition at line 103 of file gas_solid_catalytic_wall_neumann_bc_factory_impl.C.

References GRINS::StringUtilities::split_string().

Referenced by GRINS::GasSolidCatalyticWallNeumannBCOldStyleFactory::reactant_for_catalycity().

107  {
108  /* We are expecting reactions of the form
109  X+Y(s)->Z or
110  Y(s)+X->X
111  So, first we'll split on the "->", then split the reactants up and
112  figure out which is the gas species and which is the solid species. */
113  std::vector<std::string> partners;
114  StringUtilities::split_string(reaction, "->", partners);
115 
116  const std::string pre_split_reactants = partners[0];
117  product = partners[1];
118 
119  std::vector<std::string> split_reactants;
120  StringUtilities::split_string(pre_split_reactants, "+", split_reactants);
121 
122  // We can only handle two reactants currently
123  if( split_reactants.size() != 2 )
124  {
125  std::string error_msg = "ERROR: Currently, GasSolidCatalyticWall boundary condition only supports\n";
126  error_msg += " reactions of the form X+Y(s)->Z or Y(s)+X->X. Found ";
127  error_msg += StringUtilities::T_to_string<unsigned int>(split_reactants.size())+" reactants.\n";
128  libmesh_error_msg(error_msg);
129  }
130 
131 
132  // Check if the first reactant is the solid one
133  if( split_reactants[0].find("(s)") == split_reactants[0].npos )
134  {
135  // If not found, check the second reactant and error out if not found.
136  if( split_reactants[1].find("(s)") == split_reactants[1].npos )
137  {
138  std::string error_msg = "ERROR: could not find solid reactant for GasSolidCatalyticWall!\n";
139  error_msg += " Found reactants "+split_reactants[0]+", "+split_reactants[1]+"\n";
140  libmesh_error_msg(error_msg);
141  }
142  else
143  {
144  gas_reactant = split_reactants[0];
145  solid_reactant = split_reactants[1].substr(0,split_reactants[1].find("(s)"));
146  }
147  }
148  // Found (s) in the first reactant
149  else
150  {
151  // Check that there's not 2 solid reactants
152  if( split_reactants[1].find("(s)") != split_reactants[1].npos )
153  {
154  std::string error_msg = "ERROR: can have only one solid reactant for GasSolidCatalyticWall!\n";
155  error_msg += " Found reactants "+split_reactants[0]+", "+split_reactants[1]+"\n";
156  libmesh_error_msg(error_msg);
157  }
158 
159  gas_reactant = split_reactants[1];
160  solid_reactant = split_reactants[0].substr(0,split_reactants[0].find("(s)"));
161  }
162  }
void split_string(const std::string &input, const std::string &delimiter, std::vector< std::string > &results)
Definition: string_utils.C:31

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

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