GRINS-0.8.0
cantera_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-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_CANTERA_EVALUATOR_H
27 #define GRINS_CANTERA_EVALUATOR_H
28 
29 #include "grins_config.h"
30 
31 #ifdef GRINS_HAVE_CANTERA
32 
33 // GRINS
34 #include "grins/cantera_mixture.h"
35 #include "grins/cantera_thermo.h"
37 #include "grins/cantera_kinetics.h"
38 
39 namespace GRINS
40 {
42 
49  {
50  public:
51 
52  CanteraEvaluator( CanteraMixture& mixture );
54 
55  // Chemistry
56  libMesh::Real M( unsigned int species ) const;
57 
58  libMesh::Real M_mix( const std::vector<libMesh::Real>& mass_fractions ) const;
59 
60  libMesh::Real R( unsigned int species ) const;
61 
62  libMesh::Real R_mix( const std::vector<libMesh::Real>& mass_fractions ) const;
63 
64  libMesh::Real X( unsigned int species, libMesh::Real M, libMesh::Real mass_fraction ) const;
65 
66  void X( libMesh::Real M, const std::vector<libMesh::Real>& mass_fractions,
67  std::vector<libMesh::Real>& mole_fractions ) const;
68 
69  unsigned int species_index( const std::string& species_name ) const;
70 
71  std::string species_name( unsigned int species_index ) const;
72 
73  // Thermo
74  libMesh::Real cp( const libMesh::Real& T, const libMesh::Real P, const std::vector<libMesh::Real>& Y );
75 
76  libMesh::Real cv( const libMesh::Real& T, const libMesh::Real P, const std::vector<libMesh::Real>& Y );
77 
78  libMesh::Real h_s( const libMesh::Real& T, unsigned int species );
79 
80  // Transport
81  libMesh::Real mu( const libMesh::Real& T, const libMesh::Real P, const std::vector<libMesh::Real>& Y );
82 
83  libMesh::Real k( const libMesh::Real& T, const libMesh::Real P, const std::vector<libMesh::Real>& Y );
84 
85  void mu_and_k( const libMesh::Real& T, const libMesh::Real P, const std::vector<libMesh::Real>& Y,
86  libMesh::Real& mu, libMesh::Real& k );
87 
88  void mu_and_k_and_D( const libMesh::Real T,
89  const libMesh::Real rho,
90  const libMesh::Real cp,
91  const std::vector<libMesh::Real>& Y,
92  libMesh::Real& mu, libMesh::Real& k,
93  std::vector<libMesh::Real>& D );
94 
95  // Kinetics
96  void omega_dot( const libMesh::Real& T, libMesh::Real rho,
97  const std::vector<libMesh::Real> mass_fractions,
98  std::vector<libMesh::Real>& omega_dot );
99 
100  protected:
101 
103 
105 
107 
109 
110  private:
111 
113 
114  };
115 
116  /* ------------------------- Inline Functions -------------------------*/
117  inline
118  libMesh::Real CanteraEvaluator::M( unsigned int species ) const
119  {
120  return _chem.M(species);
121  }
122 
123  inline
124  libMesh::Real CanteraEvaluator::M_mix( const std::vector<libMesh::Real>& mass_fractions ) const
125  {
126  return _chem.M_mix(mass_fractions);
127  }
128 
129  inline
130  libMesh::Real CanteraEvaluator::R( unsigned int species ) const
131  {
132  return _chem.R(species);
133  }
134 
135  inline
136  libMesh::Real CanteraEvaluator::R_mix( const std::vector<libMesh::Real>& mass_fractions ) const
137  {
138  return _chem.R_mix(mass_fractions);
139  }
140 
141  inline
142  libMesh::Real CanteraEvaluator::X( unsigned int species, libMesh::Real M, libMesh::Real mass_fraction ) const
143  {
144  return _chem.X(species,M,mass_fraction);
145  }
146 
147  inline
148  void CanteraEvaluator::X( libMesh::Real M, const std::vector<libMesh::Real>& mass_fractions,
149  std::vector<libMesh::Real>& mole_fractions ) const
150  {
151  _chem.X(M,mass_fractions,mole_fractions);
152  return;
153  }
154 
155  inline
156  unsigned int CanteraEvaluator::species_index( const std::string& species_name ) const
157  {
158  return _chem.species_index(species_name);
159  }
160 
161  inline
162  std::string CanteraEvaluator::species_name( unsigned int species_index ) const
163  {
164  return _chem.species_name(species_index);
165  }
166 
167  inline
168  libMesh::Real CanteraEvaluator::cp( const libMesh::Real& T,
169  const libMesh::Real P,
170  const std::vector<libMesh::Real>& Y )
171  {
172  return _thermo.cp(T,P,Y);
173  }
174 
175  inline
176  libMesh::Real CanteraEvaluator::cv( const libMesh::Real& T,
177  const libMesh::Real P,
178  const std::vector<libMesh::Real>& Y )
179  {
180  return _thermo.cv(T,P,Y);
181  }
182 
183  inline
184  libMesh::Real CanteraEvaluator::h_s( const libMesh::Real& T, unsigned int species )
185  {
186  return _thermo.h(T,species);
187  }
188 
189  inline
190  libMesh::Real CanteraEvaluator::mu( const libMesh::Real& T,
191  const libMesh::Real P,
192  const std::vector<libMesh::Real>& Y )
193  {
194  return _transport.mu(T,P,Y);
195  }
196 
197  inline
198  libMesh::Real CanteraEvaluator::k( const libMesh::Real& T,
199  const libMesh::Real P,
200  const std::vector<libMesh::Real>& Y )
201  {
202  return _transport.k(T,P,Y);
203  }
204 
205  inline
206  void CanteraEvaluator::mu_and_k( const libMesh::Real& T,
207  const libMesh::Real P,
208  const std::vector<libMesh::Real>& Y,
209  libMesh::Real& mu, libMesh::Real& k )
210  {
211  mu = _transport.mu(T,P,Y);
212  k = _transport.k(T,P,Y);
213  }
214 
215  inline
216  void CanteraEvaluator::mu_and_k_and_D( const libMesh::Real T,
217  const libMesh::Real rho,
218  const libMesh::Real cp,
219  const std::vector<libMesh::Real>& Y,
220  libMesh::Real& mu, libMesh::Real& k,
221  std::vector<libMesh::Real>& D )
222  {
223  _transport.mu_and_k_and_D( T, rho, cp, Y, mu, k, D );
224  }
225 
226  inline
227  void CanteraEvaluator::omega_dot( const libMesh::Real& T, libMesh::Real rho,
228  const std::vector<libMesh::Real> mass_fractions,
229  std::vector<libMesh::Real>& omega_dot )
230  {
231  _kinetics.omega_dot(T,rho,mass_fractions,omega_dot);
232  }
233 
234 } // end namespace GRINS
235 
236 #endif // GRINS_HAVE_CANTERA
237 
238 #endif // GRINS_CANTERA_EVALUATOR_H
libMesh::Real R(unsigned int species) const
libMesh::Real X(unsigned int species, libMesh::Real M, libMesh::Real mass_fraction) const
libMesh::Real cp(const libMesh::Real &T, const libMesh::Real P, const std::vector< libMesh::Real > &Y)
libMesh::Real cv(const libMesh::Real &T, const libMesh::Real P, const std::vector< libMesh::Real > &Y)
libMesh::Real k(const libMesh::Real &T, const libMesh::Real P, const std::vector< libMesh::Real > &Y)
libMesh::Real M_mix(const std::vector< libMesh::Real > &mass_fractions) const
void omega_dot(const libMesh::Real &T, const libMesh::Real rho, const std::vector< libMesh::Real > &mass_fractions, std::vector< libMesh::Real > &omega_dot) const
Wrapper class for evaluating thermo properties using Cantera.
void omega_dot(const libMesh::Real &T, libMesh::Real rho, const std::vector< libMesh::Real > mass_fractions, std::vector< libMesh::Real > &omega_dot)
libMesh::Real R(unsigned int species) const
CanteraTransport _transport
std::string species_name(unsigned int species_index) const
CanteraThermodynamics _thermo
unsigned int species_index(const std::string &species_name) const
unsigned int species_index(const std::string &species_name) const
GRINS namespace.
libMesh::Real cv(const libMesh::Real &T, const libMesh::Real P, const std::vector< libMesh::Real > &Y)
libMesh::Real cp(const libMesh::Real &T, const libMesh::Real P, const std::vector< libMesh::Real > &Y)
std::string species_name(unsigned int species_index) const
void mu_and_k(const libMesh::Real &T, const libMesh::Real P, const std::vector< libMesh::Real > &Y, libMesh::Real &mu, libMesh::Real &k)
void mu_and_k_and_D(const libMesh::Real T, const libMesh::Real rho, const libMesh::Real cp, const std::vector< libMesh::Real > &Y, libMesh::Real &mu, libMesh::Real &k, std::vector< libMesh::Real > &D)
Wrapper class for evaluating thermochemistry and transport properties using Cantera.
libMesh::Real M_mix(const std::vector< libMesh::Real > &mass_fractions) const
libMesh::Real M(unsigned int species) const
libMesh::Real R_mix(const std::vector< libMesh::Real > &mass_fractions) const
libMesh::Real mu(const libMesh::Real &T, const libMesh::Real P, const std::vector< libMesh::Real > &Y)
libMesh::Real h_s(const libMesh::Real &T, unsigned int species)
libMesh::Real R_mix(const std::vector< libMesh::Real > &mass_fractions) const
Wrapper class for storing state for computing thermochemistry and transport properties using Cantera...
libMesh::Real mu(const libMesh::Real &T, const libMesh::Real P, const std::vector< libMesh::Real > &Y)
void mu_and_k_and_D(const libMesh::Real T, const libMesh::Real rho, const libMesh::Real cp, const std::vector< libMesh::Real > &Y, libMesh::Real &mu, libMesh::Real &k, std::vector< libMesh::Real > &D)
libMesh::Real X(unsigned int species, libMesh::Real M, libMesh::Real mass_fraction) const
Wrapper class for evaluating transport properties using Cantera.
libMesh::Real h(const libMesh::Real &T, unsigned int species)
libMesh::Real M(unsigned int species) const
libMesh::Real k(const libMesh::Real &T, const libMesh::Real P, const std::vector< libMesh::Real > &Y)

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