Cantera  2.1.2
TransportBase.h
Go to the documentation of this file.
1 /**
2  * @file TransportBase.h
3  * Headers for the Transport object, which is the virtual base class
4  * for all transport property evaluators and also includes the
5  * tranprops group definition
6  * (see \ref tranprops and \link Cantera::Transport Transport \endlink) .
7  *
8  * Provides class Transport.
9  */
10 // Copyright 2001-2003 California Institute of Technology
11 
12 
13 /**
14  * @defgroup tranprops Transport Properties for Species in Phases
15  *
16  * @ingroup phases
17  *
18  * These classes provide transport properties.
19  */
20 
21 #ifndef CT_TRANSPORTBASE_H
22 #define CT_TRANSPORTBASE_H
23 
26 
27 namespace Cantera
28 {
29 
30 class TransportParams;
31 class GasTransportParams;
32 class LiquidTransportParams;
33 class SolidTransportData;
34 
35 /*!
36  * \addtogroup tranprops
37  */
38 //! \cond
39 
40 const int CK_Mode = 10;
41 
42 // types of transport models that can be constructed
43 const int None = 199;
44 const int cMulticomponent = 200;
45 const int CK_Multicomponent = 202;
46 const int cMixtureAveraged = 210;
47 const int CK_MixtureAveraged = 211;
48 const int cSolidTransport = 300;
49 const int cDustyGasTransport = 400;
50 const int cUserTransport = 500;
51 const int cFtnTransport = 600;
52 const int cLiquidTransport = 700;
53 const int cAqueousTransport = 750;
54 const int cSimpleTransport = 770;
55 const int cRadiativeTransport = 800;
56 const int cWaterTransport = 721;
57 const int cPecosTransport = 900;
58 //! \endcond
59 
60 // forward reference
61 class XML_Writer;
62 
63 //! The diffusion fluxes must be referenced to a particular reference
64 //! fluid velocity.
65 /*!
66  * Most typical is to reference the diffusion fluxes to the mass averaged velocity, but
67  * referencing to the mole averaged velocity is suitable for some
68  * liquid flows, and referencing to a single species is suitable for
69  * solid phase transport within a lattice. Currently, the identity of the reference
70  * velocity is coded into each transport object as a typedef named VelocityBasis, which
71  * is equated to an integer. Negative values of this variable refer to mass or mole-averaged
72  * velocities. Zero or positive quantities refers to the reference
73  * velocity being referenced to a particular species. Below are the predefined constants
74  * for its value.
75  *
76  * - VB_MASSAVG Diffusion velocities are based on the mass averaged velocity
77  * - VB_MOLEAVG Diffusion velocities are based on the mole averaged velocities
78  * - VB_SPECIES_0 Diffusion velocities are based on the relative motion wrt species 0
79  * - ...
80  * - VB_SPECIES_3 Diffusion velocities are based on the relative motion wrt species 3
81  *
82  * @ingroup tranprops
83  */
84 typedef int VelocityBasis;
85 
86 /*!
87  * \addtogroup tranprops
88  */
89 //@{
90 //! Diffusion velocities are based on the mass averaged velocity
92 //! Diffusion velocities are based on the mole averaged velocities
94 //! Diffusion velocities are based on the relative motion wrt species 0
96 //! Diffusion velocities are based on the relative motion wrt species 1
98 //! Diffusion velocities are based on the relative motion wrt species 2
100 //! Diffusion velocities are based on the relative motion wrt species 3
102 //@}
103 
104 //! Base class for transport property managers.
105 /*!
106  * All classes that compute transport properties for a single phase derive
107  * from this class. Class Transport is meant to be used as a base class
108  * only. It is possible to instantiate it, but its methods throw exceptions
109  * if called.
110  *
111  * <HR>
112  * <H2> Relationship of the %Transport class to the ThermoPhase Class </H2>
113  * <HR>
114  *
115  * This section describes how calculations are carried out within
116  * the Transport class. The Transport class and derived classes of the
117  * the Transport class necessarily use the ThermoPhase class to obtain
118  * the list of species and the thermodynamic state of the phase.
119  *
120  * No state information is stored within Transport classes. Queries to the
121  * underlying ThermoPhase object must be made to obtain the state of the
122  * system.
123  *
124  * An exception to this however is the state information concerning the
125  * the gradients of variables. This information is not stored within
126  * the ThermoPhase objects. It may be collected within the Transport objects.
127  * In fact, the meaning of const operations within the Transport class
128  * refers to calculations which do not change the state of the
129  * system nor the state of the first order gradients of the system.
130  *
131  * When a const operation is evoked within the Transport class, it is
132  * also implicitly assumed that the underlying state within the ThermoPhase
133  * object has not changed its values.
134  *
135  * <HR>
136  * <H2> Diffusion Fluxes and their Relationship to Reference Velocities </H2>
137  * <HR>
138  *
139  * The diffusion fluxes must be referenced to a particular reference fluid
140  * velocity. Most typical is to reference the diffusion fluxes to the mass
141  * averaged velocity, but referencing to the mole averaged velocity is suitable
142  * for some liquid flows, and referencing to a single species is suitable for
143  * solid phase transport within a lattice. Currently, the identity of the
144  * reference velocity is coded into each transport object as a typedef named
145  * VelocityBasis, which is equated to an integer. Negative values of this
146  * variable refer to mass or mole-averaged velocities. Zero or positive
147  * quantities refers to the reference velocity being referenced to a particular
148  * species. Below are the predefined constants for its value.
149  *
150  * - VB_MASSAVG Diffusion velocities are based on the mass averaged velocity
151  * - VB_MOLEAVG Diffusion velocities are based on the mole averaged velocities
152  * - VB_SPECIES_0 Diffusion velocities are based on the relative motion wrt species 0
153  * - ...
154  * - VB_SPECIES_3 Diffusion velocities are based on the relative motion wrt species 3
155  *
156  * All transport managers specify a default reference velocity in their default constructors.
157  * All gas phase transport managers by default specify the mass-averaged velocity as their
158  * reference velocities.
159  *
160  * @todo Provide a general mechanism to store the gradients of state variables
161  * within the system.
162  *
163  * @ingroup tranprops
164  */
166 {
167 public:
168  //! Constructor.
169  /*!
170  * New transport managers should be created using
171  * TransportFactory, not by calling the constructor directly.
172  *
173  * @param thermo Pointer to the ThermoPhase class representing
174  * this phase.
175  * @param ndim Dimension of the flux vector used in the calculation.
176  *
177  * @see TransportFactory
178  */
179  Transport(thermo_t* thermo=0, size_t ndim = 1);
180 
181  virtual ~Transport();
182  Transport(const Transport& right);
183  Transport& operator=(const Transport& right);
184 
185  //! Duplication routine for objects which inherit from Transport
186  /*!
187  * This virtual routine can be used to duplicate objects derived from
188  * Transport even if the application only has a pointer to Transport to
189  * work with.
190  *
191  * These routines are basically wrappers around the derived copy
192  * constructor.
193  */
194  // Note ->need working copy constructors and operator=() functions for all first
195  virtual Transport* duplMyselfAsTransport() const;
196 
197  //! Transport model.
198  /*!
199  * The transport model is the set of equations used to compute the transport
200  * properties. This method returns an integer flag that identifies the
201  * transport model implemented. The base class returns 0.
202  */
203  virtual int model() const {
204  return 0;
205  }
206 
207  /*!
208  * Phase object. Every transport manager is designed to compute properties
209  * for a specific phase of a mixture, which might be a liquid solution, a
210  * gas mixture, a surface, etc. This method returns a reference to the
211  * object representing the phase itself.
212  */
214  return *m_thermo;
215  }
216 
217  /*!
218  * Returns true if the transport manager is ready for use.
219  */
220  bool ready();
221 
222  //! Set the number of dimensions to be expected in flux expressions
223  /*!
224  * @param ndim Number of dimensions in flux expressions
225  */
226  void setNDim(const int ndim);
227 
228  //! Return the number of dimensions in flux expressions
229  size_t nDim() const {
230  return m_nDim;
231  }
232 
233  //! Check that the specified species index is in range
234  //! Throws an exception if k is greater than nSpecies()
235  void checkSpeciesIndex(size_t k) const;
236 
237  //! Check that an array size is at least nSpecies()
238  //! Throws an exception if kk is less than nSpecies(). Used before calls
239  //! which take an array pointer.
240  void checkSpeciesArraySize(size_t kk) const;
241 
242  /**
243  * @name Transport Properties
244  */
245  //@{
246 
247  /*!
248  * The viscosity in Pa-s.
249  */
250  virtual doublereal viscosity() {
251  return err("viscosity");
252  }
253 
254  //! Returns the pure species viscosities
255  /*!
256  * The units are Pa-s and the length is the number of species
257  *
258  * @param visc Vector of viscosities
259  */
260  virtual void getSpeciesViscosities(doublereal* const visc) {
261  err("getSpeciesViscosities");
262  }
263 
264  /**
265  * The bulk viscosity in Pa-s. The bulk viscosity is only
266  * non-zero in rare cases. Most transport managers either
267  * overload this method to return zero, or do not implement
268  * it, in which case an exception is thrown if called.
269  */
270  virtual doublereal bulkViscosity() {
271  return err("bulkViscosity");
272  }
273 
274  /**
275  * The ionic conductivity in 1/ohm/m.
276  */
277  virtual doublereal ionConductivity() {
278  return err("ionConductivity");
279  }
280 
281  //! Returns the pure species ionic conductivity
282  /*!
283  * The units are 1/ohm/m and the length is the number of species
284  *
285  * @param ionCond Vector of ionic conductivities
286  */
287  virtual void getSpeciesIonConductivity(doublereal* const ionCond) {
288  err("getSpeciesIonConductivity");
289  }
290 
291  //! Returns the pointer to the mobility ratios of the species in the phase
292  /*!
293  * @param mobRat Returns a matrix of mobility ratios for the current problem.
294  * The mobility ratio mobRat(i,j) is defined as the ratio of the
295  * mobility of species i to species j.
296  *
297  * mobRat(i,j) = mu_i / mu_j
298  *
299  * It is returned in fortran-ordering format. ie. it is returned as mobRat[k], where
300  *
301  * k = j * nsp + i
302  *
303  * The size of mobRat must be at least equal to nsp*nsp
304  */
305  virtual void mobilityRatio(double* mobRat) {
306  err("mobilityRatio");
307  }
308 
309  //! Returns the pure species limit of the mobility ratios
310  /*!
311  * The value is dimensionless and the length is the number of species
312  *
313  * @param mobRat Vector of mobility ratios
314  */
315  virtual void getSpeciesMobilityRatio(double** mobRat) {
316  err("getSpeciesMobilityRatio");
317  }
318 
319  //! Returns the self diffusion coefficients of the species in the phase
320  /*!
321  * The self diffusion coefficient is the diffusion coefficient of a tracer
322  * species at the current temperature and composition of the species.
323  * Therefore, the dilute limit of transport is assumed for the tracer
324  * species. The effective formula may be calculated from the stefan-maxwell
325  * formulation by adding another row for the tracer species, assigning all
326  * D's to be equal to the respective species D's, and then taking the limit
327  * as the tracer species mole fraction goes to zero. The corresponding flux
328  * equation for the tracer species k in units of kmol m-2 s-1 is.
329  *
330  * \f[
331  * J_k = - D^{sd}_k \frac{C_k}{R T} \nabla \mu_k
332  * \f]
333  *
334  * The derivative is taken at constant T and P.
335  *
336  * The self diffusion calculation is handled by subclasses of
337  * LiquidTranInteraction as specified in the input file.
338  * These in turn employ subclasses of LTPspecies to
339  * determine the individual species self diffusion coeffs.
340  *
341  * @param selfDiff Vector of self-diffusion coefficients. Length = number
342  * of species in phase. units = m**2 s-1.
343  */
344  virtual void selfDiffusion(doublereal* const selfDiff) {
345  err("selfDiffusion");
346  }
347 
348  //! Returns the pure species self diffusion in solution of each species
349  /*!
350  * The pure species molar volumes are evaluated using the appropriate
351  * subclasses of LTPspecies as specified in the input file.
352  *
353  * @param selfDiff array of length "number of species"
354  * to hold returned self diffusion coeffs.
355  */
356  virtual void getSpeciesSelfDiffusion(double** selfDiff) {
357  err("getSpeciesSelfDiffusion");
358  }
359 
360  //! Returns the mixture thermal conductivity in W/m/K.
361  /*!
362  * Units are in W / m K or equivalently kg m / s3 K
363  *
364  * @return returns thermal conductivity in W/m/K.
365  */
366  virtual doublereal thermalConductivity() {
367  return err("thermalConductivity");
368  }
369 
370  /*!
371  * The electrical conductivity (Siemens/m).
372  */
373  virtual doublereal electricalConductivity() {
374  return err("electricalConductivity");
375  }
376 
377  //! Get the Electrical mobilities (m^2/V/s).
378  /*!
379  * This function returns the mobilities. In some formulations
380  * this is equal to the normal mobility multiplied by faraday's constant.
381  *
382  * Frequently, but not always, the mobility is calculated from the
383  * diffusion coefficient using the Einstein relation
384  *
385  * \f[
386  * \mu^e_k = \frac{F D_k}{R T}
387  * \f]
388  *
389  * @param mobil_e Returns the mobilities of the species in array \c
390  * mobil_e. The array must be dimensioned at least as large as
391  * the number of species.
392  */
393  virtual void getMobilities(doublereal* const mobil_e) {
394  err("getMobilities");
395  }
396 
397  //! Get the fluid mobilities (s kmol/kg).
398  /*!
399  * This function returns the fluid mobilities. Usually, you have
400  * to multiply Faraday's constant into the resulting expression
401  * to general a species flux expression.
402  *
403  * Frequently, but not always, the mobility is calculated from the
404  * diffusion coefficient using the Einstein relation
405  *
406  * \f[
407  * \mu^f_k = \frac{D_k}{R T}
408  * \f]
409  *
410  * @param mobil_f Returns the mobilities of the species in array \c mobil.
411  * The array must be dimensioned at least as large as the
412  * number of species.
413  */
414  virtual void getFluidMobilities(doublereal* const mobil_f) {
415  err("getFluidMobilities");
416  }
417 
418  //@}
419 
420  //! Compute the mixture electrical conductivity (S m-1) at the current
421  //! conditions of the phase (Siemens m-1)
422  /*!
423  * The electrical conductivity, \f$ \sigma \f$, relates the electric
424  * current density, J, to the electric field, E.
425  *
426  * \f[
427  * \vec{J} = \sigma \vec{E}
428  * \f]
429  *
430  * We assume here that the mixture electrical conductivity is an isotropic
431  * quantity, at this stage. Tensors may be included at a later time.
432  *
433  * The conductivity is the reciprocal of the resistivity.
434  *
435  * The units are Siemens m-1, where 1 S = 1 A / volt = 1 s^3 A^2 /kg /m^2
436  */
437  virtual doublereal getElectricConduct() {
438  err("getElectricConduct");
439  return 0.0;
440  }
441 
442  //! Compute the electric current density in A/m^2
443  /*!
444  * Calculates the electric current density as a vector, given
445  * the gradients of the field variables.
446  *
447  * @param ndim The number of spatial dimensions (1, 2, or 3).
448  * @param grad_T The temperature gradient (ignored in this model).
449  * @param ldx Leading dimension of the grad_X array.
450  * @param grad_X The gradient of the mole fraction
451  * @param ldf Leading dimension of the grad_V and current vectors.
452  * @param grad_V The electrostatic potential gradient.
453  * @param current The electric current in A/m^2. This is a vector of length ndim
454  */
455  virtual void getElectricCurrent(int ndim,
456  const doublereal* grad_T,
457  int ldx,
458  const doublereal* grad_X,
459  int ldf,
460  const doublereal* grad_V,
461  doublereal* current) {
462  err("getElectricCurrent");
463  }
464 
465  //! Get the species diffusive mass fluxes wrt to the specified solution
466  //! averaged velocity, given the gradients in mole fraction and temperature
467  /*!
468  * Units for the returned fluxes are kg m-2 s-1.
469  *
470  * Usually the specified solution average velocity is the mass averaged
471  * velocity. This is changed in some subclasses, however.
472  *
473  * @param ndim Number of dimensions in the flux expressions
474  * @param grad_T Gradient of the temperature
475  * (length = ndim)
476  * @param ldx Leading dimension of the grad_X array
477  * (usually equal to m_nsp but not always)
478  * @param grad_X Gradients of the mole fraction
479  * Flat vector with the m_nsp in the inner loop.
480  * length = ldx * ndim
481  * @param ldf Leading dimension of the fluxes array
482  * (usually equal to m_nsp but not always)
483  * @param fluxes Output of the diffusive mass fluxes
484  * Flat vector with the m_nsp in the inner loop.
485  * length = ldx * ndim
486  */
487  virtual void getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
488  size_t ldx, const doublereal* const grad_X,
489  size_t ldf, doublereal* const fluxes);
490 
491  //! Get the species diffusive mass fluxes wrt to the mass averaged velocity,
492  //! given the gradients in mole fraction, temperature and electrostatic
493  //! potential.
494  /*!
495  * Units for the returned fluxes are kg m-2 s-1.
496  *
497  * @param[in] ndim Number of dimensions in the flux expressions
498  * @param[in] grad_T Gradient of the temperature. (length = ndim)
499  * @param[in] ldx Leading dimension of the grad_X array (usually equal to
500  * m_nsp but not always)
501  * @param[in] grad_X Gradients of the mole fraction. Flat vector with the
502  * m_nsp in the inner loop. length = ldx * ndim.
503  * @param[in] ldf Leading dimension of the fluxes array (usually equal to
504  * m_nsp but not always).
505  * @param[in] grad_Phi Gradients of the electrostatic potential (length = ndim)
506  * @param[out] fluxes The diffusive mass fluxes. Flat vector with the m_nsp
507  * in the inner loop. length = ldx * ndim.
508  */
509  virtual void getSpeciesFluxesES(size_t ndim,
510  const doublereal* grad_T,
511  size_t ldx,
512  const doublereal* grad_X,
513  size_t ldf,
514  const doublereal* grad_Phi,
515  doublereal* fluxes) {
516  getSpeciesFluxes(ndim, grad_T, ldx, grad_X, ldf, fluxes);
517  }
518 
519  //! Get the species diffusive velocities wrt to the mass averaged velocity,
520  //! given the gradients in mole fraction and temperature
521  /*!
522  * @param[in] ndim Number of dimensions in the flux expressions
523  * @param[in] grad_T Gradient of the temperature (length = ndim)
524  * @param[in] ldx Leading dimension of the grad_X array (usually equal to
525  * m_nsp but not always)
526  * @param[in] grad_X Gradients of the mole fraction. Flat vector with the
527  * m_nsp in the inner loop. length = ldx * ndim
528  * @param[in] ldf Leading dimension of the fluxes array (usually equal to
529  * m_nsp but not always)
530  * @param[out] Vdiff Diffusive velocities wrt the mass- averaged velocity.
531  * Flat vector with the m_nsp in the inner loop.
532  * length = ldx * ndim. units are m / s.
533  */
534  virtual void getSpeciesVdiff(size_t ndim,
535  const doublereal* grad_T,
536  int ldx,
537  const doublereal* grad_X,
538  int ldf,
539  doublereal* Vdiff) {
540  err("getSpeciesVdiff");
541  }
542 
543  //! Get the species diffusive velocities wrt to the mass averaged velocity,
544  //! given the gradients in mole fraction, temperature, and electrostatic
545  //! potential.
546  /*!
547  * @param[in] ndim Number of dimensions in the flux expressions
548  * @param[in] grad_T Gradient of the temperature (length = ndim)
549  * @param[in] ldx Leading dimension of the grad_X array (usually equal to
550  * m_nsp but not always)
551  * @param[in] grad_X Gradients of the mole fraction. Flat vector with the
552  * m_nsp in the inner loop. length = ldx * ndim.
553  * @param[in] ldf Leading dimension of the fluxes array (usually equal to
554  * m_nsp but not always)
555  * @param[in] grad_Phi Gradients of the electrostatic potential
556  * (length = ndim)
557  * @param[out] Vdiff Diffusive velocities wrt the mass-averaged velocity.
558  * Flat vector with the m_nsp in the inner loop. length = ldx
559  * * ndim units are m / s.
560  */
561  virtual void getSpeciesVdiffES(size_t ndim,
562  const doublereal* grad_T,
563  int ldx,
564  const doublereal* grad_X,
565  int ldf,
566  const doublereal* grad_Phi,
567  doublereal* Vdiff) {
568  getSpeciesVdiff(ndim, grad_T, ldx, grad_X, ldf, Vdiff);
569  }
570 
571  //! Get the molar fluxes [kmol/m^2/s], given the thermodynamic state at two
572  //! nearby points.
573  /*!
574  * @param[in] state1 Array of temperature, density, and mass fractions for
575  * state 1.
576  * @param[in] state2 Array of temperature, density, and mass fractions for
577  * state 2.
578  * @param[in] delta Distance from state 1 to state 2 (m).
579  * @param[out] cfluxes Output array containing the diffusive molar fluxes of
580  * species from state1 to state2. This is a flat vector with
581  * m_nsp in the inner loop. length = ldx * ndim. Units are
582  * [kmol/m^2/s].
583  */
584  virtual void getMolarFluxes(const doublereal* const state1,
585  const doublereal* const state2, const doublereal delta,
586  doublereal* const cfluxes) {
587  err("getMolarFluxes");
588  }
589 
590  //! Get the mass fluxes [kg/m^2/s], given the thermodynamic state at two
591  //! nearby points.
592  /*!
593  * @param[in] state1 Array of temperature, density, and mass
594  * fractions for state 1.
595  * @param[in] state2 Array of temperature, density, and mass fractions for
596  * state 2.
597  * @param[in] delta Distance from state 1 to state 2 (m).
598  * @param[out] mfluxes Output array containing the diffusive mass fluxes of
599  * species from state1 to state2. This is a flat vector with
600  * m_nsp in the inner loop. length = ldx * ndim. Units are
601  * [kg/m^2/s].
602  */
603  virtual void getMassFluxes(const doublereal* state1,
604  const doublereal* state2, doublereal delta,
605  doublereal* mfluxes) {
606  err("getMassFluxes");
607  }
608 
609  //! Return a vector of Thermal diffusion coefficients [kg/m/sec].
610  /*!
611  * The thermal diffusion coefficient \f$ D^T_k \f$ is defined so that the
612  * diffusive mass flux of species <I>k</I> induced by the local temperature
613  * gradient is given by the following formula:
614  *
615  * \f[
616  * M_k J_k = -D^T_k \nabla \ln T.
617  * \f]
618  *
619  * The thermal diffusion coefficient can be either positive or negative.
620  *
621  * @param dt On return, dt will contain the species thermal diffusion
622  * coefficients. Dimension dt at least as large as the number of
623  * species. Units are kg/m/s.
624  */
625  virtual void getThermalDiffCoeffs(doublereal* const dt) {
626  err("getThermalDiffCoeffs");
627  }
628 
629  //! Returns the matrix of binary diffusion coefficients [m^2/s].
630  /*!
631  * @param[in] ld Inner stride for writing the two dimension diffusion
632  * coefficients into a one dimensional vector
633  * @param[out] d Diffusion coefficient matrix (must be at least m_k * m_k
634  * in length.
635  */
636  virtual void getBinaryDiffCoeffs(const size_t ld, doublereal* const d) {
637  err("getBinaryDiffCoeffs");
638  }
639 
640  //! Return the Multicomponent diffusion coefficients. Units: [m^2/s].
641  /*!
642  * If the transport manager implements a multicomponent diffusion
643  * model, then this method returns the array of multicomponent
644  * diffusion coefficients. Otherwise it throws an exception.
645  *
646  * @param[in] ld The dimension of the inner loop of d (usually equal to m_nsp)
647  * @param[out] d flat vector of diffusion coefficients, fortran ordering.
648  * d[ld*j+i] is the D_ij diffusion coefficient (the diffusion
649  * coefficient for species i due to species j).
650  */
651  virtual void getMultiDiffCoeffs(const size_t ld, doublereal* const d) {
652  err("getMultiDiffCoeffs");
653  }
654 
655  //! Returns a vector of mixture averaged diffusion coefficients
656  /**
657  * Mixture-averaged diffusion coefficients [m^2/s]. If the transport
658  * manager implements a mixture-averaged diffusion model, then this method
659  * returns the array of mixture-averaged diffusion coefficients. Otherwise
660  * it throws an exception.
661  *
662  * @param d Return vector of mixture averaged diffusion coefficients
663  * Units = m2/s. Length = n_sp
664  */
665  virtual void getMixDiffCoeffs(doublereal* const d) {
666  err("getMixDiffCoeffs");
667  }
668 
669  //! Returns a vector of mixture averaged diffusion coefficients
670  virtual void getMixDiffCoeffsMole(doublereal* const d) {
671  err("getMixDiffCoeffsMole");
672  }
673 
674  //! Returns a vector of mixture averaged diffusion coefficients
675  virtual void getMixDiffCoeffsMass(doublereal* const d) {
676  err("getMixDiffCoeffsMass");
677  }
678 
679  //! Set model parameters for derived classes
680  /*!
681  * This method may be derived in subclasses to set model-specific
682  * parameters. The primary use of this class is to set parameters while in
683  * the middle of a calculation without actually having to dynamically cast
684  * the base Transport pointer.
685  *
686  * @param type Specifies the type of parameters to set
687  * 0 : Diffusion coefficient
688  * 1 : Thermal Conductivity
689  * The rest are currently unused.
690  * @param k Species index to set the parameters on
691  * @param p Vector of parameters. The length of the vector
692  * varies with the parameterization
693  * @deprecated
694  */
695  virtual void setParameters(const int type, const int k, const doublereal* const p);
696 
697  //! Sets the velocity basis
698  /*!
699  * What the transport object does with this parameter is up to the
700  * individual operator. Currently, this is not functional for most
701  * transport operators including all of the gas-phase operators.
702  *
703  * @param ivb Species the velocity basis
704  */
706  m_velocityBasis = ivb;
707  }
708 
709  //! Gets the velocity basis
710  /*!
711  * What the transport object does with this parameter is up to the
712  * individual operator. Currently, this is not functional for most
713  * transport operators including all of the gas-phase operators.
714  *
715  * @return Returns the velocity basis
716  */
718  return m_velocityBasis;
719  }
720 
721  friend class TransportFactory;
722 
723 protected:
724 
725  /**
726  * @name Transport manager construction
727  * These methods are used internally during construction.
728  * @{
729  */
730 
731  //! Called by TransportFactory to set parameters.
732  /*!
733  * This is called by classes that use the gas phase parameter
734  * list to initialize themselves.
735  *
736  * @param tr Reference to the parameter list that will be used
737  * to initialize the class
738  */
739  virtual bool initGas(GasTransportParams& tr) {
740  err("initGas");
741  return false;
742  }
743 
744  //! Called by TransportFactory to set parameters.
745  /*!
746  * This is called by classes that use the liquid phase parameter
747  * list to initialize themselves.
748  *
749  * @param tr Reference to the parameter list that will be used
750  * to initialize the class
751  */
752  virtual bool initLiquid(LiquidTransportParams& tr) {
753  err("initLiquid");
754  return false;
755  }
756 
757 public:
758  //! Called by TransportFactory to set parameters.
759  /*!
760  * This is called by classes that use the solid phase parameter
761  * list to initialize themselves.
762  *
763  * @param tr Reference to the parameter list that will be used
764  * to initialize the class
765  */
766  virtual bool initSolid(SolidTransportData& tr) {
767  err("initSolid");
768  return false;
769  }
770 
771  //! Specifies the ThermoPhase object.
772  /*!
773  * We have relaxed this operation so that it will succeed when
774  * the underlying old and new ThermoPhase objects have the same
775  * number of species and the same names of the species in the
776  * same order. The idea here is to allow copy constructors and duplicators
777  * to work. In order for them to work, we need a method to switch the
778  * internal pointer within the Transport object after the duplication
779  * takes place. Also, different thermodynamic instanteations of the same
780  * species should also work.
781  *
782  * @param thermo Reference to the ThermoPhase object that
783  * the transport object will use
784  */
785  virtual void setThermo(thermo_t& thermo);
786 
787 protected:
788  //! Enable the transport object for use.
789  /*!
790  * Once finalize() has been called, the transport manager should be ready to
791  * compute any supported transport property, and no further modifications to
792  * the model parameters should be made.
793  */
794  void finalize();
795 
796  //@}
797 
798  //! pointer to the object representing the phase
800 
801  //! true if finalize has been called
802  bool m_ready;
803 
804  //! Number of species
805  size_t m_nsp;
806 
807  //! Number of dimensions used in flux expressions
808  size_t m_nDim;
809 
810  //! Velocity basis from which diffusion velocities are computed.
811  //! Defaults to the mass averaged basis = -2
813 
814 private:
815 
816  //! Error routine
817  /*!
818  * Throw an exception if a method of this class is invoked. This probably
819  * indicates that a transport manager is being used that does not implement
820  * all virtual methods, and one of those methods was called by the
821  * application program. For example, a transport manager that computes the
822  * thermal conductivity of a solid may not define the viscosity() method,
823  * since the viscosity is in this case meaningless. If the application
824  * invokes the viscosity() method, the base class method will be called,
825  * resulting in an exception being thrown.
826  *
827  * @param msg Descriptive message string to add to the error report
828  *
829  * @return returns a double, though we will never get there
830  */
831  doublereal err(const std::string& msg) const;
832 
833 };
834 
835 }
836 
837 #endif
virtual void getMixDiffCoeffsMole(doublereal *const d)
Returns a vector of mixture averaged diffusion coefficients.
This structure holds transport model parameters relevant to transport in ideal gases with a kinetic t...
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal *const d)
Returns the matrix of binary diffusion coefficients [m^2/s].
void checkSpeciesIndex(size_t k) const
Check that the specified species index is in range Throws an exception if k is greater than nSpecies(...
virtual void selfDiffusion(doublereal *const selfDiff)
Returns the self diffusion coefficients of the species in the phase.
Transport(thermo_t *thermo=0, size_t ndim=1)
Constructor.
virtual int model() const
Transport model.
const VelocityBasis VB_SPECIES_1
Diffusion velocities are based on the relative motion wrt species 1.
Definition: TransportBase.h:97
size_t m_nDim
Number of dimensions used in flux expressions.
Factory class for creating new instances of classes derived from Transport.
thermo_t * m_thermo
pointer to the object representing the phase
virtual doublereal bulkViscosity()
The bulk viscosity in Pa-s.
void setVelocityBasis(VelocityBasis ivb)
Sets the velocity basis.
Base class for transport property managers.
virtual void getSpeciesMobilityRatio(double **mobRat)
Returns the pure species limit of the mobility ratios.
virtual bool initSolid(SolidTransportData &tr)
Called by TransportFactory to set parameters.
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.
virtual void getSpeciesViscosities(doublereal *const visc)
Returns the pure species viscosities.
size_t nDim() const
Return the number of dimensions in flux expressions.
void finalize()
Enable the transport object for use.
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:101
int VelocityBasis
The diffusion fluxes must be referenced to a particular reference fluid velocity. ...
Definition: TransportBase.h:61
Class LiquidTransportParams holds transport model parameters relevant to transport in mixtures...
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 mass averaged velocity, given the gradients in mole f...
doublereal err(const std::string &msg) const
Error routine.
virtual void getMassFluxes(const doublereal *state1, const doublereal *state2, doublereal delta, doublereal *mfluxes)
Get the mass fluxes [kg/m^2/s], given the thermodynamic state at two nearby points.
VelocityBasis getVelocityBasis() const
Gets the velocity basis.
const VelocityBasis VB_SPECIES_3
Diffusion velocities are based on the relative motion wrt species 3.
void checkSpeciesArraySize(size_t kk) const
Check that an array size is at least nSpecies() Throws an exception if kk is less than nSpecies()...
virtual void setParameters(const int type, const int k, const doublereal *const p)
Set model parameters for derived classes.
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)
Get the species diffusive mass fluxes wrt to the mass averaged velocity, given the gradients in mole ...
virtual doublereal thermalConductivity()
Returns the mixture thermal conductivity in W/m/K.
virtual doublereal viscosity()
void setNDim(const int ndim)
Set the number of dimensions to be expected in flux expressions.
thermo_t & thermo()
virtual doublereal ionConductivity()
The ionic conductivity in 1/ohm/m.
virtual void getMobilities(doublereal *const mobil_e)
Get the Electrical mobilities (m^2/V/s).
virtual void getSpeciesSelfDiffusion(double **selfDiff)
Returns the pure species self diffusion in solution of each species.
virtual void getMultiDiffCoeffs(const size_t ld, doublereal *const d)
Return the Multicomponent diffusion coefficients. Units: [m^2/s].
virtual void mobilityRatio(double *mobRat)
Returns the pointer to the mobility ratios of the species in the phase.
bool m_ready
true if finalize has been called
const VelocityBasis VB_MOLEAVG
Diffusion velocities are based on the mole averaged velocities.
Definition: TransportBase.h:93
virtual void getMixDiffCoeffs(doublereal *const d)
Returns a vector of mixture averaged diffusion coefficients.
virtual void getMixDiffCoeffsMass(doublereal *const d)
Returns a vector of mixture averaged diffusion coefficients.
virtual bool initLiquid(LiquidTransportParams &tr)
Called by TransportFactory to set parameters.
Headers for the DenseMatrix object, which deals with dense rectangular matrices and description of th...
virtual doublereal electricalConductivity()
size_t m_nsp
Number of species.
virtual void getThermalDiffCoeffs(doublereal *const dt)
Return a vector of Thermal diffusion coefficients [kg/m/sec].
const VelocityBasis VB_MASSAVG
Diffusion velocities are based on the mass averaged velocity.
Definition: TransportBase.h:91
virtual void setThermo(thermo_t &thermo)
Specifies the ThermoPhase object.
virtual Transport * duplMyselfAsTransport() const
Duplication routine for objects which inherit from Transport.
virtual doublereal getElectricConduct()
Compute the mixture electrical conductivity (S m-1) at the current conditions of the phase (Siemens m...
const VelocityBasis VB_SPECIES_2
Diffusion velocities are based on the relative motion wrt species 2.
Definition: TransportBase.h:99
Header file for class ThermoPhase, the base class for phases with thermodynamic properties, and the text for the Module thermoprops (see Thermodynamic Properties and class ThermoPhase).
virtual void getMolarFluxes(const doublereal *const state1, const doublereal *const state2, const doublereal delta, doublereal *const cfluxes)
Get the molar fluxes [kmol/m^2/s], given the thermodynamic state at two nearby points.
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)
Get the species diffusive mass fluxes wrt to the specified solution averaged velocity, given the gradients in mole fraction and temperature.
Class SolidTransportData holds transport parameters for a specific solid-phase species.
int m_velocityBasis
Velocity basis from which diffusion velocities are computed.
virtual bool initGas(GasTransportParams &tr)
Called by TransportFactory to set parameters.
virtual void getFluidMobilities(doublereal *const mobil_f)
Get the fluid mobilities (s kmol/kg).
const VelocityBasis VB_SPECIES_0
Diffusion velocities are based on the relative motion wrt species 0.
Definition: TransportBase.h:95
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 mass averaged velocity, given the gradients in mole f...
virtual void getSpeciesIonConductivity(doublereal *const ionCond)
Returns the pure species ionic conductivity.