GRINS-0.8.0
antioch_mixture_builder_base.h
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 
26 #ifndef GRINS_ANTIOCH_MIXTURE_BUILDER_BASE_H
27 #define GRINS_ANTIOCH_MIXTURE_BUILDER_BASE_H
28 
29 #include "grins_config.h"
30 
31 #ifdef GRINS_HAVE_ANTIOCH
32 
33 // GRINS
35 #include "grins/antioch_mixture.h"
36 
37 // Antioch
38 #include "antioch/vector_utils_decl.h"
39 #include "antioch/vector_utils.h"
40 #include "antioch/chemical_mixture.h"
41 #include "antioch/reaction_set.h"
42 #include "antioch/nasa_mixture.h"
43 #include "antioch/cea_curve_fit.h"
44 #include "antioch/nasa_mixture_parsing.h"
45 
46 // libMesh
47 #include "libmesh/auto_ptr.h" // libMesh::UniquePtr
48 #include "libmesh/getpot.h"
49 
50 // C++
51 #include <string>
52 
53 // libMesh forward declarations
54 class GetPot;
55 
56 namespace GRINS
57 {
59 
63  {
64  public:
67 
68  libMesh::UniquePtr<Antioch::ChemicalMixture<libMesh::Real> >
69  build_chem_mix( const GetPot & input, const std::string & material );
70 
71  libMesh::UniquePtr<Antioch::ReactionSet<libMesh::Real> >
72  build_reaction_set( const GetPot & input, const std::string & material,
73  const Antioch::ChemicalMixture<libMesh::Real> & chem_mix );
74 
75  template<typename KineticsThermoCurveFit>
76  libMesh::UniquePtr<Antioch::NASAThermoMixture<libMesh::Real,KineticsThermoCurveFit> >
77  build_nasa_thermo_mix( const GetPot & input, const std::string & material,
78  const Antioch::ChemicalMixture<libMesh::Real> & chem_mix );
79 
80 
81  template<typename KineticsThermoCurveFit>
82  libMesh::UniquePtr<AntiochMixture<KineticsThermoCurveFit> >
83  build_antioch_mixture(const GetPot & input, const std::string & material );
84 
85  libMesh::Real parse_min_T( const GetPot & input, const std::string & material )
86  {
87  return input( "Materials/"+material+"/GasMixture/Antioch/minimum_T",
88  -std::numeric_limits<libMesh::Real>::max() );
89  }
90 
91  bool parse_clip_negative_rho( const GetPot & input, const std::string & material )
92  {
93  return input( "Materials/"+material+"/GasMixture/Antioch/clip_negative_rho", false);
94  }
95 
96  protected:
97 
98  void parse_nasa_data
99  ( Antioch::NASAThermoMixture<libMesh::Real,Antioch::CEACurveFit<libMesh::Real> > & nasa_mixture,
100  const GetPot & input, const std::string & material)
101  {
102  std::string cea_data_filename = input( "Materials/"+material+"/GasMixture/Antioch/cea_data", "default" );
103 
104  if( cea_data_filename == std::string("default") )
105  cea_data_filename = Antioch::DefaultInstallFilename::thermo_data();
106 
107  Antioch::read_nasa_mixture_data( nasa_mixture, cea_data_filename, Antioch::ASCII, true );
108  }
109 
110  };
111 
112  template<typename KineticsThermoCurveFit>
113  inline
114  libMesh::UniquePtr<Antioch::NASAThermoMixture<libMesh::Real,KineticsThermoCurveFit> >
115  AntiochMixtureBuilderBase::build_nasa_thermo_mix( const GetPot & input, const std::string & material,
116  const Antioch::ChemicalMixture<libMesh::Real> & chem_mix )
117  {
118  libMesh::UniquePtr<Antioch::NASAThermoMixture<libMesh::Real,KineticsThermoCurveFit> >
119  nasa_mixture( new Antioch::NASAThermoMixture<libMesh::Real,KineticsThermoCurveFit>(chem_mix) );
120 
121  this->parse_nasa_data( *nasa_mixture, input, material);
122 
123  return nasa_mixture;
124  }
125 
126  template<typename KineticsThermoCurveFit>
127  inline
128  libMesh::UniquePtr<AntiochMixture<KineticsThermoCurveFit> >
129  AntiochMixtureBuilderBase::build_antioch_mixture(const GetPot & input, const std::string & material )
130  {
131  libMesh::UniquePtr<Antioch::ChemicalMixture<libMesh::Real> > chem_mixture =
132  this->build_chem_mix(input,material);
133 
134  libMesh::UniquePtr<Antioch::ReactionSet<libMesh::Real> > reaction_set =
135  this->build_reaction_set(input,material,*chem_mixture);
136 
137  libMesh::UniquePtr<Antioch::NASAThermoMixture<libMesh::Real,KineticsThermoCurveFit> > nasa_mixture =
138  this->build_nasa_thermo_mix<KineticsThermoCurveFit>(input,material,*chem_mixture);
139 
140  libMesh::Real min_T = this->parse_min_T(input,material);
141  bool clip_negative_rho = this->parse_clip_negative_rho(input,material);
142 
143  return libMesh::UniquePtr<AntiochMixture<KineticsThermoCurveFit> >
145  (chem_mixture,reaction_set,nasa_mixture,min_T,clip_negative_rho) );
146  }
147 
148 } // end namespace GRINS
149 
150 #endif // GRINS_HAVE_ANTIOCH
151 
152 #endif // GRINS_ANTIOCH_MIXTURE_BUILDER_BASE_H
bool parse_clip_negative_rho(const GetPot &input, const std::string &material)
void parse_nasa_data(Antioch::NASAThermoMixture< libMesh::Real, Antioch::CEACurveFit< libMesh::Real > > &nasa_mixture, const GetPot &input, const std::string &material)
libMesh::UniquePtr< Antioch::ReactionSet< libMesh::Real > > build_reaction_set(const GetPot &input, const std::string &material, const Antioch::ChemicalMixture< libMesh::Real > &chem_mix)
libMesh::UniquePtr< AntiochMixture< KineticsThermoCurveFit > > build_antioch_mixture(const GetPot &input, const std::string &material)
Base class building Antioch mixture wrappers.
libMesh::UniquePtr< Antioch::NASAThermoMixture< libMesh::Real, KineticsThermoCurveFit > > build_nasa_thermo_mix(const GetPot &input, const std::string &material, const Antioch::ChemicalMixture< libMesh::Real > &chem_mix)
GRINS namespace.
Wrapper class for storing state for Antioch thermo and kinetics.
libMesh::Real parse_min_T(const GetPot &input, const std::string &material)
libMesh::UniquePtr< Antioch::ChemicalMixture< libMesh::Real > > build_chem_mix(const GetPot &input, const std::string &material)

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