GRINS-0.8.0
gas_recombination_catalytic_wall_neumann_bc_factory_impl.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2017 Paul T. Bauman, Roy H. Stogner
7 // Copyright (C) 2010-2013 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 // This class
27 
28 // GRINS
29 #include "grins/string_utils.h"
31 
32 #ifdef GRINS_HAVE_CANTERA
33 #include "grins/cantera_mixture.h"
34 #endif
35 
36 #ifdef GRINS_HAVE_ANTIOCH
38 #endif
39 
40 namespace GRINS
41 {
42  // To avoid compiler warnings without GRINS or Cantera
43 #if defined(GRINS_HAVE_ANTIOCH) || defined(GRINS_HAVE_CANTERA)
44  SharedPtr<NeumannBCAbstract>
46  ( const GetPot& input, const std::string& reaction,SharedPtr<CatalycityBase>& gamma_ptr,
47  const std::vector<VariableIndex>& species_vars,const std::string& material,
48  VariableIndex T_var,libMesh::Real p0,const std::string& thermochem_lib )
49 #else
50  SharedPtr<NeumannBCAbstract>
52  ( const GetPot& /*input*/, const std::string& reaction,SharedPtr<CatalycityBase>& /*gamma_ptr*/,
53  const std::vector<VariableIndex>& /*species_vars*/,const std::string& /*material*/,
54  VariableIndex /*T_var*/,libMesh::Real /*p0*/,const std::string& thermochem_lib )
55 #endif
56  {
57  std::string reactant;
58  std::string product;
59  this->parse_reactant_and_product(reaction,reactant,product);
60 
61  // Now construct the Neumann BC
62  SharedPtr<NeumannBCAbstract> catalytic_wall;
63 
64  ChemistryBuilder chem_builder;
65 
66  if( thermochem_lib == "cantera" )
67  {
68 #ifdef GRINS_HAVE_CANTERA
69  libMesh::UniquePtr<CanteraMixture> chem_uptr;
70  chem_builder.build_chemistry(input,material,chem_uptr);
71 
73  SharedPtr<CanteraMixture> chem_ptr(chem_uptr.release());
74 
75  this->build_wall_ptr<CanteraMixture>(chem_ptr,gamma_ptr,reactant,product,
76  species_vars,T_var,p0,catalytic_wall);
77 #else
78  libmesh_error_msg("Error: Cantera not enabled in this configuration. Reconfigure using --with-cantera option.");
79 #endif
80  }
81  else if( thermochem_lib == "antioch" )
82  {
83 #ifdef GRINS_HAVE_ANTIOCH
84  libMesh::UniquePtr<AntiochChemistry> chem_uptr;
85  chem_builder.build_chemistry(input,material,chem_uptr);
86 
88  SharedPtr<AntiochChemistry> chem_ptr(chem_uptr.release());
89 
90  this->build_wall_ptr<AntiochChemistry>(chem_ptr,gamma_ptr,reactant,product,
91  species_vars,T_var,p0,catalytic_wall);
92 #else
93  libmesh_error_msg("Error: Antioch not enabled in this configuration. Reconfigure using --with-antioch option.");
94 #endif
95  }
96  else
97  libmesh_error_msg("ERROR: Invalid thermochemistry library "+thermochem_lib+"!");
98 
99  return catalytic_wall;
100  }
101 
103  std::string& reactant,
104  std::string& product ) const
105  {
106  // Split each reaction into reactants and products
107  std::vector<std::string> partners;
108  StringUtilities::split_string(reaction, "->", partners);
109 
112  if( partners.size() != 2 )
113  libmesh_error_msg("ERROR: Must have only one reactant and one product for GasRecombinationCatalyticWall!");
114 
115  reactant = partners[0];
116  product = partners[1];
117  }
118 
119 } // end namespace GRINS
unsigned int VariableIndex
More descriptive name of the type used for variable indices.
Definition: var_typedefs.h:42
GRINS namespace.
void build_chemistry(const GetPot &input, const std::string &material, libMesh::UniquePtr< ChemistryType > &chem_ptr)
SharedPtr< NeumannBCAbstract > 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)
void split_string(const std::string &input, const std::string &delimiter, std::vector< std::string > &results)
Definition: string_utils.C:31
void parse_reactant_and_product(const std::string &reaction, std::string &reactant, std::string &product) const

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