GRINS-0.8.0
physics_factory_reacting_flows.C
Go to the documentation of this file.
1 // This class
3 
4 // GRINS
8 
9 // Antioch
10 #ifdef GRINS_HAVE_ANTIOCH
11 #include "antioch_config.h"
12 #include "antioch/sutherland_viscosity.h"
13 #include "antioch/blottner_viscosity.h"
14 #include "antioch/sutherland_parsing.h"
15 #include "antioch/blottner_parsing.h"
16 #include "antioch/eucken_thermal_conductivity.h"
17 #include "antioch/constant_lewis_diffusivity.h"
18 #endif // GRINS_HAVE_ANTIOCH
19 
20 // Physics whose factories we're instantiating
23 
24 namespace GRINS
25 {
26  template<template<typename,typename> class DerivedPhysics>
27  libMesh::UniquePtr<Physics> PhysicsFactoryReactingFlows<DerivedPhysics>::build_physics( const GetPot& input,
28  const std::string& physics_name )
29  {
30  std::string core_physics = this->find_core_physics_name(physics_name);
31 
32  std::string material = MaterialsParsing::material_name(input,core_physics);
33 
34  std::string thermochem_lib;
36  core_physics,
37  thermochem_lib );
38 
39  libMesh::UniquePtr<Physics> new_physics;
40 
41  if( thermochem_lib == "cantera" )
42  {
43 #ifdef GRINS_HAVE_CANTERA
44  libMesh::UniquePtr<CanteraMixture> gas_mix( new CanteraMixture(input,material) );
45 
46  new_physics.reset(new DerivedPhysics<CanteraMixture,CanteraEvaluator>(physics_name,input,gas_mix));
47 #else
48  libmesh_error_msg("Error: Cantera not enabled in this configuration. Reconfigure using --with-cantera option.");
49 
50 #endif // GRINS_HAVE_CANTERA
51  }
52 
53  else if( thermochem_lib == "antioch" )
54  {
55 #ifdef GRINS_HAVE_ANTIOCH
56 
57  std::string transport_model;
58  std::string thermo_model;
59  std::string viscosity_model;
60  std::string conductivity_model;
61  std::string diffusivity_model;
62 
64  core_physics,
65  transport_model,
66  thermo_model,
67  viscosity_model,
68  conductivity_model,
69  diffusivity_model );
70 
71  if( transport_model == AntiochOptions::mix_avged_transport_model() )
72  {
73  this->build_mix_avged_physics( input, physics_name, material, thermo_model, diffusivity_model,
74  conductivity_model, viscosity_model, new_physics );
75  }
76 
77  else if( transport_model == AntiochOptions::constant_transport_model() )
78  {
79  this->build_const_physics( input, physics_name, material, thermo_model, diffusivity_model,
80  conductivity_model, viscosity_model, new_physics );
81  }
82  else // transport_model
83  {
84  std::string error = "Error: Unknown Antioch transport_model "+transport_model+"!\n";
85  error += " Valid values are: "+AntiochOptions::constant_transport_model()+"\n";
87 
88  libmesh_error_msg(error);
89  }
90 #else
91  libmesh_error_msg("Error: Antioch not enabled in this configuration. Reconfigure using --with-antioch option.");
92 
93 #endif // GRINS_HAVE_ANTIOCH
94  }
95 
96  else
97  {
98  std::string error = "Error: Invalid thermo-chemistry library"+thermochem_lib+"!\n";
99  error += " Valid values are: antioch\n";
100  error += " cantera\n";
101 
102  libmesh_error_msg(error);
103  }
104 
105  libmesh_assert(new_physics);
106 
107  return new_physics;
108  }
109 
110 
111 
112 #ifdef GRINS_HAVE_ANTIOCH
113  template<template<typename,typename> class DerivedPhysics>
115  build_mix_avged_physics( const GetPot & input, const std::string & physics_name, const std::string & material,
116  const std::string & thermo_model, const std::string & diffusivity_model,
117  const std::string & conductivity_model, const std::string & viscosity_model,
118  libMesh::UniquePtr<Physics> & new_physics )
119  {
120  if( (thermo_model == AntiochOptions::stat_mech_thermo_model()) )
121  {
122  this->build_mix_avged_physics_with_thermo<Antioch::CEACurveFit<libMesh::Real>,
123  Antioch::StatMechThermodynamics<libMesh::Real> >
124  (input,physics_name,material,diffusivity_model,
125  conductivity_model,viscosity_model,
126  new_physics);
127  }
128  else if( (thermo_model == AntiochOptions::cea_nasa_model()) )
129  {
130  this->build_mix_avged_physics_with_thermo<Antioch::CEACurveFit<libMesh::Real>,
131  Antioch::IdealGasMicroThermo<Antioch::NASAEvaluator<libMesh::Real, Antioch::CEACurveFit<libMesh::Real> >, libMesh::Real> >
132  (input,physics_name,material,diffusivity_model,
133  conductivity_model,viscosity_model,
134  new_physics);
135  }
136  else
137  {
138  std::string error = "Error: Unknown Antioch thermo model "+thermo_model+"\n";
139  error += " Valid values are: "+AntiochOptions::stat_mech_thermo_model()+"\n";
140  error += " Valid values are: "+AntiochOptions::cea_nasa_model()+"\n";
141  }
142  }
143 
144  template<template<typename,typename> class DerivedPhysics>
146  build_const_physics( const GetPot & input, const std::string & physics_name, const std::string & material,
147  const std::string & thermo_model, const std::string & diffusivity_model,
148  const std::string & conductivity_model, const std::string & viscosity_model,
149  libMesh::UniquePtr<Physics> & new_physics )
150  {
151  // First check the things we must have for constant transport models
152  if( viscosity_model != AntiochOptions::constant_viscosity_model() )
153  libmesh_error_msg("Error: For constant transport_model, viscosity model must be constant!");
154 
155  if( diffusivity_model != AntiochOptions::constant_lewis_diffusivity_model() )
156  libmesh_error_msg("Error: For constant transport_model, diffusivity model must be constant_lewis!");
157 
158 
159  if( thermo_model == AntiochOptions::stat_mech_thermo_model() )
160  {
161  this->build_const_physics_with_thermo<Antioch::CEACurveFit<libMesh::Real>,
162  Antioch::StatMechThermodynamics<libMesh::Real> >
163  (input,physics_name,material,conductivity_model,new_physics);
164  }
165  else if( thermo_model == AntiochOptions::cea_nasa_model() )
166  {
167  this->build_const_physics_with_thermo<Antioch::CEACurveFit<libMesh::Real>,
168  Antioch::IdealGasMicroThermo<Antioch::NASAEvaluator<libMesh::Real,Antioch::CEACurveFit<libMesh::Real> > > >
169  (input,physics_name,material,conductivity_model,new_physics);
170  }
171  else
172  this->grins_antioch_model_error_msg(viscosity_model,conductivity_model,diffusivity_model);
173  }
174 #endif // GRINS_HAVE_ANTIOCH
175 
176  template<template<typename,typename> class DerivedPhysics>
178  ( const std::string& viscosity_model,
179  const std::string& conductivity_model,
180  const std::string& diffusivity_model ) const
181  {
182  std::string error = "Error: Unknown Antioch model combination:\n";
183  error += "viscosity_model = "+viscosity_model+"\n";
184  error += "conductivity_model = "+conductivity_model+"\n";
185  error += "diffusivity_model = "+diffusivity_model+"\n";
186 
187  libmesh_error_msg(error);
188  }
189 
191  {
193  grins_factory_rlmns
196 
198  grins_factory_rlmns_spgsm_stab
201  }
202 
203 } // end namespace GRINS
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 cea_nasa_model()
static void parse_antioch_models(const GetPot &input, const std::string &physics, std::string &transport_model, std::string &thermo_model, std::string &viscosity_model, std::string &conductivity_model, std::string &diffusivity_model)
GRINS namespace.
static std::string constant_transport_model()
static std::string mix_avged_transport_model()
static std::string stat_mech_thermo_model()
virtual libMesh::UniquePtr< Physics > build_physics(const GetPot &input, const std::string &physics_name)
void build_mix_avged_physics(const GetPot &input, const std::string &physics_name, const std::string &material, const std::string &thermo_model, const std::string &diffusivity_model, const std::string &conductivity_model, const std::string &viscosity_model, libMesh::UniquePtr< Physics > &new_physics)
Wrapper class for storing state for computing thermochemistry and transport properties using Cantera...
static std::string constant_lewis_diffusivity_model()
static PhysicsName reacting_low_mach_navier_stokes_spgsm_stab()
static std::string material_name(const GetPot &input, const std::string &physics)
Get the name of the material in the Physics/physics section.
void build_const_physics(const GetPot &input, const std::string &physics_name, const std::string &material, const std::string &thermo_model, const std::string &diffusivity_model, const std::string &conductivity_model, const std::string &viscosity_model, libMesh::UniquePtr< Physics > &new_physics)
static std::string constant_viscosity_model()
void grins_antioch_model_error_msg(const std::string &viscosity_model, const std::string &conductivity_model, const std::string &diffusivity_model) const

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