Cantera
2.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
include
cantera
transport
GasTransport.h
Go to the documentation of this file.
1
/**
2
* @file GasTransport.h
3
*/
4
5
#ifndef CT_GAS_TRANSPORT_H
6
#define CT_GAS_TRANSPORT_H
7
8
#include "
TransportBase.h
"
9
10
namespace
Cantera {
11
12
//! Class GasTransport implements some functions and properties that are
13
//! shared by the MixTransport and MultiTransport classes.
14
class
GasTransport
:
public
Transport
15
{
16
public
:
17
virtual
~
GasTransport
() {}
18
GasTransport
(
const
GasTransport
& right);
19
GasTransport
& operator=(
const
GasTransport
& right);
20
21
//! Viscosity of the mixture (kg /m /s)
22
/*!
23
* The viscosity is computed using the Wilke mixture rule (kg /m /s)
24
*
25
* \f[
26
* \mu = \sum_k \frac{\mu_k X_k}{\sum_j \Phi_{k,j} X_j}.
27
* \f]
28
*
29
* Here \f$ \mu_k \f$ is the viscosity of pure species \e k, and
30
*
31
* \f[
32
* \Phi_{k,j} = \frac{\left[1
33
* + \sqrt{\left(\frac{\mu_k}{\mu_j}\sqrt{\frac{M_j}{M_k}}\right)}\right]^2}
34
* {\sqrt{8}\sqrt{1 + M_k/M_j}}
35
* \f]
36
*
37
* @return Returns the viscosity of the mixture ( units = Pa s = kg /m /s)
38
*
39
* @see updateViscosity_T();
40
*/
41
virtual
doublereal
viscosity
();
42
43
//! Get the pure-species viscosities
44
virtual
void
getSpeciesViscosities
(doublereal*
const
visc) {
45
update_T();
46
updateViscosity_T
();
47
std::copy(
m_visc
.begin(),
m_visc
.end(), visc);
48
}
49
50
//! Returns the matrix of binary diffusion coefficients.
51
/*!
52
* d[ld*j + i] = rp * m_bdiff(i,j);
53
*
54
* @param ld offset of rows in the storage
55
* @param d output vector of diffusion coefficients. Units of m**2 / s
56
*/
57
virtual
void
getBinaryDiffCoeffs
(
const
size_t
ld, doublereal*
const
d);
58
59
//! Returns the Mixture-averaged diffusion coefficients [m^2/s].
60
/*!
61
* Returns the mixture averaged diffusion coefficients for a gas,
62
* appropriate for calculating the mass averaged diffusive flux with respect
63
* to the mass averaged velocity using gradients of the mole fraction.
64
* Note, for the single species case or the pure fluid case the routine
65
* returns the self-diffusion coefficient. This is needed to avoid a Nan
66
* result in the formula below.
67
*
68
* This is Eqn. 12.180 from "Chemically Reacting Flow"
69
*
70
* \f[
71
* D_{km}' = \frac{\left( \bar{M} - X_k M_k \right)}{ \bar{\qquad M \qquad } } {\left( \sum_{j \ne k} \frac{X_j}{D_{kj}} \right) }^{-1}
72
* \f]
73
*
74
* @param[out] d Vector of mixture diffusion coefficients, \f$ D_{km}' \f$ ,
75
* for each species (m^2/s). length m_nsp
76
*/
77
virtual
void
getMixDiffCoeffs
(doublereal*
const
d);
78
79
//! Returns the mixture-averaged diffusion coefficients [m^2/s].
80
//! These are the coefficients for calculating the molar diffusive fluxes
81
//! from the species mole fraction gradients, computed according to
82
//! Eq. 12.176 in "Chemically Reacting Flow":
83
//!
84
//! \f[ D_{km}^* = \frac{1-X_k}{\sum_{j \ne k}^K X_j/\mathcal{D}_{kj}} \f]
85
//!
86
//! @param[out] d vector of mixture-averaged diffusion coefficients for
87
//! each species, length m_nsp.
88
virtual
void
getMixDiffCoeffsMole
(doublereal*
const
d);
89
90
//! Returns the mixture-averaged diffusion coefficients [m^2/s].
91
//! These are the coefficients for calculating the diffusive mass fluxes
92
//! from the species mass fraction gradients, computed according to
93
//! Eq. 12.178 in "Chemically Reacting Flow":
94
//!
95
//! \f[ \frac{1}{D_{km}} = \sum_{j \ne k}^K \frac{X_j}{\mathcal{D}_{kj}} +
96
//! \frac{X_k}{1-Y_k} \sum_{j \ne k}^K \frac{Y_j}{\mathcal{D}_{kj}} \f]
97
//!
98
//! @param[out] d vector of mixture-averaged diffusion coefficients for
99
//! each species, length m_nsp.
100
virtual
void
getMixDiffCoeffsMass
(doublereal*
const
d);
101
102
protected
:
103
GasTransport
(
ThermoPhase
*
thermo
=0);
104
105
virtual
bool
initGas
(
GasTransportParams
& tr);
106
virtual
void
update_T();
107
virtual
void
update_C() = 0;
108
109
//! Update the temperature-dependent viscosity terms.
110
/**
111
* Updates the array of pure species viscosities, and the weighting
112
* functions in the viscosity mixture rule. The flag m_visc_ok is set to true.
113
*
114
* The formula for the weighting function is from Poling and Prausnitz,
115
* Eq. (9-5.14):
116
* \f[
117
* \phi_{ij} = \frac{ \left[ 1 + \left( \mu_i / \mu_j \right)^{1/2} \left( M_j / M_i \right)^{1/4} \right]^2 }
118
* {\left[ 8 \left( 1 + M_i / M_j \right) \right]^{1/2}}
119
* \f]
120
*/
121
virtual
void
updateViscosity_T
();
122
123
//! Update the pure-species viscosities. These are evaluated from the
124
//! polynomial fits of the temperature and are assumed to be independent
125
//! of pressure.
126
virtual
void
updateSpeciesViscosities
();
127
128
//! Update the binary diffusion coefficients
129
/*!
130
* These are evaluated from the polynomial fits of the temperature at the unit pressure of 1 Pa.
131
*/
132
virtual
void
updateDiff_T
();
133
134
//! Vector of species mole fractions. These are processed so that all mole
135
//! fractions are >= MIN_X. Length = m_kk.
136
vector_fp
m_molefracs
;
137
138
//! Internal storage for the viscosity of the mixture (kg /m /s)
139
doublereal
m_viscmix
;
140
141
//! Update boolean for mixture rule for the mixture viscosity
142
bool
m_visc_ok
;
143
144
//! Update boolean for the weighting factors for the mixture viscosity
145
bool
m_viscwt_ok
;
146
147
//! Update boolean for the species viscosities
148
bool
m_spvisc_ok
;
149
150
//! Update boolean for the binary diffusivities at unit pressure
151
bool
m_bindiff_ok
;
152
153
//! Type of the polynomial fits to temperature. CK_Mode means Chemkin mode.
154
//! Currently CA_Mode is used which are different types of fits to temperature.
155
int
m_mode
;
156
157
//! m_phi is a Viscosity Weighting Function. size = m_nsp * n_nsp
158
DenseMatrix
m_phi
;
159
160
//! work space length = m_kk
161
vector_fp
m_spwork
;
162
163
//! vector of species viscosities (kg /m /s). These are used in Wilke's
164
//! rule to calculate the viscosity of the solution. length = m_kk.
165
vector_fp
m_visc
;
166
167
//! Polynomial fits to the viscosity of each species. m_visccoeffs[k] is
168
//! the vector of polynomial coefficients for species k that fits the
169
//! viscosity as a function of temperature.
170
std::vector<vector_fp>
m_visccoeffs
;
171
172
//! Local copy of the species molecular weights.
173
vector_fp
m_mw
;
174
175
//! Holds square roots of molecular weight ratios
176
/*!
177
* m_wratjk(j,k) = sqrt(mw[j]/mw[k]) j < k
178
* m_wratjk(k,j) = sqrt(sqrt(mw[j]/mw[k])) j < k
179
*/
180
DenseMatrix
m_wratjk
;
181
182
//! Holds square roots of molecular weight ratios
183
/*!
184
* m_wratjk1(j,k) = sqrt(1.0 + mw[k]/mw[j]) j < k
185
*/
186
DenseMatrix
m_wratkj1
;
187
188
//! vector of square root of species viscosities sqrt(kg /m /s). These are
189
//! used in Wilke's rule to calculate the viscosity of the solution.
190
//! length = m_kk.
191
vector_fp
m_sqvisc
;
192
193
//! Powers of the ln temperature, up to fourth order
194
vector_fp
m_polytempvec
;
195
196
//! Current value of the temperature at which the properties in this object
197
//! are calculated (Kelvin).
198
doublereal
m_temp
;
199
200
//! Current value of Boltzman's constant times the temperature (Joules)
201
doublereal
m_kbt
;
202
203
//! current value of Boltzman's constant times the temperature.
204
//! (Joules) to 1/2 power
205
doublereal
m_sqrt_kbt
;
206
207
//! current value of temperature to 1/2 power
208
doublereal
m_sqrt_t
;
209
210
//! Current value of the log of the temperature
211
doublereal
m_logt
;
212
213
//! Current value of temperature to 1/4 power
214
doublereal
m_t14
;
215
216
//! Current value of temperature to the 3/2 power
217
doublereal
m_t32
;
218
219
//! Polynomial fits to the binary diffusivity of each species
220
/*!
221
* m_diffcoeff[ic] is vector of polynomial coefficients for species i species j
222
* that fits the binary diffusion coefficient. The relationship between i
223
* j and ic is determined from the following algorithm:
224
*
225
* int ic = 0;
226
* for (i = 0; i < m_nsp; i++) {
227
* for (j = i; j < m_nsp; j++) {
228
* ic++;
229
* }
230
* }
231
*/
232
std::vector<vector_fp>
m_diffcoeffs
;
233
234
//! Matrix of binary diffusion coefficients at the reference pressure and the current temperature
235
//! Size is nsp x nsp.
236
DenseMatrix
m_bdiff
;
237
};
238
239
}
// namespace Cantera
240
241
#endif
Generated by
1.8.2