GRINS-0.6.0
antioch_evaluator.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2015 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_EVALUATOR_H
27 #define GRINS_ANTIOCH_EVALUATOR_H
28 
29 #include "grins_config.h"
30 
31 #ifdef GRINS_HAVE_ANTIOCH
32 
33 // GRINS
34 #include "grins/antioch_mixture.h"
35 #include "grins/antioch_kinetics.h"
36 #include "grins/cached_values.h"
37 #include "grins/property_types.h"
38 
39 // Antioch
40 #include "antioch/temp_cache.h"
41 #include "antioch/cea_evaluator.h"
42 #include "antioch/stat_mech_thermo.h"
43 
44 // Boost
45 #include <boost/scoped_ptr.hpp>
46 
47 namespace GRINS
48 {
50 
57  template<typename Thermo>
59  {
60  public:
61 
62  AntiochEvaluator( const AntiochMixture& mixture );
63 
64  virtual ~AntiochEvaluator();
65 
66  // Chemistry
67  libMesh::Real M( unsigned int species ) const;
68 
69  libMesh::Real M_mix( const std::vector<libMesh::Real>& mass_fractions ) const;
70 
71  libMesh::Real R( unsigned int species ) const;
72 
73  libMesh::Real R_mix( const std::vector<libMesh::Real>& mass_fractions ) const;
74 
75  libMesh::Real X( unsigned int species, libMesh::Real M, libMesh::Real mass_fraction ) const;
76 
77  void X( libMesh::Real M, const std::vector<libMesh::Real>& mass_fractions,
78  std::vector<libMesh::Real>& mole_fractions ) const;
79 
80  unsigned int species_index( const std::string& species_name ) const;
81 
82  std::string species_name( unsigned int species_index ) const;
83 
84  // Thermo
85  libMesh::Real cp( const CachedValues& cache, unsigned int qp );
86 
87  libMesh::Real cv( const CachedValues& cache, unsigned int qp );
88 
89  libMesh::Real h_s(const CachedValues& cache, unsigned int qp, unsigned int species);
90 
91  void h_s(const CachedValues& cache, unsigned int qp, std::vector<libMesh::Real>& h_s);
92 
93  libMesh::Real h_s( const libMesh::Real& T, unsigned int species );
94 
95  libMesh::Real cp( const libMesh::Real& T,
96  const std::vector<libMesh::Real>& Y );
97 
98  // Kinetics
99  void omega_dot( const CachedValues& cache, unsigned int qp,
100  std::vector<libMesh::Real>& omega_dot );
101 
102  void omega_dot( const libMesh::Real& T, libMesh::Real rho,
103  const std::vector<libMesh::Real> mass_fractions,
104  std::vector<libMesh::Real>& omega_dot );
105 
106  protected:
107 
109 
110  // This is a template type
111  boost::scoped_ptr<Thermo> _thermo;
112 
113  boost::scoped_ptr<AntiochKinetics> _kinetics;
114 
115  boost::scoped_ptr<Antioch::TempCache<libMesh::Real> > _temp_cache;
116 
118 
120  void check_and_reset_temp_cache( const libMesh::Real& T );
121 
122  /* Below we will specialize the specialized_build_* functions to the appropriate type.
123  This way, we can control how the cached transport objects get constructed
124  based on the template type. This is achieved by the dummy types forcing operator
125  overloading for each of the specialized types. */
126  void build_thermo( const AntiochMixture& mixture )
127  { specialized_build_thermo( mixture, _thermo, thermo_type<Thermo>() ); }
128 
129  private:
130 
132 
134  boost::scoped_ptr<Antioch::StatMechThermodynamics<libMesh::Real> >& thermo,
135  thermo_type<Antioch::StatMechThermodynamics<libMesh::Real> > )
136  {
137  thermo.reset( new Antioch::StatMechThermodynamics<libMesh::Real>( mixture.chemical_mixture() ) );
138  return;
139  }
140 
142  boost::scoped_ptr<Antioch::CEAEvaluator<libMesh::Real> >& thermo,
143  thermo_type<Antioch::CEAEvaluator<libMesh::Real> > )
144  {
145  thermo.reset( new Antioch::CEAEvaluator<libMesh::Real>( mixture.cea_mixture() ) );
146  return;
147  }
148 
149  };
150 
151  /* ------------------------- Inline Functions -------------------------*/
152  template<typename Thermo>
153  inline
154  libMesh::Real AntiochEvaluator<Thermo>::M( unsigned int species ) const
155  {
156  return _chem.M(species);
157  }
158 
159  template<typename Thermo>
160  inline
161  libMesh::Real AntiochEvaluator<Thermo>::M_mix( const std::vector<libMesh::Real>& mass_fractions ) const
162  {
163  return _chem.M_mix(mass_fractions);
164  }
165 
166  template<typename Thermo>
167  inline
168  libMesh::Real AntiochEvaluator<Thermo>::R( unsigned int species ) const
169  {
170  return _chem.R(species);
171  }
172 
173  template<typename Thermo>
174  inline
175  libMesh::Real AntiochEvaluator<Thermo>::R_mix( const std::vector<libMesh::Real>& mass_fractions ) const
176  {
177  return _chem.R_mix(mass_fractions);
178  }
179 
180  template<typename Thermo>
181  inline
182  libMesh::Real AntiochEvaluator<Thermo>::X( unsigned int species, libMesh::Real M, libMesh::Real mass_fraction ) const
183  {
184  return _chem.X(species,M,mass_fraction);
185  }
186 
187  template<typename Thermo>
188  inline
189  void AntiochEvaluator<Thermo>::X( libMesh::Real M, const std::vector<libMesh::Real>& mass_fractions,
190  std::vector<libMesh::Real>& mole_fractions ) const
191  {
192  _chem.X(M,mass_fractions,mole_fractions);
193  return;
194  }
195 
196  template<typename Thermo>
197  inline
198  unsigned int AntiochEvaluator<Thermo>::species_index( const std::string& species_name ) const
199  {
200  return _chem.species_index(species_name);
201  }
202 
203  template<typename Thermo>
204  inline
205  std::string AntiochEvaluator<Thermo>::species_name( unsigned int species_index ) const
206  {
207  return _chem.species_name(species_index);
208  }
209 
210 } // end namespace GRINS
211 
212 #endif // GRINS_HAVE_ANTIOCH
213 
214 #endif // GRINS_ANTIOCH_EVALUATOR_H
libMesh::Real cv(const CachedValues &cache, unsigned int qp)
void check_and_reset_temp_cache(const libMesh::Real &T)
Helper method for managing _temp_cache.
Wrapper class for evaluating chemistry and thermo properties using Antioch.
const Antioch::ChemicalMixture< libMesh::Real > & chemical_mixture() const
Accessor to underlying Antioch object.
boost::scoped_ptr< Thermo > _thermo
libMesh::Real cp(const CachedValues &cache, unsigned int qp)
void omega_dot(const CachedValues &cache, unsigned int qp, std::vector< libMesh::Real > &omega_dot)
const Antioch::CEAThermoMixture< libMesh::Real > & cea_mixture() const
libMesh::Real h_s(const CachedValues &cache, unsigned int qp, unsigned int species)
libMesh::Real R_mix(const std::vector< libMesh::Real > &mass_fractions) const
libMesh::Real M(unsigned int species) const
std::string species_name(unsigned int species_index) const
unsigned int species_index(const std::string &species_name) const
boost::scoped_ptr< AntiochKinetics > _kinetics
const AntiochMixture & _chem
GRINS namespace.
boost::scoped_ptr< Antioch::TempCache< libMesh::Real > > _temp_cache
Wrapper class for storing state for Antioch thermo and kinetics.
libMesh::Real X(unsigned int species, libMesh::Real M, libMesh::Real mass_fraction) const
void specialized_build_thermo(const AntiochMixture &mixture, boost::scoped_ptr< Antioch::CEAEvaluator< libMesh::Real > > &thermo, thermo_type< Antioch::CEAEvaluator< libMesh::Real > >)
libMesh::Real M_mix(const std::vector< libMesh::Real > &mass_fractions) const
void specialized_build_thermo(const AntiochMixture &mixture, boost::scoped_ptr< Antioch::StatMechThermodynamics< libMesh::Real > > &thermo, thermo_type< Antioch::StatMechThermodynamics< libMesh::Real > >)
void build_thermo(const AntiochMixture &mixture)
libMesh::Real R(unsigned int species) const

Generated on Mon Jun 22 2015 21:32:20 for GRINS-0.6.0 by  doxygen 1.8.9.1