| Cantera 3.0.0

Loading...
Searching...
No Matches
DustyGasTransport.h
Go to the documentation of this file.
1/**
2 * @file DustyGasTransport.h Headers for the DustyGasTransport object, which
3 * models transport properties in porous media using the dusty gas
4 * approximation (see @ref tranprops and @link Cantera::DustyGasTransport
5 * DustyGasTransport @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_DUSTYGASTRAN_H
12#define CT_DUSTYGASTRAN_H
13
14// Cantera includes
15#include "Transport.h"
16#include "cantera/numerics/DenseMatrix.h"
17
18 namespace Cantera
19{
20//! Class DustyGasTransport implements the Dusty Gas model for transport in porous media.
21/*!
22 * As implemented here, only species transport is handled. The viscosity,
23 * thermal conductivity, and thermal diffusion coefficients are not implemented.
24 *
25 * The dusty gas model includes the effects of Darcy's law. There is a net flux
26 * of species due to a pressure gradient that is part of Darcy's law.
27 *
28 * The dusty gas model expresses the value of the molar flux of species
29 * @f$ k @f$, @f$ J_k @f$ by the following formula.
30 *
31 * @f[
32 * \sum_{j \ne k}{\frac{X_j J_k - X_k J_j}{D^e_{kj}}} + \frac{J_k}{\mathcal{D}^{e}_{k,knud}} =
33 * - \nabla C_k - \frac{C_k}{\mathcal{D}^{e}_{k,knud}} \frac{\kappa}{\mu} \nabla p
34 * @f]
35 *
36 * @f$ j @f$ is a sum over all species in the gas.
37 *
38 * The effective Knudsen diffusion coefficients are given by the following form
39 *
40 * @f[
41 * \mathcal{D}^e_{k,knud} = \frac{2}{3} \frac{r_{pore} \phi}{\tau} \left( \frac{8 R T}{\pi W_k} \right)^{1/2}
42 * @f]
43 *
44 * The effective knudsen diffusion coefficients take into account the effects of
45 * collisions of gas-phase molecules with the wall.
46 *
47 * For references on the Dusty Gas Model, see Zhu and Kee @cite zhu2006; Zhu, et al.
48 * @cite zhu2005; Mason and Malinauskas @cite mason1983; and Veldsink, et al.
49 * @cite veldsink1995.
50 * @ingroup tranprops
51 */
52 class DustyGasTransport : public Transport
53{
54 public:
55 //! default constructor
56 /*!
57 * @param thermo Pointer to the ThermoPhase object for this phase.
58 * Defaults to zero.
59 */
60 DustyGasTransport(ThermoPhase* thermo=0);
61
62 // overloaded base class methods
63
64 void setThermo(ThermoPhase& thermo) override;
65
66 string transportModel() const override {
67 return "DustyGas";
68 }
69
70 void getMultiDiffCoeffs(const size_t ld, double* const d) override;
71
72 //! Get the molar fluxes [kmol/m^2/s], given the thermodynamic state at two nearby points.
73 /*!
74 * @f[
75 * J_k = - \sum_{j = 1, N} \left[D^{multi}_{kj}\right]^{-1} \left( \nabla C_j + \frac{C_j}{\mathcal{D}^{knud}_j} \frac{\kappa}{\mu} \nabla p \right)
76 * @f]
77 *
78 * @param state1 Array of temperature, density, and mass fractions for state 1.
79 * @param state2 Array of temperature, density, and mass fractions for state 2.
80 * @param delta Distance from state 1 to state 2 (m).
81 *
82 * @param fluxes Vector of species molar fluxes due to diffusional driving force
83 */
84 void getMolarFluxes(const double* const state1, const double* const state2,
85 const double delta, double* const fluxes) override;
86
87 // new methods added in this class
88
89 //! Set the porosity (dimensionless)
90 /*!
91 * @param porosity Set the value of the porosity
92 */
93 void setPorosity(double porosity);
94
95 //! Set the tortuosity (dimensionless)
96 /*!
97 * Tortuosity is considered to be constant within the object
98 *
99 * @param tort Value of the tortuosity
100 */
101 void setTortuosity(double tort);
102
103 //! Set the mean pore radius (m)
104 /*!
105 * @param rbar Value of the pore radius ( m)
106 */
107 void setMeanPoreRadius(double rbar);
108
109 //! Set the mean particle diameter
110 /*!
111 * @param dbar Set the mean particle diameter (m)
112 */
113 void setMeanParticleDiameter(double dbar);
114
115 //! Set the permeability of the media
116 /*!
117 * If not set, the value for close-packed spheres will be used by default.
118 *
119 * The value for close-packed spheres is given below, where p is the
120 * porosity, t is the tortuosity, and d is the diameter of the sphere
121 *
122 * @f[
123 * \kappa = \frac{p^3 d^2}{72 t (1 - p)^2}
124 * @f]
125 *
126 * @param B set the permeability of the media (units = m^2)
127 */
128 void setPermeability(double B);
129
130 //! Return a reference to the transport manager used to compute the gas
131 //! binary diffusion coefficients and the viscosity.
132 /*!
133 * @returns a reference to the gas transport object
134 */
135 Transport& gasTransport();
136
137 //! Make the TransportFactory object a friend, because this object has
138 //! restricted its instantiation to classes which are friends.
139 friend class TransportFactory;
140
141 protected:
142 //! Initialization routine called by TransportFactory
143 /*!
144 * The DustyGas model is a subordinate model to the gas phase transport
145 * model. Here we set the gas phase models.
146 *
147 * This is a protected routine, so that initialization of the Model must
148 * occur within Cantera's setup
149 *
150 * @param phase Pointer to the underlying ThermoPhase model for the gas phase
151 * @param gastr Pointer to the underlying Transport model for transport in
152 * the gas phase.
153 */
154 void initialize(ThermoPhase* phase, Transport* gastr);
155
156 private:
157 //! Update temperature-dependent quantities within the object
158 /*!
159 * The object keeps a value m_temp, which is the temperature at which
160 * quantities were last evaluated at. If the temperature is changed, update
161 * Booleans are set false, triggering recomputation.
162 */
163 void updateTransport_T();
164
165 //! Update concentration-dependent quantities within the object
166 /*!
167 * The object keeps a value m_temp, which is the temperature at which
168 * quantities were last evaluated at. If the temperature is changed, update
169 * Booleans are set false, triggering recomputation.
170 */
171 void updateTransport_C();
172
173 //! Private routine to update the dusty gas binary diffusion coefficients
174 /*!
175 * The dusty gas binary diffusion coefficients @f$ D^{dg}_{i,j} @f$ are
176 * evaluated from the binary gas-phase diffusion coefficients @f$
177 * D^{bin}_{i,j} @f$ using the following formula
178 *
179 * @f[
180 * D^{dg}_{i,j} = \frac{\phi}{\tau} D^{bin}_{i,j}
181 * @f]
182 *
183 * where @f$ \phi @f$ is the porosity of the media and @f$ \tau @f$ is the
184 * tortuosity of the media.
185 */
186 void updateBinaryDiffCoeffs();
187
188 //! Update the Multicomponent diffusion coefficients that are used in the
189 //! approximation
190 /*!
191 * This routine updates the H matrix and then inverts it.
192 */
193 void updateMultiDiffCoeffs();
194
195 //! Update the Knudsen diffusion coefficients
196 /*!
197 * The Knudsen diffusion coefficients are given by the following form
198 *
199 * @f[
200 * \mathcal{D}^{knud}_k = \frac{2}{3} \frac{r_{pore} \phi}{\tau} \left( \frac{8 R T}{\pi W_k} \right)^{1/2}
201 * @f]
202 */
203 void updateKnudsenDiffCoeffs();
204
205 //! Calculate the H matrix
206 /*!
207 * The multicomponent diffusion H matrix @f$ H_{k,l} @f$ is given by the following form
208 *
209 * @f[
210 * H_{k,l} = - \frac{X_k}{D_{k,l}}
211 * @f]
212 * @f[
213 * H_{k,k} = \frac{1}{\mathcal(D)^{knud}_{k}} + \sum_{j \ne k}^N{ \frac{X_j}{D_{k,j}} }
214 * @f]
215 */
216 void eval_H_matrix();
217
218 //! Local copy of the species molecular weights
219 /*!
220 * units kg /kmol
221 * length = m_nsp;
222 */
223 vector<double> m_mw;
224
225 //! binary diffusion coefficients
226 DenseMatrix m_d;
227
228 //! mole fractions
229 vector<double> m_x;
230
231 //! Knudsen diffusion coefficients. @see updateKnudsenDiffCoeffs()
232 vector<double> m_dk;
233
234 //! temperature
235 double m_temp = -1.0;
236
237 //! Multicomponent diffusion coefficients. @see eval_H_matrix()
238 DenseMatrix m_multidiff;
239
240 //! work space of size m_nsp;
241 vector<double> m_spwork;
242
243 //! work space of size m_nsp;
244 vector<double> m_spwork2;
245
246 //! Pressure Gradient
247 double m_gradP = 0.0;
248
249 //! Update-to-date variable for Knudsen diffusion coefficients
250 bool m_knudsen_ok = false;
251
252 //! Update-to-date variable for Binary diffusion coefficients
253 bool m_bulk_ok = false;
254
255 //! Porosity
256 double m_porosity = 0.0;
257
258 //! Tortuosity
259 double m_tortuosity = 1.0;
260
261 //! Pore radius (meter)
262 double m_pore_radius = 0.0;
263
264 //! Particle diameter
265 /*!
266 * The medium is assumed to consist of particles of size m_diam. units = m
267 */
268 double m_diam = 0.0;
269
270 //! Permeability of the media
271 /*!
272 * The permeability is the proportionality constant for Darcy's law which
273 * relates discharge rate and viscosity to the applied pressure gradient.
274 *
275 * Below is Darcy's law, where @f$ \kappa @f$ is the permeability
276 *
277 * @f[
278 * v = \frac{\kappa}{\mu} \frac{\delta P}{\delta x}
279 * @f]
280 *
281 * units are m2
282 */
283 double m_perm = -1.0;
284
285 //! Pointer to the transport object for the gas phase
286 unique_ptr<Transport> m_gastran;
287};
288}
289#endif
DenseMatrix.h
Headers for the DenseMatrix object, which deals with dense rectangular matrices and description of th...
Transport.h
Headers for the Transport object, which is the virtual base class for all transport property evaluato...
Cantera::DenseMatrix
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
Definition DenseMatrix.h:55
Cantera::DustyGasTransport
Class DustyGasTransport implements the Dusty Gas model for transport in porous media.
Definition DustyGasTransport.h:53
Cantera::DustyGasTransport::m_mw
vector< double > m_mw
Local copy of the species molecular weights.
Definition DustyGasTransport.h:223
Cantera::DustyGasTransport::m_diam
double m_diam
Particle diameter.
Definition DustyGasTransport.h:268
Cantera::DustyGasTransport::getMolarFluxes
void getMolarFluxes(const double *const state1, const double *const state2, const double delta, double *const fluxes) override
Get the molar fluxes [kmol/m^2/s], given the thermodynamic state at two nearby points.
Definition DustyGasTransport.cpp:105
Cantera::DustyGasTransport::m_multidiff
DenseMatrix m_multidiff
Multicomponent diffusion coefficients.
Definition DustyGasTransport.h:238
Cantera::DustyGasTransport::m_bulk_ok
bool m_bulk_ok
Update-to-date variable for Binary diffusion coefficients.
Definition DustyGasTransport.h:253
Cantera::DustyGasTransport::m_temp
double m_temp
temperature
Definition DustyGasTransport.h:235
Cantera::DustyGasTransport::m_x
vector< double > m_x
mole fractions
Definition DustyGasTransport.h:229
Cantera::DustyGasTransport::m_dk
vector< double > m_dk
Knudsen diffusion coefficients.
Definition DustyGasTransport.h:232
Cantera::DustyGasTransport::m_porosity
double m_porosity
Porosity.
Definition DustyGasTransport.h:256
Cantera::DustyGasTransport::updateTransport_T
void updateTransport_T()
Update temperature-dependent quantities within the object.
Definition DustyGasTransport.cpp:191
Cantera::DustyGasTransport::m_knudsen_ok
bool m_knudsen_ok
Update-to-date variable for Knudsen diffusion coefficients.
Definition DustyGasTransport.h:250
Cantera::DustyGasTransport::initialize
void initialize(ThermoPhase *phase, Transport *gastr)
Initialization routine called by TransportFactory.
Definition DustyGasTransport.cpp:27
Cantera::DustyGasTransport::m_spwork
vector< double > m_spwork
work space of size m_nsp;
Definition DustyGasTransport.h:241
Cantera::DustyGasTransport::updateBinaryDiffCoeffs
void updateBinaryDiffCoeffs()
Private routine to update the dusty gas binary diffusion coefficients.
Definition DustyGasTransport.cpp:54
Cantera::DustyGasTransport::m_perm
double m_perm
Permeability of the media.
Definition DustyGasTransport.h:283
Cantera::DustyGasTransport::m_tortuosity
double m_tortuosity
Tortuosity.
Definition DustyGasTransport.h:259
Cantera::DustyGasTransport::eval_H_matrix
void eval_H_matrix()
Calculate the H matrix.
Definition DustyGasTransport.cpp:84
Cantera::DustyGasTransport::updateTransport_C
void updateTransport_C()
Update concentration-dependent quantities within the object.
Definition DustyGasTransport.cpp:201
Cantera::DustyGasTransport::updateMultiDiffCoeffs
void updateMultiDiffCoeffs()
Update the Multicomponent diffusion coefficients that are used in the approximation.
Definition DustyGasTransport.cpp:164
Cantera::DustyGasTransport::updateKnudsenDiffCoeffs
void updateKnudsenDiffCoeffs()
Update the Knudsen diffusion coefficients.
Definition DustyGasTransport.cpp:71
Cantera::DustyGasTransport::setMeanParticleDiameter
void setMeanParticleDiameter(double dbar)
Set the mean particle diameter.
Definition DustyGasTransport.cpp:234
Cantera::DustyGasTransport::setTortuosity
void setTortuosity(double tort)
Set the tortuosity (dimensionless)
Definition DustyGasTransport.cpp:221
Cantera::DustyGasTransport::setPorosity
void setPorosity(double porosity)
Set the porosity (dimensionless)
Definition DustyGasTransport.cpp:214
Cantera::DustyGasTransport::m_spwork2
vector< double > m_spwork2
work space of size m_nsp;
Definition DustyGasTransport.h:244
Cantera::DustyGasTransport::gasTransport
Transport & gasTransport()
Return a reference to the transport manager used to compute the gas binary diffusion coefficients and...
Definition DustyGasTransport.cpp:244
Cantera::DustyGasTransport::m_gastran
unique_ptr< Transport > m_gastran
Pointer to the transport object for the gas phase.
Definition DustyGasTransport.h:286
Cantera::DustyGasTransport::setPermeability
void setPermeability(double B)
Set the permeability of the media.
Definition DustyGasTransport.cpp:239
Cantera::DustyGasTransport::transportModel
string transportModel() const override
Identifies the model represented by this Transport object.
Definition DustyGasTransport.h:66
Cantera::DustyGasTransport::m_pore_radius
double m_pore_radius
Pore radius (meter)
Definition DustyGasTransport.h:262
Cantera::DustyGasTransport::setThermo
void setThermo(ThermoPhase &thermo) override
Specifies the ThermoPhase object.
Definition DustyGasTransport.cpp:21
Cantera::DustyGasTransport::getMultiDiffCoeffs
void getMultiDiffCoeffs(const size_t ld, double *const d) override
Return the Multicomponent diffusion coefficients. Units: [m^2/s].
Definition DustyGasTransport.cpp:181
Cantera::DustyGasTransport::setMeanPoreRadius
void setMeanPoreRadius(double rbar)
Set the mean pore radius (m)
Definition DustyGasTransport.cpp:228
Cantera::DustyGasTransport::m_d
DenseMatrix m_d
binary diffusion coefficients
Definition DustyGasTransport.h:226
Cantera::DustyGasTransport::m_gradP
double m_gradP
Pressure Gradient.
Definition DustyGasTransport.h:247
Cantera::ThermoPhase
Base class for a phase with thermodynamic properties.
Definition ThermoPhase.h:390
Cantera::TransportFactory
Factory class for creating new instances of classes derived from Transport.
Definition TransportFactory.h:31
Cantera::Transport
Base class for transport property managers.
Definition Transport.h:146
Cantera::Transport::thermo
ThermoPhase & thermo()
Phase object.
Definition Transport.h:192
Cantera
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564