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