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

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

#include <cantera_transport.h>

Public Member Functions

 CanteraTransport (CanteraMixture &mixture)
 
 ~CanteraTransport ()
 
libMesh::Real mu (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)
 
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)
 

Protected Attributes

Cantera::IdealGasMix & _cantera_gas
 
Cantera::Transport & _cantera_transport
 

Private Member Functions

 CanteraTransport ()
 

Detailed Description

Wrapper class for evaluating transport 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 63 of file cantera_transport.h.

Constructor & Destructor Documentation

GRINS::CanteraTransport::CanteraTransport ( CanteraMixture mixture)

Definition at line 49 of file cantera_transport.C.

50  : _cantera_gas( mixture.get_chemistry() ),
51  _cantera_transport( mixture.get_transport() )
52  {}
Cantera::IdealGasMix & _cantera_gas
Cantera::Transport & _cantera_transport
GRINS::CanteraTransport::~CanteraTransport ( )
inline

Definition at line 69 of file cantera_transport.h.

69 {};
GRINS::CanteraTransport::CanteraTransport ( )
private

Member Function Documentation

libMesh::Real GRINS::CanteraTransport::k ( 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 83 of file cantera_transport.C.

References _cantera_gas, and _cantera_transport.

Referenced by GRINS::CanteraEvaluator::k(), and GRINS::CanteraEvaluator::mu_and_k().

86  {
87  libmesh_assert_equal_to( Y.size(), _cantera_gas.nSpecies() );
88 
89  libMesh::Real k = 0.0;
90 
91  {
92  libMesh::Threads::spin_mutex::scoped_lock lock(cantera_mutex);
93 
96  try
97  {
98  _cantera_gas.setState_TPY(T, P, &Y[0]);
99  k = _cantera_transport.thermalConductivity();
100  }
101  catch(Cantera::CanteraError)
102  {
103  Cantera::showErrors(std::cerr);
104  libmesh_error();
105  }
106 
107  }
108 
109  return k;
110  }
libMesh::Real k(const libMesh::Real &T, const libMesh::Real P, const std::vector< libMesh::Real > &Y)
Cantera::IdealGasMix & _cantera_gas
Cantera::Transport & _cantera_transport
libMesh::Real GRINS::CanteraTransport::mu ( 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 54 of file cantera_transport.C.

References _cantera_gas, and _cantera_transport.

Referenced by GRINS::CanteraEvaluator::mu(), and GRINS::CanteraEvaluator::mu_and_k().

57  {
58  libmesh_assert_equal_to( Y.size(), _cantera_gas.nSpecies() );
59 
60  libMesh::Real mu = 0.0;
61 
62  {
63  libMesh::Threads::spin_mutex::scoped_lock lock(cantera_mutex);
64 
67  try
68  {
69  _cantera_gas.setState_TPY(T, P, &Y[0]);
70  mu = _cantera_transport.viscosity();
71  }
72  catch(Cantera::CanteraError)
73  {
74  Cantera::showErrors(std::cerr);
75  libmesh_error();
76  }
77 
78  }
79 
80  return mu;
81  }
Cantera::IdealGasMix & _cantera_gas
Cantera::Transport & _cantera_transport
libMesh::Real mu(const libMesh::Real &T, const libMesh::Real P, const std::vector< libMesh::Real > &Y)
void GRINS::CanteraTransport::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 
)
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 112 of file cantera_transport.C.

References _cantera_gas, and _cantera_transport.

Referenced by main(), and GRINS::CanteraEvaluator::mu_and_k_and_D().

118  {
119  libMesh::Threads::spin_mutex::scoped_lock lock(cantera_mutex);
120 
123  try
124  {
125  _cantera_gas.setState_TRY(T, rho, &Y[0]);
126 
127  mu = _cantera_transport.viscosity();
128  k = _cantera_transport.thermalConductivity();
129  _cantera_transport.getMixDiffCoeffsMass(&D[0]);
130  }
131  catch(Cantera::CanteraError)
132  {
133  Cantera::showErrors(std::cerr);
134  libmesh_error();
135  }
136  }
libMesh::Real k(const libMesh::Real &T, const libMesh::Real P, const std::vector< libMesh::Real > &Y)
Cantera::IdealGasMix & _cantera_gas
Cantera::Transport & _cantera_transport
libMesh::Real mu(const libMesh::Real &T, const libMesh::Real P, const std::vector< libMesh::Real > &Y)

Member Data Documentation

Cantera::IdealGasMix& GRINS::CanteraTransport::_cantera_gas
protected

Definition at line 84 of file cantera_transport.h.

Referenced by k(), mu(), and mu_and_k_and_D().

Cantera::Transport& GRINS::CanteraTransport::_cantera_transport
protected

Definition at line 86 of file cantera_transport.h.

Referenced by k(), mu(), and mu_and_k_and_D().


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