GRINS-0.7.0
catalytic_wall_neumann_bc_old_style_factory_base.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2016 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
32 #include "grins/string_utils.h"
34 
35 namespace GRINS
36 {
37  template<typename ImplType>
38  SharedPtr<NeumannBCAbstract>
40  MultiphysicsSystem& /*system*/,
41  const FEVariablesBase& fe_var,
42  const std::string& section )
43  {
44  std::string reaction = this->parse_reaction(input,section);
45 
46  // Parse and construct the corresponding catalycity
47  SharedPtr<CatalycityBase> gamma_ptr = this->build_catalycity( input, section,
48  this->reactant_for_catalycity(reaction) );
49 
50  std::string material;
51  this->extract_material( fe_var, material );
52 
53  // Parse thermodynamic pressure
55  libMesh::Real p0 = this->parse_thermo_pressure(input,material);
56 
57  std::string thermochem_lib = this->parse_thermochem_model(input);
58 
59  return this->build_catalytic_wall_common(input,fe_var,material,reaction,gamma_ptr,p0,thermochem_lib);
60  }
61 
62  template<typename ImplType>
64  const std::string& section ) const
65  {
66  libmesh_assert_equal_to(NeumannBCFactoryAbstract::_bc_ids->size(), 1 );
67 
68  std::string bc_id_string = StringUtilities::T_to_string<BoundaryID>( *(_bc_ids->begin()) );
69 
70  std::string prefix_str = this->catalytic_wall_prefix_str();
71 
72  std::string reaction_input_str = section+"/"+prefix_str+"_"+bc_id_string;
73 
74  // First make sure the input reaction is there
75  if(!input.have_variable(reaction_input_str))
76  libmesh_error_msg("ERROR: Could not find input for "+reaction_input_str+" !\n");
77 
78  // Make sure there's only one
79  if( input.vector_variable_size(reaction_input_str) != 1 )
80  libmesh_error_msg("ERROR: Can only specify one catalytic_reaction!\n");
81 
82  return input( reaction_input_str, std::string("DIE!") );
83  }
84 
85  template<typename ImplType>
87  const std::string& material ) const
88  {
89  std::string thermo_press_input_str =
90  "Materials/"+material+"/ThermodynamicPressure/value";
91 
92  std::string thermo_press_input_str_old_style =
94 
95  if( input.have_variable(thermo_press_input_str) && input.have_variable(thermo_press_input_str_old_style) )
96  libmesh_error_msg("ERROR: Cannot specify both "+thermo_press_input_str+" and "+thermo_press_input_str_old_style);
97 
98  libMesh::Real invalid_real = std::numeric_limits<libMesh::Real>::max();
99  libMesh::Real p0 = invalid_real;
100 
101  if( input.have_variable(thermo_press_input_str) )
102  p0 = input(thermo_press_input_str,invalid_real);
103 
104  else if( input.have_variable(thermo_press_input_str_old_style) )
105  p0 = input(thermo_press_input_str_old_style,invalid_real);
106 
107  else
108  libmesh_error_msg("ERROR: Could not valid input for thermodynamic pressure!");
109 
110  return p0;
111  }
112 
113  template<typename ImplType>
115  {
116  std::string thermochem_lib;
119  thermochem_lib );
120 
121  return thermochem_lib;
122  }
123 
124  template<typename ImplType>
125  SharedPtr<CatalycityBase>
127  const std::string& section,
128  const std::string& reactant ) const
129  {
130  libmesh_assert_equal_to(NeumannBCFactoryAbstract::_bc_ids->size(), 1 );
131  std::string bc_id_str = StringUtilities::T_to_string<BoundaryID>( *(_bc_ids->begin()) );
132 
137 
138  std::string catalycity_input_str = section+"/gamma_"+reactant+"_"+bc_id_str+"_type";
139  if( !input.have_variable(catalycity_input_str) )
140  libmesh_error_msg("ERROR: Could not find input variable "+catalycity_input_str+" !\n");
141 
142  std::string catalycity_type = input(catalycity_input_str, "none");
143  catalycity_type += "_old_style";
144 
145  libMesh::UniquePtr<CatalycityBase> catalycity_ptr = CatalycityFactoryOldStyleBase::build(catalycity_type);
146 
147  // We need to return a SharedPtr
148  return SharedPtr<CatalycityBase>( catalycity_ptr.release() );
149  }
150 
153 
154 } // end namespace GRINS
libMesh::Real parse_thermo_pressure(const GetPot &input, const std::string &material) const
static void parse_thermochemistry_model(const GetPot &input, const std::string &physics, std::string &model)
Determine thermochemistry model type.
static void set_reactant(const std::string &reactant)
static PhysicsName reacting_low_mach_navier_stokes()
static void set_bc_id(const std::string &bc_id)
virtual SharedPtr< NeumannBCAbstract > build_neumann_func(const GetPot &input, MultiphysicsSystem &system, const FEVariablesBase &fe_var, const std::string &section)
Builds the NeumannBCAbstract object for Neumann boundary conditions.
static void set_getpot(const GetPot &input)
static void set_section(const std::string &section)
static const std::set< BoundaryID > * _bc_ids
BoundaryID for constructing a particular boundary condition.
SharedPtr< CatalycityBase > build_catalycity(const GetPot &input, const std::string &section, const std::string &reactant) const
GRINS namespace.
std::string parse_reaction(const GetPot &input, const std::string &section) const
Parse the reaction.
Interface with libMesh for solving Multiphysics problems.

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