GRINS-0.6.0
antioch_chemistry.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_CHEMISTRY_H
27 #define GRINS_ANTIOCH_CHEMISTRY_H
28 
29 #include "grins_config.h"
30 
31 #ifdef GRINS_HAVE_ANTIOCH
32 
33 // GRINS
34 #include "grins/property_types.h"
35 
36 // libMesh
37 #include "libmesh/libmesh_common.h"
38 
39 // Antioch
40 #include "antioch/vector_utils_decl.h"
41 #include "antioch/vector_utils.h"
42 #include "antioch/chemical_mixture.h"
43 
44 // Boost
45 #include "boost/scoped_ptr.hpp"
46 
47 // libMesh forward declarations
48 class GetPot;
49 
50 namespace GRINS
51 {
53 
61  {
62  public:
63 
64  AntiochChemistry( const GetPot& input );
65 
66  virtual ~AntiochChemistry();
67 
69  libMesh::Real M( unsigned int species ) const;
70 
72  libMesh::Real M_mix( const std::vector<libMesh::Real>& mass_fractions ) const;
73 
75 
76  libMesh::Real R( unsigned int species ) const;
77 
79  libMesh::Real R_mix( const std::vector<libMesh::Real>& mass_fractions ) const;
80 
82  libMesh::Real X( unsigned int species, libMesh::Real M, libMesh::Real mass_fraction ) const;
83 
85  void X( libMesh::Real M, const std::vector<libMesh::Real>& mass_fractions,
86  std::vector<libMesh::Real>& mole_fractions ) const;
87 
89  libMesh::Real molar_density( const unsigned int species,
90  const libMesh::Real rho,
91  const libMesh::Real mass_fraction ) const;
92 
94  void molar_densities( const libMesh::Real rho,
95  const std::vector<libMesh::Real>& mass_fractions,
96  std::vector<libMesh::Real>& molar_densities ) const;
97 
98  unsigned int n_species() const;
99 
100  unsigned int species_index( const std::string& species_name ) const;
101 
102  std::string species_name( unsigned int species_index ) const;
103 
105  const Antioch::ChemicalMixture<libMesh::Real>& chemical_mixture() const;
106 
108  const AntiochChemistry& chemistry() const;
109 
110  protected:
111 
112  boost::scoped_ptr<Antioch::ChemicalMixture<libMesh::Real> > _antioch_gas;
113 
114  private:
115 
117 
118  };
119 
120  /* ------------------------- Inline Functions -------------------------*/
121  inline
122  libMesh::Real AntiochChemistry::M( unsigned int species ) const
123  {
124  return _antioch_gas->M(species);
125  }
126 
127  inline
128  libMesh::Real AntiochChemistry::M_mix( const std::vector<libMesh::Real>& mass_fractions ) const
129  {
130  return _antioch_gas->M(mass_fractions);
131  }
132 
133  inline
134  libMesh::Real AntiochChemistry::R( unsigned int species ) const
135  {
136  return _antioch_gas->R(species);
137  }
138 
139  inline
140  libMesh::Real AntiochChemistry::R_mix( const std::vector<libMesh::Real>& mass_fractions ) const
141  {
142  return _antioch_gas->R(mass_fractions);
143  }
144 
145  inline
146  libMesh::Real AntiochChemistry::X( unsigned int species, const libMesh::Real M,
147  const libMesh::Real mass_fraction ) const
148  {
149  return _antioch_gas->X(species,M,mass_fraction);
150  }
151 
152  inline
153  void AntiochChemistry::X( libMesh::Real M,
154  const std::vector<libMesh::Real>& mass_fractions,
155  std::vector<libMesh::Real>& mole_fractions ) const
156  {
157  _antioch_gas->X(M,mass_fractions,mole_fractions);
158  return;
159  }
160 
161  inline
162  unsigned int AntiochChemistry::n_species() const
163  {
164  return _antioch_gas->n_species();
165  }
166 
167  inline
168  unsigned int AntiochChemistry::species_index( const std::string& species_name ) const
169  {
170 #if ANTIOCH_MAJOR_VERSION < 1 && ANTIOCH_MINOR_VERSION < 3
171  return _antioch_gas->active_species_name_map().find(species_name)->second;
172 #else
173  return _antioch_gas->species_name_map().find(species_name)->second;
174 #endif
175  }
176 
177  inline
178  const Antioch::ChemicalMixture<libMesh::Real>& AntiochChemistry::chemical_mixture() const
179  {
180  return *_antioch_gas.get();
181  }
182 
183  inline
184  libMesh::Real AntiochChemistry::molar_density( const unsigned int species,
185  const libMesh::Real rho,
186  const libMesh::Real mass_fraction ) const
187  {
188  return _antioch_gas->molar_density( species, rho, mass_fraction );
189  }
190 
191  inline
192  void AntiochChemistry::molar_densities( const libMesh::Real rho,
193  const std::vector<libMesh::Real>& mass_fractions,
194  std::vector<libMesh::Real>& molar_densities ) const
195  {
196  _antioch_gas->molar_densities( rho, mass_fractions, molar_densities );
197  return;
198  }
199 
200  inline
202  {
203  return *this;
204  }
205 
206 } // end namespace GRINS
207 
208 #endif // GRINS_HAVE_ANTIOCH
209 
210 #endif // GRINS_ANTIOCH_CHEMISTRY_H
unsigned int n_species() const
libMesh::Real M_mix(const std::vector< libMesh::Real > &mass_fractions) const
Mixture molar mass (molecular weight), [kg/mol].
libMesh::Real R_mix(const std::vector< libMesh::Real > &mass_fractions) const
Mixture gas constant, [J/kg-K].
Wrapper class for Antioch::ChemicalMixture.
const Antioch::ChemicalMixture< libMesh::Real > & chemical_mixture() const
Accessor to underlying Antioch object.
unsigned int species_index(const std::string &species_name) const
const AntiochChemistry & chemistry() const
Accessor for this class.
void molar_densities(const libMesh::Real rho, const std::vector< libMesh::Real > &mass_fractions, std::vector< libMesh::Real > &molar_densities) const
Molar density for all species, [mol/m^3].
GRINS namespace.
std::string species_name(unsigned int species_index) const
libMesh::Real R(unsigned int species) const
Species gas constant, [J/kg-K].
libMesh::Real molar_density(const unsigned int species, const libMesh::Real rho, const libMesh::Real mass_fraction) const
Species molar density, [mol/m^3].
boost::scoped_ptr< Antioch::ChemicalMixture< libMesh::Real > > _antioch_gas
libMesh::Real X(unsigned int species, libMesh::Real M, libMesh::Real mass_fraction) const
Species mole fraction, unitless.
libMesh::Real M(unsigned int species) const
Species molar mass (molecular weight), [kg/mol].

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