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