Cantera  3.1.0a1
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 https://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 Kee, et al. @cite kee2003.
23  *
24  * The viscosity is computed using the Wilke mixture rule (kg /m /s)
25  *
26  * @f[
27  * \mu = \sum_k \frac{\mu_k X_k}{\sum_j \Phi_{k,j} X_j}.
28  * @f]
29  *
30  * Here @f$ \mu_k @f$ is the viscosity of pure species @e k, and
31  *
32  * @f[
33  * \Phi_{k,j} = \frac{\left[1
34  * + \sqrt{\left(\frac{\mu_k}{\mu_j}\sqrt{\frac{M_j}{M_k}}\right)}\right]^2}
35  * {\sqrt{8}\sqrt{1 + M_k/M_j}}
36  * @f]
37  *
38  * The thermal conductivity is computed from the following mixture rule:
39  * @f[
40  * \lambda = 0.5 \left( \sum_k X_k \lambda_k + \frac{1}{\sum_k X_k/\lambda_k} \right)
41  * @f]
42  *
43  * It's used to compute the flux of energy due to a thermal gradient
44  *
45  * @f[
46  * j_T = - \lambda \nabla T
47  * @f]
48  *
49  * The flux of energy has units of energy (kg m2 /s2) per second per area.
50  *
51  * The units of lambda are W / m K which is equivalent to kg m / s^3 K.
52  * @ingroup tranprops
53  */
54 class MixTransport : public GasTransport
55 {
56 public:
57  //! Default constructor.
58  MixTransport() = default;
59 
60  string transportModel() const override {
61  return (m_mode == CK_Mode) ? "mixture-averaged-CK" : "mixture-averaged";
62  }
63 
64  //! Return the thermal diffusion coefficients
65  /*!
66  * For this approximation, these are all zero.
67  *
68  * @param dt Vector of thermal diffusion coefficients. Units = kg/m/s
69  */
70  void getThermalDiffCoeffs(double* const dt) override;
71 
72  //! Returns the mixture thermal conductivity (W/m /K)
73  /*!
74  * The thermal conductivity is computed from the following mixture rule:
75  * @f[
76  * \lambda = 0.5 \left( \sum_k X_k \lambda_k + \frac{1}{\sum_k X_k/\lambda_k} \right)
77  * @f]
78  *
79  * It's used to compute the flux of energy due to a thermal gradient
80  *
81  * @f[
82  * j_T = - \lambda \nabla T
83  * @f]
84  *
85  * The flux of energy has units of energy (kg m2 /s2) per second per area.
86  *
87  * The units of lambda are W / m K which is equivalent to kg m / s^3 K.
88  *
89  * @returns the mixture thermal conductivity, with units of W/m/K
90  */
91  double thermalConductivity() override;
92 
93  //! Get the Electrical mobilities (m^2/V/s).
94  /*!
95  * This function returns the mobilities. In some formulations this is equal
96  * to the normal mobility multiplied by Faraday's constant.
97  *
98  * Here, the mobility is calculated from the diffusion coefficient using the
99  * Einstein relation
100  *
101  * @f[
102  * \mu^e_k = \frac{F D_k}{R T}
103  * @f]
104  *
105  * @param mobil Returns the mobilities of the species in array @c mobil.
106  * The array must be dimensioned at least as large as the
107  * number of species.
108  */
109  void getMobilities(double* const mobil) override;
110 
111  //! Update the internal parameters whenever the temperature has changed
112  /*!
113  * This is called whenever a transport property is requested if the
114  * temperature has changed since the last call to update_T().
115  */
116  void update_T() override;
117 
118  //! Update the internal parameters whenever the concentrations have changed
119  /*!
120  * This is called whenever a transport property is requested if the
121  * concentrations have changed since the last call to update_C().
122  */
123  void update_C() override;
124 
125  //! Get the species diffusive mass fluxes wrt to the mass averaged velocity,
126  //! given the gradients in mole fraction and temperature
127  /*!
128  * Units for the returned fluxes are kg m-2 s-1.
129  *
130  * The diffusive mass flux of species @e k is computed from
131  * @f[
132  * \vec{j}_k = -n M_k D_k \nabla X_k.
133  * @f]
134  *
135  * @param ndim Number of dimensions in the flux expressions
136  * @param grad_T Gradient of the temperature (length = ndim)
137  * @param ldx Leading dimension of the grad_X array
138  * (usually equal to m_nsp but not always)
139  * @param grad_X Gradients of the mole fraction. Flat vector with the
140  * m_nsp in the inner loop. length = ldx * ndim
141  * @param ldf Leading dimension of the fluxes array
142  * (usually equal to m_nsp but not always)
143  * @param fluxes Output of the diffusive mass fluxes. Flat vector with
144  * the m_nsp in the inner loop. length = ldx * ndim
145  */
146  void getSpeciesFluxes(size_t ndim, const double* const grad_T,
147  size_t ldx, const double* const grad_X,
148  size_t ldf, double* const fluxes) override;
149 
150  void init(ThermoPhase* thermo, int mode=0, int log_level=0) override;
151 
152 protected:
153  //! Update the temperature dependent parts of the species thermal
154  //! conductivities
155  /*!
156  * These are evaluated from the polynomial fits of the temperature and are
157  * assumed to be independent of pressure
158  */
159  void updateCond_T();
160 
161  //! vector of species thermal conductivities (W/m /K)
162  /*!
163  * These are used in wilke's rule to calculate the viscosity of the
164  * solution. units = W /m /K = kg m /s^3 /K. length = m_kk.
165  */
166  vector<double> m_cond;
167 
168  //! Internal storage for the calculated mixture thermal conductivity
169  /*!
170  * Units = W /m /K
171  */
172  double m_lambda = 0.0;
173 
174  //! Update boolean for the species thermal conductivities
175  bool m_spcond_ok = false;
176 
177  //! Update boolean for the mixture rule for the mixture thermal conductivity
178  bool m_condmix_ok = false;
179 };
180 }
181 #endif
Headers for the DenseMatrix object, which deals with dense rectangular matrices and description of th...
Class GasTransport implements some functions and properties that are shared by the MixTransport and M...
Definition: GasTransport.h:26
int m_mode
Type of the polynomial fits to temperature.
Definition: GasTransport.h:316
Class MixTransport implements mixture-averaged transport properties for ideal gas mixtures.
Definition: MixTransport.h:55
void update_T() override
Update the internal parameters whenever the temperature has changed.
double thermalConductivity() override
Returns the mixture thermal conductivity (W/m /K)
bool m_spcond_ok
Update boolean for the species thermal conductivities.
Definition: MixTransport.h:175
void getSpeciesFluxes(size_t ndim, const double *const grad_T, size_t ldx, const double *const grad_X, size_t ldf, double *const fluxes) override
Get the species diffusive mass fluxes wrt to the mass averaged velocity, given the gradients in mole ...
double m_lambda
Internal storage for the calculated mixture thermal conductivity.
Definition: MixTransport.h:172
void updateCond_T()
Update the temperature dependent parts of the species thermal conductivities.
void getMobilities(double *const mobil) override
Get the Electrical mobilities (m^2/V/s).
void update_C() override
Update the internal parameters whenever the concentrations have changed.
vector< double > m_cond
vector of species thermal conductivities (W/m /K)
Definition: MixTransport.h:166
void getThermalDiffCoeffs(double *const dt) override
Return the thermal diffusion coefficients.
string transportModel() const override
Identifies the model represented by this Transport object.
Definition: MixTransport.h:60
MixTransport()=default
Default constructor.
bool m_condmix_ok
Update boolean for the mixture rule for the mixture thermal conductivity.
Definition: MixTransport.h:178
void init(ThermoPhase *thermo, int mode=0, int log_level=0) override
Initialize a transport manager.
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:390
ThermoPhase & thermo()
Phase object.
Definition: Transport.h:103
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:564