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