GRINS-0.8.0
List of all members | Public Member Functions | Protected Attributes | Private Member Functions
GRINS::CanteraThermodynamics Class Reference

Wrapper class for evaluating thermo properties using Cantera. More...

#include <cantera_thermo.h>

Collaboration diagram for GRINS::CanteraThermodynamics:
Collaboration graph
[legend]

Public Member Functions

 CanteraThermodynamics (CanteraMixture &mixture)
 
 ~CanteraThermodynamics ()
 
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 h (const libMesh::Real &T, unsigned int species)
 

Protected Attributes

CanteraMixture_cantera_mixture
 
Cantera::IdealGasMix & _cantera_gas
 

Private Member Functions

 CanteraThermodynamics ()
 

Detailed Description

Wrapper class for evaluating thermo properties using Cantera.

This class is expected to be constructed after threads have been forked and will only live during the lifetime of the thread. Note that this documentation will always be built regardless if Cantera is included in the GRINS build or not. Check configure output to confirm that Cantera was included in the build if you wish to use it.

Definition at line 61 of file cantera_thermo.h.

Constructor & Destructor Documentation

GRINS::CanteraThermodynamics::CanteraThermodynamics ( CanteraMixture mixture)

Definition at line 43 of file cantera_thermo.C.

44  : _cantera_mixture(mixture),
45  _cantera_gas(mixture.get_chemistry())
46  {}
Cantera::IdealGasMix & _cantera_gas
CanteraMixture & _cantera_mixture
GRINS::CanteraThermodynamics::~CanteraThermodynamics ( )
inline

Definition at line 66 of file cantera_thermo.h.

66 {};
GRINS::CanteraThermodynamics::CanteraThermodynamics ( )
private

Member Function Documentation

libMesh::Real GRINS::CanteraThermodynamics::cp ( const libMesh::Real &  T,
const libMesh::Real  P,
const std::vector< libMesh::Real > &  Y 
)
Todo:
Need to make sure this will work in a threaded environment. Not sure if we will get thread lock here or not.

Definition at line 48 of file cantera_thermo.C.

References _cantera_gas.

Referenced by GRINS::CanteraEvaluator::cp().

51  {
52  libmesh_assert_equal_to( Y.size(), _cantera_gas.nSpecies() );
53 
54  libMesh::Real cp = 0.0;
55 
56  {
59  libMesh::Threads::spin_mutex::scoped_lock lock(cantera_mutex);
60 
61  try
62  {
63  _cantera_gas.setState_TPY( T, P, &Y[0] );
64 
65  cp = _cantera_gas.cp_mass();
66  }
67  catch(Cantera::CanteraError)
68  {
69  Cantera::showErrors(std::cerr);
70  libmesh_error();
71  }
72 
73  }
74 
75  return cp;
76  }
libMesh::Real cp(const libMesh::Real &T, const libMesh::Real P, const std::vector< libMesh::Real > &Y)
Cantera::IdealGasMix & _cantera_gas
libMesh::Real GRINS::CanteraThermodynamics::cv ( const libMesh::Real &  T,
const libMesh::Real  P,
const std::vector< libMesh::Real > &  Y 
)
Todo:
Need to make sure this will work in a threaded environment. Not sure if we will get thread lock here or not.

Definition at line 78 of file cantera_thermo.C.

References _cantera_gas.

Referenced by GRINS::CanteraEvaluator::cv().

81  {
82  libmesh_assert_equal_to( Y.size(), _cantera_gas.nSpecies() );
83 
84  libMesh::Real cv = 0.0;
85 
86  {
89  libMesh::Threads::spin_mutex::scoped_lock lock(cantera_mutex);
90 
91  try
92  {
93  _cantera_gas.setState_TPY( T, P, &Y[0] );
94 
95  cv = _cantera_gas.cv_mass();
96  }
97  catch(Cantera::CanteraError)
98  {
99  Cantera::showErrors(std::cerr);
100  libmesh_error();
101  }
102 
103  }
104 
105  return cv;
106  }
libMesh::Real cv(const libMesh::Real &T, const libMesh::Real P, const std::vector< libMesh::Real > &Y)
Cantera::IdealGasMix & _cantera_gas
libMesh::Real GRINS::CanteraThermodynamics::h ( const libMesh::Real &  T,
unsigned int  species 
)

Definition at line 108 of file cantera_thermo.C.

References _cantera_gas, _cantera_mixture, and GRINS::CanteraMixture::R().

Referenced by GRINS::CanteraEvaluator::h_s().

109  {
110  std::vector<libMesh::Real> h_RT( _cantera_gas.nSpecies(), 0.0 );
111 
112  try
113  {
114  _cantera_gas.setTemperature( T );
115 
116  _cantera_gas.getEnthalpy_RT( &h_RT[0] );
117  }
118  catch(Cantera::CanteraError)
119  {
120  Cantera::showErrors(std::cerr);
121  libmesh_error();
122  }
123 
124  return h_RT[species]*_cantera_mixture.R(species)*T;
125  }
libMesh::Real R(unsigned int species) const
Cantera::IdealGasMix & _cantera_gas
CanteraMixture & _cantera_mixture

Member Data Documentation

Cantera::IdealGasMix& GRINS::CanteraThermodynamics::_cantera_gas
protected

Definition at line 78 of file cantera_thermo.h.

Referenced by cp(), cv(), and h().

CanteraMixture& GRINS::CanteraThermodynamics::_cantera_mixture
protected

Definition at line 76 of file cantera_thermo.h.

Referenced by h().


The documentation for this class was generated from the following files:

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