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