Cantera  2.3.0
MixTransport.h
Go to the documentation of this file.
1 /**
2  * @file MixTransport.h
3  * Headers for the MixTransport object, which models transport properties
4  * in ideal gas solutions using a mixture averaged approximation
5  * (see \ref tranprops and \link Cantera::MixTransport MixTransport \endlink) .
6  */
7 
8 // This file is part of Cantera. See License.txt in the top-level directory or
9 // at http://www.cantera.org/license.txt for license and copyright information.
10 
11 #ifndef CT_MIXTRAN_H
12 #define CT_MIXTRAN_H
13 
14 #include "GasTransport.h"
16 
17 namespace Cantera
18 {
19 //! Class MixTransport implements mixture-averaged transport properties for
20 //! ideal gas mixtures.
21 /*!
22  * The model is based on that described in: R. J. Kee, M. J. Coltrin, and P.
23  * Glarborg, "Chemically Reacting Flow: Theory & Practice", John Wiley & Sons,
24  * 2003.
25  *
26  * The viscosity is computed using the Wilke mixture rule (kg /m /s)
27  *
28  * \f[
29  * \mu = \sum_k \frac{\mu_k X_k}{\sum_j \Phi_{k,j} X_j}.
30  * \f]
31  *
32  * Here \f$ \mu_k \f$ is the viscosity of pure species \e k, and
33  *
34  * \f[
35  * \Phi_{k,j} = \frac{\left[1
36  * + \sqrt{\left(\frac{\mu_k}{\mu_j}\sqrt{\frac{M_j}{M_k}}\right)}\right]^2}
37  * {\sqrt{8}\sqrt{1 + M_k/M_j}}
38  * \f]
39  *
40  * The thermal conductivity is computed from the following mixture rule:
41  * \f[
42  * \lambda = 0.5 \left( \sum_k X_k \lambda_k + \frac{1}{\sum_k X_k/\lambda_k} \right)
43  * \f]
44  *
45  * It's used to compute the flux of energy due to a thermal gradient
46  *
47  * \f[
48  * j_T = - \lambda \nabla T
49  * \f]
50  *
51  * The flux of energy has units of energy (kg m2 /s2) per second per area.
52  *
53  * The units of lambda are W / m K which is equivalent to kg m / s^3 K.
54  * @ingroup tranprops
55  */
56 class MixTransport : public GasTransport
57 {
58 public:
59  //! Default constructor.
60  MixTransport();
61 
62  MixTransport(const MixTransport& right);
63  MixTransport& operator=(const MixTransport& right);
64  virtual Transport* duplMyselfAsTransport() const;
65 
66  //! Return the model id for transport
67  /*!
68  * @return cMixtureAverage
69  */
70  virtual int model() const {
71  warn_deprecated("MixTransport::model",
72  "To be removed after Cantera 2.3.");
73  return cMixtureAveraged;
74  }
75 
76  virtual std::string transportType() const {
77  return "Mix";
78  }
79 
80  //! Return the thermal diffusion coefficients
81  /*!
82  * For this approximation, these are all zero.
83  *
84  * @param dt Vector of thermal diffusion coefficients. Units = kg/m/s
85  */
86  virtual void getThermalDiffCoeffs(doublereal* const dt);
87 
88  //! Returns the mixture thermal conductivity (W/m /K)
89  /*!
90  * The thermal conductivity is computed from the following mixture rule:
91  * \f[
92  * \lambda = 0.5 \left( \sum_k X_k \lambda_k + \frac{1}{\sum_k X_k/\lambda_k} \right)
93  * \f]
94  *
95  * It's used to compute the flux of energy due to a thermal gradient
96  *
97  * \f[
98  * j_T = - \lambda \nabla T
99  * \f]
100  *
101  * The flux of energy has units of energy (kg m2 /s2) per second per area.
102  *
103  * The units of lambda are W / m K which is equivalent to kg m / s^3 K.
104  *
105  * @returns the mixture thermal conductivity, with units of W/m/K
106  */
107  virtual doublereal thermalConductivity();
108 
109  //! Get the Electrical mobilities (m^2/V/s).
110  /*!
111  * This function returns the mobilities. In some formulations this is equal
112  * to the normal mobility multiplied by Faraday's constant.
113  *
114  * Here, the mobility is calculated from the diffusion coefficient using the
115  * Einstein relation
116  *
117  * \f[
118  * \mu^e_k = \frac{F D_k}{R T}
119  * \f]
120  *
121  * @param mobil Returns the mobilities of the species in array \c mobil.
122  * The array must be dimensioned at least as large as the
123  * number of species.
124  */
125  virtual void getMobilities(doublereal* const mobil);
126 
127  //! Update the internal parameters whenever the temperature has changed
128  /*!
129  * This is called whenever a transport property is requested if the
130  * temperature has changed since the last call to update_T().
131  */
132  virtual void update_T();
133 
134  //! Update the internal parameters whenever the concentrations have changed
135  /*!
136  * This is called whenever a transport property is requested if the
137  * concentrations have changed since the last call to update_C().
138  */
139  virtual void update_C();
140 
141  //! Get the species diffusive mass fluxes wrt to the mass averaged velocity,
142  //! given the gradients in mole fraction and temperature
143  /*!
144  * Units for the returned fluxes are kg m-2 s-1.
145  *
146  * The diffusive mass flux of species \e k is computed from
147  * \f[
148  * \vec{j}_k = -n M_k D_k \nabla X_k.
149  * \f]
150  *
151  * @param ndim Number of dimensions in the flux expressions
152  * @param grad_T Gradient of the temperature (length = ndim)
153  * @param ldx Leading dimension of the grad_X array
154  * (usually equal to m_nsp but not always)
155  * @param grad_X Gradients of the mole fraction. Flat vector with the
156  * m_nsp in the inner loop. length = ldx * ndim
157  * @param ldf Leading dimension of the fluxes array
158  * (usually equal to m_nsp but not always)
159  * @param fluxes Output of the diffusive mass fluxes. Flat vector with
160  * the m_nsp in the inner loop. length = ldx * ndim
161  */
162  virtual void getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
163  size_t ldx, const doublereal* const grad_X,
164  size_t ldf, doublereal* const fluxes);
165 
166  virtual void init(thermo_t* thermo, int mode=0, int log_level=0);
167 
168 private:
169  //! Calculate the pressure from the ideal gas law
170  doublereal pressure_ig() const {
171  return (m_thermo->molarDensity() * GasConstant *
172  m_thermo->temperature());
173  }
174 
175  //! Update the temperature dependent parts of the species thermal
176  //! conductivities
177  /*!
178  * These are evaluated from the polynomial fits of the temperature and are
179  * assumed to be independent of pressure
180  */
181  void updateCond_T();
182 
183  //! vector of species thermal conductivities (W/m /K)
184  /*!
185  * These are used in wilke's rule to calculate the viscosity of the
186  * solution. units = W /m /K = kg m /s^3 /K. length = m_kk.
187  */
189 
190  //! Internal storage for the calculated mixture thermal conductivity
191  /*!
192  * Units = W /m /K
193  */
194  doublereal m_lambda;
195 
196  //! Update boolean for the species thermal conductivities
198 
199  //! Update boolean for the mixture rule for the mixture thermal conductivity
201 
202  //! Debug flag - turns on more printing
203  bool m_debug;
204 };
205 }
206 #endif
virtual Transport * duplMyselfAsTransport() const
Duplication routine for objects which inherit from Transport.
vector_fp m_cond
vector of species thermal conductivities (W/m /K)
Definition: MixTransport.h:188
doublereal temperature() const
Temperature (K).
Definition: Phase.h:601
bool m_condmix_ok
Update boolean for the mixture rule for the mixture thermal conductivity.
Definition: MixTransport.h:200
virtual void update_C()
Update the internal parameters whenever the concentrations have changed.
thermo_t * m_thermo
pointer to the object representing the phase
Base class for transport property managers.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
virtual void getSpeciesFluxes(size_t ndim, const doublereal *const grad_T, size_t ldx, const doublereal *const grad_X, size_t ldf, doublereal *const fluxes)
Get the species diffusive mass fluxes wrt to the mass averaged velocity, given the gradients in mole ...
bool m_spcond_ok
Update boolean for the species thermal conductivities.
Definition: MixTransport.h:197
virtual void getMobilities(doublereal *const mobil)
Get the Electrical mobilities (m^2/V/s).
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:93
virtual void update_T()
Update the internal parameters whenever the temperature has changed.
void updateCond_T()
Update the temperature dependent parts of the species thermal conductivities.
doublereal molarDensity() const
Molar density (kmol/m^3).
Definition: Phase.cpp:666
virtual int model() const
Return the model id for transport.
Definition: MixTransport.h:70
virtual std::string transportType() const
Identifies the Transport object type.
Definition: MixTransport.h:76
doublereal pressure_ig() const
Calculate the pressure from the ideal gas law.
Definition: MixTransport.h:170
thermo_t & thermo()
MixTransport()
Default constructor.
doublereal m_lambda
Internal storage for the calculated mixture thermal conductivity.
Definition: MixTransport.h:194
bool m_debug
Debug flag - turns on more printing.
Definition: MixTransport.h:203
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:157
Headers for the DenseMatrix object, which deals with dense rectangular matrices and description of th...
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Definition: ct_defs.h:64
virtual void getThermalDiffCoeffs(doublereal *const dt)
Return the thermal diffusion coefficients.
virtual void init(thermo_t *thermo, int mode=0, int log_level=0)
Initialize a transport manager.
Namespace for the Cantera kernel.
Definition: application.cpp:29
Class MixTransport implements mixture-averaged transport properties for ideal gas mixtures...
Definition: MixTransport.h:56
virtual doublereal thermalConductivity()
Returns the mixture thermal conductivity (W/m /K)
Class GasTransport implements some functions and properties that are shared by the MixTransport and M...
Definition: GasTransport.h:22