Cantera  2.3.0
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 http://www.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 "TransportBase.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  * References for the Dusty Gas Model
48  *
49  * 1. H. Zhu, R. J. Kee, "Modeling Electrochemical Impedance Spectra in SOFC
50  * Button Cells with Internal Methane Reforming," J. Electrochem. Soc.,
51  * 153(9) A1765-1772 (2006).
52  * 2. H. Zhu, R. J. Kee, V. M. Janardhanan, O. Deutschmann, D. G. Goodwin, J.
53  * Electrochem. Soc., 152, A2427 (2005).
54  * 3. E. A. Mason, A. P. Malinauskas," Gas Transport in Porous Media: the Dusty-
55  * Gas Model", American Elsevier, New York (1983).
56  * 4. J. W. Veldsink, R. M. J. van Damme, G. F. Versteeg, W. P. M. van Swaaij,
57  * "The use of the dusty gas model for the description of mass transport with
58  * chemical reaction in porous media," Chemical Engineering Journal, 57, 115
59  * - 125 (1995).
60  * @ingroup tranprops
61  */
63 {
64 public:
65  //! default constructor
66  /*!
67  * @param thermo Pointer to the ThermoPhase object for this phase.
68  * Defaults to zero.
69  */
71 
73 
74  //! Assignment operator
75  /*!
76  * Warning -> Shallow pointer copies are made of m_thermo and m_gastran.
77  * gastran may not point to the correct object after this copy.
78  * The routine initialize() must be called after this routine to
79  * complete the copy.
80  *
81  * @param right Reference to DustyGasTransport object to be copied
82  * into the current one.
83  */
85 
86  virtual Transport* duplMyselfAsTransport() const;
87 
88  // overloaded base class methods
89 
90  virtual void setThermo(thermo_t& thermo);
91 
92  virtual int model() const {
93  warn_deprecated("DustyGasTransport::model",
94  "To be removed after Cantera 2.3.");
95  return cDustyGasTransport;
96  }
97 
98  virtual std::string transportType() const {
99  return "DustyGas";
100  }
101 
102  virtual void getMultiDiffCoeffs(const size_t ld, doublereal* const d);
103 
104  //! Get the molar fluxes [kmol/m^2/s], given the thermodynamic state at two nearby points.
105  /*!
106  * \f[
107  * 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)
108  * \f]
109  *
110  * @param state1 Array of temperature, density, and mass fractions for state 1.
111  * @param state2 Array of temperature, density, and mass fractions for state 2.
112  * @param delta Distance from state 1 to state 2 (m).
113  *
114  * @param fluxes Vector of species molar fluxes due to diffusional driving force
115  */
116  virtual void getMolarFluxes(const doublereal* const state1,
117  const doublereal* const state2, const doublereal delta,
118  doublereal* const fluxes);
119 
120  // new methods added in this class
121 
122  //! Set the porosity (dimensionless)
123  /*!
124  * @param porosity Set the value of the porosity
125  */
126  void setPorosity(doublereal porosity);
127 
128  //! Set the tortuosity (dimensionless)
129  /*!
130  * Tortuosity is considered to be constant within the object
131  *
132  * @param tort Value of the tortuosity
133  */
134  void setTortuosity(doublereal tort);
135 
136  //! Set the mean pore radius (m)
137  /*!
138  * @param rbar Value of the pore radius ( m)
139  */
140  void setMeanPoreRadius(doublereal rbar);
141 
142  //! Set the mean particle diameter
143  /*!
144  * @param dbar Set the mean particle diameter (m)
145  */
146  void setMeanParticleDiameter(doublereal dbar);
147 
148  //! Set the permeability of the media
149  /*!
150  * If not set, the value for close-packed spheres will be used by default.
151  *
152  * The value for close-packed spheres is given below, where p is the
153  * porosity, t is the tortuosity, and d is the diameter of the sphere
154  *
155  * \f[
156  * \kappa = \frac{p^3 d^2}{72 t (1 - p)^2}
157  * \f]
158  *
159  * @param B set the permeability of the media (units = m^2)
160  */
161  void setPermeability(doublereal B);
162 
163  //! Return a reference to the transport manager used to compute the gas
164  //! binary diffusion coefficients and the viscosity.
165  /*!
166  * @returns a reference to the gas transport object
167  */
169 
170  //! Make the TransportFactory object a friend, because this object has
171  //! restricted its instantiation to classes which are friends.
172  friend class TransportFactory;
173 
174 protected:
175  //! Initialization routine called by TransportFactory
176  /*!
177  * The DustyGas model is a subordinate model to the gas phase transport
178  * model. Here we set the gas phase models.
179  *
180  * This is a protected routine, so that initialization of the Model must
181  * occur within Cantera's setup
182  *
183  * @param phase Pointer to the underlying ThermoPhase model for the gas phase
184  * @param gastr Pointer to the underlying Transport model for transport in
185  * the gas phase.
186  */
187  void initialize(ThermoPhase* phase, Transport* gastr);
188 
189 private:
190  //! Update temperature-dependent quantities within the object
191  /*!
192  * The object keeps a value m_temp, which is the temperature at which
193  * quantities were last evaluated at. If the temperature is changed, update
194  * Booleans are set false, triggering recomputation.
195  */
196  void updateTransport_T();
197 
198  //! Update concentration-dependent quantities within the object
199  /*!
200  * The object keeps a value m_temp, which is the temperature at which
201  * quantities were last evaluated at. If the temperature is changed, update
202  * Booleans are set false, triggering recomputation.
203  */
204  void updateTransport_C();
205 
206  //! Private routine to update the dusty gas binary diffusion coefficients
207  /*!
208  * The dusty gas binary diffusion coefficients \f$ D^{dg}_{i,j} \f$ are
209  * evaluated from the binary gas-phase diffusion coefficients \f$
210  * D^{bin}_{i,j} \f$ using the following formula
211  *
212  * \f[
213  * D^{dg}_{i,j} = \frac{\phi}{\tau} D^{bin}_{i,j}
214  * \f]
215  *
216  * where \f$ \phi \f$ is the porosity of the media and \f$ \tau \f$ is the
217  * tortuosity of the media.
218  */
219  void updateBinaryDiffCoeffs();
220 
221  //! Update the Multicomponent diffusion coefficients that are used in the
222  //! approximation
223  /*!
224  * This routine updates the H matrix and then inverts it.
225  */
226  void updateMultiDiffCoeffs();
227 
228  //! Update the Knudsen diffusion coefficients
229  /*!
230  * The Knudsen diffusion coefficients are given by the following form
231  *
232  * \f[
233  * \mathcal{D}^{knud}_k = \frac{2}{3} \frac{r_{pore} \phi}{\tau} \left( \frac{8 R T}{\pi W_k} \right)^{1/2}
234  * \f]
235  */
237 
238  //! Calculate the H matrix
239  /*!
240  * The multicomponent diffusion H matrix \f$ H_{k,l} \f$ is given by the following form
241  *
242  * \f[
243  * H_{k,l} = - \frac{X_k}{D_{k,l}}
244  * \f]
245  * \f[
246  * H_{k,k} = \frac{1}{\mathcal(D)^{knud}_{k}} + \sum_{j \ne k}^N{ \frac{X_j}{D_{k,j}} }
247  * \f]
248  */
249  void eval_H_matrix();
250 
251  //! Local copy of the species molecular weights
252  /*!
253  * units kg /kmol
254  * length = m_nsp;
255  */
257 
258  //! binary diffusion coefficients
260 
261  //! mole fractions
263 
264  //! Knudsen diffusion coefficients. @see updateKnudsenDiffCoeffs()
266 
267  //! temperature
268  doublereal m_temp;
269 
270  //! Multicomponent diffusion coefficients. @see eval_H_matrix()
272 
273  //! work space of size m_nsp;
275 
276  //! work space of size m_nsp;
278 
279  //! Pressure Gradient
280  doublereal m_gradP;
281 
282  //! Update-to-date variable for Knudsen diffusion coefficients
284 
285  //! Update-to-date variable for Binary diffusion coefficients
286  bool m_bulk_ok;
287 
288  //! Porosity
289  doublereal m_porosity;
290 
291  //! Tortuosity
292  doublereal m_tortuosity;
293 
294  //! Pore radius (meter)
295  doublereal m_pore_radius;
296 
297  //! Particle diameter
298  /*!
299  * The medium is assumed to consist of particles of size m_diam. units = m
300  */
301  doublereal m_diam;
302 
303  //! Permeability of the media
304  /*!
305  * The permeability is the proportionality constant for Darcy's law which
306  * relates discharge rate and viscosity to the applied pressure gradient.
307  *
308  * Below is Darcy's law, where \f$ \kappa \f$ is the permeability
309  *
310  * \f[
311  * v = \frac{\kappa}{\mu} \frac{\delta P}{\delta x}
312  * \f]
313  *
314  * units are m2
315  */
316  doublereal m_perm;
317 
318  //! Pointer to the transport object for the gas phase
319  std::unique_ptr<Transport> m_gastran;
320 };
321 }
322 #endif
doublereal m_pore_radius
Pore radius (meter)
virtual void getMultiDiffCoeffs(const size_t ld, doublereal *const d)
Return the Multicomponent diffusion coefficients. Units: [m^2/s].
std::unique_ptr< Transport > m_gastran
Pointer to the transport object for the gas phase.
void updateTransport_T()
Update temperature-dependent quantities within the object.
virtual void setThermo(thermo_t &thermo)
Specifies the ThermoPhase object.
Transport & gasTransport()
Return a reference to the transport manager used to compute the gas binary diffusion coefficients and...
doublereal m_diam
Particle diameter.
vector_fp m_x
mole fractions
Factory class for creating new instances of classes derived from Transport.
Headers for the Transport object, which is the virtual base class for all transport property evaluato...
Class DustyGasTransport implements the Dusty Gas model for transport in porous media.
DenseMatrix m_d
binary diffusion coefficients
DustyGasTransport(thermo_t *thermo=0)
default constructor
Base class for transport property managers.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
DustyGasTransport & operator=(const DustyGasTransport &right)
Assignment operator.
vector_fp m_dk
Knudsen diffusion coefficients.
void updateMultiDiffCoeffs()
Update the Multicomponent diffusion coefficients that are used in the approximation.
virtual std::string transportType() const
Identifies the Transport object type.
void eval_H_matrix()
Calculate the H matrix.
doublereal m_perm
Permeability of the media.
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:93
doublereal m_gradP
Pressure Gradient.
void updateTransport_C()
Update concentration-dependent quantities within the object.
virtual Transport * duplMyselfAsTransport() const
Duplication routine for objects which inherit from Transport.
void setPorosity(doublereal porosity)
Set the porosity (dimensionless)
bool m_knudsen_ok
Update-to-date variable for Knudsen diffusion coefficients.
vector_fp m_spwork2
work space of size m_nsp;
void initialize(ThermoPhase *phase, Transport *gastr)
Initialization routine called by TransportFactory.
void setTortuosity(doublereal tort)
Set the tortuosity (dimensionless)
virtual void getMolarFluxes(const doublereal *const state1, const doublereal *const state2, const doublereal delta, doublereal *const fluxes)
Get the molar fluxes [kmol/m^2/s], given the thermodynamic state at two nearby points.
void setMeanPoreRadius(doublereal rbar)
Set the mean pore radius (m)
doublereal m_porosity
Porosity.
thermo_t & thermo()
doublereal m_tortuosity
Tortuosity.
void setPermeability(doublereal B)
Set the permeability of the media.
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
bool m_bulk_ok
Update-to-date variable for Binary diffusion coefficients.
Headers for the DenseMatrix object, which deals with dense rectangular matrices and description of th...
doublereal m_temp
temperature
virtual int model() const
Transport model.
Namespace for the Cantera kernel.
Definition: application.cpp:29
void updateBinaryDiffCoeffs()
Private routine to update the dusty gas binary diffusion coefficients.
DenseMatrix m_multidiff
Multicomponent diffusion coefficients.
vector_fp m_mw
Local copy of the species molecular weights.
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
Definition: DenseMatrix.h:72
vector_fp m_spwork
work space of size m_nsp;
void setMeanParticleDiameter(doublereal dbar)
Set the mean particle diameter.
void updateKnudsenDiffCoeffs()
Update the Knudsen diffusion coefficients.