GRINS-0.6.0
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
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 CachedValues &cache, unsigned int qp) const
 
libMesh::Real k (const CachedValues &cache, unsigned int qp) const
 
void D (const CachedValues &cache, unsigned int qp, std::vector< libMesh::Real > &D) const
 

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  {
53  return;
54  }
Cantera::IdealGasMix & _cantera_gas
Cantera::Transport & _cantera_transport
GRINS::CanteraTransport::~CanteraTransport ( )

Definition at line 56 of file cantera_transport.C.

57  {
58  return;
59  }
GRINS::CanteraTransport::CanteraTransport ( )
private

Member Function Documentation

void GRINS::CanteraTransport::D ( const CachedValues cache,
unsigned int  qp,
std::vector< libMesh::Real > &  D 
) const
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 123 of file cantera_transport.C.

References _cantera_gas, _cantera_transport, GRINS::CachedValues::get_cached_values(), GRINS::CachedValues::get_cached_vector_values(), GRINS::Cache::MASS_FRACTIONS, GRINS::Cache::TEMPERATURE, and GRINS::Cache::THERMO_PRESSURE.

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

125  {
126  const libMesh::Real T = cache.get_cached_values(Cache::TEMPERATURE)[qp];
127  const libMesh::Real P = cache.get_cached_values(Cache::THERMO_PRESSURE)[qp];
128  const std::vector<libMesh::Real>& Y = cache.get_cached_vector_values(Cache::MASS_FRACTIONS)[qp];
129 
130  libmesh_assert_equal_to( Y.size(), D.size() );
131  libmesh_assert_equal_to( Y.size(), _cantera_gas.nSpecies() );
132 
133  {
134  libMesh::Threads::spin_mutex::scoped_lock lock(cantera_mutex);
135 
138  try
139  {
140  _cantera_gas.setState_TPY(T, P, &Y[0]);
141  _cantera_transport.getMixDiffCoeffsMass(&D[0]);
142  }
143  catch(Cantera::CanteraError)
144  {
145  Cantera::showErrors(std::cerr);
146  libmesh_error();
147  }
148 
149  }
150 
151  return;
152  }
void D(const CachedValues &cache, unsigned int qp, std::vector< libMesh::Real > &D) const
Cantera::IdealGasMix & _cantera_gas
Cantera::Transport & _cantera_transport
libMesh::Real GRINS::CanteraTransport::k ( const CachedValues cache,
unsigned int  qp 
) const
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 92 of file cantera_transport.C.

References _cantera_gas, _cantera_transport, GRINS::CachedValues::get_cached_values(), GRINS::CachedValues::get_cached_vector_values(), GRINS::Cache::MASS_FRACTIONS, GRINS::Cache::TEMPERATURE, and GRINS::Cache::THERMO_PRESSURE.

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

93  {
94  const libMesh::Real T = cache.get_cached_values(Cache::TEMPERATURE)[qp];
95  const libMesh::Real P = cache.get_cached_values(Cache::THERMO_PRESSURE)[qp];
96  const std::vector<libMesh::Real>& Y = cache.get_cached_vector_values(Cache::MASS_FRACTIONS)[qp];
97 
98  libmesh_assert_equal_to( Y.size(), _cantera_gas.nSpecies() );
99 
100  libMesh::Real k = 0.0;
101 
102  {
103  libMesh::Threads::spin_mutex::scoped_lock lock(cantera_mutex);
104 
107  try
108  {
109  _cantera_gas.setState_TPY(T, P, &Y[0]);
110  k = _cantera_transport.thermalConductivity();
111  }
112  catch(Cantera::CanteraError)
113  {
114  Cantera::showErrors(std::cerr);
115  libmesh_error();
116  }
117 
118  }
119 
120  return k;
121  }
Cantera::IdealGasMix & _cantera_gas
Cantera::Transport & _cantera_transport
libMesh::Real k(const CachedValues &cache, unsigned int qp) const
libMesh::Real GRINS::CanteraTransport::mu ( const CachedValues cache,
unsigned int  qp 
) const
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 61 of file cantera_transport.C.

References _cantera_gas, _cantera_transport, GRINS::CachedValues::get_cached_values(), GRINS::CachedValues::get_cached_vector_values(), GRINS::Cache::MASS_FRACTIONS, GRINS::Cache::TEMPERATURE, and GRINS::Cache::THERMO_PRESSURE.

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

62  {
63  const libMesh::Real T = cache.get_cached_values(Cache::TEMPERATURE)[qp];
64  const libMesh::Real P = cache.get_cached_values(Cache::THERMO_PRESSURE)[qp];
65  const std::vector<libMesh::Real>& Y = cache.get_cached_vector_values(Cache::MASS_FRACTIONS)[qp];
66 
67  libmesh_assert_equal_to( Y.size(), _cantera_gas.nSpecies() );
68 
69  libMesh::Real mu = 0.0;
70 
71  {
72  libMesh::Threads::spin_mutex::scoped_lock lock(cantera_mutex);
73 
76  try
77  {
78  _cantera_gas.setState_TPY(T, P, &Y[0]);
79  mu = _cantera_transport.viscosity();
80  }
81  catch(Cantera::CanteraError)
82  {
83  Cantera::showErrors(std::cerr);
84  libmesh_error();
85  }
86 
87  }
88 
89  return mu;
90  }
Cantera::IdealGasMix & _cantera_gas
Cantera::Transport & _cantera_transport
libMesh::Real mu(const CachedValues &cache, unsigned int qp) const

Member Data Documentation

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

Definition at line 79 of file cantera_transport.h.

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

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

Definition at line 81 of file cantera_transport.h.

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


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

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