Cantera  2.3.0
GasTransport.h
Go to the documentation of this file.
1 /**
2  * @file GasTransport.h
3  */
4
5 // This file is part of Cantera. See License.txt in the top-level directory or
7
8 #ifndef CT_GAS_TRANSPORT_H
9 #define CT_GAS_TRANSPORT_H
10
11 #include "TransportBase.h"
13
14 namespace Cantera
15 {
16
17 class MMCollisionInt;
18
19 //! Class GasTransport implements some functions and properties that are
20 //! shared by the MixTransport and MultiTransport classes.
21 //! @ingroup tranprops
22 class GasTransport : public Transport
23 {
24 public:
25  GasTransport(const GasTransport& right);
26  GasTransport& operator=(const GasTransport& right);
27
28  //! Viscosity of the mixture (kg /m /s)
29  /*!
30  * The viscosity is computed using the Wilke mixture rule (kg /m /s)
31  *
32  * \f[
33  * \mu = \sum_k \frac{\mu_k X_k}{\sum_j \Phi_{k,j} X_j}.
34  * \f]
35  *
36  * Here \f$\mu_k \f$ is the viscosity of pure species \e k, and
37  *
38  * \f[
39  * \Phi_{k,j} = \frac{\left[1
40  * + \sqrt{\left(\frac{\mu_k}{\mu_j}\sqrt{\frac{M_j}{M_k}}\right)}\right]^2}
41  * {\sqrt{8}\sqrt{1 + M_k/M_j}}
42  * \f]
43  *
44  * @returns the viscosity of the mixture (units = Pa s = kg /m /s)
45  *
46  * @see updateViscosity_T();
47  */
48  virtual doublereal viscosity();
49
50  //! Get the pure-species viscosities
51  virtual void getSpeciesViscosities(doublereal* const visc) {
52  update_T();
54  std::copy(m_visc.begin(), m_visc.end(), visc);
55  }
56
57  //! Returns the matrix of binary diffusion coefficients.
58  /*!
59  * d[ld*j + i] = rp * m_bdiff(i,j);
60  *
61  * @param ld offset of rows in the storage
62  * @param d output vector of diffusion coefficients. Units of m**2 / s
63  */
64  virtual void getBinaryDiffCoeffs(const size_t ld, doublereal* const d);
65
66  //! Returns the Mixture-averaged diffusion coefficients [m^2/s].
67  /*!
68  * Returns the mixture averaged diffusion coefficients for a gas,
69  * appropriate for calculating the mass averaged diffusive flux with respect
70  * to the mass averaged velocity using gradients of the mole fraction.
71  * Note, for the single species case or the pure fluid case the routine
72  * returns the self-diffusion coefficient. This is needed to avoid a Nan
73  * result in the formula below.
74  *
75  * This is Eqn. 12.180 from "Chemically Reacting Flow"
76  *
77  * \f[
78  * 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}
79  * \f]
80  *
81  * @param[out] d Vector of mixture diffusion coefficients, \f$D_{km}' \f$ ,
82  * for each species (m^2/s). length m_nsp
83  */
84  virtual void getMixDiffCoeffs(doublereal* const d);
85
86  //! Returns the mixture-averaged diffusion coefficients [m^2/s].
87  //! These are the coefficients for calculating the molar diffusive fluxes
88  //! from the species mole fraction gradients, computed according to
89  //! Eq. 12.176 in "Chemically Reacting Flow":
90  //!
91  //! \f[ D_{km}^* = \frac{1-X_k}{\sum_{j \ne k}^K X_j/\mathcal{D}_{kj}} \f]
92  //!
93  //! @param[out] d vector of mixture-averaged diffusion coefficients for
94  //! each species, length m_nsp.
95  virtual void getMixDiffCoeffsMole(doublereal* const d);
96
97  //! Returns the mixture-averaged diffusion coefficients [m^2/s].
98  /*!
99  * These are the coefficients for calculating the diffusive mass fluxes
100  * from the species mass fraction gradients, computed according to
101  * Eq. 12.178 in "Chemically Reacting Flow":
102  *
103  * \f[
104  * \frac{1}{D_{km}} = \sum_{j \ne k}^K \frac{X_j}{\mathcal{D}_{kj}} +
105  * \frac{X_k}{1-Y_k} \sum_{j \ne k}^K \frac{Y_j}{\mathcal{D}_{kj}}
106  * \f]
107  *
108  * @param[out] d vector of mixture-averaged diffusion coefficients for
109  * each species, length m_nsp.
110  */
111  virtual void getMixDiffCoeffsMass(doublereal* const d);
112
113  virtual void init(thermo_t* thermo, int mode=0, int log_level=0);
114
115 protected:
117
118  virtual void update_T();
119  virtual void update_C() = 0;
120
121  //! Update the temperature-dependent viscosity terms.
122  /**
123  * Updates the array of pure species viscosities, and the weighting
124  * functions in the viscosity mixture rule. The flag m_visc_ok is set to true.
125  *
126  * The formula for the weighting function is from Poling and Prausnitz,
127  * Eq. (9-5.14):
128  * \f[
129  * \phi_{ij} = \frac{ \left[ 1 + \left( \mu_i / \mu_j \right)^{1/2} \left( M_j / M_i \right)^{1/4} \right]^2 }
130  * {\left[ 8 \left( 1 + M_i / M_j \right) \right]^{1/2}}
131  * \f]
132  */
133  virtual void updateViscosity_T();
134
135  //! Update the pure-species viscosities. These are evaluated from the
136  //! polynomial fits of the temperature and are assumed to be independent
137  //! of pressure.
139
140  //! Update the binary diffusion coefficients
141  /*!
142  * These are evaluated from the polynomial fits of the temperature at the
143  * unit pressure of 1 Pa.
144  */
145  virtual void updateDiff_T();
146
147  //! @name Initialization
148  //! @{
149
150  //! Prepare to build a new kinetic-theory-based transport manager for
151  //! low-density gases
152  /*!
153  * Uses polynomial fits to Monchick & Mason collision integrals.
154  */
155  void setupMM();
156
157  //! Read the transport database
158  /*!
159  * Read transport property data from a file for a list of species. Given the
160  * name of a file containing transport property parameters and a list of
161  * species names.
162  */
163  void getTransportData();
164
165  //! Corrections for polar-nonpolar binary diffusion coefficients
166  /*!
167  * Calculate corrections to the well depth parameter and the diameter for
168  * use in computing the binary diffusion coefficient of polar-nonpolar
170  * Royal Society (1968).
171  *
172  * @param i Species one - this is a bimolecular correction routine
173  * @param j species two - this is a bimolecular correction routine
174  * @param f_eps Multiplicative correction factor to be applied to epsilon(i,j)
175  * @param f_sigma Multiplicative correction factor to be applied to diam(i,j)
176  */
177  void makePolarCorrections(size_t i, size_t j, doublereal& f_eps,
178  doublereal& f_sigma);
179
180  //! Generate polynomial fits to collision integrals
181  /*!
182  * @param integrals interpolator for the collision integrals
183  */
184  void fitCollisionIntegrals(MMCollisionInt& integrals);
185
186  //! Generate polynomial fits to the viscosity, conductivity, and
187  //! the binary diffusion coefficients
188  /*!
189  * If CK_mode, then the fits are of the form
190  * \f[
191  * \log(\eta(i)) = \sum_{n = 0}^3 a_n(i) (\log T)^n
192  * \f]
193  * and
194  * \f[
195  * \log(D(i,j)) = \sum_{n = 0}^3 a_n(i,j) (\log T)^n
196  * \f]
197  * Otherwise the fits are of the form
198  * \f[
199  * \eta(i)/sqrt(k_BT) = \sum_{n = 0}^4 a_n(i) (\log T)^n
200  * \f]
201  * and
202  * \f[
203  * D(i,j)/sqrt(k_BT)) = \sum_{n = 0}^4 a_n(i,j) (\log T)^n
204  * \f]
205  *
206  * @param integrals interpolator for the collision integrals
207  */
208  void fitProperties(MMCollisionInt& integrals);
209
210  //! Second-order correction to the binary diffusion coefficients
211  /*!
212  * Calculate second-order corrections to binary diffusion coefficient pair
213  * (dkj, djk). At first order, the binary diffusion coefficients are
214  * independent of composition, and d(k,j) = d(j,k). But at second order,
215  * there is a weak dependence on composition, with the result that d(k,j) !=
216  * d(j,k). This method computes the multiplier by which the first-order
217  * binary diffusion coefficient should be multiplied to produce the value
218  * correct to second order. The expressions here are taken from Marerro and
219  * Mason, J. Phys. Chem. Ref. Data, vol. 1, p. 3 (1972).
220  *
221  * @param t Temperature (K)
222  * @param integrals interpolator for the collision integrals
223  * @param k index of first species
224  * @param j index of second species
225  * @param xk Mole fraction of species k
226  * @param xj Mole fraction of species j
227  * @param fkj multiplier for d(k,j)
228  * @param fjk multiplier for d(j,k)
229  *
230  * @note This method is not used currently.
231  */
232  void getBinDiffCorrection(doublereal t, MMCollisionInt& integrals, size_t k,
233  size_t j, doublereal xk, doublereal xj,
234  doublereal& fkj, doublereal& fjk);
235
236  //! @}
237
238  //! Vector of species mole fractions. These are processed so that all mole
239  //! fractions are >= *Tiny*. Length = m_kk.
241
242  //! Internal storage for the viscosity of the mixture (kg /m /s)
243  doublereal m_viscmix;
244
245  //! Update boolean for mixture rule for the mixture viscosity
246  bool m_visc_ok;
247
248  //! Update boolean for the weighting factors for the mixture viscosity
250
251  //! Update boolean for the species viscosities
253
254  //! Update boolean for the binary diffusivities at unit pressure
256
257  //! Type of the polynomial fits to temperature. CK_Mode means Chemkin mode.
258  //! Currently CA_Mode is used which are different types of fits to temperature.
259  int m_mode;
260
261  //! m_phi is a Viscosity Weighting Function. size = m_nsp * n_nsp
263
264  //! work space length = m_kk
266
267  //! vector of species viscosities (kg /m /s). These are used in Wilke's
268  //! rule to calculate the viscosity of the solution. length = m_kk.
270
271  //! Polynomial fits to the viscosity of each species. m_visccoeffs[k] is
272  //! the vector of polynomial coefficients for species k that fits the
273  //! viscosity as a function of temperature.
274  std::vector<vector_fp> m_visccoeffs;
275
276  //! Local copy of the species molecular weights.
278
279  //! Holds square roots of molecular weight ratios
280  /*!
281  * @code
282  * m_wratjk(j,k) = sqrt(mw[j]/mw[k]) j < k
283  * m_wratjk(k,j) = sqrt(sqrt(mw[j]/mw[k])) j < k
284  * @endcode
285  */
287
288  //! Holds square roots of molecular weight ratios
289  /*!
290  * m_wratjk1(j,k) = sqrt(1.0 + mw[k]/mw[j]) j < k
291  */
293
294  //! vector of square root of species viscosities sqrt(kg /m /s). These are
295  //! used in Wilke's rule to calculate the viscosity of the solution.
296  //! length = m_kk.
298
299  //! Powers of the ln temperature, up to fourth order
301
302  //! Current value of the temperature at which the properties in this object
303  //! are calculated (Kelvin).
304  doublereal m_temp;
305
306  //! Current value of Boltzmann constant times the temperature (Joules)
307  doublereal m_kbt;
308
309  //! current value of Boltzmann constant times the temperature.
310  //! (Joules) to 1/2 power
311  doublereal m_sqrt_kbt;
312
313  //! current value of temperature to 1/2 power
314  doublereal m_sqrt_t;
315
316  //! Current value of the log of the temperature
317  doublereal m_logt;
318
319  //! Current value of temperature to 1/4 power
320  doublereal m_t14;
321
322  //! Current value of temperature to the 3/2 power
323  doublereal m_t32;
324
325  //! Polynomial fits to the binary diffusivity of each species
326  /*!
327  * m_diffcoeff[ic] is vector of polynomial coefficients for species i
328  * species j that fits the binary diffusion coefficient. The relationship
329  * between i j and ic is determined from the following algorithm:
330  *
331  * int ic = 0;
332  * for (i = 0; i < m_nsp; i++) {
333  * for (j = i; j < m_nsp; j++) {
334  * ic++;
335  * }
336  * }
337  */
338  std::vector<vector_fp> m_diffcoeffs;
339
340  //! Matrix of binary diffusion coefficients at the reference pressure and
341  //! the current temperature Size is nsp x nsp.
343
344  //! temperature fits of the heat conduction
345  /*!
346  * Dimensions are number of species (nsp) polynomial order of the collision
347  * integral fit (degree+1).
348  */
349  std::vector<vector_fp> m_condcoeffs;
350
351  //! Indices for the (i,j) interaction in collision integral fits
352  /*!
353  * m_poly[i][j] contains the index for (i,j) interactions in
354  * #m_omega22_poly, #m_astar_poly, #m_bstar_poly, and #m_cstar_poly.
355  */
356  std::vector<vector_int> m_poly;
357
358  //! Fit for omega22 collision integral
359  /*!
360  * m_omega22_poly[m_poly[i][j]] is the vector of polynomial coefficients
361  * (length degree+1) for the collision integral fit for the species pair
362  * (i,j).
363  */
364  std::vector<vector_fp> m_omega22_poly;
365
366  //! Fit for astar collision integral
367  /*!
368  * m_astar_poly[m_poly[i][j]] is the vector of polynomial coefficients
369  * (length degree+1) for the collision integral fit for the species pair
370  * (i,j).
371  */
372  std::vector<vector_fp> m_astar_poly;
373
374  //! Fit for bstar collision integral
375  /*!
376  * m_bstar_poly[m_poly[i][j]] is the vector of polynomial coefficients
377  * (length degree+1) for the collision integral fit for the species pair
378  * (i,j).
379  */
380  std::vector<vector_fp> m_bstar_poly;
381
382  //! Fit for cstar collision integral
383  /*!
384  * m_bstar_poly[m_poly[i][j]] is the vector of polynomial coefficients
385  * (length degree+1) for the collision integral fit for the species pair
386  * (i,j).
387  */
388  std::vector<vector_fp> m_cstar_poly;
389
390  //! Rotational relaxation number for each species
391  /*!
392  * length is the number of species in the phase. units are dimensionless
393  */
395
396  //! Dimensionless rotational heat capacity of each species
397  /*!
398  * These values are 0, 1 and 1.5 for single-molecule, linear, and nonlinear
399  * species respectively length is the number of species in the phase.
400  * Dimensionless (Cr / R)
401  */
403
404  //! Vector of booleans indicating whether a species is a polar molecule
405  /*!
406  * Length is nsp
407  */
408  std::vector<bool> m_polar;
409
410  //! Polarizability of each species in the phase
411  /*!
412  * Length = nsp. Units = m^3
413  */
415
416  //! Lennard-Jones well-depth of the species in the current phase
417  /*!
418  * length is the number of species in the phase. Units are Joules (Note this
419  * is not Joules/kmol) (note, no kmol -> this is a per molecule amount)
420  */
422
423  //! Lennard-Jones diameter of the species in the current phase
424  /*!
425  * length is the number of species in the phase. units are in meters.
426  */
428
429  //! This is the reduced mass of the interaction between species i and j
430  /*!
431  * reducedMass(i,j) = mw[i] * mw[j] / (Avogadro * (mw[i] + mw[j]));
432  *
433  * Units are kg (note, no kmol -> this is a per molecule amount)
434  *
435  * Length nsp * nsp. This is a symmetric matrix
436  */
438
439  //! hard-sphere diameter for (i,j) collision
440  /*!
441  * diam(i,j) = 0.5*(sigma[i] + sigma[j]);
442  * Units are m (note, no kmol -> this is a per molecule amount)
443  *
444  * Length nsp * nsp. This is a symmetric matrix.
445  */
447
448  //! The effective well depth for (i,j) collisions
449  /*!
450  * epsilon(i,j) = sqrt(eps[i]*eps[j]);
451  * Units are Joules (note, no kmol -> this is a per molecule amount)
452  *
453  * Length nsp * nsp. This is a symmetric matrix.
454  */
456
457  //! The effective dipole moment for (i,j) collisions
458  /*!
459  * Given dipoleMoment in Debye (a Debye is 3.335e-30 C-m):
460  *
461  * dipole(i,i) = 1.e-21 / lightSpeed * dipoleMoment;
462  * dipole(i,j) = sqrt(dipole(i,i) * dipole(j,j));
463  * (note, no kmol -> this is a per molecule amount)
464  *
465  * Length nsp * nsp. This is a symmetric matrix.
466  */
468
469  //! Reduced dipole moment of the interaction between two species
470  /*!
471  * This is the reduced dipole moment of the interaction between two species
472  * 0.5 * dipole(i,j)^2 / (4 * Pi * epsilon_0 * epsilon(i,j) * d^3);
473  *
474  * Length nsp * nsp .This is a symmetric matrix
475  */
477
478  //! Pitzer acentric factor
479  /*!
480  * Length is the number of species in the phase. Dimensionless.
481  */
483
484  //! Level of verbose printing during initialization
486 };
487
488 } // namespace Cantera
489
490 #endif
Update the pure-species viscosities.
void fitProperties(MMCollisionInt &integrals)
Generate polynomial fits to the viscosity, conductivity, and the binary diffusion coefficients...
DenseMatrix m_dipole
The effective dipole moment for (i,j) collisions.
Definition: GasTransport.h:467
bool m_visc_ok
Update boolean for mixture rule for the mixture viscosity.
Definition: GasTransport.h:246
std::vector< bool > m_polar
Vector of booleans indicating whether a species is a polar molecule.
Definition: GasTransport.h:408
std::vector< vector_fp > m_diffcoeffs
Polynomial fits to the binary diffusivity of each species.
Definition: GasTransport.h:338
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal *const d)
Returns the matrix of binary diffusion coefficients.
Headers for the Transport object, which is the virtual base class for all transport property evaluato...
bool m_bindiff_ok
Update boolean for the binary diffusivities at unit pressure.
Definition: GasTransport.h:255
Base class for transport property managers.
DenseMatrix m_wratjk
Holds square roots of molecular weight ratios.
Definition: GasTransport.h:286
DenseMatrix m_bdiff
Matrix of binary diffusion coefficients at the reference pressure and the current temperature Size is...
Definition: GasTransport.h:342
doublereal m_temp
Current value of the temperature at which the properties in this object are calculated (Kelvin)...
Definition: GasTransport.h:304
std::vector< vector_fp > m_cstar_poly
Fit for cstar collision integral.
Definition: GasTransport.h:388
virtual void updateViscosity_T()
Update the temperature-dependent viscosity terms.
void setupMM()
Prepare to build a new kinetic-theory-based transport manager for low-density gases.
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:93
int m_mode
Type of the polynomial fits to temperature.
Definition: GasTransport.h:259
std::vector< vector_fp > m_omega22_poly
Fit for omega22 collision integral.
Definition: GasTransport.h:364
doublereal m_sqrt_kbt
current value of Boltzmann constant times the temperature.
Definition: GasTransport.h:311
virtual void updateDiff_T()
Update the binary diffusion coefficients.
virtual void init(thermo_t *thermo, int mode=0, int log_level=0)
Initialize a transport manager.
vector_fp m_visc
vector of species viscosities (kg /m /s).
Definition: GasTransport.h:269
vector_fp m_spwork
work space length = m_kk
Definition: GasTransport.h:265
virtual void getMixDiffCoeffs(doublereal *const d)
Returns the Mixture-averaged diffusion coefficients [m^2/s].
std::vector< vector_fp > m_bstar_poly
Fit for bstar collision integral.
Definition: GasTransport.h:380
vector_fp m_sigma
Lennard-Jones diameter of the species in the current phase.
Definition: GasTransport.h:427
std::vector< vector_fp > m_astar_poly
Fit for astar collision integral.
Definition: GasTransport.h:372
vector_fp m_eps
Lennard-Jones well-depth of the species in the current phase.
Definition: GasTransport.h:421
vector_fp m_polytempvec
Powers of the ln temperature, up to fourth order.
Definition: GasTransport.h:300
bool m_spvisc_ok
Update boolean for the species viscosities.
Definition: GasTransport.h:252
virtual void getMixDiffCoeffsMole(doublereal *const d)
Returns the mixture-averaged diffusion coefficients [m^2/s].
std::vector< vector_int > m_poly
Indices for the (i,j) interaction in collision integral fits.
Definition: GasTransport.h:356
bool m_viscwt_ok
Update boolean for the weighting factors for the mixture viscosity.
Definition: GasTransport.h:249
DenseMatrix m_phi
m_phi is a Viscosity Weighting Function. size = m_nsp * n_nsp
Definition: GasTransport.h:262
virtual void getSpeciesViscosities(doublereal *const visc)
Get the pure-species viscosities.
Definition: GasTransport.h:51
doublereal m_t14
Current value of temperature to 1/4 power.
Definition: GasTransport.h:320
virtual void getMixDiffCoeffsMass(doublereal *const d)
Returns the mixture-averaged diffusion coefficients [m^2/s].
thermo_t & thermo()
DenseMatrix m_reducedMass
This is the reduced mass of the interaction between species i and j.
Definition: GasTransport.h:437
void fitCollisionIntegrals(MMCollisionInt &integrals)
Generate polynomial fits to collision integrals.
vector_fp m_zrot
Rotational relaxation number for each species.
Definition: GasTransport.h:394
void getBinDiffCorrection(doublereal t, MMCollisionInt &integrals, size_t k, size_t j, doublereal xk, doublereal xj, doublereal &fkj, doublereal &fjk)
Second-order correction to the binary diffusion coefficients.
vector_fp m_sqvisc
vector of square root of species viscosities sqrt(kg /m /s).
Definition: GasTransport.h:297
DenseMatrix m_epsilon
The effective well depth for (i,j) collisions.
Definition: GasTransport.h:455
vector_fp m_crot
Dimensionless rotational heat capacity of each species.
Definition: GasTransport.h:402
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
vector_fp m_w_ac
Pitzer acentric factor.
Definition: GasTransport.h:482
doublereal m_sqrt_t
current value of temperature to 1/2 power
Definition: GasTransport.h:314
DenseMatrix m_diam
hard-sphere diameter for (i,j) collision
Definition: GasTransport.h:446
Headers for the DenseMatrix object, which deals with dense rectangular matrices and description of th...
doublereal m_logt
Current value of the log of the temperature.
Definition: GasTransport.h:317
DenseMatrix m_wratkj1
Holds square roots of molecular weight ratios.
Definition: GasTransport.h:292
void getTransportData()
void makePolarCorrections(size_t i, size_t j, doublereal &f_eps, doublereal &f_sigma)
Corrections for polar-nonpolar binary diffusion coefficients.
Calculation of Collision integrals.
DenseMatrix m_delta
Reduced dipole moment of the interaction between two species.
Definition: GasTransport.h:476
doublereal m_viscmix
Internal storage for the viscosity of the mixture (kg /m /s)
Definition: GasTransport.h:243
std::vector< vector_fp > m_condcoeffs
temperature fits of the heat conduction
Definition: GasTransport.h:349
doublereal m_kbt
Current value of Boltzmann constant times the temperature (Joules)
Definition: GasTransport.h:307
Namespace for the Cantera kernel.
Definition: application.cpp:29
doublereal m_t32
Current value of temperature to the 3/2 power.
Definition: GasTransport.h:323
virtual doublereal viscosity()
Viscosity of the mixture (kg /m /s)
std::vector< vector_fp > m_visccoeffs
Polynomial fits to the viscosity of each species.
Definition: GasTransport.h:274
int m_log_level
Level of verbose printing during initialization.
Definition: GasTransport.h:485
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
Definition: DenseMatrix.h:72
vector_fp m_molefracs
Vector of species mole fractions.
Definition: GasTransport.h:240
Class GasTransport implements some functions and properties that are shared by the MixTransport and M...
Definition: GasTransport.h:22
vector_fp m_alpha
Polarizability of each species in the phase.
Definition: GasTransport.h:414
vector_fp m_mw
Local copy of the species molecular weights.
Definition: GasTransport.h:277