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