Cantera  2.1.2
LiquidTransport.h
Go to the documentation of this file.
1 /**
2  * @file LiquidTransport.h
3  * Header file defining class LiquidTransport
4  */
5 #ifndef CT_LIQUIDTRAN_H
6 #define CT_LIQUIDTRAN_H
7 
8 #include "TransportBase.h"
10 #include "TransportParams.h"
11 #include "LiquidTransportParams.h"
12 
13 namespace Cantera
14 {
15 
16 // Forward references
17 class LiquidTransportParams;
18 
19 //! Class LiquidTransport implements models for transport
20 //! properties for liquid phases.
21 /*!
22  * Liquid Transport is set up with some flexibility in this class. Transport
23  * properties like viscosity and thermal conductivity are allowed flexibility
24  * within the constraints of the LiquidTransportProperty and
25  * LiquidTransportInteractions classes. For species diffusion, the
26  * LiquidTransport class focuses on the Stefan-Maxwell equation to determine
27  * the diffusion velocities. Other options for liquid diffusion include
28  * solvent-dominated diffusion, and a class SolventTransport should be
29  * forthcoming.
30  *
31  * The class LiquidTransport has several roles.
32  * -# It brings together the individual species transport
33  * properties, expressed as subclasses of LTPspecies
34  * (Liquid Transport Properties of Species) through
35  * LiquidTransportData, with models for
36  * the composition dependence of liquid transport properties
37  * expressed as subclasses of LiquidTranInteraction
38  * (mixing rules) through LiquidTransportParams. Calculating
39  * mixture properties generally consists of calling the
40  * getMixTansProp member of LiquidTranInteraction by passing
41  * a vector of LTPSpecies
42  * -# It calculates the bulk velocity \f$ \vec{v} \f$ and
43  * individual species diffusion velocities, \f$ \vec{V_i} \f$
44  * using the Stefan-Maxwell equations. It is possible to set a
45  * flag to calculate relative to a mass-averaged bulk velocity,
46  * relative to a mole-averaged bulk velocity or relative to a
47  * single species velocity using the <velocityBasis basis="mass">,
48  * <velocityBasis basis="mass">, or <velocityBasis basis="Cl-">
49  * keyword. Mass-averaged velocities are the default for which
50  * the diffusion velocities satisfy
51  * \f[
52  * \sum_{i} Y_i \vec{V_i} = 0
53  * \f]
54  * for mass fraction \f$ Y_i \f$. For mole-averaged velocities
55  * \f[
56  * \sum_{i} X_i \vec{V_i} = 0
57  * \f]
58  * for mole fraction \f$ X_i \f$. or
59  * \f[
60  * \vec{V_i} = 0
61  * \f]
62  * for reference species \f$ i \f$.
63  * -# It provides access to a number of derived quantities
64  * related to transport properties as described in the
65  * various methods below.
66  *
67  * Within LiquidTransport, the state is presumed to be
68  * defined in terms of the species mole fraction,
69  * temperature and pressure. Charged species are expected
70  * and quantities like the electric current are computed
71  * based on a combined electrochemcial potential.
72  *
73  *
74  * @ingroup tranprops
75  */
76 class LiquidTransport : public Transport
77 {
78 public:
79  //! Default constructor.
80  /*!
81  * This requires call to initLiquid(LiquidTransportParams& tr)
82  * after filling LiquidTransportParams to complete instantiation.
83  * The filling of LiquidTransportParams is currently carried out
84  * in the TransportFactory class, but might be moved at some point.
85  *
86  * @param thermo ThermoPhase object holding species information.
87  * @param ndim Number of spatial dimensions.
88  */
89  LiquidTransport(thermo_t* thermo = 0, int ndim = 1);
90 
91  LiquidTransport(const LiquidTransport& right);
92  LiquidTransport& operator=(const LiquidTransport& right);
93  virtual Transport* duplMyselfAsTransport() const;
94  virtual ~LiquidTransport();
95 
96  //! Initialize the transport object
97  /*!
98  * Here we change all of the internal dimensions to be sufficient.
99  * We get the object ready to do property evaluations.
100  * A lot of the input required to do property evaluations is
101  * contained in the LiquidTransportParams class that is
102  * filled in TransportFactory.
103  *
104  * @param tr Transport parameters for all of the species in the phase.
105  */
106  virtual bool initLiquid(LiquidTransportParams& tr);
107 
108  friend class TransportFactory;
109 
110  virtual int model() const {
111  return cLiquidTransport;
112  }
113 
114  //! Returns the viscosity of the solution
115  /*!
116  * The viscosity calculation is handled by subclasses of
117  * LiquidTranInteraction as specified in the input file.
118  * These in turn employ subclasses of LTPspecies to
119  * determine the individual species viscosities.
120  */
121  virtual doublereal viscosity();
122 
123  //! Returns the pure species viscosities for all species
124  /*!
125  * The pure species viscosities are evaluated using the appropriate
126  * subclasses of LTPspecies as specified in the input file.
127  *
128  * @param visc array of length "number of species"
129  * to hold returned viscosities.
130  */
131  virtual void getSpeciesViscosities(doublereal* const visc);
132 
133  //! Returns the ionic conductivity of the solution
134  /*!
135  * The ionic conductivity calculation is handled by subclasses of
136  * LiquidTranInteraction as specified in the input file.
137  * These in turn employ subclasses of LTPspecies to
138  * determine the individual species ionic conductivities.
139  */
140  virtual doublereal ionConductivity();
141 
142  //! Returns the pure species ionic conductivities for all species
143  /*!
144  * The pure species ionic conductivities are evaluated using the
145  * appropriate subclasses of LTPspecies as specified in the
146  * input file.
147  *
148  * @param ionCond Array of length "number of species" to hold returned
149  * ionic conductivities.
150  */
151  virtual void getSpeciesIonConductivity(doublereal* const ionCond);
152 
153  //! Returns the pointer to the mobility ratios of the binary
154  //! combinations of the transported species for the solution
155  //! Has size of the number of binary interactions = nsp*nsp
156  /*!
157  * The mobility ratio calculation is handled by subclasses of
158  * LiquidTranInteraction as specified in the input file.
159  * These in turn employ subclasses of LTPspecies to
160  * determine the mobility ratios in the pure species.
161  *
162  * @param mobRat Vector of mobility ratios
163  */
164  virtual void mobilityRatio(doublereal* mobRat);
165 
166  //! Returns a double pointer to the mobility ratios of the
167  //! transported species in each pure species phase.
168  /*!
169  * Has size of the number of binary interactions by the number of species
170  * (nsp*nsp X nsp). The pure species mobility ratios are evaluated using
171  * the appropriate subclasses of LTPspecies as specified in the input
172  * file.
173  *
174  * @param mobRat array of length "number of species"
175  * to hold returned mobility ratios.
176  */
177  virtual void getSpeciesMobilityRatio(doublereal** mobRat);
178 
179  //! Returns the self diffusion coefficients of the species in the phase.
180  //! Has size of nsp(coeffs)
181  /*!
182  * The self diffusion coefficient is the diffusion coefficient of a
183  * tracer species at the current temperature and composition of the
184  * species. Therefore, the dilute limit of transport is assumed for the
185  * tracer species. The effective formula may be calculated from the
186  * stefan-maxwell formulation by adding another row for the tracer
187  * species, assigning all D's to be equal to the respective species D's,
188  * and then taking the limit as the tracer species mole fraction goes to
189  * zero. The corresponding flux equation for the tracer species k in
190  * units of kmol m-2 s-1 is.
191  *
192  * \f[
193  * J_k = - D^{sd}_k \frac{C_k}{R T} \nabla \mu_k
194  * \f]
195  *
196  * The derivative is taken at constant T and P.
197  *
198  * The self diffusion calculation is handled by subclasses of
199  * LiquidTranInteraction as specified in the input file.
200  * These in turn employ subclasses of LTPspecies to
201  * determine the individual species self diffusion coeffs.
202  *
203  * @param selfDiff Vector of self-diffusion coefficients
204  * Length = number of species in phase
205  * units = m**2 s-1
206  */
207  virtual void selfDiffusion(doublereal* const selfDiff);
208 
209  //! Returns the self diffusion coefficients in the pure species phases.
210  //! Has size of nsp(coeffs) x nsp(phases)
211  /*!
212  * The pure species molar volumes are evaluated using the appropriate
213  * subclasses of LTPspecies as specified in the input file.
214  *
215  * @param selfDiff array of length "number of species"
216  * to hold returned self diffusion coeffs.
217  */
218  virtual void getSpeciesSelfDiffusion(doublereal** selfDiff);
219 
220  //! Returns the hydrodynamic radius for all species
221  /*!
222  * The species hydrodynamic radii are evaluated using the appropriate
223  * subclasses of LTPspecies as specified in the input file.
224  *
225  * @param radius array of length "number of species"
226  * to hold returned radii.
227  */
228  virtual void getSpeciesHydrodynamicRadius(doublereal* const radius);
229 
230  //! Returns the binary diffusion coefficients
231  /*!
232  * The binary diffusion coefficients are specified in the input file
233  * through the LiquidTransportInteractions class. These are the binary
234  * interaction coefficients employed in the Stefan-Maxwell equation.
235  *
236  * @param ld number of species in system
237  * @param d vector of binary diffusion coefficients
238  * units = m2 s-1. length = ld*ld = (number of species)^2
239  */
240  virtual void getBinaryDiffCoeffs(const size_t ld, doublereal* const d);
241 
242  //! Get the Mixture diffusion coefficients
243  /*!
244  * The mixture diffusion coefficients are not well defined
245  * in the context of LiquidTransport because the Stefan Maxwell
246  * equation is solved. Here the mixture diffusion coefficients
247  * are defined according to Ficks law:
248  * \f[
249  * X_i \vec{V_i} = -D_i \nabla X_i.
250  * \f]
251  * Solving Ficks Law for \f$ D_i \f$ gives a mixture diffusion
252  * coefficient
253  * \f[
254  * D_i = - X_i \vec{V_i} / ( \nabla X_i ).
255  * \f]
256  * If \f$ \nabla X_i = 0 \f$ this is undefined and the
257  * nonsensical value -1 is returned.
258  *
259  * Note that this evaluation of \f$ \vec{V_i} \f$ requires
260  * a solve of the Stefan Maxwell equation making this
261  * determination of the mixture averaged diffusion coefficients
262  * a \e slow method for obtaining diffusion coefficients.
263  *
264  * Also note that the Stefan Maxwell solve will be based upon
265  * the thermodynamic state (including gradients) most recently
266  * set. Gradients can be set specifically using set_Grad_V,
267  * set_Grad_X and set_Grad_T or through calls to
268  * getSpeciesFluxes, getSpeciesFluxesES, getSpeciesVdiff,
269  * getSpeciesVdiffES, etc.
270  *
271  * @param d vector of mixture diffusion coefficients
272  * units = m2 s-1. length = number of species
273  */
274  virtual void getMixDiffCoeffs(doublereal* const d);
275 
276  //! Return the thermal diffusion coefficients
277  /*!
278  * These are all zero for this simple implementation
279  *
280  * @param dt thermal diffusion coefficients
281  */
282  virtual void getThermalDiffCoeffs(doublereal* const dt);
283 
284  //! Return the thermal conductivity of the solution
285  /*!
286  * The thermal conductivity calculation is handled by subclasses of
287  * LiquidTranInteraction as specified in the input file.
288  * These in turn employ subclasses of LTPspecies to
289  * determine the individual species thermal conductivities.
290  */
291  virtual doublereal thermalConductivity();
292 
293  //! Get the Electrical mobilities (m^2/V/s).
294  /*!
295  * The electrical mobilities are not well defined
296  * in the context of LiquidTransport because the Stefan Maxwell
297  * equation is solved. Here the electrical mobilities
298  * are calculated from the mixture-averaged
299  * diffusion coefficients through a call to getMixDiffCoeffs()
300  * using the Einstein relation
301  *
302  * \f[
303  * \mu^e_k = \frac{F D_k}{R T}
304  * \f]
305  *
306  * Note that this call to getMixDiffCoeffs() requires
307  * a solve of the Stefan Maxwell equation making this
308  * determination of the mixture averaged diffusion coefficients
309  * a \e slow method for obtaining diffusion coefficients.
310  *
311  * Also note that the Stefan Maxwell solve will be based upon the
312  * thermodynamic state (including gradients) most recently set.
313  * Gradients can be set specifically using set_Grad_V, set_Grad_X and
314  * set_Grad_T or through calls to getSpeciesFluxes, getSpeciesFluxesES,
315  * getSpeciesVdiff, getSpeciesVdiffES, etc.
316  *
317  * @param mobil_e Returns the electrical mobilities of
318  * the species in array \c mobil_e. The array must be
319  * dimensioned at least as large as the number of species.
320  */
321  virtual void getMobilities(doublereal* const mobil_e);
322 
323  //! Get the fluid mobilities (s kmol/kg).
324  /*!
325  * The fluid mobilities are not well defined in the context of
326  * LiquidTransport because the Stefan Maxwell equation is solved. Here
327  * the fluid mobilities are calculated from the mixture-averaged
328  * diffusion coefficients through a call to getMixDiffCoeffs() using the
329  * Einstein relation
330  *
331  * \f[
332  * \mu^f_k = \frac{D_k}{R T}
333  * \f]
334  *
335  * Note that this call to getMixDiffCoeffs() requires
336  * a solve of the Stefan Maxwell equation making this
337  * determination of the mixture averaged diffusion coefficients
338  * a \e slow method for obtaining diffusion coefficients.
339  *
340  * Also note that the Stefan Maxwell solve will be based upon the
341  * thermodynamic state (including gradients) most recently set.
342  * Gradients can be set specifically using set_Grad_V, set_Grad_X and
343  * set_Grad_T or through calls to getSpeciesFluxes, getSpeciesFluxesES,
344  * getSpeciesVdiff, getSpeciesVdiffES, etc.
345  *
346  * @param mobil_f Returns the fluid mobilities of
347  * the species in array \c mobil_f. The array must be
348  * dimensioned at least as large as the number of species.
349  */
350  virtual void getFluidMobilities(doublereal* const mobil_f);
351 
352  //! Specify the value of the gradient of the voltage
353  /*!
354  * @param grad_V Gradient of the voltage (length num dimensions);
355  */
356  virtual void set_Grad_V(const doublereal* const grad_V);
357 
358  //! Specify the value of the gradient of the temperature
359  /*!
360  * @param grad_T Gradient of the temperature (length num dimensions);
361  */
362  virtual void set_Grad_T(const doublereal* const grad_T);
363 
364  //! Specify the value of the gradient of the MoleFractions
365  /*!
366  * @param grad_X Gradient of the mole fractions(length nsp * num dimensions);
367  */
368  virtual void set_Grad_X(const doublereal* const grad_X);
369 
370  //! Compute the mixture electrical conductivity from
371  //! the Stefan-Maxwell equation.
372  /*!
373  * To compute the mixture electrical conductance, the Stefan
374  * Maxwell equation is solved for zero species gradients and
375  * for unit potential gradient, \f$ \nabla V \f$.
376  * The species fluxes are converted to current by summing over
377  * the charge-weighted fluxes according to
378  * \f[
379  * \vec{i} = \sum_{i} z_i F \rho \vec{V_i} / W_i
380  * \f]
381  * where \f$ z_i \f$ is the charge on species i,
382  * \f$ F \f$ is Faradays constant, \f$ \rho \f$ is the density,
383  * \f$ W_i \f$ is the molecular mass of species i.
384  * The conductance, \f$ \kappa \f$ is obtained from
385  * \f[
386  * \kappa = \vec{i} / \nabla V.
387  * \f]
388  */
389  virtual doublereal getElectricConduct();
390 
391  //! Compute the electric current density in A/m^2
392  /*!
393  * The electric current is computed first by computing the
394  * species diffusive fluxes using the Stefan Maxwell solution
395  * and then the current, \f$ \vec{i} \f$ by summing over
396  * the charge-weighted fluxes according to
397  * \f[
398  * \vec{i} = \sum_{i} z_i F \rho \vec{V_i} / W_i
399  * \f]
400  * where \f$ z_i \f$ is the charge on species i,
401  * \f$ F \f$ is Faradays constant, \f$ \rho \f$ is the density,
402  * \f$ W_i \f$ is the molecular mass of species \c i.
403  *
404  * @param ndim The number of spatial dimensions (1, 2, or 3).
405  * @param grad_T The temperature gradient (ignored in this model).
406  * @param ldx Leading dimension of the grad_X array.
407  * @param grad_X Gradients of the mole fraction
408  * Flat vector with the m_nsp in the inner loop.
409  * length = ldx * ndim
410  * @param ldf Leading dimension of the grad_V and current vectors.
411  * @param grad_V The electrostatic potential gradient.
412  * @param current The electric current in A/m^2.
413  */
414  virtual void getElectricCurrent(int ndim,
415  const doublereal* grad_T,
416  int ldx,
417  const doublereal* grad_X,
418  int ldf,
419  const doublereal* grad_V,
420  doublereal* current);
421 
422  //! Get the species diffusive velocities wrt to the averaged velocity,
423  //! given the gradients in mole fraction and temperature
424  /*!
425  * The average velocity can be computed on a mole-weighted
426  * or mass-weighted basis, or the diffusion velocities may
427  * be specified as relative to a specific species (i.e. a
428  * solvent) all according to the velocityBasis input parameter.
429  *
430  * Units for the returned velocities are m s-1.
431  *
432  * @param ndim Number of dimensions in the flux expressions
433  * @param grad_T Gradient of the temperature
434  * (length = ndim)
435  * @param ldx Leading dimension of the grad_X array
436  * (usually equal to m_nsp but not always)
437  * @param grad_X Gradients of the mole fraction
438  * Flat vector with the m_nsp in the inner loop.
439  * length = ldx * ndim
440  * @param ldf Leading dimension of the fluxes array
441  * (usually equal to m_nsp but not always)
442  * @param Vdiff Output of the diffusive velocities.
443  * Flat vector with the m_nsp in the inner loop.
444  * length = ldx * ndim
445  */
446  virtual void getSpeciesVdiff(size_t ndim,
447  const doublereal* grad_T,
448  int ldx,
449  const doublereal* grad_X,
450  int ldf,
451  doublereal* Vdiff);
452 
453  //! Get the species diffusive velocities wrt to the averaged velocity,
454  //! given the gradients in mole fraction, temperature and electrostatic potential.
455  /*!
456  * The average velocity can be computed on a mole-weighted
457  * or mass-weighted basis, or the diffusion velocities may
458  * be specified as relative to a specific species (i.e. a
459  * solvent) all according to the velocityBasis input parameter.
460  *
461  * Units for the returned velocities are m s-1.
462  *
463  * @param ndim Number of dimensions in the flux expressions
464  * @param grad_T Gradient of the temperature
465  * (length = ndim)
466  * @param ldx Leading dimension of the grad_X array
467  * (usually equal to m_nsp but not always)
468  * @param grad_X Gradients of the mole fraction
469  * Flat vector with the m_nsp in the inner loop.
470  * length = ldx * ndim
471  * @param ldf Leading dimension of the fluxes array
472  * (usually equal to m_nsp but not always)
473  * @param grad_Phi Gradients of the electrostatic potential
474  * (length = ndim)
475  * @param Vdiff Output of the species diffusion velocities
476  * Flat vector with the m_nsp in the inner loop.
477  * length = ldx * ndim
478  */
479  virtual void getSpeciesVdiffES(size_t ndim, const doublereal* grad_T,
480  int ldx, const doublereal* grad_X,
481  int ldf, const doublereal* grad_Phi,
482  doublereal* Vdiff) ;
483 
484  //! Return the species diffusive mass fluxes wrt to
485  //! the averaged velocity in [kmol/m^2/s].
486  /*!
487  * The diffusive mass flux of species \e k [kmol/m^2/s] is computed
488  * using the Stefan-Maxwell equation
489  *
490  * \f[
491  * X_i \nabla \mu_i = RT \sum_i \frac{X_i X_j}{D_{ij}}
492  * ( \vec{V}_j - \vec{V}_i )
493  * \f]
494  *
495  * to determine the diffusion velocity and
496  *
497  * \f[
498  * \vec{N}_i = C_T X_i \vec{V}_i
499  * \f]
500  *
501  * to determine the diffusion flux. Here \f$ C_T \f$ is the
502  * total concentration of the mixture [kmol/m^3], \f$ D_{ij} \f$
503  * are the Stefa-Maxwell interaction parameters in [m^2/s],
504  * \f$ \vec{V}_{i} \f$ is the diffusion velocity of species \e i,
505  * \f$ \mu_i \f$ is the electrochemical potential of species \e i.
506  *
507  * Note that for this method, there is no argument for the gradient of the
508  * electric potential (voltage). Electric potential gradients can be set
509  * with set_Grad_V() or method getSpeciesFluxesES() can be called.x
510  *
511  * The diffusion velocity is relative to an average velocity that can be
512  * computed on a mole-weighted or mass-weighted basis, or the diffusion
513  * velocities may be specified as relative to a specific species (i.e. a
514  * solvent) all according to the `velocityBasis` input parameter.
515  *
516  * @param ndim The number of spatial dimensions (1, 2, or 3).
517  * @param grad_T The temperature gradient (ignored in this model).
518  * (length = ndim)
519  * @param ldx Leading dimension of the grad_X array.
520  * (usually equal to m_nsp but not always)
521  * @param grad_X Gradients of the mole fraction
522  * Flat vector with the m_nsp in the inner loop.
523  * length = ldx * ndim
524  * @param ldf Leading dimension of the fluxes array
525  * (usually equal to m_nsp but not always)
526  * @param fluxes Output of the diffusive mass fluxes
527  * Flat vector with the m_nsp in the inner loop.
528  * length = ldx * ndim
529  */
530  virtual void getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
531  size_t ldx, const doublereal* const grad_X,
532  size_t ldf, doublereal* const fluxes);
533 
534  //! Return the species diffusive mass fluxes wrt to
535  //! the averaged velocity in [kmol/m^2/s].
536  /*!
537  * The diffusive mass flux of species \e k is computed
538  * using the Stefan-Maxwell equation
539  * \f[
540  * X_i \nabla \mu_i
541  * = RT \sum_i \frac{X_i X_j}{D_{ij}}
542  * ( \vec{V}_j - \vec{V}_i )
543  * \f]
544  * to determine the diffusion velocity and
545  * \f[
546  * \vec{N}_i = C_T X_i \vec{V}_i
547  * \f]
548  * to determine the diffusion flux. Here \f$ C_T \f$ is the
549  * total concentration of the mixture [kmol/m^3], \f$ D_{ij} \f$
550  * are the Stefa-Maxwell interaction parameters in [m^2/s],
551  * \f$ \vec{V}_{i} \f$ is the diffusion velocity of species \e i,
552  * \f$ \mu_i \f$ is the electrochemical potential of species \e i.
553  *
554  * The diffusion velocity is relative to an average velocity that can be
555  * computed on a mole-weighted or mass-weighted basis, or the diffusion
556  * velocities may be specified as relative to a specific species (i.e. a
557  * solvent) all according to the `velocityBasis` input parameter.
558  *
559  * @param ndim The number of spatial dimensions (1, 2, or 3).
560  * @param grad_T The temperature gradient (ignored in this model).
561  * (length = ndim)
562  * @param ldx Leading dimension of the grad_X array.
563  * (usually equal to m_nsp but not always)
564  * @param grad_X Gradients of the mole fraction
565  * Flat vector with the m_nsp in the inner loop.
566  * length = ldx * ndim
567  * @param ldf Leading dimension of the fluxes array
568  * (usually equal to m_nsp but not always)
569  * @param grad_Phi Gradients of the electrostatic potential
570  * length = ndim
571  * @param fluxes Output of the diffusive mass fluxes
572  * Flat vector with the m_nsp in the inner loop.
573  * length = ldx * ndim
574  */
575  virtual void getSpeciesFluxesES(size_t ndim,
576  const doublereal* grad_T,
577  size_t ldx,
578  const doublereal* grad_X,
579  size_t ldf,
580  const doublereal* grad_Phi,
581  doublereal* fluxes);
582 
583  //! Return the species diffusive velocities relative to
584  //! the averaged velocity.
585  /*!
586  * This method acts similarly to getSpeciesVdiffES() but requires all
587  * gradients to be preset using methods set_Grad_X(), set_Grad_V(),
588  * set_Grad_T(). See the documentation of getSpeciesVdiffES() for details.
589  *
590  * @param ldf Leading dimension of the Vdiff array.
591  * @param Vdiff Output of the diffusive velocities.
592  * Flat vector with the m_nsp in the inner loop.
593  * length = ldx * ndim
594  */
595  virtual void getSpeciesVdiffExt(size_t ldf, doublereal* Vdiff);
596 
597  //! Return the species diffusive fluxes relative to
598  //! the averaged velocity.
599  /*!
600  * This method acts similarly to getSpeciesFluxesES() but
601  * requires all gradients to be preset using methods
602  * set_Grad_X(), set_Grad_V(), set_Grad_T().
603  * See the documentation of getSpeciesFluxesES() for details.
604  *
605  * units = kg/m2/s
606  *
607  * @param ldf Leading dimension of the Vdiff array.
608  * @param fluxes Output of the diffusive fluxes.
609  * Flat vector with the m_nsp in the inner loop.
610  * length = ldx * ndim
611  */
612  virtual void getSpeciesFluxesExt(size_t ldf, doublereal* fluxes);
613 
614 protected:
615  //! Returns true if temperature has changed,
616  //! in which case flags are set to recompute transport properties.
617  /*!
618  * This is called whenever a transport property is requested.
619  * The first task is to check whether the temperature has changed
620  * since the last call to update_T().
621  * If it hasn't then an immediate return is carried out.
622  *
623  * Note this should be a lightweight function since it's
624  * part of all of the interfaces.
625  *
626  * @return Returns true if the temperature has changed, and false otherwise
627  */
628  virtual bool update_T();
629 
630  //! Returns true if mixture composition has changed,
631  //! in which case flags are set to recompute transport properties.
632  /*!
633  * This is called for every interface call to check whether
634  * the concentrations have changed. Concentrations change
635  * whenever the pressure or the mole fraction has changed.
636  * If it has changed, the recalculations should be done.
637  *
638  * Note this should be a lightweight function since it's
639  * part of all of the interfaces.
640  *
641  * @return Returns true if the mixture composition has changed, and false otherwise.
642  */
643  virtual bool update_C();
644 
645  //! Updates the internal value of the gradient of the
646  //! logarithm of the activity, which is
647  //! used in the gradient of the chemical potential.
648  /*!
649  * Evaluate the gradients of the activity
650  * as they alter the diffusion coefficient.
651  *
652  * The gradient of the chemical potential can be written in terms of
653  * gradient of the logarithm of the mole fraction times a correction
654  * associated with the gradient of the activity coefficient relative to
655  * that of the mole fraction. Specifically, the gradients of the
656  * logarithms of each are involved according to the formula
657  *
658  * \f[
659  * \nabla \mu_k = RT \left[ \nabla ( \ln X_k ) +
660  * \nabla ( \ln \gamma_k ) \right] = RT \left[
661  * \nabla ( \ln a_k ) \right]
662  * \f]
663  *
664  * The gradient in the activity coefficient requires the use of thermophase
665  * getdlnActCoeff that calculates its change based on a chane in the state
666  * (i.e. temperature and composition of each species) which was first
667  * implemented in MargulesVPSSTP.cpp (LiquidTransport.h doxygen)
668  */
669  virtual void update_Grad_lnAC();
670 
671  //! Solve the stefan_maxell equations for the diffusive fluxes.
672  /*!
673  * The diffusive mass flux of species \e k is computed
674  * using the Stefan-Maxwell equation
675  * \f[
676  * X_i \nabla \mu_i
677  * = RT \sum_i \frac{X_i X_j}{D_{ij}}
678  * ( \vec{V}_j - \vec{V}_i )
679  * \f]
680  * to determine the diffusion velocity and
681  * \f[
682  * \vec{N}_i = C_T X_i \vec{V}_i
683  * \f]
684  * to determine the diffusion flux. Here \f$ C_T \f$ is the
685  * total concentration of the mixture [kmol/m^3], \f$ D_{ij} \f$
686  * are the Stefa-Maxwell interaction parameters in [m^2/s],
687  * \f$ \vec{V}_{i} \f$ is the diffusion velocity of species \e i,
688  * \f$ \mu_i \f$ is the electrochemical potential of species \e i.
689  *
690  * The diffusion velocity is relative to an average velocity that can be
691  * computed on a mole-weighted or mass-weighted basis, or the diffusion
692  * velocities may be specified as relative to a specific species (i.e. a
693  * solvent) all according to the `velocityBasis` input parameter.
694  *
695  * The gradient in the activity coefficient requires the use of thermophase
696  * getdlnActCoeff that calculates its change based on a change in the state
697  * i.e. temperature and composition of each species.
698  * First implemented in MargulesVPSSTP.cppmeter.
699  *
700  * One of the Stefan Maxwell equations is replaced by the appropriate
701  * definition of the mass-averaged velocity, the mole-averaged velocity
702  * or the specification that velocities are relative to that
703  * of one species.
704  */
705  void stefan_maxwell_solve();
706 
707  //! Updates the array of pure species viscosities internally.
708  /*!
709  * The flag m_visc_ok is set to true.
710  *
711  * Note that for viscosity, a positive activation energy
712  * corresponds to the typical case of a positive argument
713  * to the exponential so that the Arrhenius expression is
714  *
715  * \f[
716  * \mu = A T^n \exp( + E / R T )
717  * \f]
718  */
719  void updateViscosity_T();
720 
721  //! Update the temperature-dependent ionic conductivity terms
722  //! for each species internally
723  /*!
724  * The flag m_ionCond_temp_ok is set to true.
725  */
727 
728  //! Updates the array of pure species mobility ratios internally.
729  /*!
730  * The flag m_mobRat_ok is set to true.
731  */
732  void updateMobilityRatio_T();
733 
734  //! Updates the array of pure species self diffusion coeffs internally.
735  /*!
736  * The flag m_selfDiff_ok is set to true.
737  */
738  void updateSelfDiffusion_T();
739 
740  //! Update the temperature-dependent hydrodynamic radius terms
741  //! for each species internally
742  /*!
743  * The flag m_radi_temp_ok is set to true.
744  */
746 
747  //! Update the temperature-dependent parts of the mixture-averaged
748  //! thermal conductivity internally
749  void updateCond_T();
750 
751  //! Update the concentration parts of the viscosities
752  /*!
753  * Internal routine is run whenever the update_boolean
754  * m_visc_conc_ok is false. Currently there is no concentration
755  * dependence for the pure species viscosities.
756  */
757  void updateViscosities_C();
758 
759  //! Update the concentration parts of the ionic conductivity
760  /*!
761  * Internal routine is run whenever the update_boolean
762  * m_ionCond_conc_ok is false. Currently there is no concentration
763  * dependence for the pure species ionic conductivity.
764  */
766 
767  //! Update the concentration parts of the mobility ratio
768  /*!
769  * Internal routine is run whenever the update_boolean
770  * m_mobRat_conc_ok is false. Currently there is no concentration
771  * dependence for the pure species mobility ratio.
772  */
773  void updateMobilityRatio_C();
774 
775  //! Update the concentration parts of the self diffusion
776  /*!
777  * Internal routine is run whenever the update_boolean
778  * m_selfDiff_conc_ok is false. Currently there is no concentration
779  * dependence for the pure species self diffusion.
780  */
781  void updateSelfDiffusion_C();
782 
783  //! Update the concentration dependence of the hydrodynamic radius
784  /*!
785  * Internal routine is run whenever the update_boolean
786  * m_radi_conc_ok is false. Currently there is no concentration
787  * dependence for the hydrodynamic radius.
788  */
790 
791  //! Update the binary Stefan-Maxwell diffusion coefficients
792  //! wrt T using calls to the appropriate LTPspecies subclass
793  void updateDiff_T();
794 
795 private:
796  //! Number of species squared
797  size_t m_nsp2;
798 
799  //! Local copy of the molecular weights of the species
800  /*!
801  * Length is equal to the number of species in the phase
802  */
804 
805  //! Viscosity for each species expressed as an appropriate subclass
806  //! of LTPspecies
807  /*!
808  * These subclasses of LTPspecies evaluate the species-specific
809  * transport properties according to the parameters parsed in
810  * TransportFactory::getLiquidSpeciesTransportData().
811  */
812  std::vector<LTPspecies*> m_viscTempDep_Ns;
813 
814  //! Viscosity of the mixture expressed as a subclass of
815  //! LiquidTranInteraction
816  /*!
817  * These subclasses of LiquidTranInteraction evaluate the
818  * mixture transport properties according to the parameters parsed in
819  * TransportFactory::getLiquidInteractionsTransportData().
820  */
822 
823  //! Ionic conductivity for each species expressed as an appropriate subclass
824  //! of LTPspecies
825  /*!
826  * These subclasses of LTPspecies evaluate the species-specific
827  * transport properties according to the parameters parsed in
828  * TransportFactory::getLiquidSpeciesTransportData().
829  */
830  std::vector<LTPspecies*> m_ionCondTempDep_Ns;
831 
832  //! Ionic Conductivity of the mixture expressed as a subclass of
833  //! LiquidTranInteraction
834  /*!
835  * These subclasses of LiquidTranInteraction evaluate the
836  * mixture transport properties according to the parameters parsed in
837  * TransportFactory::getLiquidInteractionsTransportData().
838  */
840 
841  //! Type def for LTPvector equating it with a vector of pointers to LTPspecies
842  typedef std::vector<LTPspecies*> LTPvector;
843 
844  //! Mobility ratio for the binary cominations of each species in each
845  //! pure phase expressed as an appropriate subclass of LTPspecies
846  /*!
847  * These subclasses of LTPspecies evaluate the species-specific
848  * transport properties according to the parameters parsed in
849  * TransportFactory::getLiquidSpeciesTransportData().
850  */
851  std::vector<LTPvector> m_mobRatTempDep_Ns;
852 
853  //! Mobility ratio for each binary combination of mobile species in the mixture
854  //! expressed as a subclass of LiquidTranInteraction
855  /*!
856  * These subclasses of LiquidTranInteraction evaluate the
857  * mixture transport properties according to the parameters parsed in
858  * TransportFactory::getLiquidInteractionsTransportData().
859  */
860  std::vector<LiquidTranInteraction*> m_mobRatMixModel;
861 
862  //! Self Diffusion for each species in each pure species phase
863  //! expressed as an appropriate subclass of LTPspecies
864  /*!
865  * These subclasses of LTPspecies evaluate the species-specific
866  * transport properties according to the parameters parsed in
867  * TransportFactory::getLiquidSpeciesTransportData().
868  */
869  std::vector<LTPvector> m_selfDiffTempDep_Ns;
870 
871  //! Self Diffusion for each species in the mixture expressed as a subclass of
872  //! LiquidTranInteraction
873  /*!
874  * These subclasses of LiquidTranInteraction evaluate the
875  * mixture transport properties according to the parameters parsed in
876  * TransportFactory::getLiquidInteractionsTransportData().
877  */
878  std::vector<LiquidTranInteraction*> m_selfDiffMixModel;
879 
880  //! Thermal conductivity for each species expressed as an
881  //! appropriate subclass of LTPspecies
882  /*!
883  * These subclasses of LTPspecies evaluate the species-specific
884  * transport properties according to the parameters parsed in
885  * TransportFactory::getLiquidSpeciesTransportData().
886  */
887  std::vector<LTPspecies*> m_lambdaTempDep_Ns;
888 
889  //! Thermal conductivity of the mixture expressed as a subclass of
890  //! LiquidTranInteraction
891  /*!
892  * These subclasses of LiquidTranInteraction evaluate the
893  * mixture transport properties according to the parameters parsed in
894  * TransportFactory::getLiquidInteractionsTransportData().
895  */
897 
898  //! (NOT USED IN LiquidTransport.)
899  //! Diffusion coefficient model for each species expressed as an
900  //! appropriate subclass of LTPspecies
901  /*!
902  * These subclasses of LTPspecies evaluate the species-specific
903  * transport properties according to the parameters parsed in
904  * TransportFactory::getLiquidSpeciesTransportData().
905  *
906  * Since the LiquidTransport class uses the Stefan-Maxwell equation
907  * to describe species diffusivity, the species-specific
908  * diffusivity is irrelevant.
909  */
910  std::vector<LTPspecies*> m_diffTempDep_Ns;
911 
912  //! Species diffusivity of the mixture expressed as a subclass of
913  //! LiquidTranInteraction. This will return an array of Stefan-Maxwell
914  //! interaction parameters for use in the Stefan-Maxwell solution.
915  /*!
916  * These subclasses of LiquidTranInteraction evaluate the
917  * mixture transport properties according to the parameters parsed in
918  * TransportFactory::getLiquidInteractionsTransportData().
919  */
921 
922  //! Setfan-Maxwell diffusion coefficients
924 
925  //! Hydrodynamic radius for each species expressed as an appropriate subclass of LTPspecies
926  /*!
927  * These subclasses of LTPspecies evaluate the species-specific
928  * transport properties according to the parameters parsed in
929  * TransportFactory::getLiquidSpeciesTransportData().
930  * length = nsp
931  */
932  std::vector<LTPspecies*> m_radiusTempDep_Ns;
933 
934  //! (Not used in LiquidTransport)
935  //! Hydrodynamic radius of the mixture expressed as a subclass of
936  //! LiquidTranInteraction
937  /*!
938  * These subclasses of LiquidTranInteraction evaluate the
939  * mixture transport properties according to the parameters parsed in
940  * TransportFactory::getLiquidInteractionsTransportData().
941  */
943 
944  //! Species hydrodynamic radius
946 
947  //! Internal value of the gradient of the mole fraction vector
948  /*!
949  * Note, this is the only gradient value that can and perhaps
950  * should reflect the true state of the mole fractions in the
951  * application solution vector. In other words no cropping or
952  * massaging of the values to make sure they are above zero
953  * should occur. - developing ....
954  *
955  * m_nsp is the number of species in the fluid
956  * k is the species index
957  * n is the dimensional index (x, y, or z). It has a length
958  * equal to m_nDim
959  *
960  * m_Grad_X[n*m_nsp + k]
961  */
963 
964  //! Gradient of the logarithm of the activity
965  /*!
966  * This quantity appears in the gradient of the chemical potential.
967  * It replaces the gradient of the mole fraction, and in this way
968  * serves to "modify" the diffusion coefficient.
969  *
970  * \f[
971  * m\_Grad\_lnAC[k] = \nabla ( \ln X_k ) +
972  * \nabla ( \ln \gamma_k )
973  * \f]
974  *
975  * k is the species index
976  * n is the dimensional index (x, y, or z). It has a length
977  * equal to m_nDim
978  *
979  * m_Grad_X[n*m_nsp + k]
980  */
982 
983  //! Internal value of the gradient of the Temperature vector
984  /*!
985  * Generally, if a transport property needs this in its evaluation it
986  * will look to this place to get it.
987  *
988  * No internal property is precalculated based on gradients. Gradients
989  * are assumed to be freshly updated before every property call.
990  */
992 
993  //! Internal value of the gradient of the Pressure vector
994  /*!
995  * Generally, if a transport property needs this in its evaluation it
996  * will look to this place to get it.
997  *
998  * No internal property is precalculated based on gradients. Gradients
999  * are assumed to be freshly updated before every property call.
1000  */
1002 
1003  //! Internal value of the gradient of the Electric Voltage
1004  /*!
1005  * Generally, if a transport property needs this in its evaluation it
1006  * will look to this place to get it.
1007  *
1008  * No internal property is precalculated based on gradients. Gradients
1009  * are assumed to be freshly updated before every property call.
1010  */
1012 
1013  //! Gradient of the electrochemical potential
1014  /*!
1015  * m_nsp is the number of species in the fluid. k is the species index. n
1016  * is the dimensional index (x, y, or z)
1017  *
1018  * \f[
1019  * m\_Grad\_mu[n*m_nsp + k]
1020  * \f]
1021  */
1023 
1024  // property values
1025 
1026  //! Array of Binary Diffusivities
1027  /*!
1028  * These are evaluated according to the subclass of
1029  * LiquidTranInteraction stored in m_diffMixModel.
1030  *
1031  * This has a size equal to nsp x nsp. It is a symmetric matrix. D_ii is
1032  * the self diffusion coefficient. D_ii is not needed except for when
1033  * there is one species in the mixture.
1034  *
1035  * units m2/sec
1036  */
1038 
1039  //! Internal value of the species viscosities
1040  /*!
1041  * Viscosity of the species evaluated using subclass of LTPspecies
1042  * held in m_viscTempDep_Ns.
1043  *
1044  * Length = number of species
1045  *
1046  * controlling update boolean -> m_visc_temp_ok
1047  */
1049 
1050  //! Internal value of the species ionic conductivities
1051  /*!
1052  * Ionic conductivity of the species evaluated using subclass of LTPspecies
1053  * held in m_ionCondTempDep_Ns.
1054  *
1055  * Length = number of species
1056  *
1057  * controlling update boolean -> m_ionCond_temp_ok
1058  */
1060 
1061  //! Internal value of the species mobility ratios
1062  /*!
1063  * Mobility ratio of the species evaluated using subclass of LTPspecies
1064  * held in m_mobRatTempDep_Ns.
1065  *
1066  * Length = number of species
1067  *
1068  * controlling update boolean -> m_mobRat_temp_ok
1069  */
1071 
1072  //! Internal value of the species self diffusion coefficients
1073  /*!
1074  * Self diffusion of the species evaluated using subclass of LTPspecies
1075  * held in m_selfDiffTempDep_Ns.
1076  *
1077  * Length = number of species
1078  *
1079  * controlling update boolean -> m_selfDiff_temp_ok
1080  */
1082 
1083  //! Internal value of the species individual thermal conductivities
1084  /*!
1085  * Thermal conductivities of the species evaluated using subclass
1086  * of LTPspecies held in m_lambdaTempDep_Ns.
1087  *
1088  * Length = number of species
1089  *
1090  */
1092 
1093  //! State of the mole fraction vector.
1095 
1096  //! Local copy of the mass fractions of the species in the phase
1097  /*!
1098  * The mass fraction vector comes from the ThermoPhase object.
1099  *
1100  * length = m_nsp
1101  */
1103 
1104  //! Local copy of the mass fractions of the species in the phase
1105  /**
1106  * This version of the mass fraction vector is adjusted to a
1107  * minimum lower bound of *Tiny* for use in transport calculations.
1108  */
1110 
1111  //! Local copy of the mole fractions of the species in the phase
1112  /*!
1113  * The mole fractions here are assumed to be bounded by 0.0 and 1.0
1114  * and they are assumed to add up to one exactly. This mole
1115  * fraction vector comes from the ThermoPhase object. Derivative
1116  * quantities from this are referred to as bounded.
1117  *
1118  * Update info?
1119  * length = m_nsp
1120  */
1122 
1123  //! Non-zero mole fraction vector used in transport property calculations
1124  /*!
1125  * The mole fractions here are assumed to be bounded by *Tiny* and 1.0
1126  * and they may not be assumed to add up to one. This
1127  * mole fraction vector is created from the ThermoPhase object.
1128  * Derivative quantities of this use the _tran suffix.
1129  *
1130  * Update info?
1131  * length = m_nsp
1132  */
1134 
1135  //! Local copy of the concentrations of the species in the phase
1136  /*!
1137  * The concentrations are consistent with the m_molefracs
1138  * vector which is bounded and sums to one.
1139  *
1140  * Update info?
1141  * length = m_nsp
1142  */
1144 
1145  //! Local copy of the total concentration.
1146  /*!
1147  * This is consistent with the m_concentrations[] and
1148  * m_molefracs[] vector.
1149  */
1150  doublereal concTot_;
1151 
1152  //! Local copy of the total concentration.
1153  /*!
1154  * This is consistent with the x_molefracs_tran vector and
1155  * with the concTot_ number;
1156  */
1157  doublereal concTot_tran_;
1158 
1159  //! Mean molecular mass
1161 
1162  //! Density
1163  doublereal dens_;
1164 
1165  //! Local copy of the charge of each species
1166  /*!
1167  * Contains the charge of each species (length m_nsp)
1168  */
1170 
1171  //! Specific volume for each species. Local copy from thermo object.
1173 
1174  //! Vector of activity coefficients
1176 
1177  //! RHS to the stefan-maxwell equation
1179 
1180  //! Matrix for the stefan maxwell equation.
1182 
1183  //! Current Temperature -> locally stored
1184  /*!
1185  * This is used to test whether new temperature computations
1186  * should be performed.
1187  */
1188  doublereal m_temp;
1189 
1190  //! Current value of the pressure
1191  doublereal m_press;
1192 
1193  //! Solution of the Stefan Maxwell equation in terms of flux
1194  /*!
1195  * This is the mass flux of species k in units of kg m-3 s-1.
1196  */
1198 
1199  //! Solution of the Stefan Maxwell equation
1200  /*!
1201  * This is the diffusion velocity of species k
1202  * in units of m/s and relative to the mole-averaged velocity.
1203  */
1205 
1206  //! Saved value of the mixture thermal conductivity
1207  doublereal m_lambda;
1208 
1209  //! Saved value of the mixture viscosity
1210  doublereal m_viscmix;
1211 
1212  //! Saved value of the mixture ionic conductivity
1213  doublereal m_ionCondmix;
1214 
1215  //! Saved values of the mixture mobility ratios
1217 
1218  //! Saved values of the mixture self diffusion coefficients
1220 
1221  //! work space
1222  /*!
1223  * Length is equal to m_nsp
1224  */
1226 
1227 private:
1228  //! Boolean indicating that the top-level mixture viscosity is current
1229  /*!
1230  * This is turned false for every change in T, P, or C.
1231  */
1233 
1234  //! Boolean indicating that weight factors wrt viscosity is current
1236 
1237  //! Flag to indicate that the pure species viscosities
1238  //! are current wrt the concentration
1240 
1241  //! Boolean indicating that the top-level mixture ionic conductivity is current
1242  /*!
1243  * This is turned false for every change in T, P, or C.
1244  */
1246 
1247  //! Boolean indicating that weight factors wrt ionic conductivty is current
1249 
1250  //! Flag to indicate that the pure species ionic conductivities
1251  //! are current wrt the concentration
1253 
1254  //! Flag to indicate that the mixture conductivity is current
1256 
1257  //! Boolean indicating that the top-level mixture mobility ratio is current
1258  /*!
1259  * This is turned false for every change in T, P, or C.
1260  */
1262 
1263  //! Boolean indicating that weight factors wrt mobility ratio is current
1265 
1266  //! Flag to indicate that the pure species mobility ratios
1267  //! are current wrt the concentration
1269 
1270  //! Boolean indicating that the top-level mixture self diffusion is current
1271  /*!
1272  * This is turned false for every change in T, P, or C.
1273  */
1275 
1276  //! Boolean indicating that weight factors wrt self diffusion is current
1278 
1279  //! Flag to indicate that the pure species self diffusion
1280  //! are current wrt the concentration
1282 
1283  //! Boolean indicating that mixture diffusion coeffs are current
1285 
1286  //! Boolean indicating that temperature dependence of
1287  //! hydrodynamic radius is current
1289 
1290  //! Flag to indicate that the hydrodynamic radius is current
1291  //! is current wrt the concentration
1293 
1294  //! Boolean indicating that mixture diffusion coeffs are current
1296 
1297  //! Boolean indicating that binary diffusion coeffs are current
1299 
1300  //! Flag to indicate that the pure species conductivities
1301  //! are current wrt the temperature
1303 
1304  //! Boolean indicating that mixture conductivity is current
1306 
1307  //! Mode indicator for transport models -- currently unused.
1308  int m_mode;
1309 
1310  //! Debugging flags
1311  /*!
1312  * Turn on to get debugging information
1313  */
1314  bool m_debug;
1315 
1316  //! Throw an exception if this method is invoked.
1317  /*!
1318  * This probably indicates something is not yet implemented.
1319  *
1320  * @param msg Indicates the member function which is not implemented
1321  */
1322  doublereal err(const std::string& msg) const;
1323 };
1324 }
1325 #endif
doublereal err(const std::string &msg) const
Throw an exception if this method is invoked.
bool m_debug
Debugging flags.
virtual doublereal ionConductivity()
Returns the ionic conductivity of the solution.
bool m_lambda_mix_ok
Boolean indicating that mixture conductivity is current.
LiquidTranInteraction * m_radiusMixModel
(Not used in LiquidTransport) Hydrodynamic radius of the mixture expressed as a subclass of LiquidTra...
vector_fp m_mw
Local copy of the molecular weights of the species.
vector_fp m_lambdaSpecies
Internal value of the species individual thermal conductivities.
size_t m_nsp2
Number of species squared.
virtual doublereal viscosity()
Returns the viscosity of the solution.
bool m_ionCond_mix_ok
Boolean indicating that the top-level mixture ionic conductivity is current.
virtual void getSpeciesVdiffES(size_t ndim, const doublereal *grad_T, int ldx, const doublereal *grad_X, int ldf, const doublereal *grad_Phi, doublereal *Vdiff)
Get the species diffusive velocities wrt to the averaged velocity, given the gradients in mole fracti...
doublereal m_press
Current value of the pressure.
bool m_radi_conc_ok
Flag to indicate that the hydrodynamic radius is current is current wrt the concentration.
bool m_visc_conc_ok
Flag to indicate that the pure species viscosities are current wrt the concentration.
bool m_diff_temp_ok
Boolean indicating that binary diffusion coeffs are current.
vector_fp m_Grad_V
Internal value of the gradient of the Electric Voltage.
bool m_cond_mix_ok
Flag to indicate that the mixture conductivity is current.
std::vector< LTPvector > m_selfDiffTempDep_Ns
Self Diffusion for each species in each pure species phase expressed as an appropriate subclass of LT...
virtual void getSpeciesFluxesExt(size_t ldf, doublereal *fluxes)
Return the species diffusive fluxes relative to the averaged velocity.
virtual void set_Grad_V(const doublereal *const grad_V)
Specify the value of the gradient of the voltage.
void updateIonConductivity_C()
Update the concentration parts of the ionic conductivity.
std::vector< LTPspecies * > m_radiusTempDep_Ns
Hydrodynamic radius for each species expressed as an appropriate subclass of LTPspecies.
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal *const d)
Returns the binary diffusion coefficients.
Factory class for creating new instances of classes derived from Transport.
DenseMatrix m_diff_Dij
Setfan-Maxwell diffusion coefficients.
virtual void update_Grad_lnAC()
Updates the internal value of the gradient of the logarithm of the activity, which is used in the gra...
doublereal m_ionCondmix
Saved value of the mixture ionic conductivity.
doublereal meanMolecularWeight_
Mean molecular mass.
Headers for the Transport object, which is the virtual base class for all transport property evaluato...
std::vector< LTPspecies * > LTPvector
Type def for LTPvector equating it with a vector of pointers to LTPspecies.
Class LiquidTransport implements models for transport properties for liquid phases.
vector_fp m_Grad_mu
Gradient of the electrochemical potential.
bool m_mobRat_temp_ok
Boolean indicating that weight factors wrt mobility ratio is current.
virtual void getThermalDiffCoeffs(doublereal *const dt)
Return the thermal diffusion coefficients.
virtual void set_Grad_T(const doublereal *const grad_T)
Specify the value of the gradient of the temperature.
bool m_radi_mix_ok
Boolean indicating that mixture diffusion coeffs are current.
std::vector< LiquidTranInteraction * > m_mobRatMixModel
Mobility ratio for each binary combination of mobile species in the mixture expressed as a subclass o...
Array2D m_Vdiff
Solution of the Stefan Maxwell equation.
Base class for transport property managers.
vector_fp m_ionCondSpecies
Internal value of the species ionic conductivities.
virtual void getSpeciesMobilityRatio(doublereal **mobRat)
Returns a double pointer to the mobility ratios of the transported species in each pure species phase...
std::vector< LTPvector > m_mobRatTempDep_Ns
Mobility ratio for the binary cominations of each species in each pure phase expressed as an appropri...
void updateViscosity_T()
Updates the array of pure species viscosities internally.
void updateDiff_T()
Update the binary Stefan-Maxwell diffusion coefficients wrt T using calls to the appropriate LTPspeci...
LiquidTranInteraction * m_lambdaMixModel
Thermal conductivity of the mixture expressed as a subclass of LiquidTranInteraction.
void updateHydrodynamicRadius_C()
Update the concentration dependence of the hydrodynamic radius.
vector_fp m_molefracs
Local copy of the mole fractions of the species in the phase.
bool m_ionCond_conc_ok
Flag to indicate that the pure species ionic conductivities are current wrt the concentration.
virtual void getSpeciesVdiff(size_t ndim, const doublereal *grad_T, int ldx, const doublereal *grad_X, int ldf, doublereal *Vdiff)
Get the species diffusive velocities wrt to the averaged velocity, given the gradients in mole fracti...
int m_mode
Mode indicator for transport models – currently unused.
bool m_visc_temp_ok
Boolean indicating that weight factors wrt viscosity is current.
virtual bool update_T()
Returns true if temperature has changed, in which case flags are set to recompute transport propertie...
virtual void getFluidMobilities(doublereal *const mobil_f)
Get the fluid mobilities (s kmol/kg).
void updateSelfDiffusion_C()
Update the concentration parts of the self diffusion.
virtual int model() const
Transport model.
std::vector< LTPspecies * > m_viscTempDep_Ns
Viscosity for each species expressed as an appropriate subclass of LTPspecies.
A class for 2D arrays stored in column-major (Fortran-compatible) form.
Definition: Array.h:33
virtual void set_Grad_X(const doublereal *const grad_X)
Specify the value of the gradient of the MoleFractions.
virtual void getElectricCurrent(int ndim, const doublereal *grad_T, int ldx, const doublereal *grad_X, int ldf, const doublereal *grad_V, doublereal *current)
Compute the electric current density in A/m^2.
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:101
vector_fp m_Grad_T
Internal value of the gradient of the Temperature vector.
bool m_mobRat_conc_ok
Flag to indicate that the pure species mobility ratios are current wrt the concentration.
Class LiquidTransportParams holds transport model parameters relevant to transport in mixtures...
Header file defining class LiquidTransportParams.
doublereal m_temp
Current Temperature -> locally stored.
void updateMobilityRatio_C()
Update the concentration parts of the mobility ratio.
virtual void getSpeciesFluxes(size_t ndim, const doublereal *const grad_T, size_t ldx, const doublereal *const grad_X, size_t ldf, doublereal *const fluxes)
Return the species diffusive mass fluxes wrt to the averaged velocity in [kmol/m^2/s].
DenseMatrix m_B
RHS to the stefan-maxwell equation.
void updateCond_T()
Update the temperature-dependent parts of the mixture-averaged thermal conductivity internally...
virtual void getSpeciesViscosities(doublereal *const visc)
Returns the pure species viscosities for all species.
bool m_diff_mix_ok
Boolean indicating that mixture diffusion coeffs are current.
doublereal m_viscmix
Saved value of the mixture viscosity.
virtual void getSpeciesSelfDiffusion(doublereal **selfDiff)
Returns the self diffusion coefficients in the pure species phases.
vector_fp m_spwork
work space
void updateSelfDiffusion_T()
Updates the array of pure species self diffusion coeffs internally.
int m_iStateMF
State of the mole fraction vector.
void stefan_maxwell_solve()
Solve the stefan_maxell equations for the diffusive fluxes.
std::vector< LTPspecies * > m_ionCondTempDep_Ns
Ionic conductivity for each species expressed as an appropriate subclass of LTPspecies.
bool m_lambda_temp_ok
Flag to indicate that the pure species conductivities are current wrt the temperature.
vector_fp m_Grad_X
Internal value of the gradient of the mole fraction vector.
virtual doublereal thermalConductivity()
Return the thermal conductivity of the solution.
bool m_selfDiff_conc_ok
Flag to indicate that the pure species self diffusion are current wrt the concentration.
vector_fp m_Grad_lnAC
Gradient of the logarithm of the activity.
doublereal dens_
Density.
bool m_selfDiff_temp_ok
Boolean indicating that weight factors wrt self diffusion is current.
std::vector< LiquidTranInteraction * > m_selfDiffMixModel
Self Diffusion for each species in the mixture expressed as a subclass of LiquidTranInteraction.
virtual void getMobilities(doublereal *const mobil_e)
Get the Electrical mobilities (m^2/V/s).
vector_fp m_chargeSpecies
Local copy of the charge of each species.
bool m_radi_temp_ok
Boolean indicating that temperature dependence of hydrodynamic radius is current. ...
virtual void selfDiffusion(doublereal *const selfDiff)
Returns the self diffusion coefficients of the species in the phase.
virtual bool initLiquid(LiquidTransportParams &tr)
Initialize the transport object.
thermo_t & thermo()
bool m_selfDiff_mix_ok
Boolean indicating that the top-level mixture self diffusion is current.
LiquidTranInteraction * m_diffMixModel
Species diffusivity of the mixture expressed as a subclass of LiquidTranInteraction.
vector_fp m_volume_spec
Specific volume for each species. Local copy from thermo object.
vector_fp m_mobRatMix
Saved values of the mixture mobility ratios.
vector_fp m_massfracs_tran
Local copy of the mass fractions of the species in the phase.
virtual void getSpeciesVdiffExt(size_t ldf, doublereal *Vdiff)
Return the species diffusive velocities relative to the averaged velocity.
std::vector< LTPspecies * > m_lambdaTempDep_Ns
Thermal conductivity for each species expressed as an appropriate subclass of LTPspecies.
vector_fp m_actCoeff
Vector of activity coefficients.
bool m_visc_mix_ok
Boolean indicating that the top-level mixture viscosity is current.
doublereal concTot_tran_
Local copy of the total concentration.
void updateMobilityRatio_T()
Updates the array of pure species mobility ratios internally.
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
virtual Transport * duplMyselfAsTransport() const
Duplication routine for objects which inherit from Transport.
vector_fp m_hydrodynamic_radius
Species hydrodynamic radius.
LiquidTranInteraction * m_ionCondMixModel
Ionic Conductivity of the mixture expressed as a subclass of LiquidTranInteraction.
void updateViscosities_C()
Update the concentration parts of the viscosities.
Headers for the DenseMatrix object, which deals with dense rectangular matrices and description of th...
DenseMatrix m_selfDiffSpecies
Internal value of the species self diffusion coefficients.
virtual void getMixDiffCoeffs(doublereal *const d)
Get the Mixture diffusion coefficients.
virtual bool update_C()
Returns true if mixture composition has changed, in which case flags are set to recompute transport p...
LiquidTransport(thermo_t *thermo=0, int ndim=1)
Default constructor.
vector_fp m_concentrations
Local copy of the concentrations of the species in the phase.
vector_fp m_selfDiffMix
Saved values of the mixture self diffusion coefficients.
vector_fp m_Grad_P
Internal value of the gradient of the Pressure vector.
vector_fp m_molefracs_tran
Non-zero mole fraction vector used in transport property calculations.
virtual void getSpeciesIonConductivity(doublereal *const ionCond)
Returns the pure species ionic conductivities for all species.
void updateHydrodynamicRadius_T()
Update the temperature-dependent hydrodynamic radius terms for each species internally.
bool m_ionCond_temp_ok
Boolean indicating that weight factors wrt ionic conductivty is current.
void updateIonConductivity_T()
Update the temperature-dependent ionic conductivity terms for each species internally.
virtual void mobilityRatio(doublereal *mobRat)
Returns the pointer to the mobility ratios of the binary combinations of the transported species for ...
DenseMatrix m_A
Matrix for the stefan maxwell equation.
doublereal m_lambda
Saved value of the mixture thermal conductivity.
virtual doublereal getElectricConduct()
Compute the mixture electrical conductivity from the Stefan-Maxwell equation.
vector_fp m_massfracs
Local copy of the mass fractions of the species in the phase.
vector_fp m_viscSpecies
Internal value of the species viscosities.
virtual void getSpeciesHydrodynamicRadius(doublereal *const radius)
Returns the hydrodynamic radius for all species.
virtual void getSpeciesFluxesES(size_t ndim, const doublereal *grad_T, size_t ldx, const doublereal *grad_X, size_t ldf, const doublereal *grad_Phi, doublereal *fluxes)
Return the species diffusive mass fluxes wrt to the averaged velocity in [kmol/m^2/s].
Base class to handle transport property evaluation in a mixture.
Class that holds the data that is read in from the xml file, and which is used for processing of the ...
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
Definition: DenseMatrix.h:70
Array2D m_flux
Solution of the Stefan Maxwell equation in terms of flux.
doublereal concTot_
Local copy of the total concentration.
LiquidTranInteraction * m_viscMixModel
Viscosity of the mixture expressed as a subclass of LiquidTranInteraction.
bool m_mobRat_mix_ok
Boolean indicating that the top-level mixture mobility ratio is current.
std::vector< LTPspecies * > m_diffTempDep_Ns
(NOT USED IN LiquidTransport.) Diffusion coefficient model for each species expressed as an appropria...
DenseMatrix m_bdiff
Array of Binary Diffusivities.
DenseMatrix m_mobRatSpecies
Internal value of the species mobility ratios.