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