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