Clean up Doxygen documentation for class Transport and descendants

This commit is contained in:
Ray Speth 2013-06-03 22:16:29 +00:00
parent e667978655
commit 098a87cdcd
22 changed files with 585 additions and 2711 deletions

View file

@ -4,18 +4,15 @@
*/
// Copyright 2001 California Institute of Technology
#ifndef CT_AQUEOUSTRAN_H
#define CT_AQUEOUSTRAN_H
// Cantera includes
#include "TransportBase.h"
#include "cantera/numerics/DenseMatrix.h"
#include "TransportParams.h"
#include "LiquidTransportParams.h"
#include <vector>
#include <string>
#include <map>
@ -25,15 +22,12 @@
namespace Cantera
{
class LiquidTransportParams;
//! Class AqueousTransport implements mixture-averaged transport
//! properties for brine phases.
/*!
* The model is based on that
* described by Newman, Electrochemical Systems
* The model is based on that described by Newman, Electrochemical Systems
*
* The velocity of species i may be described by the
* following equation p. 297 (12.1)
@ -74,7 +68,6 @@ class LiquidTransportParams;
* \mathbf{v}_i = \mathbf{v} + \frac{\mathbf{j}_i}{\rho_i}
* \f]
*
*
* \f[
* c_i \nabla \mu_i = R T \sum_j \frac{c_i c_j}{c_T D_{ij}}
* (\frac{\mathbf{j}_j}{\rho_j} - \frac{\mathbf{j}_i}{\rho_i})
@ -105,9 +98,8 @@ class LiquidTransportParams;
* (\frac{x_i \mathbf{j}_j}{M_j} - \frac{x_j \mathbf{j}_i}{M_i})
* \f]
*
* With this formulation we may solve for the diffusion velocities,
* without having to worry about what the mass averaged velocity
* is.
* With this formulation we may solve for the diffusion velocities, without
* having to worry about what the mass averaged velocity is.
*
* <H2> Viscosity Calculation </H2>
*
@ -115,19 +107,12 @@ class LiquidTransportParams;
* In the first part, the viscosity of the pure species are calculated
* In the second part, a mixing rule is applied, based on the
* Wilkes correlation, to yield the mixture viscosity.
*
*
*
*/
class AqueousTransport : public Transport
{
public:
//! default constructor
AqueousTransport();
//! Return the model id for this transport parameterization
virtual int model() const {
return cAqueousTransport;
}
@ -153,7 +138,6 @@ public:
//! Returns the pure species viscosities
/*!
*
* Controlling update boolean = m_viscwt_ok
*
* @param visc Vector of species viscosities
@ -192,75 +176,35 @@ public:
*/
virtual doublereal thermalConductivity();
//! Returns the binary diffusion coefficients
/*!
* @param ld
* @param d
*/
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal* const d);
//! Get the Mixture diffusion coefficients
/*!
* For the single species case or the pure fluid case the routine returns
* the self-diffusion coefficient. This is need to avoid a NaN result.
* @param d vector of mixture diffusion coefficients
* units = m2 s-1. length = number of species
*/
virtual void getMixDiffCoeffs(doublereal* const d);
//! Get the Electrical mobilities (m^2/V/s).
/*!
* This function returns the electrical mobilities. In some formulations
* this is equal to the normal mobility multiplied by faraday's constant.
*
* Frequently, but not always, the mobility is calculated from the
* diffusion coefficient using the Einstein relation
*
* \f[
* \mu^e_k = \frac{F D_k}{R T}
* \f]
*
* @param mobil_e Returns the mobilities of
* the species in array \c mobil_e. The array must be
* dimensioned at least as large as the number of species.
*/
virtual void getMobilities(doublereal* const mobil_e);
//! Get the fluid mobilities (s kmol/kg).
/*!
* This function returns the fluid mobilities. Usually, you have
* to multiply Faraday's constant into the resulting expression
* to general a species flux expression.
*
* Frequently, but not always, the mobility is calculated from the
* diffusion coefficient using the Einstein relation
*
* \f[
* \mu^f_k = \frac{D_k}{R T}
* \f]
*
* @param mobil_f Returns the mobilities of
* the species in array \c mobil_f. The array must be
* dimensioned at least as large as the number of species.
*/
virtual void getFluidMobilities(doublereal* const mobil_f);
//! Specify the value of the gradient of the voltage
/*!
*
* @param grad_V Gradient of the voltage (length num dimensions);
*/
virtual void set_Grad_V(const doublereal* const grad_V);
//! Specify the value of the gradient of the temperature
/*!
*
* @param grad_T Gradient of the temperature (length num dimensions);
*/
virtual void set_Grad_T(const doublereal* const grad_T);
//! Specify the value of the gradient of the MoleFractions
/*!
*
* @param grad_X Gradient of the mole fractions(length nsp * num dimensions);
*/
virtual void set_Grad_X(const doublereal* const grad_X);
@ -268,49 +212,20 @@ public:
//! Handles the effects of changes in the Temperature, internally
//! within the object.
/*!
* This is called whenever a transport property is
* requested.
* The first task is to check whether the temperature has changed
* since the last call to update_T().
* If it hasn't then an immediate return is carried out.
*
* @internal
* This is called whenever a transport property is requested. The first
* task is to check whether the temperature has changed since the last
* call to update_T(). If it hasn't then an immediate return is carried
* out.
*/
virtual void update_T();
//! Handles the effects of changes in the mixture concentration
/*!
* This is called the first time any transport property
* is requested from Mixture after the concentrations
* have changed.
*
* @internal
* This is called the first time any transport property is requested from
* Mixture after the concentrations have changed.
*/
virtual void update_C();
//! Get the species diffusive mass fluxes wrt to the specified solution averaged velocity,
//! given the gradients in mole fraction and temperature
/*!
* Units for the returned fluxes are kg m-2 s-1.
*
* Usually the specified solution average velocity is the mass averaged velocity.
* This is changed in some subclasses, however.
*
* @param ndim Number of dimensions in the flux expressions
* @param grad_T Gradient of the temperature
* (length = ndim)
* @param ldx Leading dimension of the grad_X array
* (usually equal to m_nsp but not always)
* @param grad_X Gradients of the mole fraction
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* @param ldf Leading dimension of the fluxes array
* (usually equal to m_nsp but not always)
* @param fluxes Output of the diffusive mass fluxes
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
*/
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);
@ -344,14 +259,12 @@ public:
*/
virtual void getSpeciesFluxesExt(size_t ldf, doublereal* const fluxes);
//! Initialize the transport object
/*!
* Here we change all of the internal dimensions to be sufficient.
* We get the object ready to do property evaluations.
*
* @param tr Transport parameters for all of the species
* in the phase.
* @param tr Transport parameters for all of the species in the phase.
*/
virtual bool initLiquid(LiquidTransportParams& tr);
@ -366,8 +279,7 @@ public:
*/
class LiquidTransportData getLiquidTransportData(int k);
//! Solve the stefan_maxell equations for the diffusive fluxes.
//! Solve the Stefan-Maxwell equations for the diffusive fluxes.
void stefan_maxwell_solve();
private:
@ -396,7 +308,6 @@ private:
*/
std::vector<vector_fp> m_diffcoeffs;
//! Internal value of the gradient of the mole fraction vector
/*!
* m_nsp is the number of species in the fluid
@ -410,25 +321,21 @@ private:
//! Internal value of the gradient of the Temperature vector
/*!
* Generally, if a transport property needs this
* in its evaluation it will look to this place
* to get it.
* Generally, if a transport property needs this in its evaluation it
* will look to this place to get it.
*
* No internal property is precalculated based on gradients.
* Gradients are assumed to be freshly updated before
* every property call.
* No internal property is precalculated based on gradients. Gradients
* are assumed to be freshly updated before every property call.
*/
vector_fp m_Grad_T;
//! Internal value of the gradient of the Electric Voltage
/*!
* Generally, if a transport property needs this
* in its evaluation it will look to this place
* to get it.
* Generally, if a transport property needs this in its evaluation it
* will look to this place to get it.
*
* No internal property is precalculated based on gradients.
* Gradients are assumed to be freshly updated before
* every property call.
* No internal property is precalculated based on gradients. Gradients
* are assumed to be freshly updated before every property call.
*/
vector_fp m_Grad_V;
@ -592,11 +499,11 @@ private:
//! work space of size m_nsp
vector_fp m_spwork;
//! Update the temperature-dependent viscosity terms.
//! Updates the array of pure species viscosities, and the
//! weighting functions in the viscosity mixture rule.
//! Update the temperature-dependent viscosity terms.
/*!
* The flag m_visc_ok is set to true.
* Updates the array of pure species viscosities, and the weighting
* functions in the viscosity mixture rule. The flag m_visc_ok is set to
* true.
*/
void updateViscosity_T();
@ -609,15 +516,12 @@ private:
* Internal routine is run whenever the update_boolean
* m_spvisc_ok is false. This routine will calculate
* internal values for the species viscosities.
*
* @internal
*/
void updateSpeciesViscosities();
//! Update the binary diffusion coefficients wrt T.
/*!
* These are evaluated
* from the polynomial fits at unit pressure (1 Pa).
* These are evaluated from the polynomial fits at unit pressure (1 Pa).
*/
void updateDiff_T();
@ -670,9 +574,3 @@ private:
};
}
#endif

View file

@ -7,7 +7,6 @@
// Copyright 2003 California Institute of Technology
#ifndef CT_DUSTYGASTRAN_H
#define CT_DUSTYGASTRAN_H
@ -15,19 +14,19 @@
#include "TransportBase.h"
#include "cantera/numerics/DenseMatrix.h"
namespace Cantera
{
//! Class DustyGasTransport implements the Dusty Gas model for transport in porous media.
/*!
* As implemented here, only species transport is handled. The viscosity, thermal conductivity, and thermal
* diffusion coefficients are not implemented.
* As implemented here, only species transport is handled. The viscosity,
* thermal conductivity, and thermal diffusion coefficients are not
* implemented.
*
* The dusty gas model includes the effects of Darcy's law. There is a net flux of species due to a pressure gradient
* that is part of Darcy's law.
* The dusty gas model includes the effects of Darcy's law. There is a net
* flux of species due to a pressure gradient that is part of Darcy's law.
*
* The dusty gas model expresses the value of the molar flux of species \f$ k \f$, \f$ J_k \f$ by the following formula.
* The dusty gas model expresses the value of the molar flux of species \f$ k
* \f$, \f$ J_k \f$ by the following formula.
*
* \f[
* \sum_{j \ne k}{\frac{X_j J_k - X_k J_j}{D^e_{kj}}} + \frac{J_k}{\mathcal{D}^{e}_{k,knud}} =
@ -61,24 +60,17 @@ namespace Cantera
*/
class DustyGasTransport : public Transport
{
public:
//! default constructor
/*!
* @param thermo Pointer to the %ThermoPhase object for this phase. Defaults to zero.
* @param thermo Pointer to the ThermoPhase object for this phase. Defaults to zero.
*/
DustyGasTransport(thermo_t* thermo=0);
//! Copy Constructor for the %DustyGasTransport object.
/*!
* @param right %LiquidTransport to be copied
*/
DustyGasTransport(const DustyGasTransport& right);
//! Assignment operator
/*!
*
* Warning -> Shallow pointer copies are made of m_thermo and m_gastran.. gastran may not point to the correct
* object after this copy. The routine initialize() must be called after this
* routine to complete the copy.
@ -88,44 +80,18 @@ public:
*/
DustyGasTransport& operator=(const DustyGasTransport& right);
//! Destructor.
virtual ~DustyGasTransport();
//! Duplication routine for objects which inherit from %Transport
/*!
* This virtual routine can be used to duplicate %Transport objects
* inherited from %Transport even if the application only has
* a pointer to %Transport to work with.
*
* These routines are basically wrappers around the derived copy
* constructor.
*/
virtual Transport* duplMyselfAsTransport() const;
//! Specifies the %ThermPhase object.
/*!
* We have relaxed this operation so that it will succeed when
* the underlying old and new ThermoPhase objects have the same
* number of species and the same names of the species in the
* same order. The idea here is to allow copy constructors and duplicators
* to work. In order for them to work, we need a method to switch the
* internal pointer within the Transport object after the duplication
* takes place. Also, different thermodynamic instanteations of the same
* species should also work.
*
* @param thermo Reference to the ThermoPhase object that
* the transport object will use
*/
virtual void setThermo(thermo_t& thermo);
//---------------------------------------------------------
// overloaded base class methods
virtual void setThermo(thermo_t& thermo);
virtual int model() const {
return cDustyGasTransport;
}
//! Set the Parameters in the model
/*!
* @param type Type of the parameter to set
@ -140,7 +106,6 @@ public:
*/
virtual void setParameters(const int type, const int k, const doublereal* const p);
//! Return the Multicomponent diffusion coefficients. Units: [m^2/s].
/*!
* Returns the array of multicomponent diffusion coefficients.
@ -154,7 +119,6 @@ public:
//! Get the molar fluxes [kmol/m^2/s], given the thermodynamic state at two nearby points.
/*!
*
* \f[
* J_k = - \sum_{j = 1, N} \left[D^{multi}_{kj}\right]^{-1} \left( \nabla C_j + \frac{C_j}{\mathcal{D}^{knud}_j} \frac{\kappa}{\mu} \nabla p \right)
* \f]
@ -220,12 +184,10 @@ public:
*/
Transport& gasTransport();
//! Make the TransportFactory object a friend, because this object has restricted its
//! instantiation to classes which are friends.
friend class TransportFactory;
protected:
//! Initialization routine called by TransportFactory
@ -235,60 +197,62 @@ protected:
*
* This is a protected routine, so that initialization of the Model must occur within Cantera's setup
*
* @param phase Pointer to the underlying ThermoPhase model for the gas phase
* @param gastr Pointer to the underlying Transport model for transport in the gas phase.
* @param phase Pointer to the underlying ThermoPhase model for the gas phase
* @param gastr Pointer to the underlying Transport model for transport in the gas phase.
*/
void initialize(ThermoPhase* phase, Transport* gastr);
private:
//! Update temperature-dependent quantities within the object
/*!
* The object keeps a value m_temp, which is the temperature at which quantities were last evaluated
* at. If the temperature is changed, update Booleans are set false, triggering recomputation.
* The object keeps a value m_temp, which is the temperature at which
* quantities were last evaluated at. If the temperature is changed,
* update Booleans are set false, triggering recomputation.
*/
void updateTransport_T();
//! Update concentration-dependent quantities within the object
/*!
* The object keeps a value m_temp, which is the temperature at which quantities were last evaluated
* at. If the temperature is changed, update Booleans are set false, triggering recomputation.
* The object keeps a value m_temp, which is the temperature at which
* quantities were last evaluated at. If the temperature is changed,
* update Booleans are set false, triggering recomputation.
*/
void updateTransport_C();
//! Private routine to update the dusty gas binary diffusion coefficients
/*!
* The dusty gas binary diffusion coefficients \f$ D^{dg}_{i,j} \f$ are evaluated from the binary
* gas-phase diffusion coefficients \f$ D^{bin}_{i,j} \f$ using the following formula
* The dusty gas binary diffusion coefficients \f$ D^{dg}_{i,j} \f$ are
* evaluated from the binary gas-phase diffusion coefficients \f$
* D^{bin}_{i,j} \f$ using the following formula
*
* \f[
* D^{dg}_{i,j} = \frac{\phi}{\tau} D^{bin}_{i,j}
* \f]
*
* where \f$ \phi \f$ is the porosity of the media and \f$ \tau \f$ is the tortuosity of the media.
* where \f$ \phi \f$ is the porosity of the media and \f$ \tau \f$ is
* the tortuosity of the media.
*
*/
void updateBinaryDiffCoeffs();
//! Private routine to update the Multicomponent diffusion coefficients that are used in the approximation
//! Update the Multicomponent diffusion coefficients that are used in the
//! approximation
/*!
* This routine updates the H matrix and then inverts it.
*/
void updateMultiDiffCoeffs();
//! Private routine to update the Knudsen diffusion coefficients
//! Update the Knudsen diffusion coefficients
/*!
* The Knudsen diffusion coefficients are given by the following form
*
* \f[
* \mathcal{D}^{knud}_k = \frac{2}{3} \frac{r_{pore} \phi}{\tau} \left( \frac{8 R T}{\pi W_k} \right)^{1/2}
* \f]
*
*/
void updateKnudsenDiffCoeffs();
//! Private routine to calculate the H matrix
//! Calculate the H matrix
/*!
* The multicomponent diffusion H matrix \f$ H_{k,l} \f$ is given by the following form
*
@ -321,7 +285,6 @@ private:
* \f[
* \mathcal{D}^{knud}_k = \frac{2}{3} \frac{r_{pore} \phi}{\tau} \left( \frac{8 R T}{\pi W_k} \right)^{1/2}
* \f]
*
*/
vector_fp m_dk;
@ -397,9 +360,3 @@ private:
};
}
#endif

View file

@ -88,15 +88,19 @@ public:
virtual void getMixDiffCoeffsMole(doublereal* const d);
//! Returns the mixture-averaged diffusion coefficients [m^2/s].
//! These are the coefficients for calculating the diffusive mass fluxes
//! from the species mass fraction gradients, computed according to
//! Eq. 12.178 in "Chemically Reacting Flow":
//!
//! \f[ \frac{1}{D_{km}} = \sum_{j \ne k}^K \frac{X_j}{\mathcal{D}_{kj}} +
//! \frac{X_k}{1-Y_k} \sum_{j \ne k}^K \frac{Y_j}{\mathcal{D}_{kj}} \f]
//!
//! @param[out] d vector of mixture-averaged diffusion coefficients for
//! each species, length m_nsp.
/*!
* These are the coefficients for calculating the diffusive mass fluxes
* from the species mass fraction gradients, computed according to
* Eq. 12.178 in "Chemically Reacting Flow":
*
* \f[
* \frac{1}{D_{km}} = \sum_{j \ne k}^K \frac{X_j}{\mathcal{D}_{kj}} +
* \frac{X_k}{1-Y_k} \sum_{j \ne k}^K \frac{Y_j}{\mathcal{D}_{kj}}
* \f]
*
* @param[out] d vector of mixture-averaged diffusion coefficients for
* each species, length m_nsp.
*/
virtual void getMixDiffCoeffsMass(doublereal* const d);
protected:
@ -174,14 +178,16 @@ protected:
//! Holds square roots of molecular weight ratios
/*!
* m_wratjk(j,k) = sqrt(mw[j]/mw[k]) j < k
* m_wratjk(k,j) = sqrt(sqrt(mw[j]/mw[k])) j < k
* @code
* m_wratjk(j,k) = sqrt(mw[j]/mw[k]) j < k
* m_wratjk(k,j) = sqrt(sqrt(mw[j]/mw[k])) j < k
* @endcode
*/
DenseMatrix m_wratjk;
//! Holds square roots of molecular weight ratios
/*!
* m_wratjk1(j,k) = sqrt(1.0 + mw[k]/mw[j]) j < k
* `m_wratjk1(j,k) = sqrt(1.0 + mw[k]/mw[j]) j < k`
*/
DenseMatrix m_wratkj1;
@ -222,17 +228,17 @@ protected:
* that fits the binary diffusion coefficient. The relationship between i
* j and ic is determined from the following algorithm:
*
* int ic = 0;
* for (i = 0; i < m_nsp; i++) {
* for (j = i; j < m_nsp; j++) {
* ic++;
* }
* }
* int ic = 0;
* for (i = 0; i < m_nsp; i++) {
* for (j = i; j < m_nsp; j++) {
* ic++;
* }
* }
*/
std::vector<vector_fp> m_diffcoeffs;
//! Matrix of binary diffusion coefficients at the reference pressure and the current temperature
//! Size is nsp x nsp.
//! Matrix of binary diffusion coefficients at the reference pressure and
//! the current temperature Size is nsp x nsp.
DenseMatrix m_bdiff;
};

View file

@ -5,8 +5,6 @@
#ifndef CT_LIQUIDTRAN_H
#define CT_LIQUIDTRAN_H
// STL includes
#include <vector>
#include <string>
@ -26,20 +24,17 @@ namespace Cantera
// Forward references
class LiquidTransportParams;
//! Class LiquidTransport implements models for transport
//! properties for liquid phases.
/*!
* Liquid Transport is set up with some flexibility in
* this class. Transport properties like viscosity
* and thermal conductivity are allowed flexibility within
* the constraints of the LiquidTransportProperty and
* LiquidTransportInteractions classes. For species
* diffusion, the LiquidTransport class focuses on
* the Stefan-Maxwell equation to determine the diffusion
* velocities. Other options for liquid diffusion include
* solvent-dominated diffusion, and a class SolventTransport
* should be forthcoming.
* Liquid Transport is set up with some flexibility in this class. Transport
* properties like viscosity and thermal conductivity are allowed flexibility
* within the constraints of the LiquidTransportProperty and
* LiquidTransportInteractions classes. For species diffusion, the
* LiquidTransport class focuses on the Stefan-Maxwell equation to determine
* the diffusion velocities. Other options for liquid diffusion include
* solvent-dominated diffusion, and a class SolventTransport should be
* forthcoming.
*
* The class LiquidTransport has several roles.
* -# It brings together the individual species transport
@ -77,7 +72,6 @@ class LiquidTransportParams;
* related to transport properties as described in the
* various methods below.
*
*
* Within LiquidTransport, the state is presumed to be
* defined in terms of the species mole fraction,
* temperature and pressure. Charged species are expected
@ -102,35 +96,9 @@ public:
*/
LiquidTransport(thermo_t* thermo = 0, int ndim = 1);
//! Copy Constructor for the %LiquidThermo object.
/*!
* @param right %LiquidTransport to be copied
*/
LiquidTransport(const LiquidTransport& right);
//! Assignment operator
/*!
* This is NOT a virtual function.
*
* @param right Reference to %LiquidTransport object to be copied
* into the current one.
*/
LiquidTransport& operator=(const LiquidTransport& right);
//! Duplication routine for objects which inherit from
//! %Transport
/*!
* This virtual routine can be used to duplicate %Transport objects
* inherited from %Transport even if the application only has
* a pointer to %Transport to work with.
*
* These routines are basically wrappers around the derived copy
* constructor.
*/
virtual Transport* duplMyselfAsTransport() const;
//! virtual destructor
virtual ~LiquidTransport();
//! Initialize the transport object
@ -141,20 +109,16 @@ public:
* contained in the LiquidTransportParams class that is
* filled in TransportFactory.
*
* @param tr Transport parameters for all of the species
* in the phase.
* @param tr Transport parameters for all of the species in the phase.
*/
virtual bool initLiquid(LiquidTransportParams& tr);
friend class TransportFactory;
//! Return the model id for this transport parameterization
virtual int model() const {
return cLiquidTransport;
}
//! Returns the viscosity of the solution
/*!
* The viscosity calculation is handled by subclasses of
@ -166,9 +130,8 @@ public:
//! Returns the pure species viscosities for all species
/*!
* The pure species viscosities are evaluated using the
* appropriate subclasses of LTPspecies as specified in the
* input file.
* The pure species viscosities are evaluated using the appropriate
* subclasses of LTPspecies as specified in the input file.
*
* @param visc array of length "number of species"
* to hold returned viscosities.
@ -190,7 +153,8 @@ public:
* appropriate subclasses of LTPspecies as specified in the
* input file.
*
* @param ionCond Array of length "number of species" to hold returned ionic conductivities.
* @param ionCond Array of length "number of species" to hold returned
* ionic conductivities.
*/
virtual void getSpeciesIonConductivity(doublereal* const ionCond);
@ -210,11 +174,10 @@ public:
//! Returns a double pointer to the mobility ratios of the
//! transported species in each pure species phase.
/*!
* Has size of the number of binary interactions by the number
* of species (nsp*nsp X nsp)
* The pure species mobility ratios are evaluated using the
* appropriate subclasses of LTPspecies as specified in the
* input file.
* Has size of the number of binary interactions by the number of species
* (nsp*nsp X nsp). The pure species mobility ratios are evaluated using
* the appropriate subclasses of LTPspecies as specified in the input
* file.
*
* @param mobRat array of length "number of species"
* to hold returned mobility ratios.
@ -224,14 +187,15 @@ public:
//! Returns the self diffusion coefficients of the species in the phase.
//! Has size of nsp(coeffs)
/*!
* The self diffusion coefficient is the diffusion coefficient of a tracer species
* at the current temperature and composition of the species. Therefore,
* the dilute limit of transport is assumed for the tracer species.
* The effective formula may be calculated from the stefan-maxwell formulation by
* adding another row for the tracer species, assigning all D's to be equal
* to the respective species D's, and then taking the limit as the
* tracer species mole fraction goes to zero. The corresponding flux equation
* for the tracer species k in units of kmol m-2 s-1 is.
* The self diffusion coefficient is the diffusion coefficient of a
* tracer species at the current temperature and composition of the
* species. Therefore, the dilute limit of transport is assumed for the
* tracer species. The effective formula may be calculated from the
* stefan-maxwell formulation by adding another row for the tracer
* species, assigning all D's to be equal to the respective species D's,
* and then taking the limit as the tracer species mole fraction goes to
* zero. The corresponding flux equation for the tracer species k in
* units of kmol m-2 s-1 is.
*
* \f[
* J_k = - D^{sd}_k \frac{C_k}{R T} \nabla \mu_k
@ -253,9 +217,8 @@ public:
//! Returns the self diffusion coefficients in the pure species phases.
//! Has size of nsp(coeffs) x nsp(phases)
/*!
* The pure species molar volumes are evaluated using the
* appropriate subclasses of LTPspecies as specified in the
* input file.
* The pure species molar volumes are evaluated using the appropriate
* subclasses of LTPspecies as specified in the input file.
*
* @param selfDiff array of length "number of species"
* to hold returned self diffusion coeffs.
@ -264,9 +227,8 @@ public:
//! Returns the hydrodynamic radius for all species
/*!
* The species hydrodynamic radii are evaluated using the
* appropriate subclasses of LTPspecies as specified in the
* input file.
* The species hydrodynamic radii are evaluated using the appropriate
* subclasses of LTPspecies as specified in the input file.
*
* @param radius array of length "number of species"
* to hold returned radii.
@ -275,10 +237,9 @@ public:
//! Returns the binary diffusion coefficients
/*!
* The binary diffusion coefficients are specified in the input
* file through the LiquidTransportInteractions class. These
* are the binary interaction coefficients employed in the
* Stefan-Maxwell equation.
* The binary diffusion coefficients are specified in the input file
* through the LiquidTransportInteractions class. These are the binary
* interaction coefficients employed in the Stefan-Maxwell equation.
*
* @param ld number of species in system
* @param d vector of binary diffusion coefficients
@ -320,7 +281,6 @@ public:
*/
virtual void getMixDiffCoeffs(doublereal* const d);
//! Return the thermal diffusion coefficients
/*!
* These are all zero for this simple implementation
@ -356,12 +316,11 @@ public:
* determination of the mixture averaged diffusion coefficients
* a \e slow method for obtaining diffusion coefficients.
*
* Also note that the Stefan Maxwell solve will be based upon
* the thermodynamic state (including gradients) most recently
* set. Gradients can be set specifically using set_Grad_V,
* set_Grad_X and set_Grad_T or through calls to
* getSpeciesFluxes, getSpeciesFluxesES, getSpeciesVdiff,
* getSpeciesVdiffES, etc.
* Also note that the Stefan Maxwell solve will be based upon the
* thermodynamic state (including gradients) most recently set.
* Gradients can be set specifically using set_Grad_V, set_Grad_X and
* set_Grad_T or through calls to getSpeciesFluxes, getSpeciesFluxesES,
* getSpeciesVdiff, getSpeciesVdiffES, etc.
*
* @param mobil_e Returns the electrical mobilities of
* the species in array \c mobil_e. The array must be
@ -371,12 +330,11 @@ public:
//! Get the fluid mobilities (s kmol/kg).
/*!
* The fluid mobilities are not well defined
* in the context of LiquidTransport because the Stefan Maxwell
* equation is solved. Here the fluid mobilities
* are calculated from the mixture-averaged
* diffusion coefficients through a call to getMixDiffCoeffs()
* using the Einstein relation
* The fluid mobilities are not well defined in the context of
* LiquidTransport because the Stefan Maxwell equation is solved. Here
* the fluid mobilities are calculated from the mixture-averaged
* diffusion coefficients through a call to getMixDiffCoeffs() using the
* Einstein relation
*
* \f[
* \mu^f_k = \frac{D_k}{R T}
@ -387,12 +345,11 @@ public:
* determination of the mixture averaged diffusion coefficients
* a \e slow method for obtaining diffusion coefficients.
*
* Also note that the Stefan Maxwell solve will be based upon
* the thermodynamic state (including gradients) most recently
* set. Gradients can be set specifically using set_Grad_V,
* set_Grad_X and set_Grad_T or through calls to
* getSpeciesFluxes, getSpeciesFluxesES, getSpeciesVdiff,
* getSpeciesVdiffES, etc.
* Also note that the Stefan Maxwell solve will be based upon the
* thermodynamic state (including gradients) most recently set.
* Gradients can be set specifically using set_Grad_V, set_Grad_X and
* set_Grad_T or through calls to getSpeciesFluxes, getSpeciesFluxesES,
* getSpeciesVdiff, getSpeciesVdiffES, etc.
*
* @param mobil_f Returns the fluid mobilities of
* the species in array \c mobil_f. The array must be
@ -402,7 +359,6 @@ public:
//! Specify the value of the gradient of the voltage
/*!
*
* @param grad_V Gradient of the voltage (length num dimensions);
*/
virtual void set_Grad_V(const doublereal* const grad_V);
@ -415,7 +371,6 @@ public:
//! Specify the value of the gradient of the MoleFractions
/*!
*
* @param grad_X Gradient of the mole fractions(length nsp * num dimensions);
*/
virtual void set_Grad_X(const doublereal* const grad_X);
@ -438,7 +393,6 @@ public:
* \f[
* \kappa = \vec{i} / \nabla V.
* \f]
*
*/
virtual doublereal getElectricConduct();
@ -473,7 +427,6 @@ public:
const doublereal* grad_V,
doublereal* current);
//! Get the species diffusive velocities wrt to the averaged velocity,
//! given the gradients in mole fraction and temperature
/*!
@ -536,11 +489,9 @@ public:
int ldf, const doublereal* grad_Phi,
doublereal* Vdiff) ;
//! Return the species diffusive mass fluxes wrt to
//! the averaged velocity in [kmol/m^2/s].
/*!
*
* The diffusive mass flux of species \e k [kmol/m^2/s] is computed
* using the Stefan-Maxwell equation
*
@ -561,16 +512,14 @@ public:
* \f$ \vec{V}_{i} \f$ is the diffusion velocity of species \e i,
* \f$ \mu_i \f$ is the electrochemical potential of species \e i.
*
* Note that for this method, there is no argument for the
* gradient of the electric potential (voltage). Electric
* potential gradients can be set with set_Grad_V() or
* method getSpeciesFluxesES() can be called.x
* Note that for this method, there is no argument for the gradient of the
* electric potential (voltage). Electric potential gradients can be set
* with set_Grad_V() or method getSpeciesFluxesES() can be called.x
*
* The diffusion velocity is relative to an average velocity
* that can be computed on a mole-weighted
* or mass-weighted basis, or the diffusion velocities may
* be specified as relative to a specific species (i.e. a
* solvent) all according to the \verbatim <velocityBasis> \endverbatim input parameter.
* The diffusion velocity is relative to an average velocity that can be
* computed on a mole-weighted or mass-weighted basis, or the diffusion
* velocities may be specified as relative to a specific species (i.e. a
* solvent) all according to the `velocityBasis` input parameter.
*
* @param ndim The number of spatial dimensions (1, 2, or 3).
* @param grad_T The temperature gradient (ignored in this model).
@ -593,7 +542,6 @@ public:
//! Return the species diffusive mass fluxes wrt to
//! the averaged velocity in [kmol/m^2/s].
/*!
*
* The diffusive mass flux of species \e k is computed
* using the Stefan-Maxwell equation
* \f[
@ -611,13 +559,11 @@ public:
* \f$ \vec{V}_{i} \f$ is the diffusion velocity of species \e i,
* \f$ \mu_i \f$ is the electrochemical potential of species \e i.
*
* The diffusion velocity is relative to an average velocity
* that can be computed on a mole-weighted
* or mass-weighted basis, or the diffusion velocities may
* be specified as relative to a specific species (i.e. a
* solvent) all according to the \verbatim <velocityBasis>
* \endverbatim input parameter.
* The diffusion velocity is relative to an average velocity that can be
* computed on a mole-weighted or mass-weighted basis, or the diffusion
* velocities may be specified as relative to a specific species (i.e. a
* solvent) all according to the `velocityBasis` input parameter.
*
* @param ndim The number of spatial dimensions (1, 2, or 3).
* @param grad_T The temperature gradient (ignored in this model).
* (length = ndim)
@ -645,10 +591,9 @@ public:
//! Return the species diffusive velocities relative to
//! the averaged velocity.
/*!
* This method acts similarly to getSpeciesVdiffES() but
* requires all gradients to be preset using methods
* set_Grad_X(), set_Grad_V(), set_Grad_T().
* See the documentation of getSpeciesVdiffES() for details.
* This method acts similarly to getSpeciesVdiffES() but requires all
* gradients to be preset using methods set_Grad_X(), set_Grad_V(),
* set_Grad_T(). See the documentation of getSpeciesVdiffES() for details.
*
* @param ldf Leading dimension of the Vdiff array.
* @param Vdiff Output of the diffusive velocities.
@ -683,12 +628,9 @@ protected:
* since the last call to update_T().
* If it hasn't then an immediate return is carried out.
*
*
* Note this should be a lightweight function since it's
* part of all of the interfaces.
*
* @internal
*
* @return Returns true if the temperature has changed, and false otherwise
*/
virtual bool update_T();
@ -704,13 +646,10 @@ protected:
* Note this should be a lightweight function since it's
* part of all of the interfaces.
*
* @internal
*
* @return Returns true if the mixture composition has changed, and false otherwise.
*/
virtual bool update_C();
//! Updates the internal value of the gradient of the
//! logarithm of the activity, which is
//! used in the gradient of the chemical potential.
@ -737,7 +676,6 @@ protected:
*/
virtual void update_Grad_lnAC();
//! Solve the stefan_maxell equations for the diffusive fluxes.
/*!
* The diffusive mass flux of species \e k is computed
@ -757,12 +695,11 @@ protected:
* \f$ \vec{V}_{i} \f$ is the diffusion velocity of species \e i,
* \f$ \mu_i \f$ is the electrochemical potential of species \e i.
*
* The diffusion velocity is relative to an average velocity
* that can be computed on a mole-weighted
* or mass-weighted basis, or the diffusion velocities may
* be specified as relative to a specific species (i.e. a
* solvent) all according to the \verbatim <velocityBasis>
* \endverbatim input para
* The diffusion velocity is relative to an average velocity that can be
* computed on a mole-weighted or mass-weighted basis, or the diffusion
* velocities may be specified as relative to a specific species (i.e. a
* solvent) all according to the `velocityBasis` input parameter.
*
* The gradient in the activity coefficient requires the use of thermophase
* getdlnActCoeff that calculates its change based on a change in the state
* i.e. temperature and composition of each species.
@ -824,8 +761,6 @@ protected:
* Internal routine is run whenever the update_boolean
* m_visc_conc_ok is false. Currently there is no concentration
* dependence for the pure species viscosities.
*
* @internal
*/
void updateViscosities_C();
@ -834,8 +769,6 @@ protected:
* Internal routine is run whenever the update_boolean
* m_ionCond_conc_ok is false. Currently there is no concentration
* dependence for the pure species ionic conductivity.
*
* @internal
*/
void updateIonConductivity_C();
@ -844,8 +777,6 @@ protected:
* Internal routine is run whenever the update_boolean
* m_mobRat_conc_ok is false. Currently there is no concentration
* dependence for the pure species mobility ratio.
*
* @internal
*/
void updateMobilityRatio_C();
@ -854,8 +785,6 @@ protected:
* Internal routine is run whenever the update_boolean
* m_selfDiff_conc_ok is false. Currently there is no concentration
* dependence for the pure species self diffusion.
*
* @internal
*/
void updateSelfDiffusion_C();
@ -864,8 +793,6 @@ protected:
* Internal routine is run whenever the update_boolean
* m_radi_conc_ok is false. Currently there is no concentration
* dependence for the hydrodynamic radius.
*
* @internal
*/
void updateHydrodynamicRadius_C();
@ -873,7 +800,6 @@ protected:
//! wrt T using calls to the appropriate LTPspecies subclass
void updateDiff_T();
private:
//! Number of species squared
size_t m_nsp2;
@ -992,9 +918,8 @@ private:
std::vector<LTPspecies*> m_diffTempDep_Ns;
//! Species diffusivity of the mixture expressed as a subclass of
//! LiquidTranInteraction. This will return an array of
//! Stefan-Maxwell interaction parameters for use in the
//! Stefan-Maxwell solution.
//! LiquidTranInteraction. This will return an array of Stefan-Maxwell
//! interaction parameters for use in the Stefan-Maxwell solution.
/*!
* These subclasses of LiquidTranInteraction evaluate the
* mixture transport properties according to the parameters parsed in
@ -1005,7 +930,6 @@ private:
//! Setfan-Maxwell diffusion coefficients
DenseMatrix m_diff_Dij;
//! Hydrodynamic radius for each species expressed as an appropriate subclass of LTPspecies
/*!
* These subclasses of LTPspecies evaluate the species-specific
@ -1028,9 +952,6 @@ private:
//! Species hydrodynamic radius
vector_fp m_hydrodynamic_radius;
//! Hydrodynamic radius
//! Internal value of the gradient of the mole fraction vector
/*!
* Note, this is the only gradient value that can and perhaps
@ -1064,51 +985,43 @@ private:
* equal to m_nDim
*
* m_Grad_X[n*m_nsp + k]
*
*/
vector_fp m_Grad_lnAC;
//! Internal value of the gradient of the Temperature vector
/*!
* Generally, if a transport property needs this
* in its evaluation it will look to this place
* to get it.
* Generally, if a transport property needs this in its evaluation it
* will look to this place to get it.
*
* No internal property is precalculated based on gradients.
* Gradients are assumed to be freshly updated before
* every property call.
* No internal property is precalculated based on gradients. Gradients
* are assumed to be freshly updated before every property call.
*/
vector_fp m_Grad_T;
//! Internal value of the gradient of the Pressure vector
/*!
* Generally, if a transport property needs this
* in its evaluation it will look to this place
* to get it.
* Generally, if a transport property needs this in its evaluation it
* will look to this place to get it.
*
* No internal property is precalculated based on gradients.
* Gradients are assumed to be freshly updated before
* every property call.
* No internal property is precalculated based on gradients. Gradients
* are assumed to be freshly updated before every property call.
*/
vector_fp m_Grad_P;
//! Internal value of the gradient of the Electric Voltage
/*!
* Generally, if a transport property needs this
* in its evaluation it will look to this place
* to get it.
* Generally, if a transport property needs this in its evaluation it
* will look to this place to get it.
*
* No internal property is precalculated based on gradients.
* Gradients are assumed to be freshly updated before
* every property call.
* No internal property is precalculated based on gradients. Gradients
* are assumed to be freshly updated before every property call.
*/
vector_fp m_Grad_V;
//! Gradient of the electrochemical potential
/*!
* m_nsp is the number of species in the fluid
* k is the species index
* n is the dimensional index (x, y, or z)
* m_nsp is the number of species in the fluid. k is the species index. n
* is the dimensional index (x, y, or z)
*
* \f[
* m\_Grad\_mu[n*m_nsp + k]
@ -1123,10 +1036,9 @@ private:
* These are evaluated according to the subclass of
* LiquidTranInteraction stored in m_diffMixModel.
*
* This has a size equal to nsp x nsp
* It is a symmetric matrix.
* D_ii is the self diffusion coefficient. D_ii is not
* needed except for when there is one species in the mixture.
* This has a size equal to nsp x nsp. It is a symmetric matrix. D_ii is
* the self diffusion coefficient. D_ii is not needed except for when
* there is one species in the mixture.
*
* units m2/sec
*/
@ -1288,8 +1200,7 @@ private:
//! Solution of the Stefan Maxwell equation in terms of flux
/*!
* This is the mass flux of species k
* in units of kg m-3 s-1.
* This is the mass flux of species k in units of kg m-3 s-1.
*/
Array2D m_flux;
@ -1321,8 +1232,6 @@ private:
*/
vector_fp m_spwork;
private:
//! Boolean indicating that the top-level mixture viscosity is current
/*!
@ -1419,13 +1328,6 @@ private:
* @param msg Indicates the member function which is not implemented
*/
doublereal err(const std::string& msg) const;
};
}
#endif

View file

@ -28,9 +28,8 @@ class GasTransportParams;
//! Class MixTransport implements mixture-averaged transport properties for ideal gas mixtures.
/*!
* The model is based on that described by Kee, Coltrin, and Glarborg, "Theoretical and
* Practical Aspects of Chemically Reacting Flow Modeling."
*
* The model is based on that described by Kee, Coltrin, and Glarborg,
* "Theoretical and Practical Aspects of Chemically Reacting Flow Modeling."
*
* The viscosity is computed using the Wilke mixture rule (kg /m /s)
*
@ -46,7 +45,6 @@ class GasTransportParams;
* {\sqrt{8}\sqrt{1 + M_k/M_j}}
* \f]
*
*
* The thermal conductivity is computed from the following mixture rule:
* \f[
* \lambda = 0.5 \left( \sum_k X_k \lambda_k + \frac{1}{\sum_k X_k/\lambda_k} \right)
@ -62,11 +60,9 @@ class GasTransportParams;
*
* The units of lambda are W / m K which is equivalent to kg m / s^3 K.
*
*
*/
class MixTransport : public GasTransport
{
protected:
//! Default constructor.
@ -74,31 +70,8 @@ protected:
public:
//!Copy Constructor for the %MixTransport object.
/*!
* @param right %LiquidTransport to be copied
*/
MixTransport(const MixTransport& right);
//! Assignment operator
/*!
* This is NOT a virtual function.
*
* @param right Reference to %LiquidTransport object to be copied
* into the current one.
*/
MixTransport& operator=(const MixTransport& right);
//! Duplication routine for objects which inherit from
//! %Transport
/*!
* This virtual routine can be used to duplicate %Transport objects
* inherited from %Transport even if the application only has
* a pointer to %Transport to work with.
*
* These routines are basically wrappers around the derived copy
* constructor.
*/
virtual Transport* duplMyselfAsTransport() const;
//! Return the model id for transport
@ -158,17 +131,15 @@ public:
//! Update the internal parameters whenever the temperature has changed
/*!
* @internal
* This is called whenever a transport property is requested if the temperature has changed
* since the last call to update_T().
* This is called whenever a transport property is requested if
* the temperature has changed since the last call to update_T().
*/
virtual void update_T();
//! Update the internal parameters whenever the concentrations have changed
/*!
* @internal
* This is called whenever a transport property is requested if the concentrations have changed
* since the last call to update_C().
* This is called whenever a transport property is requested if the
* concentrations have changed since the last call to update_C().
*/
virtual void update_C();
@ -177,7 +148,6 @@ public:
/*!
* Units for the returned fluxes are kg m-2 s-1.
*
*
* The diffusive mass flux of species \e k is computed from
* \f[
* \vec{j}_k = -n M_k D_k \nabla X_k.
@ -223,14 +193,12 @@ private:
//! Update the temperature dependent parts of the species thermal conductivities
/*!
* These are evaluated from the polynomial fits of the temperature and are assumed to be
* independent of pressure
* These are evaluated from the polynomial fits of the temperature and are
* assumed to be independent of pressure
*/
void updateCond_T();
// --------- Member Data -------------
private:
//! Polynomial fits to the thermal conductivity of each species
/*!
* m_condcoeffs[k] is vector of polynomial coefficients for species k
@ -240,9 +208,8 @@ private:
//! vector of species thermal conductivities (W/m /K)
/*!
* These are used in wilke's rule to calculate the viscosity of the solution
* units = W /m /K = kg m /s^3 /K.
* length = m_kk
* These are used in wilke's rule to calculate the viscosity of the
* solution. units = W /m /K = kg m /s^3 /K. length = m_kk.
*/
vector_fp m_cond;

View file

@ -21,21 +21,17 @@ namespace Cantera
class GasTransportParams;
//====================================================================================================================
//! Class MultiTransport implements multicomponent transport
//! properties for ideal gas mixtures.
//! Class MultiTransport implements multicomponent transport properties for
//! ideal gas mixtures.
/*!
*
* The implementation generally
* follows the procedure outlined in Kee, Coltrin, and Glarborg,
* "Theoretical and Practical Aspects of Chemically Reacting Flow
* Modeling," Wiley Interscience.
* The implementation generally follows the procedure outlined in Kee,
* Coltrin, and Glarborg, "Theoretical and Practical Aspects of Chemically
* Reacting Flow Modeling," Wiley Interscience.
*
* @ingroup transportProps
*/
class MultiTransport : public GasTransport
{
protected:
//! default constructor
@ -45,7 +41,6 @@ protected:
MultiTransport(thermo_t* thermo=0);
public:
// overloaded base class methods
virtual int model() const {
if (m_mode == CK_Mode) {
return CK_Multicomponent;
@ -111,11 +106,11 @@ public:
const doublereal delta,
doublereal* const fluxes);
//! Get the mass diffusional fluxes [kg/m^2/s] of the species, given the thermodynamic
//! state at two nearby points.
//! Get the mass diffusional fluxes [kg/m^2/s] of the species, given the
//! thermodynamic state at two nearby points.
/*!
* The specific diffusional fluxes are calculated with reference to the mass averaged
* velocity. This is a one-dimensional vector
* The specific diffusional fluxes are calculated with reference to the
* mass averaged velocity. This is a one-dimensional vector
*
* @param state1 Array of temperature, density, and mass
* fractions for state 1.
@ -138,7 +133,6 @@ public:
friend class TransportFactory;
protected:
//! Update basic temperature-dependent quantities if the temperature has changed.
void update_T();
@ -150,7 +144,6 @@ protected:
void updateThermal_T();
private:
doublereal m_thermal_tlast;
// property values
@ -180,8 +173,8 @@ public:
vector_fp m_sigma;
vector_fp m_alpha;
DenseMatrix m_dipole;
private:
private:
vector_fp m_sqrt_eps_k;
DenseMatrix m_log_eps_k;
vector_fp m_frot_298;

View file

@ -5,7 +5,6 @@
// Copyright 2001 California Institute of Technology
#ifndef CT_PECOSTRAN_H
#define CT_PECOSTRAN_H
@ -31,14 +30,11 @@
namespace Cantera
{
class GasTransportParams;
/**
*
* Class PecosTransport implements mixture-averaged transport
* properties for ideal gas mixtures.
*
*/
class PecosTransport : public Transport
{
@ -50,9 +46,20 @@ public:
//! Viscosity of the mixture
/*!
*
* The viscosity is computed using the Wilke mixture rule.
* \f[
* \mu = \sum_k \frac{\mu_k X_k}{\sum_j \Phi_{k,j} X_j}.
* \f]
* Here \f$ \mu_k \f$ is the viscosity of pure species \e k,
* and
* \f[
* \Phi_{k,j} = \frac{\left[1
* + \sqrt{\left(\frac{\mu_k}{\mu_j}\sqrt{\frac{M_j}{M_k}}\right)}\right]^2}
* {\sqrt{8}\sqrt{1 + M_k/M_j}}
* \f]
* @see updateViscosity_T();
*/
virtual doublereal viscosity();
virtual doublereal viscosity();
virtual void getSpeciesViscosities(doublereal* const visc) {
update_T();
@ -66,8 +73,8 @@ public:
*/
virtual void getThermalDiffCoeffs(doublereal* const dt);
/*! returns the mixture thermal conductivity
*
//! Returns the mixture thermal conductivity
/*!
* This is computed using the lumped model,
* \f[
* k = k^{tr} + k^{ve}
@ -81,18 +88,33 @@ public:
* k^{ve}= \mu_s C_{v,s}^{vib} + \mu_s C_{v,s}^{elec}
* \f]
*
* The thermal conductivity is computed using the Wilke mixture rule.
* \f[
* k = \sum_s \frac{k_s X_s}{\sum_j \Phi_{s,j} X_j}.
* \f]
* Here \f$ k_s \f$ is the conductivity of pure species \e s,
* and
* \f[
* \Phi_{s,j} = \frac{\left[1
* + \sqrt{\left(\frac{\mu_k}{\mu_j}\sqrt{\frac{M_j}{M_s}}\right)}\right]^2}
* {\sqrt{8}\sqrt{1 + M_s/M_j}}
* \f]
* @see updateCond_T();
* @todo Reconcile these these formulas with the implementation
*/
virtual doublereal thermalConductivity();
//! binary diffusion coefficients
/*!
* Using Ramshaw's self-consistent Effective Binary Diffusion
* (1990, J. Non-Equilib. Thermo)
*/
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal* const d);
//! Mixture-averaged diffusion coefficients [m^2/s].
/*!
* For the single species case or the pure fluid case
* the routine returns the self-diffusion coefficient.
* This is need to avoid a Nan result in the formula
* below.
* For the single species case or the pure fluid case the routine returns
* the self-diffusion coefficient. This is need to avoid a NaN result.
*/
virtual void getMixDiffCoeffs(doublereal* const d);
@ -121,13 +143,22 @@ public:
virtual void getMobilities(doublereal* const mobil);
virtual void update_T();
/**
* This is called the first time any transport property is requested from
* Mixture after the concentrations have changed.
*/
virtual void update_C();
//! Get the species diffusive mass fluxes wrt to
//! the mass averaged velocity,
//! given the gradients in mole fraction and temperature
//! Get the species diffusive mass fluxes wrt to the mass averaged
//! velocity, given the gradients in mole fraction and temperature
/*!
* Units for the returned fluxes are kg m-2 s-1.
* The diffusive mass flux of species \e k is computed from
* \f[
* \vec{j}_k = -n M_k D_k \nabla X_k + \frac{\rho_k}{\rho} \sum_r n M_r D_r \nabla X_r
* \f]
* This neglects pressure, forced and thermal diffusion.
* Units for the returned fluxes are kg m-2 s-1.
*
* @param ndim Number of dimensions in the flux expressions
* @param grad_T Gradient of the temperature
@ -151,24 +182,18 @@ public:
//! Initialize the transport object
/*!
*
* Here we change all of the internal dimensions to be sufficient.
* We get the object ready to do property evaluations.
*
* @param tr Transport parameters for all of the species
* in the phase.
*
* @param tr Transport parameters for all of the species in the phase.
*/
virtual bool initGas(GasTransportParams& tr);
/**
*
* Reads the transport table specified (currently defaults to internal file)
*
* Reads the user-specified transport table, appending new species
* data and/or replacing default species data.
*
*/
void read_blottner_transport_table();
@ -181,11 +206,9 @@ public:
*
* @param k Species number to obtain the properties from.
*/
struct GasTransportData getGasTransportData(int);
struct GasTransportData getGasTransportData(int k);
protected:
/// default constructor
PecosTransport();
private:
@ -253,9 +276,41 @@ private:
vector_fp m_spwork;
void updateThermal_T();
/**
* Update the temperature-dependent viscosity terms. Updates the array of
* pure species viscosities, and the weighting functions in the viscosity
* mixture rule. The flag m_visc_ok is set to true.
*/
void updateViscosity_T();
/**
* Update the temperature-dependent parts of the mixture-averaged
* thermal conductivity.
*
* Calculated as,
* \f[
* k= \mu_s (5/2 * C_{v,s}^{trans} + C_{v,s}^{rot} + C_{v,s}^{vib}
* \f]
*/
void updateCond_T();
/**
* Update the pure-species viscosities. (Pa-s) = (kg/m/sec)
*
* Using Blottner fit for viscosity. Defines kinematic viscosity
* of the form
* \f[
* \mu_s\left(T\right) = 0.10 \exp\left(A_s\left(\log T\right)^2 + B_s\log T + C_s\right)
* \f]
* where \f$ A_s \f$, \f$ B_s \f$, and \f$ C_s \f$ are constants.
*/
void updateSpeciesViscosities();
/**
* Update the binary diffusion coefficients. These are evaluated
* from the polynomial fits at unit pressure (1 Pa).
*/
void updateDiff_T();
void correctBinDiffCoeffs();
bool m_viscmix_ok;

View file

@ -31,8 +31,7 @@ class LiquidTransportParams;
//! Class SimpleTransport implements mixture-averaged transport
//! properties for liquid phases.
/*!
* The model is based on that
* described by Newman, Electrochemical Systems
* The model is based on that described by Newman, Electrochemical Systems
*
* The velocity of species i may be described by the
* following equation p. 297 (12.1)
@ -73,7 +72,6 @@ class LiquidTransportParams;
* \mathbf{v}_i = \mathbf{v} + \frac{\mathbf{j}_i}{\rho_i}
* \f]
*
*
* \f[
* c_i \nabla \mu_i = R T \sum_j \frac{c_i c_j}{c_T D_{ij}}
* (\frac{\mathbf{j}_j}{\rho_j} - \frac{\mathbf{j}_i}{\rho_i})
@ -128,7 +126,6 @@ class LiquidTransportParams;
* \mu = \sum_k {\mu_k X_k}
* \f]
*
*
* <H2> Calculate of the Binary Diffusion Coefficients </H2>
*
* The binary diffusion coefficients are obtained from the pure species diffusion coefficients
@ -138,9 +135,6 @@ class LiquidTransportParams;
* D_{i,j} = \frac{1}{2} \left( D^0_i(T) + D^0_j(T) \right)
* \f]
*
*
*
*
* <H2> Electrical Mobilities </H2>
*
* The mobility \f$ \mu^e_k \f$ is calculated from the diffusion coefficient using the Einstein relation.
@ -185,7 +179,6 @@ class LiquidTransportParams;
* \rho V_c = - \sum_j {c^T M_j D_j \nabla X_j} + \sum_j F C^T M_j \frac{D_j}{ R T } X_j z_j \nabla V
* \f]
*
*
* <H2> Species Diffusional Velocities </H2>
*
* Species diffusional velocities are calculated from the species diffusional fluxes, within this object,
@ -195,18 +188,15 @@ class LiquidTransportParams;
* j_k = \rho Y_k V_k^d
* \f]
*
*
* TODO
* This object has to be made compatible with different types of reference velocities. Right now, elements
* of the formulas are only compatible with the mass-averaged velocity.
*
* @ingroup tranprops
*
*/
class SimpleTransport : public Transport
{
public:
//! Default constructor.
/*!
* This requires call to initLiquid(LiquidTransportParams& tr)
@ -219,35 +209,9 @@ public:
*/
SimpleTransport(thermo_t* thermo = 0, int ndim = 1);
//!Copy Constructor for the %LiquidThermo object.
/*!
* @param right %LiquidTransport to be copied
*/
SimpleTransport(const SimpleTransport& right);
//! Assignment operator
/*!
* This is NOT a virtual function.
*
* @param right Reference to %LiquidTransport object to be copied
* into the current one.
*/
SimpleTransport& operator=(const SimpleTransport& right);
//! Duplication routine for objects which inherit from
//! %Transport
/*!
* This virtual routine can be used to duplicate %Transport objects
* inherited from %Transport even if the application only has
* a pointer to %Transport to work with.
*
* These routines are basically wrappers around the derived copy
* constructor.
*/
virtual Transport* duplMyselfAsTransport() const;
//! virtual destructor
virtual ~SimpleTransport();
//! Initialize the transport object
@ -255,17 +219,14 @@ public:
* Here we change all of the internal dimensions to be sufficient.
* We get the object ready to do property evaluations.
*
* @param tr Transport parameters for all of the species
* in the phase.
* @param tr Transport parameters for all of the species in the phase.
*/
virtual bool initLiquid(LiquidTransportParams& tr);
//! Return the model id for this transport parameterization
virtual int model() const {
return cSimpleTransport;
}
//! Returns the mixture viscosity of the solution
/*!
* The viscosity is computed using the general mixture rules
@ -295,8 +256,7 @@ public:
*
* units are Pa s or kg/m/s
*
* @param visc Return the species viscosities as a vector of
* length m_nsp
* @param visc Return the species viscosities as a vector of length m_nsp
*/
virtual void getSpeciesViscosities(doublereal* const visc);
@ -314,7 +274,6 @@ public:
*/
virtual void getMixDiffCoeffs(doublereal* const d);
//! Return the thermal diffusion coefficients
/*!
* These are all zero for this simple implementation
@ -323,7 +282,6 @@ public:
*/
virtual void getThermalDiffCoeffs(doublereal* const dt);
//! Returns the mixture thermal conductivity of the solution
/*!
* The thermal is computed using the general mixture rules
@ -336,7 +294,7 @@ public:
* Solvent-only:
* \f[
* \lambda = \lambda_0
*
* \f]
* Mixture-average:
* \f[
@ -347,50 +305,14 @@ public:
*
* @see updateCond_T();
*/
virtual doublereal thermalConductivity();
//! Get the electrical Mobilities (m^2/V/s).
/*!
* This function returns the mobilities. In some formulations
* this is equal to the normal mobility multiplied by faraday's constant.
*
* Frequently, but not always, the mobility is calculated from the
* diffusion coefficient using the Einstein relation
*
* \f[
* \mu^e_k = \frac{F D_k}{R T}
* \f]
*
* @param mobil_e Returns the mobilities of
* the species in array \c mobil_e. The array must be
* dimensioned at least as large as the number of species.
*/
virtual void getMobilities(doublereal* const mobil_e);
//! Get the fluid mobilities (s kmol/kg).
/*!
* This function returns the fluid mobilities. Usually, you have
* to multiply Faraday's constant into the resulting expression
* to general a species flux expression.
*
* Frequently, but not always, the mobility is calculated from the
* diffusion coefficient using the Einstein relation
*
* \f[
* \mu^f_k = \frac{D_k}{R T}
* \f]
*
*
* @param mobil_f Returns the mobilities of
* the species in array \c mobil. The array must be
* dimensioned at least as large as the number of species.
*/
virtual void getFluidMobilities(doublereal* const mobil_f);
//! Specify the value of the gradient of the voltage
/*!
*
* @param grad_V Gradient of the voltage (length num dimensions);
*/
virtual void set_Grad_V(const doublereal* const grad_V);
@ -403,7 +325,6 @@ public:
//! Specify the value of the gradient of the MoleFractions
/*!
*
* @param grad_X Gradient of the mole fractions(length nsp * num dimensions);
*/
virtual void set_Grad_X(const doublereal* const grad_X);
@ -470,7 +391,6 @@ public:
int ldf, const doublereal* grad_Phi,
doublereal* Vdiff);
//! Get the species diffusive mass fluxes wrt to the specified solution averaged velocity,
//! given the gradients in mole fraction and temperature
/*!
@ -492,7 +412,6 @@ public:
* V_c = - \sum_j {\rho M_j D_j \nabla X_j}
* \f]
*
*
* @param ndim The number of spatial dimensions (1, 2, or 3).
* @param grad_T The temperature gradient (ignored in this model).
* @param ldx Leading dimension of the grad_X array.
@ -507,13 +426,11 @@ public:
//! Return the species diffusive mass fluxes wrt to
//! the mass averaged velocity,
/*!
*
* units = kg/m2/s
*
* Internally, gradients in the in mole fraction, temperature
* and electrostatic potential contribute to the diffusive flux
*
*
* The diffusive mass flux of species \e k is computed from the following
* formula
*
@ -534,7 +451,6 @@ public:
virtual void getSpeciesFluxesExt(size_t ldf, doublereal* fluxes);
protected:
//! Handles the effects of changes in the Temperature, internally
//! within the object.
/*!
@ -543,8 +459,6 @@ protected:
* since the last call to update_T().
* If it hasn't then an immediate return is carried out.
*
* @internal
*
* @return Returns true if the temperature has changed, and false otherwise
*/
virtual bool update_T();
@ -558,8 +472,6 @@ protected:
*
* Note this should be a lightweight function since it's
* part of all of the interfaces.
*
* @internal
*/
virtual bool update_C();
@ -577,22 +489,17 @@ protected:
//! Update the concentration parts of the viscosities
/*!
* Internal routine is run whenever the update_boolean
* is false. This routine will calculate
* internal values for the species viscosities.
*
* @internal
* Internal routine is run whenever the update_boolean is false. This
* routine will calculate internal values for the species viscosities.
*/
void updateViscosities_C();
//! Update the binary diffusion coefficients wrt T.
/*!
* These are evaluated
* from the polynomial fits at unit pressure (1 Pa).
* These are evaluated from the polynomial fits at unit pressure (1 Pa).
*/
void updateDiff_T();
private:
//! Temperature dependence type
/*!
@ -616,7 +523,6 @@ private:
* mixture viscosity
* mixture thermal conductivity
*
*
* Types of composition dependencies
* 0 - Solvent values (i.e., species 0) contributes only
* 1 - linear combination of mole fractions;
@ -630,11 +536,7 @@ private:
*/
bool useHydroRadius_;
//! Boolean indicating whether electro-migration term should be
//! added
/*!
*
*/
//! Boolean indicating whether electro-migration term should be added
bool doMigration_;
//! Local Copy of the molecular weights of the species
@ -647,20 +549,14 @@ private:
std::vector<LTPspecies*> m_coeffVisc_Ns;
//! Pure species thermal conductivities in Arrhenius temperature-dependent form.
/*!
*
*/
std::vector<LTPspecies*> m_coeffLambda_Ns;
//! Pure species viscosities in Arrhenius temperature-dependent form.
std::vector<LTPspecies*> m_coeffDiff_Ns;
//! Hydrodynamic radius in LTPspecies form
std::vector<LTPspecies*> m_coeffHydroRadius_Ns;
//! Internal value of the gradient of the mole fraction vector
/*!
* Note, this is the only gradient value that can and perhaps
@ -680,45 +576,36 @@ private:
//! Internal value of the gradient of the Temperature vector
/*!
* Generally, if a transport property needs this
* in its evaluation it will look to this place
* to get it.
* Generally, if a transport property needs this in its evaluation it
* will look to this place to get it.
*
* No internal property is precalculated based on gradients.
* Gradients are assumed to be freshly updated before
* every property call.
* No internal property is precalculated based on gradients. Gradients
* are assumed to be freshly updated before every property call.
*/
vector_fp m_Grad_T;
//! Internal value of the gradient of the Pressure vector
/*!
* Generally, if a transport property needs this
* in its evaluation it will look to this place
* to get it.
* Generally, if a transport property needs this in its evaluation it
* will look to this place to get it.
*
* No internal property is precalculated based on gradients.
* Gradients are assumed to be freshly updated before
* every property call.
* No internal property is precalculated based on gradients. Gradients
* are assumed to be freshly updated before every property call.
*/
vector_fp m_Grad_P;
//! Internal value of the gradient of the Electric Voltage
/*!
* Generally, if a transport property needs this
* in its evaluation it will look to this place
* to get it.
* Generally, if a transport property needs this in its evaluation it
* will look to this place to get it.
*
* No internal property is precalculated based on gradients.
* Gradients are assumed to be freshly updated before
* every property call.
* No internal property is precalculated based on gradients. Gradients
* are assumed to be freshly updated before every property call.
*/
vector_fp m_Grad_V;
// property values
//! Vector of Species Diffusivities
/*!
* Depends on the temperature. We have set the pressure dependence
@ -766,7 +653,6 @@ private:
*/
vector_fp m_molefracs;
//! Local copy of the concentrations of the species in the phase
/*!
* The concentrations are consistent with the m_molefracs
@ -803,11 +689,9 @@ private:
*/
doublereal m_temp;
//! Current value of the pressure
doublereal m_press;
//! Saved value of the mixture thermal conductivity
doublereal m_lambda;
@ -822,8 +706,6 @@ private:
vector_fp m_fluxes;
private:
//! Boolean indicating that the top-level mixture viscosity is current
/*!
@ -847,7 +729,6 @@ private:
//! Boolean indicating that mixture conductivity is current
bool m_cond_mix_ok;
//! Number of dimensions
/*!
* Either 1, 2, or 3
@ -870,9 +751,3 @@ private:
};
}
#endif

View file

@ -27,134 +27,99 @@ namespace Cantera
//! Class SolidTransport implements transport properties for solids.
class SolidTransport : public Transport
{
public:
//! Default constructor
SolidTransport();
//! Copy Constructor
/*!
* @param right Object to be copied
*/
SolidTransport(const SolidTransport& right);
//! Assignment operator
/*!
* This is NOT a virtual function.
*
* @param right Reference to Transport object to be copied into the
* current one.
*/
SolidTransport& operator=(const SolidTransport& right);
//! Duplication routine for objects which inherit from
//! %Transport
/*!
* This virtual routine can be used to duplicate %Transport objects
* inherited from %Transport even if the application only has
* a pointer to %Transport to work with.
*
* These routines are basically wrappers around the derived copy
* constructor.
*/
virtual Transport* duplMyselfAsTransport() const;
virtual int model() const {
return cSolidTransport;
}
/**
* The ionic conducitivity in 1/ohm/m.
//! Returns the ionic conductivity of the phase
/*!
* The thermo phase needs to be updated (temperature) prior to calling this.
* The ionConductivity calculation is handled by subclasses of
* LTPspecies as specified in the input file.
*/
virtual doublereal ionConductivity() ;
//! Returns the mixture thermal conductivity in W/m/K.
//! Returns the thermal conductivity of the phase
/*!
* Units are in W / m K or equivalently kg m / s3 K
* The thermo phase needs to be updated (temperature) prior to calling this.
* The thermalConductivity calculation is handled by subclasses of
* LTPspecies as specified in the input file.
*
* @return returns thermal conductivity in W/m/K.
* There is also a legacy method to evaluate
* \f[
* \lambda = A T^n \exp(-E/RT)
* \f]
*/
virtual doublereal thermalConductivity();
/**
* The electrical conductivity (Siemens/m).
//! Returns the electron conductivity of the phase
/*!
* The thermo phase needs to be updated (temperature) prior to calling
* this. The ionConductivity calculation is handled by subclasses of
* LTPspecies as specified in the input file.
*
* There is also a legacy multicomponent diffusion approach to electrical
* conductivity.
*/
virtual doublereal electricalConductivity();
/**
* The diffusivity of defects in the solid (m^2/s).
/*!
* The diffusivity of defects in the solid (m^2/s). The thermo phase needs
* to be updated (temperature) prior to calling this. The
* defectDiffusivity calculation is handled by subclasses of LTPspecies
* as specified in the input file.
*/
virtual doublereal defectDiffusivity();
/**
* The activity of defects in the solid.
* At some point this should be variable and the diffusion coefficient should depend on it...
* At some point this should be variable and the diffusion coefficient should depend on it.
*
* The thermo phase needs to be updated (temperature) prior to calling this.
* The defectActivity calculation is handled by subclasses of
* LTPspecies as specified in the input file.
*/
virtual doublereal defectActivity();
///////////HEWSON WONDERS IF THE FOLLOWING ARE RELEVANT??
/*
* The diffusion coefficients are computed from
*
* \f[
* D_k = A_k T^{n_k} \exp(-E_k/RT).
* \f]
*
* The diffusion coefficients are only non-zero for species for which
* parameters have been specified using method setParameters.
* @todo HEWSON WONDERS IF THE FOLLOWING ARE RELEVANT??
*/
virtual void getMixDiffCoeffs(doublereal* const d);
//! Compute the electrical mobilities of the species from the diffusion coefficients,
//! using the Einstein relation.
/*!
* Frequently, but not always, the mobility is calculated from the
* diffusion coefficient using the Einstein relation
*
* \f[
* \mu^e_k = \frac{F D_k}{R T}
* \f]
*
* units (m^2/V/s).
* @param mobil Returns the mobilities of
* the species in array \c mobil_e. The array must be
* dimensioned at least as large as the number of species.
*/
virtual void getMobilities(doublereal* const mobil);
//! Set model parameters for derived classes
/*!
* This method may be derived in subclasses to set model-specific parameters.
* The primary use of this class is to set parameters while in the middle of a calculation
* without actually having to dynamically cast the base Transport pointer.
*
* @param type Specifies the type of parameters to set
* 0 : Diffusion coefficient
* 1 : Thermal Conductivity
* The rest are currently unused.
* @param k Species index to set the parameters on
* @param p Vector of parameters. The length of the vector
* varies with the parameterization
*/
virtual void setParameters(const int n, const int k, const doublereal* const p);
friend class TransportFactory;
protected:
//! Initialize the transport object
/*!
* Here we change all of the internal dimensions to be sufficient.
* We get the object ready to do property evaluations.
* A lot of the input required to do property evaluations is
* contained in the SolidTransportParams class that is
* filled in TransportFactory.
* Here we change all of the internal dimensions to be sufficient. We get
* the object ready to do property evaluations. A lot of the input
* required to do property evaluations is contained in the
* SolidTransportParams class that is filled in TransportFactory.
*
* @param tr Transport parameters for all of the species
* in the phase.
*/
virtual bool initSolid(SolidTransportData& tr);
private:
//! Model type for the ionic conductivity
/*!
* shallow pointer that should be zero during destructor
@ -186,9 +151,6 @@ private:
LTPspecies* m_defectActivity;
//! number of mobile species
/*!
* This is equal to the
*/
size_t m_nmobile;
//! Coefficient for the diffusivity of species within a solid
@ -238,9 +200,3 @@ private:
};
}
#endif

View file

@ -103,29 +103,23 @@ const VelocityBasis VB_SPECIES_3 = 3;
//! Base class for transport property managers.
/*!
* All classes that compute transport properties for a single phase
* derive from this class. Class
* %Transport is meant to be used as a base class only. It is
* possible to instantiate it, but its methods throw exceptions if
* called.
*
* Note, transport properties for multiphase situations have yet to be
* fully developed within Cantera.
*
* All member functions are virtual, unless otherwise stated.
* All classes that compute transport properties for a single phase derive
* from this class. Class Transport is meant to be used as a base class
* only. It is possible to instantiate it, but its methods throw exceptions
* if called.
*
* <HR>
* <H2> Relationship of the %Transport class to the %ThermoPhase Class </H2>
* <H2> Relationship of the %Transport class to the ThermoPhase Class </H2>
* <HR>
*
* This section describes how calculations are carried out within
* the %Transport class. The %Transport class and derived classes of the
* the %Transport class necessarily use the %ThermoPhase class to obtain
* the Transport class. The Transport class and derived classes of the
* the Transport class necessarily use the ThermoPhase class to obtain
* the list of species and the thermodynamic state of the phase.
*
* No state information is stored within %Transport classes.
* Queries to the underlying ThermoPhase object must be made to obtain
* the state of the system.
* No state information is stored within Transport classes. Queries to the
* underlying ThermoPhase object must be made to obtain the state of the
* system.
*
* An exception to this however is the state information concerning the
* the gradients of variables. This information is not stored within
@ -138,22 +132,20 @@ const VelocityBasis VB_SPECIES_3 = 3;
* also implicitly assumed that the underlying state within the ThermoPhase
* object has not changed its values.
*
*
* <HR>
* <H2> Diffusion Fluxes and their Relationship to Reference Velocities </H2>
* <HR>
*
* The diffusion fluxes must be referenced to a particular reference
* fluid velocity.
* Most typical is to reference the diffusion fluxes to the mass averaged velocity, but
* referencing to the mole averaged velocity is suitable for some
* liquid flows, and referencing to a single species is suitable for
* solid phase transport within a lattice. Currently, the identity of the reference
* velocity is coded into each transport object as a typedef named VelocityBasis, which
* is equated to an integer. Negative values of this variable refer to mass or mole-averaged
* velocities. Zero or positive quantities refers to the reference
* velocity being referenced to a particular species. Below are the predefined constants
* for its value.
* The diffusion fluxes must be referenced to a particular reference fluid
* velocity. Most typical is to reference the diffusion fluxes to the mass
* averaged velocity, but referencing to the mole averaged velocity is suitable
* for some liquid flows, and referencing to a single species is suitable for
* solid phase transport within a lattice. Currently, the identity of the
* reference velocity is coded into each transport object as a typedef named
* VelocityBasis, which is equated to an integer. Negative values of this
* variable refer to mass or mole-averaged velocities. Zero or positive
* quantities refers to the reference velocity being referenced to a particular
* species. Below are the predefined constants for its value.
*
* - VB_MASSAVG Diffusion velocities are based on the mass averaged velocity
* - VB_MOLEAVG Diffusion velocities are based on the mole averaged velocities
@ -165,7 +157,6 @@ const VelocityBasis VB_SPECIES_3 = 3;
* All gas phase transport managers by default specify the mass-averaged velocity as their
* reference velocities.
*
*
* @todo Provide a general mechanism to store the gradients of state variables
* within the system.
*
@ -173,9 +164,7 @@ const VelocityBasis VB_SPECIES_3 = 3;
*/
class Transport
{
public:
//! Constructor.
/*!
* New transport managers should be created using
@ -189,30 +178,15 @@ public:
*/
Transport(thermo_t* thermo=0, size_t ndim = 1);
//! Destructor.
virtual ~Transport();
//! Copy Constructor for the %Transport object.
/*!
* @param right Transport to be copied
*/
Transport(const Transport& right);
//! Assignment operator
/*!
* This is NOT a virtual function.
*
* @param right Reference to Transport object to be copied into the
* current one.
*/
Transport& operator=(const Transport& right);
//! Duplication routine for objects which inherit from
//! %Transport
//! Duplication routine for objects which inherit from Transport
/*!
* This virtual routine can be used to duplicate %Transport objects
* inherited from %Transport even if the application only has
* a pointer to %Transport to work with.
* This virtual routine can be used to duplicate objects derived from
* Transport even if the application only has a pointer to Transport to
* work with.
*
* These routines are basically wrappers around the derived copy
* constructor.
@ -220,46 +194,38 @@ public:
// Note ->need working copy constructors and operator=() functions for all first
virtual Transport* duplMyselfAsTransport() const;
//! Transport model.
/*!
* The transport model is the set of equations used to compute the transport properties. This
* virtual method returns an integer flag that identifies the
* The transport model is the set of equations used to compute the transport
* properties. This method returns an integer flag that identifies the
* transport model implemented. The base class returns 0.
*/
virtual int model() const {
return 0;
}
/**
* Phase object. Every transport manager is designed to compute
* properties for a specific phase of a mixture, which might be a
* liquid solution, a gas mixture, a surface, etc. This method
* returns a reference to the object representing the phase
* itself.
/*!
* Phase object. Every transport manager is designed to compute properties
* for a specific phase of a mixture, which might be a liquid solution, a
* gas mixture, a surface, etc. This method returns a reference to the
* object representing the phase itself.
*/
thermo_t& thermo() {
return *m_thermo;
}
/**
/*!
* Returns true if the transport manager is ready for use.
*/
bool ready();
//! Set the number of dimensions to be expected in flux expressions
/*!
* Internal memory will be set with this value.
*
* @param ndim Number of dimensions in flux expressions
*/
void setNDim(const int ndim);
//! Return the number of dimensions in flux expressions
/*!
* @return Returns the number of dimensions
*/
size_t nDim() const {
return m_nDim;
}
@ -278,8 +244,7 @@ public:
*/
//@{
/**
/*!
* The viscosity in Pa-s.
*/
virtual doublereal viscosity() {
@ -323,10 +288,8 @@ public:
err("getSpeciesIonConductivity");
}
//! Returns the pointer to the mobility ratios of the species in the phase
/*!
*
* @param mobRat Returns a matrix of mobility ratios for the current problem.
* The mobility ratio mobRat(i,j) is defined as the ratio of the
* mobility of species i to species j.
@ -355,14 +318,14 @@ public:
//! Returns the self diffusion coefficients of the species in the phase
/*!
* The self diffusion coefficient is the diffusion coefficient of a tracer species
* at the current temperature and composition of the species. Therefore,
* the dilute limit of transport is assumed for the tracer species.
* The effective formula may be calculated from the stefan-maxwell formulation by
* adding another row for the tracer species, assigning all D's to be equal
* to the respective species D's, and then taking the limit as the
* tracer species mole fraction goes to zero. The corresponding flux equation
* for the tracer species k in units of kmol m-2 s-1 is.
* The self diffusion coefficient is the diffusion coefficient of a tracer
* species at the current temperature and composition of the species.
* Therefore, the dilute limit of transport is assumed for the tracer
* species. The effective formula may be calculated from the stefan-maxwell
* formulation by adding another row for the tracer species, assigning all
* D's to be equal to the respective species D's, and then taking the limit
* as the tracer species mole fraction goes to zero. The corresponding flux
* equation for the tracer species k in units of kmol m-2 s-1 is.
*
* \f[
* J_k = - D^{sd}_k \frac{C_k}{R T} \nabla \mu_k
@ -375,20 +338,17 @@ public:
* These in turn employ subclasses of LTPspecies to
* determine the individual species self diffusion coeffs.
*
* @param selfDiff Vector of self-diffusion coefficients
* Length = number of species in phase
* units = m**2 s-1
* @param selfDiff Vector of self-diffusion coefficients. Length = number
* of species in phase. units = m**2 s-1.
*/
virtual void selfDiffusion(doublereal* const selfDiff) {
err("selfDiffusion");
}
//! Returns the pure species self diffusion in solution of each species
/*!
* The pure species molar volumes are evaluated using the
* appropriate subclasses of LTPspecies as specified in the
* input file.
* The pure species molar volumes are evaluated using the appropriate
* subclasses of LTPspecies as specified in the input file.
*
* @param selfDiff array of length "number of species"
* to hold returned self diffusion coeffs.
@ -407,14 +367,13 @@ public:
return err("thermalConductivity");
}
/**
/*!
* The electrical conductivity (Siemens/m).
*/
virtual doublereal electricalConductivity() {
return err("electricalConductivity");
}
//! Get the Electrical mobilities (m^2/V/s).
/*!
* This function returns the mobilities. In some formulations
@ -427,10 +386,9 @@ public:
* \mu^e_k = \frac{F D_k}{R T}
* \f]
*
*
* @param mobil_e Returns the mobilities of
* the species in array \c mobil_e. The array must be
* dimensioned at least as large as the number of species.
* @param mobil_e Returns the mobilities of the species in array \c
* mobil_e. The array must be dimensioned at least as large as
* the number of species.
*/
virtual void getMobilities(doublereal* const mobil_e) {
err("getMobilities");
@ -449,16 +407,14 @@ public:
* \mu^f_k = \frac{D_k}{R T}
* \f]
*
*
* @param mobil_f Returns the mobilities of
* the species in array \c mobil. The array must be
* dimensioned at least as large as the number of species.
* @param mobil_f Returns the mobilities of the species in array \c mobil.
* The array must be dimensioned at least as large as the
* number of species.
*/
virtual void getFluidMobilities(doublereal* const mobil_f) {
err("getFluidMobilities");
}
//@}
//! Compute the mixture electrical conductivity (S m-1) at the current
@ -471,9 +427,8 @@ public:
* \vec{J} = \sigma \vec{E}
* \f]
*
* We assume here that the mixture electrical conductivity is an
* isotropic quantity, at this stage. Tensors may be included at a
* later time.
* We assume here that the mixture electrical conductivity is an isotropic
* quantity, at this stage. Tensors may be included at a later time.
*
* The conductivity is the reciprocal of the resistivity.
*
@ -507,14 +462,13 @@ public:
err("getElectricCurrent");
}
//! Get the species diffusive mass fluxes wrt to the specified solution averaged velocity,
//! given the gradients in mole fraction and temperature
//! Get the species diffusive mass fluxes wrt to the specified solution
//! averaged velocity, given the gradients in mole fraction and temperature
/*!
* Units for the returned fluxes are kg m-2 s-1.
*
* Usually the specified solution average velocity is the mass averaged velocity.
* This is changed in some subclasses, however.
* Usually the specified solution average velocity is the mass averaged
* velocity. This is changed in some subclasses, however.
*
* @param ndim Number of dimensions in the flux expressions
* @param grad_T Gradient of the temperature
@ -534,28 +488,23 @@ public:
size_t ldx, const doublereal* const grad_X,
size_t ldf, doublereal* const fluxes);
//! Get the species diffusive mass fluxes wrt to
//! the mass averaged velocity,
//! given the gradients in mole fraction, temperature
//! and electrostatic potential.
//! Get the species diffusive mass fluxes wrt to the mass averaged velocity,
//! given the gradients in mole fraction, temperature and electrostatic
//! potential.
/*!
* Units for the returned fluxes are kg m-2 s-1.
*
* @param ndim Number of dimensions in the flux expressions
* @param grad_T Gradient of the temperature
* (length = ndim)
* @param ldx Leading dimension of the grad_X array
* (usually equal to m_nsp but not always)
* @param grad_X Gradients of the mole fraction
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* @param ldf Leading dimension of the fluxes array
* (usually equal to m_nsp but not always)
* @param grad_Phi Gradients of the electrostatic potential
* (length = ndim)
* @param fluxes Output of the diffusive mass fluxes
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* @param[in] ndim Number of dimensions in the flux expressions
* @param[in] grad_T Gradient of the temperature. (length = ndim)
* @param[in] ldx Leading dimension of the grad_X array (usually equal to
* m_nsp but not always)
* @param[in] grad_X Gradients of the mole fraction. Flat vector with the
* m_nsp in the inner loop. length = ldx * ndim.
* @param[in] ldf Leading dimension of the fluxes array (usually equal to
* m_nsp but not always).
* @param[in] grad_Phi Gradients of the electrostatic potential (length = ndim)
* @param[out] fluxes The diffusive mass fluxes. Flat vector with the m_nsp
* in the inner loop. length = ldx * ndim.
*/
virtual void getSpeciesFluxesES(size_t ndim,
const doublereal* grad_T,
@ -567,28 +516,20 @@ public:
getSpeciesFluxes(ndim, grad_T, ldx, grad_X, ldf, fluxes);
}
//! Get the species diffusive velocities wrt to
//! the mass averaged velocity,
//! Get the species diffusive velocities wrt to the mass averaged velocity,
//! given the gradients in mole fraction and temperature
/*!
* Units for the returned velocities are m s-1
*
* @param ndim Number of dimensions in the flux expressions
* @param grad_T Gradient of the temperature
* (length = ndim)
* @param ldx Leading dimension of the grad_X array
* (usually equal to m_nsp but not always)
* @param grad_X Gradients of the mole fraction
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* @param ldf Leading dimension of the fluxes array
* (usually equal to m_nsp but not always)
* @param Vdiff Output of the diffusive velocities wrt the mass-averaged
* velocity
* @param[in] ndim Number of dimensions in the flux expressions
* @param[in] grad_T Gradient of the temperature (length = ndim)
* @param[in] ldx Leading dimension of the grad_X array (usually equal to
* m_nsp but not always)
* @param[in] grad_X Gradients of the mole fraction. Flat vector with the
* m_nsp in the inner loop. length = ldx * ndim
* @param[in] ldf Leading dimension of the fluxes array (usually equal to
* m_nsp but not always)
* @param[out] Vdiff Diffusive velocities wrt the mass- averaged velocity.
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* units are m / s.
* length = ldx * ndim. units are m / s.
*/
virtual void getSpeciesVdiff(size_t ndim,
const doublereal* grad_T,
@ -600,27 +541,22 @@ public:
}
//! Get the species diffusive velocities wrt to the mass averaged velocity,
//! given the gradients in mole fraction, temperature,
//! and electrostatic potential.
//! given the gradients in mole fraction, temperature, and electrostatic
//! potential.
/*!
* Units for the returned velocities are m s-1.
*
* @param ndim Number of dimensions in the flux expressions
* @param grad_T Gradient of the temperature
* @param[in] ndim Number of dimensions in the flux expressions
* @param[in] grad_T Gradient of the temperature (length = ndim)
* @param[in] ldx Leading dimension of the grad_X array (usually equal to
* m_nsp but not always)
* @param[in] grad_X Gradients of the mole fraction. Flat vector with the
* m_nsp in the inner loop. length = ldx * ndim.
* @param[in] ldf Leading dimension of the fluxes array (usually equal to
* m_nsp but not always)
* @param[in] grad_Phi Gradients of the electrostatic potential
* (length = ndim)
* @param ldx Leading dimension of the grad_X array
* (usually equal to m_nsp but not always)
* @param grad_X Gradients of the mole fraction
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* @param ldf Leading dimension of the fluxes array
* (usually equal to m_nsp but not always)
* @param grad_Phi Gradients of the electrostatic potential
* (length = ndim)
* @param Vdiff Output of the diffusive velocities wrt the mass-averaged velocity
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* units are m / s.
* @param[out] Vdiff Diffusive velocities wrt the mass-averaged velocity.
* Flat vector with the m_nsp in the inner loop. length = ldx
* * ndim units are m / s.
*/
virtual void getSpeciesVdiffES(size_t ndim,
const doublereal* grad_T,
@ -632,20 +568,18 @@ public:
getSpeciesVdiff(ndim, grad_T, ldx, grad_X, ldf, Vdiff);
}
//! Get the molar fluxes [kmol/m^2/s], given the thermodynamic
//! state at two nearby points.
//! Get the molar fluxes [kmol/m^2/s], given the thermodynamic state at two
//! nearby points.
/*!
* @param state1 Array of temperature, density, and mass
* fractions for state 1.
* @param state2 Array of temperature, density, and mass
* fractions for state 2.
* @param delta Distance from state 1 to state 2 (m).
* @param cfluxes Output array containing the diffusive molar fluxes of species
* from state1 to state2. This is a flat vector with the
* m_nsp in the inner loop.
* length = ldx * ndim.
* Units are [kmol/m^2/s].
* @param[in] state1 Array of temperature, density, and mass fractions for
* state 1.
* @param[in] state2 Array of temperature, density, and mass fractions for
* state 2.
* @param[in] delta Distance from state 1 to state 2 (m).
* @param[out] cfluxes Output array containing the diffusive molar fluxes of
* species from state1 to state2. This is a flat vector with
* m_nsp in the inner loop. length = ldx * ndim. Units are
* [kmol/m^2/s].
*/
virtual void getMolarFluxes(const doublereal* const state1,
const doublereal* const state2, const doublereal delta,
@ -653,20 +587,18 @@ public:
err("getMolarFluxes");
}
//! Get the mass fluxes [kg/m^2/s], given the thermodynamic
//! state at two nearby points.
//! Get the mass fluxes [kg/m^2/s], given the thermodynamic state at two
//! nearby points.
/*!
* @param state1 Array of temperature, density, and mass
* @param[in] state1 Array of temperature, density, and mass
* fractions for state 1.
* @param state2 Array of temperature, density, and mass
* fractions for state 2.
* @param delta Distance from state 1 to state 2 (m).
* @param mfluxes Output array containing the diffusive mass fluxes of species
* from state1 to state2. This is a flat vector with the
* m_nsp in the inner loop.
* length = ldx * ndim.
* Units are [kg/m^2/s].
* @param[in] state2 Array of temperature, density, and mass fractions for
* state 2.
* @param[in] delta Distance from state 1 to state 2 (m).
* @param[out] mfluxes Output array containing the diffusive mass fluxes of
* species from state1 to state2. This is a flat vector with
* m_nsp in the inner loop. length = ldx * ndim. Units are
* [kg/m^2/s].
*/
virtual void getMassFluxes(const doublereal* state1,
const doublereal* state2, doublereal delta,
@ -676,9 +608,9 @@ public:
//! Return a vector of Thermal diffusion coefficients [kg/m/sec].
/*!
* The thermal diffusion coefficient \f$ D^T_k \f$ is defined
* so that the diffusive mass flux of species <I>k</I> induced by the
* local temperature gradient is given by the following formula
* The thermal diffusion coefficient \f$ D^T_k \f$ is defined so that the
* diffusive mass flux of species <I>k</I> induced by the local temperature
* gradient is given by the following formula:
*
* \f[
* M_k J_k = -D^T_k \nabla \ln T.
@ -686,35 +618,33 @@ public:
*
* The thermal diffusion coefficient can be either positive or negative.
*
* @param dt On return, dt will contain the species thermal
* diffusion coefficients. Dimension dt at least as large as
* the number of species. Units are kg/m/s.
* @param dt On return, dt will contain the species thermal diffusion
* coefficients. Dimension dt at least as large as the number of
* species. Units are kg/m/s.
*/
virtual void getThermalDiffCoeffs(doublereal* const dt) {
err("getThermalDiffCoeffs");
}
//! Returns the matrix of binary diffusion coefficients [m^2/s].
/*!
* @param ld Inner stride for writing the two dimension diffusion
* @param[in] ld Inner stride for writing the two dimension diffusion
* coefficients into a one dimensional vector
* @param d Diffusion coefficient matrix (must be at least m_k * m_k
* @param[out] d Diffusion coefficient matrix (must be at least m_k * m_k
* in length.
*/
virtual void getBinaryDiffCoeffs(const size_t ld, doublereal* const d) {
err("getBinaryDiffCoeffs");
}
//! Return the Multicomponent diffusion coefficients. Units: [m^2/s].
/*!
* If the transport manager implements a multicomponent diffusion
* model, then this method returns the array of multicomponent
* diffusion coefficients. Otherwise it throws an exception.
*
* @param ld The dimension of the inner loop of d (usually equal to m_nsp)
* @param d flat vector of diffusion coefficients, fortran ordering.
* @param[in] ld The dimension of the inner loop of d (usually equal to m_nsp)
* @param[out] d flat vector of diffusion coefficients, fortran ordering.
* d[ld*j+i] is the D_ij diffusion coefficient (the diffusion
* coefficient for species i due to species j).
*/
@ -722,15 +652,12 @@ public:
err("getMultiDiffCoeffs");
}
//! Returns a vector of mixture averaged diffusion coefficients
/**
* Mixture-averaged diffusion coefficients [m^2/s]. If the
*
* transport manager implements a mixture-averaged diffusion
* model, then this method returns the array of
* mixture-averaged diffusion coefficients. Otherwise it
* throws an exception.
* Mixture-averaged diffusion coefficients [m^2/s]. If the transport
* manager implements a mixture-averaged diffusion model, then this method
* returns the array of mixture-averaged diffusion coefficients. Otherwise
* it throws an exception.
*
* @param d Return vector of mixture averaged diffusion coefficients
* Units = m2/s. Length = n_sp
@ -739,7 +666,6 @@ public:
err("getMixDiffCoeffs");
}
//! Returns a vector of mixture averaged diffusion coefficients
virtual void getMixDiffCoeffsMole(doublereal* const d) {
err("getMixDiffCoeffsMole");
@ -752,9 +678,10 @@ public:
//! Set model parameters for derived classes
/*!
* This method may be derived in subclasses to set model-specific parameters.
* The primary use of this class is to set parameters while in the middle of a calculation
* without actually having to dynamically cast the base Transport pointer.
* This method may be derived in subclasses to set model-specific
* parameters. The primary use of this class is to set parameters while in
* the middle of a calculation without actually having to dynamically cast
* the base Transport pointer.
*
* @param type Specifies the type of parameters to set
* 0 : Diffusion coefficient
@ -792,7 +719,6 @@ public:
friend class TransportFactory;
protected:
/**
@ -801,13 +727,6 @@ protected:
* @{
*/
/**
* Called by TransportFactory to set parameters.
*/
//virtual bool init(TransportParams& tr)
//{ err("init"); return false; }
//! Called by TransportFactory to set parameters.
/*!
* This is called by classes that use the gas phase parameter
@ -848,8 +767,7 @@ public:
return false;
}
public:
//! Specifies the %ThermPhase object.
//! Specifies the ThermoPhase object.
/*!
* We have relaxed this operation so that it will succeed when
* the underlying old and new ThermoPhase objects have the same
@ -865,14 +783,12 @@ public:
*/
virtual void setThermo(thermo_t& thermo);
protected:
//! Enable the transport object for use.
/*!
* Once finalize() has been called, the
* transport manager should be ready to compute any supported
* transport property, and no further modifications to the
* model parameters should be made.
* Once finalize() has been called, the transport manager should be ready to
* compute any supported transport property, and no further modifications to
* the model parameters should be made.
*/
void finalize();
@ -898,16 +814,14 @@ private:
//! Error routine
/*!
* Throw an exception if a method of this class is
* invoked. This probably indicates that a transport manager
* is being used that does not implement all virtual methods,
* and one of those methods was called by the application
* program. For example, a transport manager that computes the
* thermal conductivity of a solid may not define the
* viscosity() method, since the viscosity is in this case
* meaningless. If the application invokes the viscosity()
* method, the base class method will be called, resulting in
* an exception being thrown.
* Throw an exception if a method of this class is invoked. This probably
* indicates that a transport manager is being used that does not implement
* all virtual methods, and one of those methods was called by the
* application program. For example, a transport manager that computes the
* thermal conductivity of a solid may not define the viscosity() method,
* since the viscosity is in this case meaningless. If the application
* invokes the viscosity() method, the base class method will be called,
* resulting in an exception being thrown.
*
* @param msg Descriptive message string to add to the error report
*

View file

@ -5,8 +5,6 @@
#ifndef CT_WATERTRAN_H
#define CT_WATERTRAN_H
// STL includes
#include <vector>
#include <string>
@ -37,13 +35,9 @@ class WaterProps;
class PDSS_Water;
//! Transport Parameters for pure water
/*!
*
*/
class WaterTransport : public Transport
{
public:
//! default constructor
/*!
* @param thermo ThermoPhase object that represents the phase.
@ -54,34 +48,10 @@ public:
*/
WaterTransport(thermo_t* thermo = 0, int ndim = 1);
//!Copy Constructor for the %LiquidThermo object.
/*!
* @param right ThermoPhase to be copied
*/
WaterTransport(const WaterTransport& right);
//! Assignment operator
/*!
* This is NOT a virtual function.
*
* @param right Reference to %ThermoPhase object to be copied into the
* current one.
*/
WaterTransport& operator=(const WaterTransport& right);
//! Duplication routine for objects which inherit from
//! %Transport
/*!
* This virtual routine can be used to duplicate %Transport objects
* inherited from %Transport even if the application only has
* a pointer to %Transport to work with.
*
* These routines are basically wrappers around the derived copy
* constructor.
*/
virtual Transport* duplMyselfAsTransport() const;
//! Return the model id for this transport parameterization
virtual int model() const {
return cWaterTransport;
}
@ -104,19 +74,10 @@ public:
*/
virtual doublereal viscosity();
//! The bulk viscosity in Pa-s.
/*!
* The bulk viscosity is only
* non-zero in rare cases. Most transport managers either
* overload this method to return zero, or do not implement
* it, in which case an exception is thrown if called.
*/
virtual doublereal bulkViscosity() {
return 0.0;
}
//! Returns the thermal conductivity of water at the current conditions
//! (W/m/K)
/*!
@ -134,7 +95,6 @@ public:
*/
virtual doublereal thermalConductivity();
private:
//! Routine to do some common initializations at the start of using
@ -158,19 +118,11 @@ private:
*/
WaterProps* m_waterProps;
//! Pressure dependent standard state object for water
/*!
* We assume that species 0 is water, with a PDSS_Water object.
*/
PDSS_Water* m_waterPDSS;
};
}
#endif

View file

@ -115,21 +115,7 @@ bool AqueousTransport::initLiquid(LiquidTransportParams& tr)
return true;
}
//====================================================================================================================
/*
* The viscosity is computed using the Wilke mixture rule.
* \f[
* \mu = \sum_k \frac{\mu_k X_k}{\sum_j \Phi_{k,j} X_j}.
* \f]
* Here \f$ \mu_k \f$ is the viscosity of pure species \e k,
* and
* \f[
* \Phi_{k,j} = \frac{\left[1
* + \sqrt{\left(\frac{\mu_k}{\mu_j}\sqrt{\frac{M_j}{M_k}}\right)}\right]^2}
* {\sqrt{8}\sqrt{1 + M_k/M_j}}
* \f]
* @see updateViscosity_T();
*/
doublereal AqueousTransport::viscosity()
{
@ -153,20 +139,13 @@ doublereal AqueousTransport::viscosity()
}
return m_viscmix;
}
//====================================================================================================================
// Returns the pure species viscosities
/*
*
* Controlling update boolean = m_viscwt_ok
*
* @param visc Vector of species viscosities
*/
void AqueousTransport::getSpeciesViscosities(doublereal* const visc)
{
updateViscosity_T();
copy(m_visc.begin(), m_visc.end(), visc);
}
//====================================================================================================================
void AqueousTransport::getBinaryDiffCoeffs(const size_t ld, doublereal* const d)
{
update_T();
@ -184,23 +163,7 @@ void AqueousTransport::getBinaryDiffCoeffs(const size_t ld, doublereal* const d)
d[ld*j + i] = rp * m_bdiff(i,j);
}
}
//====================================================================================================================
// Get the electrical Mobilities (m^2/V/s).
/*
* This function returns the mobilities. In some formulations
* this is equal to the normal mobility multiplied by faraday's constant.
*
* Frequently, but not always, the mobility is calculated from the
* diffusion coefficient using the Einstein relation
*
* \f[
* \mu^e_k = \frac{F D_k}{R T}
* \f]
*
* @param mobil_e Returns the mobilities of
* the species in array \c mobil_e. The array must be
* dimensioned at least as large as the number of species.
*/
void AqueousTransport::getMobilities(doublereal* const mobil)
{
getMixDiffCoeffs(DATA_PTR(m_spwork));
@ -209,7 +172,7 @@ void AqueousTransport::getMobilities(doublereal* const mobil)
mobil[k] = c1 * m_spwork[k];
}
}
//====================================================================================================================
void AqueousTransport::getFluidMobilities(doublereal* const mobil)
{
getMixDiffCoeffs(DATA_PTR(m_spwork));
@ -218,21 +181,21 @@ void AqueousTransport::getFluidMobilities(doublereal* const mobil)
mobil[k] = c1 * m_spwork[k];
}
}
//====================================================================================================================
void AqueousTransport::set_Grad_V(const doublereal* const grad_V)
{
for (size_t a = 0; a < m_nDim; a++) {
m_Grad_V[a] = grad_V[a];
}
}
//====================================================================================================================
void AqueousTransport::set_Grad_T(const doublereal* const grad_T)
{
for (size_t a = 0; a < m_nDim; a++) {
m_Grad_T[a] = grad_T[a];
}
}
//====================================================================================================================
void AqueousTransport::set_Grad_X(const doublereal* const grad_X)
{
size_t itop = m_nDim * m_nsp;
@ -240,14 +203,7 @@ void AqueousTransport::set_Grad_X(const doublereal* const grad_X)
m_Grad_X[i] = grad_X[i];
}
}
//====================================================================================================================
/*
* The thermal conductivity is computed from the following mixture rule:
* \[
* \lambda = 0.5 \left( \sum_k X_k \lambda_k
* + \frac{1}{\sum_k X_k/\lambda_k}\right)
* \]
*/
doublereal AqueousTransport::thermalConductivity()
{
update_T();
@ -266,54 +222,14 @@ doublereal AqueousTransport::thermalConductivity()
}
return m_lambda;
}
//====================================================================================================================
// Return a vector of Thermal diffusion coefficients [kg/m/sec].
/*
* The thermal diffusion coefficient \f$ D^T_k \f$ is defined
* so that the diffusive mass flux of species <I>k<\I> induced by the
* local temperature gradient is given by the following formula
*
* \f[
* M_k J_k = -D^T_k \nabla \ln T.
* \f]
*
* The thermal diffusion coefficient can be either positive or negative.
*
* In this method we set it to zero.
*
* @param dt On return, dt will contain the species thermal
* diffusion coefficients. Dimension dt at least as large as
* the number of species. Units are kg/m/s.
*/
void AqueousTransport::getThermalDiffCoeffs(doublereal* const dt)
{
for (size_t k = 0; k < m_nsp; k++) {
dt[k] = 0.0;
}
}
//====================================================================================================================
// Get the species diffusive mass fluxes wrt to the specified solution averaged velocity,
// given the gradients in mole fraction and temperature
/*
* Units for the returned fluxes are kg m-2 s-1.
*
* Usually the specified solution average velocity is the mass averaged velocity.
* This is changed in some subclasses, however.
*
* @param ndim Number of dimensions in the flux expressions
* @param grad_T Gradient of the temperature
* (length = ndim)
* @param ldx Leading dimension of the grad_X array
* (usually equal to m_nsp but not always)
* @param grad_X Gradients of the mole fraction
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* @param ldf Leading dimension of the fluxes array
* (usually equal to m_nsp but not always)
* @param fluxes Output of the diffusive mass fluxes
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
*/
void AqueousTransport::getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
size_t ldx, const doublereal* const grad_X,
size_t ldf, doublereal* const fluxes)
@ -322,34 +238,7 @@ void AqueousTransport::getSpeciesFluxes(size_t ndim, const doublereal* const gra
set_Grad_X(grad_X);
getSpeciesFluxesExt(ldf, fluxes);
}
//====================================================================================================================
// Return the species diffusive mass fluxes wrt to the specified averaged velocity,
/*
* This method acts similarly to getSpeciesFluxesES() but
* requires all gradients to be preset using methods set_Grad_X(), set_Grad_V(), set_Grad_T().
* See the documentation of getSpeciesFluxesES() for details.
*
* units = kg/m2/s
*
* Internally, gradients in the in mole fraction, temperature
* and electrostatic potential contribute to the diffusive flux
*
* The diffusive mass flux of species \e k is computed from the following formula
*
* \f[
* j_k = - \rho M_k D_k \nabla X_k - Y_k V_c
* \f]
*
* where V_c is the correction velocity
*
* \f[
* V_c = - \sum_j {\rho M_j D_j \nabla X_j}
* \f]
*
* @param ldf Stride of the fluxes array. Must be equal to or greater than the number of species.
* @param fluxes Output of the diffusive fluxes. Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
*/
void AqueousTransport::getSpeciesFluxesExt(size_t ldf, doublereal* const fluxes)
{
update_T();
@ -375,18 +264,9 @@ void AqueousTransport::getSpeciesFluxesExt(size_t ldf, doublereal* const fluxes)
}
}
}
//====================================================================================================================
/**
* Mixture-averaged diffusion coefficients [m^2/s].
*
* For the single species case or the pure fluid case
* the routine returns the self-diffusion coefficient.
* This is need to avoid a Nan result in the formula
* below.
*/
void AqueousTransport::getMixDiffCoeffs(doublereal* const d)
{
update_T();
update_C();
@ -421,18 +301,6 @@ void AqueousTransport::getMixDiffCoeffs(doublereal* const d)
}
}
//====================================================================================================================
// Handles the effects of changes in the Temperature, internally
// within the object.
/*
* This is called whenever a transport property is
* requested.
* The first task is to check whether the temperature has changed
* since the last call to update_T().
* If it hasn't then an immediate return is carried out.
*
* @internal
*/
void AqueousTransport::update_T()
{
doublereal t = m_thermo->temperature();
@ -474,12 +342,7 @@ void AqueousTransport::update_T()
// For now, for a concentration redo also
m_iStateMF = -1;
}
//====================================================================================================================
/**
* @internal This is called the first time any transport property
* is requested from Mixture after the concentrations
* have changed.
*/
void AqueousTransport::update_C()
{
@ -512,11 +375,7 @@ void AqueousTransport::update_C()
m_molefracs[k] = std::max(Tiny, m_molefracs[k]);
}
}
//====================================================================================================================
/*
* Update the temperature-dependent parts of the mixture-averaged
* thermal conductivity.
*/
void AqueousTransport::updateCond_T()
{
if (m_mode == CK_Mode) {
@ -531,14 +390,9 @@ void AqueousTransport::updateCond_T()
m_spcond_ok = true;
m_condmix_ok = false;
}
//====================================================================================================================
/*
* Update the binary diffusion coefficients. These are evaluated
* from the polynomial fits at unit pressure (1 Pa).
*/
void AqueousTransport::updateDiff_T()
{
// evaluate binary diffusion coefficients at unit pressure
size_t ic = 0;
if (m_mode == CK_Mode) {
@ -563,10 +417,7 @@ void AqueousTransport::updateDiff_T()
m_bindiff_ok = true;
m_diffmix_ok = false;
}
//====================================================================================================================
/*
* Update the pure-species viscosities.
*/
void AqueousTransport::updateSpeciesViscosities()
{
if (m_mode == CK_Mode) {
@ -583,13 +434,7 @@ void AqueousTransport::updateSpeciesViscosities()
}
m_spvisc_ok = true;
}
//====================================================================================================================
/*
* Update the temperature-dependent viscosity terms.
* Updates the array of pure species viscosities, and the
* weighting functions in the viscosity mixture rule.
* The flag m_visc_ok is set to true.
*/
void AqueousTransport::updateViscosity_T()
{
doublereal vratiokj, wratiojk, factor1;
@ -614,25 +459,14 @@ void AqueousTransport::updateViscosity_T()
}
m_viscwt_ok = true;
}
//====================================================================================================================
/*
* This function returns a Transport data object for a given species.
*
*/
LiquidTransportData AqueousTransport::getLiquidTransportData(int kSpecies)
{
LiquidTransportData td;
td.speciesName = m_thermo->speciesName(kSpecies);
return td;
}
//====================================================================================================================
/*
*
* Solve for the diffusional velocities in the Stefan-Maxwell equations
*
*/
void AqueousTransport::stefan_maxwell_solve()
{
size_t VIM = 2;
@ -752,9 +586,6 @@ void AqueousTransport::stefan_maxwell_solve()
throw CanteraError("routine", "not done");
break;
}
}
}
//====================================================================================================================
}
//======================================================================================================================

View file

@ -18,8 +18,6 @@ using namespace std;
namespace Cantera
{
//====================================================================================================================
DustyGasTransport::DustyGasTransport(thermo_t* thermo) :
Transport(thermo),
m_mw(0),
@ -39,7 +37,7 @@ DustyGasTransport::DustyGasTransport(thermo_t* thermo) :
m_gastran(0)
{
}
//====================================================================================================================
DustyGasTransport::DustyGasTransport(const DustyGasTransport& right) :
Transport(),
m_mw(0),
@ -60,14 +58,7 @@ DustyGasTransport::DustyGasTransport(const DustyGasTransport& right) :
{
*this = right;
}
//====================================================================================================================
// Assignment operator
/*
* This is NOT a virtual function.
*
* @param right Reference to %DustyGasTransport object to be copied
* into the current one.
*/
DustyGasTransport& DustyGasTransport::operator=(const DustyGasTransport& right)
{
if (&right == this) {
@ -100,60 +91,25 @@ DustyGasTransport& DustyGasTransport::operator=(const DustyGasTransport& right)
return *this;
}
//====================================================================================================================
DustyGasTransport::~DustyGasTransport()
{
delete m_gastran;
}
//====================================================================================================================
// Duplication routine for objects which inherit from %Transport
/*
* This virtual routine can be used to duplicate %Transport objects
* inherited from %Transport even if the application only has
* a pointer to %Transport to work with.
*
* These routines are basically wrappers around the derived copy
* constructor.
*/
Transport* DustyGasTransport::duplMyselfAsTransport() const
{
DustyGasTransport* tr = new DustyGasTransport(*this);
return dynamic_cast<Transport*>(tr);
}
//====================================================================================================================
// Specifies the %ThermPhase object.
/*
* We have relaxed this operation so that it will succeed when
* the underlying old and new ThermoPhase objects have the same
* number of species and the same names of the species in the
* same order. The idea here is to allow copy constructors and duplicators
* to work. In order for them to work, we need a method to switch the
* internal pointer within the Transport object after the duplication
* takes place. Also, different thermodynamic instanteations of the same
* species should also work.
*
* @param thermo Reference to the ThermoPhase object that
* the transport object will use
*/
void DustyGasTransport::setThermo(thermo_t& thermo)
{
Transport::setThermo(thermo);
m_gastran->setThermo(thermo);
}
//====================================================================================================================
// Set the Parameters in the model
/*
* @param type Type of the parameter to set
* 0 - porosity
* 1 - tortuosity
* 2 - mean pore radius
* 3 - mean particle radius
* 4 - permeability
* @param k Unused int
* @param p pointer to double for the input list of parameters
*
*/
void DustyGasTransport::setParameters(const int type, const int k, const doublereal* const p)
{
switch (type) {
@ -176,17 +132,7 @@ void DustyGasTransport::setParameters(const int type, const int k, const doubler
throw CanteraError("DustyGasTransport::init", "unknown parameter");
}
}
//====================================================================================================================
// Initialization routine called by TransportFactory
/*
* The DustyGas model is a subordinate model to the gas phase transport model. Here we
* set the gas phase models.
*
* This is a protected routine, so that initialization of the Model must occur within Cantera's setup
*
* @param phase Pointer to the underlying ThermoPhase model for the gas phase
* @param gastr Pointer to the underlying Transport model for transport in the gas phase.
*/
void DustyGasTransport::initialize(ThermoPhase* phase, Transport* gastr)
{
@ -216,19 +162,7 @@ void DustyGasTransport::initialize(ThermoPhase* phase, Transport* gastr)
m_spwork.resize(m_nsp);
m_spwork2.resize(m_nsp);
}
//====================================================================================================================
// Private routine to update the dusty gas binary diffusion coefficients
/*
* The dusty gas binary diffusion coefficients \f$ D^{dg}_{i,j} \f$ are evaluated from the binary
* gas-phase diffusion coefficients \f$ D^{bin}_{i,j} \f$ using the following formula
*
* \f[
* D^{dg}_{i,j} = \frac{\phi}{\tau} D^{bin}_{i,j}
* \f]
*
* where \f$ \phi \f$ is the porosity of the media and \f$ \tau \f$ is the tortuosity of the media.
*
*/
void DustyGasTransport::updateBinaryDiffCoeffs()
{
if (m_bulk_ok) {
@ -245,16 +179,7 @@ void DustyGasTransport::updateBinaryDiffCoeffs()
}
m_bulk_ok = true;
}
//====================================================================================================================
// Private routine to update the Knudsen diffusion coefficients
/*
* The Knudsen diffusion coefficients are given by the following form
*
* \f[
* \mathcal{D}^{knud}_k = \frac{2}{3} \frac{r_{pore} \phi}{\tau} \left( \frac{8 R T}{\pi W_k} \right)^{1/2}
* \f]
*
*/
void DustyGasTransport::updateKnudsenDiffCoeffs()
{
if (m_knudsen_ok) {
@ -269,21 +194,6 @@ void DustyGasTransport::updateKnudsenDiffCoeffs()
m_knudsen_ok = true;
}
//====================================================================================================================
// Private routine to calculate the H matrix
/*
* The H matrix is the term we have given to the matrix of coefficients in the equation for the molar
* fluxes. The matrix must be inverted in order to calculate the molar fluxes.
*
* The multicomponent diffusion H matrix \f$ H_{k,l} \f$ is given by the following formulas
*
* \f[
* H_{k,l} = - \frac{X_k}{D^e_{k,l}}
* \f]
* \f[
* H_{k,k} = \frac{1}{\mathcal(D)^{e}_{k, knud}} + \sum_{j \ne k}^N{ \frac{X_j}{D^e_{k,j}} }
* \f]
*/
void DustyGasTransport::eval_H_matrix()
{
updateBinaryDiffCoeffs();
@ -306,13 +216,12 @@ void DustyGasTransport::eval_H_matrix()
m_multidiff(k,k) = 1.0/m_dk[k] + sum;
}
}
//====================================================================================================================
void DustyGasTransport::getMolarFluxes(const doublereal* const state1,
const doublereal* const state2,
const doublereal delta,
doublereal* const fluxes)
{
doublereal conc1, conc2;
// cbar will be the average concentration between the two points
@ -369,11 +278,7 @@ void DustyGasTransport::getMolarFluxes(const doublereal* const state1,
increment(m_multidiff, cbar, fluxes);
scale(fluxes, fluxes + m_nsp, fluxes, -1.0);
}
//====================================================================================================================
// Private routine to update the Multicomponent diffusion coefficients that are used in the approximation
/*
* This routine updates the H matrix and then inverts it.
*/
void DustyGasTransport::updateMultiDiffCoeffs()
{
// see if temperature has changed
@ -392,16 +297,7 @@ void DustyGasTransport::updateMultiDiffCoeffs()
"invert returned ierr = "+int2str(ierr));
}
}
//====================================================================================================================
// Return the Multicomponent diffusion coefficients. Units: [m^2/s].
/*
* Returns the array of multicomponent diffusion coefficients.
*
* @param ld The dimension of the inner loop of d (usually equal to m_nsp)
* @param d flat vector of diffusion coefficients, fortran ordering.
* d[ld*j+i] is the D_ij diffusion coefficient (the diffusion
* coefficient for species i due to species j).
*/
void DustyGasTransport::getMultiDiffCoeffs(const size_t ld, doublereal* const d)
{
updateMultiDiffCoeffs();
@ -411,12 +307,7 @@ void DustyGasTransport::getMultiDiffCoeffs(const size_t ld, doublereal* const d)
}
}
}
//====================================================================================================================
// Update temperature-dependent quantities within the object
/*
* The object keeps a value m_temp, which is the temperature at which quantities were last evaluated
* at. If the temperature is changed, update Booleans are set false, triggering recomputation.
*/
void DustyGasTransport::updateTransport_T()
{
if (m_temp == m_thermo->temperature()) {
@ -426,7 +317,7 @@ void DustyGasTransport::updateTransport_T()
m_knudsen_ok = false;
m_bulk_ok = false;
}
//====================================================================================================================
void DustyGasTransport::updateTransport_C()
{
m_thermo->getMoleFractions(DATA_PTR(m_x));
@ -439,75 +330,40 @@ void DustyGasTransport::updateTransport_C()
// diffusion coeffs depend on Pressure
m_bulk_ok = false;
}
//====================================================================================================================
// Set the porosity (dimensionless)
/*
* @param porosity Set the value of the porosity
*/
void DustyGasTransport::setPorosity(doublereal porosity)
{
m_porosity = porosity;
m_knudsen_ok = false;
m_bulk_ok = false;
}
//====================================================================================================================
// Set the tortuosity (dimensionless)
/*
* @param tort Value of the tortuosity
*/
void DustyGasTransport::setTortuosity(doublereal tort)
{
m_tortuosity = tort;
m_knudsen_ok = false;
m_bulk_ok = false;
}
//====================================================================================================================
// Set the mean pore radius (m)
/*
* @param rbar Value of the pore radius ( m)
*/
void DustyGasTransport::setMeanPoreRadius(doublereal rbar)
{
m_pore_radius = rbar;
m_knudsen_ok = false;
}
//====================================================================================================================
// Set the mean particle diameter
/*
* @param dbar Set the mean particle diameter (m)
*/
void DustyGasTransport::setMeanParticleDiameter(doublereal dbar)
{
m_diam = dbar;
}
//====================================================================================================================
// Set the permeability of the media
/*
* If not set, the value for close-packed spheres will be used by default.
*
* The value for close-packed spheres is given below, where p is the porosity,
* t is the tortuosity, and d is the diameter of the sphere
*
* \f[
* \kappa = \frac{p^3 d^2}{72 t (1 - p)^2}
* \f]
*
* @param B set the permeability of the media (units = m^2)
*/
void DustyGasTransport::setPermeability(doublereal B)
{
m_perm = B;
}
//====================================================================================================================
// Return a reference to the transport manager used to compute the gas
// binary diffusion coefficients and the viscosity.
/*
* @return Returns a reference to the gas transport object
*/
Transport& DustyGasTransport::gasTransport()
{
return *m_gastran;
}
//====================================================================================================================
}

View file

@ -7,21 +7,14 @@
#ifndef CT_LMATRIX_H
#define CT_LMATRIX_H
#include "cantera/numerics/DenseMatrix.h"
#include "cantera/base/ct_defs.h"
#include <vector>
/////////////////////////////////////////////////////////////////////
#include "cantera/transport/MultiTransport.h"
namespace Cantera
{
//====================================================================================================================
// #define CHEMKIN_COMPATIBILITY_MODE
//! Constant to compare dimensionless heat capacities against zero
const doublereal Min_C_Internal = 0.001;
//====================================================================================================================
bool MultiTransport::hasInternalModes(size_t j)
{
#ifdef CHEMKIN_COMPATIBILITY_MODE
@ -31,13 +24,8 @@ bool MultiTransport::hasInternalModes(size_t j)
#endif
}
//====================================================================================================================
/*
* Evaluate the upper-left block of the L matrix.
*/
void MultiTransport::eval_L0000(const doublereal* const x)
{
doublereal prefactor = 16.0*m_temp/25.0;
doublereal sum;
for (size_t i = 0; i < m_nsp; i++) {
@ -58,10 +46,9 @@ void MultiTransport::eval_L0000(const doublereal* const x)
m_Lmatrix(i,i) = 0.0;
}
}
//====================================================================================================================
void MultiTransport::eval_L0010(const doublereal* const x)
{
doublereal prefactor = 1.6*m_temp;
doublereal sum, wj, xj;
@ -82,7 +69,7 @@ void MultiTransport::eval_L0010(const doublereal* const x)
m_Lmatrix(j,j+m_nsp) += sum;
}
}
//====================================================================================================================
void MultiTransport::eval_L1000()
{
for (size_t j = 0; j < m_nsp; j++) {
@ -91,10 +78,9 @@ void MultiTransport::eval_L1000()
}
}
}
//====================================================================================================================
void MultiTransport::eval_L1010(const doublereal* x)
{
const doublereal fiveover3pi = 5.0/(3.0*Pi);
doublereal prefactor = (16.0*m_temp)/25.0;
@ -134,10 +120,9 @@ void MultiTransport::eval_L1010(const doublereal* x)
m_Lmatrix(j+m_nsp,j+m_nsp) -= sum*constant1;
}
}
//====================================================================================================================
void MultiTransport::eval_L1001(const doublereal* x)
{
doublereal prefactor = 32.00*m_temp/(5.00*Pi);
doublereal constant, sum;
size_t n2 = 2*m_nsp;
@ -162,7 +147,6 @@ void MultiTransport::eval_L1001(const doublereal* x)
}
}
}
//====================================================================================================================
void MultiTransport::eval_L0001()
{
@ -173,7 +157,6 @@ void MultiTransport::eval_L0001()
}
}
}
//====================================================================================================================
void MultiTransport::eval_L0100()
{
@ -183,7 +166,6 @@ void MultiTransport::eval_L0100()
m_Lmatrix(i+n2,j) = 0.0; // see Eq. (12.123)
}
}
//====================================================================================================================
void MultiTransport::eval_L0110()
{
@ -193,10 +175,9 @@ void MultiTransport::eval_L0110()
m_Lmatrix(i+n2,j+m_nsp) = m_Lmatrix(j+m_nsp,i+n2); // see Eq. (12.123)
}
}
//====================================================================================================================
void MultiTransport::eval_L0101(const doublereal* x)
{
const doublereal fivepi = 5.00*Pi;
const doublereal eightoverpi = 8.0 / Pi;
@ -231,5 +212,5 @@ void MultiTransport::eval_L0101(const doublereal* x)
}
}
}
//======================================================================================================================
#endif

View file

@ -18,10 +18,6 @@ using namespace std;
namespace Cantera
{
//////////////////// class LiquidTransport methods //////////////
LiquidTransport::LiquidTransport(thermo_t* thermo, int ndim) :
Transport(thermo, ndim),
m_nsp2(0),
@ -65,7 +61,6 @@ LiquidTransport::LiquidTransport(thermo_t* thermo, int ndim) :
{
}
LiquidTransport::LiquidTransport(const LiquidTransport& right) :
Transport(right.m_thermo, right.m_nDim),
m_nsp2(0),
@ -194,7 +189,6 @@ LiquidTransport& LiquidTransport::operator=(const LiquidTransport& right)
return *this;
}
Transport* LiquidTransport::duplMyselfAsTransport() const
{
return new LiquidTransport(*this);
@ -202,7 +196,6 @@ Transport* LiquidTransport::duplMyselfAsTransport() const
LiquidTransport::~LiquidTransport()
{
//These are constructed in TransportFactory::newLTP
for (size_t k = 0; k < m_nsp; k++) {
delete m_viscTempDep_Ns[k];
@ -229,20 +222,8 @@ LiquidTransport::~LiquidTransport()
delete m_lambdaMixModel;
delete m_diffMixModel;
//if ( m_radiusMixModel ) delete m_radiusMixModel;
}
// Initialize the transport object
/*
* Here we change all of the internal dimensions to be sufficient.
* We get the object ready to do property evaluations.
* A lot of the input required to do property evaluations is
* contained in the LiquidTransportParams class that is
* filled in TransportFactory.
*
* @param tr Transport parameters for all of the species
* in the phase.
*/
bool LiquidTransport::initLiquid(LiquidTransportParams& tr)
{
@ -419,20 +400,8 @@ bool LiquidTransport::initLiquid(LiquidTransportParams& tr)
return true;
}
/****************** viscosity ******************************/
// Returns the viscosity of the solution
/*
* The viscosity calculation is handled by subclasses of
* LiquidTranInteraction as specified in the input file.
* These in turn employ subclasses of LTPspecies to
* determine the individual species viscosities.
*/
doublereal LiquidTransport::viscosity()
{
update_T();
update_C();
@ -446,15 +415,6 @@ doublereal LiquidTransport::viscosity()
return m_viscmix;
}
// Returns the pure species viscosities for all species
/*
* The pure species viscosities are evaluated using the
* appropriate subclasses of LTPspecies as specified in the
* input file.
*
* @param visc array of length "number of species"
* to hold returned viscosities.
*/
void LiquidTransport::getSpeciesViscosities(doublereal* const visc)
{
update_T();
@ -464,18 +424,8 @@ void LiquidTransport::getSpeciesViscosities(doublereal* const visc)
copy(m_viscSpecies.begin(), m_viscSpecies.end(), visc);
}
/****************** ionConductivity ******************************/
// Returns the ionic conductivity of the solution
/*
* The ionConductivity calculation is handled by subclasses of
* LiquidTranInteraction as specified in the input file.
* These in turn employ subclasses of LTPspecies to
* determine the individual species ionic conductivities.
*/
doublereal LiquidTransport:: ionConductivity()
{
update_T();
update_C();
@ -500,15 +450,6 @@ doublereal LiquidTransport:: ionConductivity()
*/
}
// Returns the pure species ionic conductivities for all species
/*
* The pure species ionic conductivities are evaluated using the
* appropriate subclasses of LTPspecies as specified in the
* input file.
*
* @param ionCond array of length "number of species"
* to hold returned ionic conductivities.
*/
void LiquidTransport::getSpeciesIonConductivity(doublereal* ionCond)
{
update_T();
@ -518,15 +459,6 @@ void LiquidTransport::getSpeciesIonConductivity(doublereal* ionCond)
copy(m_ionCondSpecies.begin(), m_ionCondSpecies.end(), ionCond);
}
/****************** mobilityRatio ******************************/
// Returns the mobility ratios of the solution
/*
* The mobility ratio calculation is handled by subclasses of
* LiquidTranInteraction as specified in the input file.
* These in turn employ subclasses of LTPspecies to
* determine the individual species mobility ratios.
*/
void LiquidTransport:: mobilityRatio(doublereal* mobRat)
{
@ -549,15 +481,6 @@ void LiquidTransport:: mobilityRatio(doublereal* mobRat)
}
}
// Returns the pure species mobility ratios for all species
/*
* The pure species mobility ratios are evaluated using the
* appropriate subclasses of LTPspecies as specified in the
* input file.
*
* @param mobRat array of length "number of species"
* to hold returned mobility ratio.
*/
void LiquidTransport::getSpeciesMobilityRatio(doublereal** mobRat)
{
update_T();
@ -570,33 +493,7 @@ void LiquidTransport::getSpeciesMobilityRatio(doublereal** mobRat)
}
}
}
//====================================================================================================================
// Returns the self diffusion coefficients of the species in the phase
/*
* The self diffusion coefficient is the diffusion coefficient of a tracer species
* at the current temperature and composition of the species. Therefore,
* the dilute limit of transport is assumed for the tracer species.
* The effective formula may be calculated from the stefan-maxwell formulation by
* adding another row for the tracer species, assigning all D's to be equal
* to the respective species D's, and then taking the limit as the
* tracer species mole fraction goes to zero. The corresponding flux equation
* for the tracer species k in units of kmol m-2 s-1 is.
*
* \f[
* J_k = - D^{sd}_k \frac{C_k}{R T} \nabla \mu_k
* \f]
*
* The derivative is taken at constant T and P.
*
* The self diffusion calculation is handled by subclasses of
* LiquidTranInteraction as specified in the input file.
* These in turn employ subclasses of LTPspecies to
* determine the individual species self diffusion coeffs.
*
* @param selfDiff Vector of self-diffusion coefficients
* Length = number of species in phase
* units = m**2 s-1
*/
void LiquidTransport::selfDiffusion(doublereal* const selfDiff)
{
update_T();
@ -610,16 +507,7 @@ void LiquidTransport::selfDiffusion(doublereal* const selfDiff)
selfDiff[k] = m_selfDiffMix[k];
}
}
//====================================================================================================================
// Returns the pure species self diffusion for all species
/*
* The pure species self diffusion coeffs are evaluated using the
* appropriate subclasses of LTPspecies as specified in the
* input file.
*
* @param selfDiff array of size "number of species"^2
* to hold returned self diffusion.
*/
void LiquidTransport::getSpeciesSelfDiffusion(doublereal** selfDiff)
{
update_T();
@ -633,16 +521,6 @@ void LiquidTransport::getSpeciesSelfDiffusion(doublereal** selfDiff)
}
}
//===============================================================
// Returns the hydrodynamic radius for all species
/*
* The species hydrodynamic radii are evaluated using the
* appropriate subclasses of LTPspecies as specified in the
* input file.
*
* @param radius array of length "number of species"
* to hold returned radii.
*/
void LiquidTransport::getSpeciesHydrodynamicRadius(doublereal* const radius)
{
update_T();
@ -653,15 +531,6 @@ void LiquidTransport::getSpeciesHydrodynamicRadius(doublereal* const radius)
}
//================================================================
// Return the thermal conductivity of the solution
/*
* The thermal conductivity calculation is handled by subclasses of
* LiquidTranInteraction as specified in the input file.
* These in turn employ subclasses of LTPspecies to
* determine the individual species thermal conductivities.
*/
doublereal LiquidTransport::thermalConductivity()
{
@ -676,15 +545,6 @@ doublereal LiquidTransport::thermalConductivity()
return m_lambda;
}
/****************** thermal diffusion coefficients ************/
// Return the thermal diffusion coefficients
/*
* These are all zero for this simple implementation
*
* @param dt thermal diffusion coefficients
*/
void LiquidTransport::getThermalDiffCoeffs(doublereal* const dt)
{
for (size_t k = 0; k < m_nsp; k++) {
@ -692,20 +552,6 @@ void LiquidTransport::getThermalDiffCoeffs(doublereal* const dt)
}
}
/******************* binary diffusion coefficients **************/
// Returns the binary diffusion coefficients
/*
* The binary diffusion coefficients are specified in the input
* file through the LiquidTransportInteractions class. These
* are the binary interaction coefficients employed in the
* Stefan-Maxwell equation.
*
* @param ld number of species in system
* @param d vector of binary diffusion coefficients
* units = m2 s-1. length = ld*ld = (number of species)^2
*/
void LiquidTransport::getBinaryDiffCoeffs(size_t ld, doublereal* d)
{
if (ld != m_nsp)
@ -729,36 +575,7 @@ void LiquidTransport::getBinaryDiffCoeffs(size_t ld, doublereal* d)
}
}
}
//================================================================================================
// Get the Electrical mobilities (m^2/V/s).
/*
* The electrical mobilities are not well defined
* in the context of LiquidTransport because the Stefan Maxwell
* equation is solved. Here the electrical mobilities
* are calculated from the mixture-averaged
* diffusion coefficients through a call to getMixDiffCoeffs()
* using the Einstein relation
*
* \f[
* \mu^e_k = \frac{F D_k}{R T}
* \f]
*
* Note that this call to getMixDiffCoeffs() requires
* a solve of the Stefan Maxwell equation making this
* determination of the mixture averaged diffusion coefficients
* a {\em slow} method for obtaining diffusion coefficients.
*
* Also note that the Stefan Maxwell solve will be based upon
* the thermodynamic state (including gradients) most recently
* set. Gradients can be set specifically using set_Grad_V,
* set_Grad_X and set_Grad_T or through calls to
* getSpeciesFluxes, getSpeciesFluxesES, getSpeciesVdiff,
* getSpeciesVdiffES, etc.
*
* @param mobil_e Returns the electrical mobilities of
* the species in array \c mobil_e. The array must be
* dimensioned at least as large as the number of species.
*/
void LiquidTransport::getMobilities(doublereal* const mobil)
{
getMixDiffCoeffs(DATA_PTR(m_spwork));
@ -767,36 +584,7 @@ void LiquidTransport::getMobilities(doublereal* const mobil)
mobil[k] = c1 * m_spwork[k];
}
}
//================================================================================================
// Get the fluid mobilities (s kmol/kg).
/*
* The fluid mobilities are not well defined
* in the context of LiquidTransport because the Stefan Maxwell
* equation is solved. Here the fluid mobilities
* are calculated from the mixture-averaged
* diffusion coefficients through a call to getMixDiffCoeffs()
* using the Einstein relation
*
* \f[
* \mu^f_k = \frac{D_k}{R T}
* \f]
*
* Note that this call to getMixDiffCoeffs() requires
* a solve of the Stefan Maxwell equation making this
* determination of the mixture averaged diffusion coefficients
* a {\em slow} method for obtaining diffusion coefficients.
*
* Also note that the Stefan Maxwell solve will be based upon
* the thermodynamic state (including gradients) most recently
* set. Gradients can be set specifically using set_Grad_V,
* set_Grad_X and set_Grad_T or through calls to
* getSpeciesFluxes, getSpeciesFluxesES, getSpeciesVdiff,
* getSpeciesVdiffES, etc.
*
* @param mobil_f Returns the fluid mobilities of
* the species in array \c mobil_f. The array must be
* dimensioned at least as large as the number of species.
*/
void LiquidTransport::getFluidMobilities(doublereal* const mobil_f)
{
getMixDiffCoeffs(DATA_PTR(m_spwork));
@ -805,35 +593,21 @@ void LiquidTransport::getFluidMobilities(doublereal* const mobil_f)
mobil_f[k] = c1 * m_spwork[k];
}
}
//==============================================================
// Specify the value of the gradient of the temperature
/*
* @param grad_T Gradient of the temperature (length num dimensions);
*/
void LiquidTransport::set_Grad_T(const doublereal* grad_T)
{
for (size_t a = 0; a < m_nDim; a++) {
m_Grad_T[a] = grad_T[a];
}
}
//==============================================================
// Specify the value of the gradient of the voltage
/*
*
* @param grad_V Gradient of the voltage (length num dimensions);
*/
void LiquidTransport::set_Grad_V(const doublereal* grad_V)
{
for (size_t a = 0; a < m_nDim; a++) {
m_Grad_V[a] = grad_V[a];
}
}
//==============================================================
// Specify the value of the gradient of the MoleFractions
/*
*
* @param grad_X Gradient of the mole fractions(length nsp * num dimensions);
*/
void LiquidTransport::set_Grad_X(const doublereal* grad_X)
{
size_t itop = m_nDim * m_nsp;
@ -841,27 +615,7 @@ void LiquidTransport::set_Grad_X(const doublereal* grad_X)
m_Grad_X[i] = grad_X[i];
}
}
//==============================================================
// Compute the mixture electrical conductivity from
// the Stefan-Maxwell equation.
/*
* To compute the mixture electrical conductance, the Stefan
* Maxwell equation is solved for zero species gradients and
* for unit potential gradient, \f$ \nabla V \f$.
* The species fluxes are converted to current by summing over
* the charge-weighted fluxes according to
* \f[
* \vec{i} = \sum_{i} z_i F \rho \vec{V_i} / W_i
* \f]
* where \f$ z_i \f$ is the charge on species i,
* \f$ F \f$ is Faradays constant, \f$ \rho \f$ is the density,
* \f$ W_i \f$ is the molecular mass of species i.
* The conductance, \f$ \kappa \f$ is obtained from
* \f[
* \kappa = \vec{i} / \nabla V.
* \f]
*/
doublereal LiquidTransport::getElectricConduct()
{
vector_fp gradT(m_nDim,0.0);
@ -896,27 +650,6 @@ doublereal LiquidTransport::getElectricConduct()
return current;
}
// Compute the electric current density in A/m^2
/*
* The electric current is computed first by computing the
* species diffusive fluxes using the Stefan Maxwell solution
* and then the current, \f$ \vec{i} \f$ by summing over
* the charge-weighted fluxes according to
* \f[
* \vec{i} = \sum_{i} z_i F \rho \vec{V_i} / W_i
* \f]
* where \f$ z_i \f$ is the charge on species i,
* \f$ F \f$ is Faradays constant, \f$ \rho \f$ is the density,
* \f$ W_i \f$ is the molecular mass of species i.
*
* @param ndim The number of spatial dimensions (1, 2, or 3).
* @param grad_T The temperature gradient (ignored in this model).
* @param ldx Leading dimension of the grad_X array.
* @param grad_T The temperature gradient (ignored in this model).
* @param ldf Leading dimension of the grad_V and current vectors.
* @param grad_V The electrostatic potential gradient.
* @param current The electric current in A/m^2.
*/
void LiquidTransport::getElectricCurrent(int ndim,
const doublereal* grad_T,
int ldx,
@ -925,7 +658,6 @@ void LiquidTransport::getElectricCurrent(int ndim,
const doublereal* grad_V,
doublereal* current)
{
set_Grad_T(grad_T);
set_Grad_X(grad_X);
set_Grad_V(grad_V);
@ -944,31 +676,6 @@ void LiquidTransport::getElectricCurrent(int ndim,
}
}
// Get the species diffusive velocities wrt to
// the averaged velocity,
// given the gradients in mole fraction and temperature
/*
* The average velocity can be computed on a mole-weighted
* or mass-weighted basis, or the diffusion velocities may
* be specified as relative to a specific species (i.e. a
* solvent) all according to the velocityBasis input parameter.
*
* Units for the returned fluxes are kg m-2 s-1.
*
* @param ndim Number of dimensions in the flux expressions
* @param grad_T Gradient of the temperature
* (length = ndim)
* @param ldx Leading dimension of the grad_X array
* (usually equal to m_nsp but not always)
* @param grad_X Gradients of the mole fraction
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* @param ldf Leading dimension of the fluxes array
* (usually equal to m_nsp but not always)
* @param Vdiff Output of the diffusive velocities.
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
*/
void LiquidTransport::getSpeciesVdiff(size_t ndim,
const doublereal* grad_T,
int ldx, const doublereal* grad_X,
@ -979,16 +686,6 @@ void LiquidTransport::getSpeciesVdiff(size_t ndim,
getSpeciesVdiffExt(ldf, Vdiff);
}
/*
* @param ndim The number of spatial dimensions (1, 2, or 3).
* @param grad_T The temperature gradient (ignored in this model).
* @param ldx Leading dimension of the grad_X array.
* The diffusive mass flux of species \e k is computed from
*
* \f[
* \vec{j}_k = -n M_k D_k \nabla X_k.
* \f]
*/
void LiquidTransport::getSpeciesVdiffES(size_t ndim,
const doublereal* grad_T,
int ldx,
@ -1003,55 +700,6 @@ void LiquidTransport::getSpeciesVdiffES(size_t ndim,
getSpeciesVdiffExt(ldf, Vdiff);
}
// Return the species diffusive mass fluxes wrt to
// the averaged velocity in [kmol/m^2/s].
/*
*
* The diffusive mass flux of species \e k is computed
* using the Stefan-Maxwell equation
* \f[
* X_i \nabla \mu_i
* = RT \sum_i \frac{X_i X_j}{D_{ij}}
* ( \vec{V}_j - \vec{V}_i )
* \f]
* to determine the diffusion velocity and
* \f[
* \vec{N}_i = C_T X_i \vec{V}_i
* \f]
* to determine the diffusion flux. Here \f$ C_T \f$ is the
* total concentration of the mixture [kmol/m^3], \f$ D_{ij} \f$
* are the Stefa-Maxwell interaction parameters in [m^2/s],
* \f$ \vec{V}_{i} \f$ is the diffusion velocity of species \e i,
* \f$ \mu_i \f$ is the electrochemical potential of species \e i.
*
* Note that for this method, there is no argument for the
* gradient of the electric potential (voltage). Electric
* potential gradients can be set with set_Grad_V() or
* method getSpeciesFluxesES() can be called.x
*
* The diffusion velocity is relative to an average velocity
* that can be computed on a mole-weighted
* or mass-weighted basis, or the diffusion velocities may
* be specified as relative to a specific species (i.e. a
* solvent) all according to the \verbatim <velocityBasis>
* \endverbatim input parameter.
* @param ndim The number of spatial dimensions (1, 2, or 3).
* @param grad_T The temperature gradient (ignored in this model).
* (length = ndim)
* @param ldx Leading dimension of the grad_X array.
* (usually equal to m_nsp but not always)
* @param grad_X Gradients of the mole fraction
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* @param ldf Leading dimension of the fluxes array
* (usually equal to m_nsp but not always)
* @param grad_Phi Gradients of the electrostatic potential
* length = ndim
* @param fluxes Output of the diffusive mass fluxes
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
*/
void LiquidTransport::getSpeciesFluxes(size_t ndim,
const doublereal* const grad_T,
size_t ldx, const doublereal* const grad_X,
@ -1062,50 +710,6 @@ void LiquidTransport::getSpeciesFluxes(size_t ndim,
getSpeciesFluxesExt(ldf, fluxes);
}
// Return the species diffusive mass fluxes wrt to
// the averaged velocity in [kmol/m^2/s].
/*
*
* The diffusive mass flux of species \e k is computed
* using the Stefan-Maxwell equation
* \f[
* X_i \nabla \mu_i
* = RT \sum_i \frac{X_i X_j}{D_{ij}}
* ( \vec{V}_j - \vec{V}_i )
* \f]
* to determine the diffusion velocity and
* \f[
* \vec{N}_i = C_T X_i \vec{V}_i
* \f]
* to determine the diffusion flux. Here \f$ C_T \f$ is the
* total concentration of the mixture [kmol/m^3], \f$ D_{ij} \f$
* are the Stefa-Maxwell interaction parameters in [m^2/s],
* \f$ \vec{V}_{i} \f$ is the diffusion velocity of species \e i,
* \f$ \mu_i \f$ is the electrochemical potential of species \e i.
*
* The diffusion velocity is relative to an average velocity
* that can be computed on a mole-weighted
* or mass-weighted basis, or the diffusion velocities may
* be specified as relative to a specific species (i.e. a
* solvent) all according to the \verbatim <velocityBasis>
* \endverbatim input parameter.
* @param ndim The number of spatial dimensions (1, 2, or 3).
* @param grad_T The temperature gradient (ignored in this model).
* (length = ndim)
* @param ldx Leading dimension of the grad_X array.
* (usually equal to m_nsp but not always)
* @param grad_X Gradients of the mole fraction
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* @param ldf Leading dimension of the fluxes array
* (usually equal to m_nsp but not always)
* @param grad_Phi Gradients of the electrostatic potential
* length = ndim
* @param fluxes Output of the diffusive mass fluxes
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
*/
void LiquidTransport::getSpeciesFluxesES(size_t ndim,
const doublereal* grad_T,
size_t ldx,
@ -1120,19 +724,6 @@ void LiquidTransport::getSpeciesFluxesES(size_t ndim,
getSpeciesFluxesExt(ldf, fluxes);
}
// Return the species diffusive velocities relative to
// the averaged velocity.
/*
* This method acts similarly to getSpeciesVdiffES() but
* requires all gradients to be preset using methods
* set_Grad_X(), set_Grad_V(), set_Grad_T().
* See the documentation of getSpeciesVdiffES() for details.
*
* @param ldf Leading dimension of the Vdiff array.
* @param Vdiff Output of the diffusive velocities.
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
*/
void LiquidTransport::getSpeciesVdiffExt(size_t ldf, doublereal* Vdiff)
{
stefan_maxwell_solve();
@ -1144,21 +735,6 @@ void LiquidTransport::getSpeciesVdiffExt(size_t ldf, doublereal* Vdiff)
}
}
// Return the species diffusive fluxes relative to
// the averaged velocity.
/*
* This method acts similarly to getSpeciesFluxesES() but
* requires all gradients to be preset using methods
* set_Grad_X(), set_Grad_V(), set_Grad_T().
* See the documentation of getSpeciesFluxesES() for details.
*
* units = kg/m2/s
*
* @param ldf Leading dimension of the Vdiff array.
* @param fluxes Output of the diffusive fluxes.
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
*/
void LiquidTransport::getSpeciesFluxesExt(size_t ldf, doublereal* fluxes)
{
stefan_maxwell_solve();
@ -1170,41 +746,8 @@ void LiquidTransport::getSpeciesFluxesExt(size_t ldf, doublereal* fluxes)
}
}
// Get the Mixture diffusion coefficients [m^2/s]
/*
* The mixture diffusion coefficients are not well defined
* in the context of LiquidTransport because the Stefan Maxwell
* equation is solved. Here the mixture diffusion coefficients
* are defined according to Ficks law:
* \f[
* X_i \vec{V_i} = -D_i \nabla X_i.
* \f]
* Solving Ficks Law for \f$ D_i \f$ gives a mixture diffusion
* coefficient
* \f[
* D_i = - X_i \vec{V_i} / ( \nabla X_i ).
* \f]
* If \f$ \nabla X_i = 0 \f$ this is undefined and the
* nonsensical value -1 is returned.
*
* Note that this evaluation of \f$ \vec{V_i} \f$ requires
* a solve of the Stefan Maxwell equation making this
* determination of the mixture averaged diffusion coefficients
* a {\em slow} method for obtaining diffusion coefficients.
*
* Also note that the Stefan Maxwell solve will be based upon
* the thermodynamic state (including gradients) most recently
* set. Gradients can be set specifically using set_Grad_V,
* set_Grad_X and set_Grad_T or through calls to
* getSpeciesFluxes, getSpeciesFluxesES, getSpeciesVdiff,
* getSpeciesVdiffES, etc.
*
* @param d vector of mixture diffusion coefficients
* units = m2 s-1. length = number of species
*/
void LiquidTransport::getMixDiffCoeffs(doublereal* const d)
{
stefan_maxwell_solve();
for (size_t n = 0; n < m_nDim; n++) {
@ -1220,18 +763,6 @@ void LiquidTransport::getMixDiffCoeffs(doublereal* const d)
}
}
// Handles the effects of changes in the Temperature, internally
// within the object.
/*
* This is called whenever a transport property is
* requested.
* The first task is to check whether the temperature has changed
* since the last call to update_T().
* If it hasn't then an immediate return is carried out.
*
* @internal
*/
bool LiquidTransport::update_T()
{
// First make a decision about whether we need to recalculate
@ -1276,19 +807,6 @@ bool LiquidTransport::update_T()
return true;
}
// Handles the effects of changes in the mixture concentration
/*
* This is called for every interface call to check whether
* the concentrations have changed. Concentrations change
* whenever the pressure or the mole fraction has changed.
* If it has changed, the recalculations should be done.
*
* Note this should be a lightweight function since it's
* part of all of the interfaces.
*
* @internal
*/
bool LiquidTransport::update_C()
{
// If the pressure has changed then the concentrations
@ -1341,17 +859,6 @@ bool LiquidTransport::update_C()
return true;
}
/*************************************************************************
*
* methods to update species temperature-dependent properties
*
*************************************************************************/
/**
* Update the temperature-dependent parts of the species
* thermal conductivity internally using calls to the
* appropriate LTPspecies subclass.
*/
void LiquidTransport::updateCond_T()
{
for (size_t k = 0; k < m_nsp; k++) {
@ -1361,9 +868,6 @@ void LiquidTransport::updateCond_T()
m_lambda_mix_ok = false;
}
// Update the binary Stefan-Maxwell diffusion coefficients
// wrt T using calls to the appropriate LTPspecies subclass
void LiquidTransport::updateDiff_T()
{
m_diffMixModel->getMatrixTransProp(m_bdiff);
@ -1371,27 +875,11 @@ void LiquidTransport::updateDiff_T()
m_diff_mix_ok = false;
}
// Update the pure-species viscosities functional dependence on concentration.
void LiquidTransport::updateViscosities_C()
{
m_visc_conc_ok = true;
}
/*
* Updates the array of pure species viscosities internally
* using calls to the appropriate LTPspecies subclass.
* The flag m_visc_ok is set to true.
*
* Note that for viscosity, a positive activation energy
* corresponds to the typical case of a positive argument
* to the exponential so that the Arrhenius expression is
*
* \f[
* \mu = A T^n \exp( + E / R T )
* \f]
*/
void LiquidTransport::updateViscosity_T()
{
for (size_t k = 0; k < m_nsp; k++) {
@ -1401,19 +889,11 @@ void LiquidTransport::updateViscosity_T()
m_visc_mix_ok = false;
}
// Update the pure-species ionic conductivities functional dependence on concentration.
void LiquidTransport::updateIonConductivity_C()
{
m_ionCond_conc_ok = true;
}
/*
* Updates the array of pure species ionic conductivities internally
* using calls to the appropriate LTPspecies subclass.
* The flag m_ionCond_ok is set to true.
*/
void LiquidTransport::updateIonConductivity_T()
{
for (size_t k = 0; k < m_nsp; k++) {
@ -1423,18 +903,11 @@ void LiquidTransport::updateIonConductivity_T()
m_ionCond_mix_ok = false;
}
// Update the pure-species mobility ratios functional dependence on concentration.
void LiquidTransport::updateMobilityRatio_C()
{
m_mobRat_conc_ok = true;
}
/*
* Updates the array of pure species mobility ratios internally
* using calls to the appropriate LTPspecies subclass.
* The flag m_mobRat_ok is set to true.
*/
void LiquidTransport::updateMobilityRatio_T()
{
for (size_t k = 0; k < m_nsp2; k++) {
@ -1446,19 +919,11 @@ void LiquidTransport::updateMobilityRatio_T()
m_mobRat_mix_ok = false;
}
// Update the pure-species self diffusion functional dependence on concentration.
void LiquidTransport::updateSelfDiffusion_C()
{
m_selfDiff_conc_ok = true;
}
/*
* Updates the array of pure species self diffusion internally
* using calls to the appropriate LTPspecies subclass.
* The flag m_selfDiff_ok is set to true.
*/
void LiquidTransport::updateSelfDiffusion_T()
{
for (size_t k = 0; k < m_nsp2; k++) {
@ -1469,15 +934,12 @@ void LiquidTransport::updateSelfDiffusion_T()
m_selfDiff_temp_ok = true;
m_selfDiff_mix_ok = false;
}
//=============================================================================================================
void LiquidTransport::updateHydrodynamicRadius_C()
{
m_radi_conc_ok = true;
}
//=============================================================================================================
// Update the temperature-dependent hydrodynamic radius terms
// for each species internally using calls to the
// appropriate LTPspecies subclass
void LiquidTransport::updateHydrodynamicRadius_T()
{
for (size_t k = 0; k < m_nsp; k++) {
@ -1511,43 +973,7 @@ void LiquidTransport::update_Grad_lnAC()
return;
}
//====================================================================================================================
/*
*
* Solve for the diffusional velocities in the Stefan-Maxwell equations
*
*/
// Solve the stefan_maxell equations for the diffusive fluxes.
/*
* The diffusive mass flux of species \e k is computed
* using the Stefan-Maxwell equation
* \f[
* X_i \nabla \mu_i
* = RT \sum_i \frac{X_i X_j}{D_{ij}}
* ( \vec{V}_j - \vec{V}_i )
* \f]
* to determine the diffusion velocity and
* \f[
* \vec{N}_i = C_T X_i \vec{V}_i
* \f]
* to determine the diffusion flux. Here \f$ C_T \f$ is the
* total concentration of the mixture [kmol/m^3], \f$ D_{ij} \f$
* are the Stefa-Maxwell interaction parameters in [m^2/s],
* \f$ \vec{V}_{i} \f$ is the diffusion velocity of species \e i,
* \f$ \mu_i \f$ is the electrochemical potential of species \e i.
*
* The diffusion velocity is relative to an average velocity
* that can be computed on a mole-weighted
* or mass-weighted basis, or the diffusion velocities may
* be specified as relative to a specific species (i.e. a
* solvent) all according to the \verbatim <velocityBasis>
* \endverbatim input parameter.
*
* One of the Stefan Maxwell equations is replaced by the appropriate
* definition of the mass-averaged velocity, the mole-averaged velocity
* or the specification that velocities are relative to that
* of one species.
*/
void LiquidTransport::stefan_maxwell_solve()
{
doublereal tmp;
@ -1792,11 +1218,7 @@ void LiquidTransport::stefan_maxwell_solve()
}
}
}
//====================================================================================================================
// Throw an exception indicating something is not yet implemented.
/*
* @param msg String with an informative message
*/
doublereal LiquidTransport::err(const std::string& msg) const
{
throw CanteraError("LiquidTransport::err()",
@ -1805,6 +1227,5 @@ doublereal LiquidTransport::err(const std::string& msg) const
"(Did you forget to specify a transport model?)\n\n\n");
return 0.0;
}
//====================================================================================================================
}
//======================================================================================================================

View file

@ -17,8 +17,6 @@ using namespace std;
namespace Cantera
{
//====================================================================================================================
MixTransport::MixTransport() :
m_condcoeffs(0),
m_cond(0),
@ -28,7 +26,7 @@ MixTransport::MixTransport() :
m_debug(false)
{
}
//====================================================================================================================
MixTransport::MixTransport(const MixTransport& right) :
GasTransport(right),
m_condcoeffs(0),
@ -40,14 +38,7 @@ MixTransport::MixTransport(const MixTransport& right) :
{
*this = right;
}
//====================================================================================================================
// Assignment operator
/*
* This is NOT a virtual function.
*
* @param right Reference to %LiquidTransport object to be copied
* into the current one.
*/
MixTransport& MixTransport::operator=(const MixTransport& right)
{
if (&right == this) {
@ -64,22 +55,12 @@ MixTransport& MixTransport::operator=(const MixTransport& right)
return *this;
}
//====================================================================================================================
// Duplication routine for objects which inherit from %Transport
/*
* This virtual routine can be used to duplicate %Transport objects
* inherited from %Transport even if the application only has
* a pointer to %Transport to work with.
*
* These routines are basically wrappers around the derived copy
* constructor.
*/
Transport* MixTransport::duplMyselfAsTransport() const
{
return new MixTransport(*this);
}
//====================================================================================================================
bool MixTransport::initGas(GasTransportParams& tr)
{
GasTransport::initGas(tr);
@ -103,7 +84,6 @@ bool MixTransport::initGas(GasTransportParams& tr)
return true;
}
//===================================================================================================================
void MixTransport::getMobilities(doublereal* const mobil)
{
getMixDiffCoeffs(DATA_PTR(m_spwork));
@ -112,26 +92,7 @@ void MixTransport::getMobilities(doublereal* const mobil)
mobil[k] = c1 * m_spwork[k];
}
}
//===================================================================================================================
// Returns the mixture thermal conductivity (W/m /K)
/*
* The thermal conductivity is computed from the following mixture rule:
* \f[
* \lambda = 0.5 \left( \sum_k X_k \lambda_k + \frac{1}{\sum_k X_k/\lambda_k} \right)
* \f]
*
* It's used to compute the flux of energy due to a thermal gradient
*
* \f[
* j_T = - \lambda \nabla T
* \f]
*
* The flux of energy has units of energy (kg m2 /s2) per second per area.
*
* The units of lambda are W / m K which is equivalent to kg m / s^3 K.
*
* @return Returns the mixture thermal conductivity, with units of W/m/K
*/
doublereal MixTransport::thermalConductivity()
{
update_T();
@ -151,47 +112,14 @@ doublereal MixTransport::thermalConductivity()
}
return m_lambda;
}
//===================================================================================================================
// Return the thermal diffusion coefficients
/*
* For this approximation, these are all zero.
*
* Eqns. (12.168) shows how they are used in an expression for the species flux.
*
* @param dt Vector of thermal diffusion coefficients. Units = kg/m/s
*/
void MixTransport::getThermalDiffCoeffs(doublereal* const dt)
{
for (size_t k = 0; k < m_nsp; k++) {
dt[k] = 0.0;
}
}
//===================================================================================================================
// Get the species diffusive mass fluxes wrt to the mass averaged velocity,
// given the gradients in mole fraction and temperature
/*
* Units for the returned fluxes are kg m-2 s-1.
*
*
* The diffusive mass flux of species \e k is computed from
* \f[
* \vec{j}_k = -n M_k D_k \nabla X_k.
* \f]
*
* @param ndim Number of dimensions in the flux expressions
* @param grad_T Gradient of the temperature
* (length = ndim)
* @param ldx Leading dimension of the grad_X array
* (usually equal to m_nsp but not always)
* @param grad_X Gradients of the mole fraction
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* @param ldf Leading dimension of the fluxes array
* (usually equal to m_nsp but not always)
* @param fluxes Output of the diffusive mass fluxes
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
*/
void MixTransport::getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
size_t ldx, const doublereal* const grad_X,
size_t ldf, doublereal* const fluxes)
@ -220,12 +148,6 @@ void MixTransport::getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
}
}
//===========================================================================================================
/*
* @internal This is called whenever a transport property is
* requested from ThermoSubstance if the temperature has changed
* since the last call to update_T.
*/
void MixTransport::update_T()
{
doublereal t = m_thermo->temperature();
@ -242,12 +164,7 @@ void MixTransport::update_T()
m_bindiff_ok = false;
m_condmix_ok = false;
}
//====================================================================================================================
/*
* @internal This is called the first time any transport property
* is requested from Mixture after the concentrations
* have changed.
*/
void MixTransport::update_C()
{
// signal that concentration-dependent quantities will need to
@ -264,11 +181,7 @@ void MixTransport::update_C()
m_molefracs[k] = std::max(Tiny, m_molefracs[k]);
}
}
//====================================================================================================================
/*
* Update the temperature-dependent parts of the mixture-averaged
* thermal conductivity.
*/
void MixTransport::updateCond_T()
{
if (m_mode == CK_Mode) {

View file

@ -7,18 +7,12 @@
* See file License.txt for licensing information
*/
#include "cantera/thermo/ThermoPhase.h"
#include "cantera/transport/MultiTransport.h"
#include "cantera/numerics/ctlapack.h"
#include "cantera/numerics/DenseMatrix.h"
#include "cantera/base/utilities.h"
#include "cantera/base/utilities.h"
#include "L_matrix.h"
#include "cantera/transport/TransportParams.h"
#include "cantera/thermo/IdealGasPhase.h"
#include "cantera/transport/TransportFactory.h"
#include "cantera/base/stringUtils.h"
@ -31,10 +25,7 @@ namespace Cantera
///////////////////// helper functions /////////////////////////
/**
* @internal
*
* The Parker temperature correction to the rotational collision
* number.
* The Parker temperature correction to the rotational collision number.
*
* @param tr Reduced temperature \f$ \epsilon/kT \f$
* @param sqtr square root of tr.
@ -54,7 +45,6 @@ MultiTransport::MultiTransport(thermo_t* thermo)
{
}
//====================================================================================================================
bool MultiTransport::initGas(GasTransportParams& tr)
{
GasTransport::initGas(tr);
@ -126,13 +116,6 @@ bool MultiTransport::initGas(GasTransportParams& tr)
return true;
}
//====================================================================================================================
/****************** thermal conductivity **********************/
/**
* @internal
*/
doublereal MultiTransport::thermalConductivity()
{
solveLMatrixEquation();
@ -142,13 +125,7 @@ doublereal MultiTransport::thermalConductivity()
}
return -4.0*sum;
}
//====================================================================================================================
// Return the thermal diffusion coefficients for the species
/*
*
* @param dt thermal diffusion coefficients
* (length = m_nsp)
*/
void MultiTransport::getThermalDiffCoeffs(doublereal* const dt)
{
solveLMatrixEquation();
@ -157,11 +134,7 @@ void MultiTransport::getThermalDiffCoeffs(doublereal* const dt)
dt[k] = c * m_mw[k] * m_molefracs[k] * m_a[k];
}
}
//====================================================================================================================
/**
* @internal
*/
void MultiTransport::solveLMatrixEquation()
{
// if T has changed, update the temperature-dependent properties.
@ -206,6 +179,7 @@ void MultiTransport::solveLMatrixEquation()
// evaluate the submatrices of the L matrix
m_Lmatrix.resize(3*m_nsp, 3*m_nsp, 0.0);
//! Evaluate the upper-left block of the L matrix.
eval_L0000(DATA_PTR(m_molefracs));
eval_L0010(DATA_PTR(m_molefracs));
eval_L0001();
@ -242,26 +216,6 @@ void MultiTransport::solveLMatrixEquation()
m_l0000_ok = false;
}
//====================================================================================================================
// Get the species diffusive mass fluxes wrt to the mass averaged velocity,
// given the gradients in mole fraction and temperature
/*
* Units for the returned fluxes are kg m-2 s-1.
*
* @param ndim Number of dimensions in the flux expressions
* @param grad_T Gradient of the temperature
* (length = ndim)
* @param ldx Leading dimension of the grad_X array
* (usually equal to m_nsp but not always)
* @param grad_X Gradients of the mole fraction
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* @param ldf Leading dimension of the fluxes array
* (usually equal to m_nsp but not always)
* @param fluxes Output of the diffusive mass fluxes
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
*/
void MultiTransport::getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
size_t ldx, const doublereal* const grad_X,
size_t ldf, doublereal* const fluxes)
@ -375,21 +329,7 @@ void MultiTransport::getSpeciesFluxes(size_t ndim, const doublereal* const grad_
}
}
}
//====================================================================================================================
// Get the mass diffusional fluxes [kg/m^2/s] of the species, given the thermodynamic
// state at two nearby points.
/*
* The specific diffusional fluxes are calculated with reference to the mass averaged
* velocity. This is a one-dimensional vector
*
* @param state1 Array of temperature, density, and mass
* fractions for state 1.
* @param state2 Array of temperature, density, and mass
* fractions for state 2.
* @param delta Distance from state 1 to state 2 (m).
* @param fluxes Output mass fluxes of the species.
* (length = m_nsp)
*/
void MultiTransport::getMassFluxes(const doublereal* state1, const doublereal* state2, doublereal delta,
doublereal* fluxes)
{
@ -495,7 +435,7 @@ void MultiTransport::getMassFluxes(const doublereal* state1, const doublereal* s
}
}
}
//====================================================================================================================
void MultiTransport::getMolarFluxes(const doublereal* const state1,
const doublereal* const state2,
const doublereal delta,
@ -546,8 +486,6 @@ void MultiTransport::getMultiDiffCoeffs(const size_t ld, doublereal* const d)
}
}
}
//====================================================================================================================
void MultiTransport::update_T()
{
@ -583,12 +521,6 @@ void MultiTransport::update_C()
m_lmatrix_soln_ok = false;
}
/*************************************************************************
*
* methods to update temperature-dependent properties
*
*************************************************************************/
void MultiTransport::updateThermal_T()
{
if (m_thermal_tlast == m_thermo->temperature()) {

View file

@ -1,7 +1,6 @@
/**
* @file PecosTransport.cpp
* Mixture-averaged transport properties.
*
*/
#include "cantera/thermo/ThermoPhase.h"
@ -20,20 +19,15 @@ using namespace std;
namespace Cantera
{
//////////////////// class PecosTransport methods //////////////
PecosTransport::PecosTransport() :
m_nsp(0),
m_temp(-1.0),
m_logt(0.0)
{
}
bool PecosTransport::initGas(GasTransportParams& tr)
{
// constant substance attributes
m_thermo = tr.thermo;
m_nsp = m_thermo->nSpecies();
@ -107,33 +101,8 @@ bool PecosTransport::initGas(GasTransportParams& tr)
return true;
}
/*********************************************************
*
* Public methods
*
*********************************************************/
/****************** viscosity ******************************/
/**
* The viscosity is computed using the Wilke mixture rule.
* \f[
* \mu = \sum_k \frac{\mu_k X_k}{\sum_j \Phi_{k,j} X_j}.
* \f]
* Here \f$ \mu_k \f$ is the viscosity of pure species \e k,
* and
* \f[
* \Phi_{k,j} = \frac{\left[1
* + \sqrt{\left(\frac{\mu_k}{\mu_j}\sqrt{\frac{M_j}{M_k}}\right)}\right]^2}
* {\sqrt{8}\sqrt{1 + M_k/M_j}}
* \f]
* @see updateViscosity_T();
*/
doublereal PecosTransport::viscosity()
{
update_T();
update_C();
@ -157,14 +126,6 @@ doublereal PecosTransport::viscosity()
return vismix;
}
/******************* binary diffusion coefficients **************/
/*
*
* Using Ramshaw's self-consistent Effective Binary Diffusion
* (1990, J. Non-Equilib. Thermo)
* Adding more doxygen would be good here
*/
void PecosTransport::getBinaryDiffCoeffs(const size_t ld, doublereal* const d)
{
int i,j;
@ -183,7 +144,6 @@ void PecosTransport::getBinaryDiffCoeffs(const size_t ld, doublereal* const d)
}
}
void PecosTransport::getMobilities(doublereal* const mobil)
{
int k;
@ -194,23 +154,6 @@ void PecosTransport::getMobilities(doublereal* const mobil)
}
}
/****************** thermal conductivity **********************/
/**
* The thermal conductivity is computed using the Wilke mixture rule.
* \f[
* \k = \sum_s \frac{k_s X_s}{\sum_j \Phi_{s,j} X_j}.
* \f]
* Here \f$ \k_s \f$ is the conductivity of pure species \e s,
* and
* \f[
* \Phi_{s,j} = \frac{\left[1
* + \sqrt{\left(\frac{\mu_k}{\mu_j}\sqrt{\frac{M_j}{M_s}}\right)}\right]^2}
* {\sqrt{8}\sqrt{1 + M_s/M_j}}
* \f]
* @see updateCond_T();
*/
doublereal PecosTransport::thermalConductivity()
{
int k;
@ -237,15 +180,6 @@ doublereal PecosTransport::thermalConductivity()
}
/****************** thermal diffusion coefficients ************/
/**
* Thermal diffusion is not considered in this pecos
* model. To include thermal diffusion, use transport manager
* MultiTransport instead. This methods fills out array dt with
* zeros.
*/
void PecosTransport::getThermalDiffCoeffs(doublereal* const dt)
{
int k;
@ -254,18 +188,6 @@ void PecosTransport::getThermalDiffCoeffs(doublereal* const dt)
}
}
/**
* @param ndim The number of spatial dimensions (1, 2, or 3).
* @param grad_T The temperature gradient (ignored in this model).
* @param ldx Leading dimension of the grad_X array.
* The diffusive mass flux of species \e k is computed from
* \f[
* \vec{j}_k = -n M_k D_k \nabla X_k + \frac{\rho_k}{\rho} \sum_r n M_r D_r \nabla X_r
* \f]
*
* This is neglective pressure, forced and thermal diffusion.
*
*/
void PecosTransport::getSpeciesFluxes(size_t ndim,
const doublereal* const grad_T,
size_t ldx, const doublereal* const grad_X,
@ -305,17 +227,8 @@ void PecosTransport::getSpeciesFluxes(size_t ndim,
}
}
/**
* Mixture-averaged diffusion coefficients [m^2/s].
*
* For the single species case or the pure fluid case
* the routine returns the self-diffusion coefficient.
* This is need to avoid a Nan result in the formula
* below.
*/
void PecosTransport::getMixDiffCoeffs(doublereal* const d)
{
update_T();
update_C();
@ -443,8 +356,7 @@ void PecosTransport::update_T()
m_polytempvec[3] = m_logt*m_logt*m_logt;
m_polytempvec[4] = m_logt*m_logt*m_logt*m_logt;
// temperature has changed, so polynomial fits will need to be
// redone.
// temperature has changed, so polynomial fits will need to be redone.
m_viscmix_ok = false;
m_spvisc_ok = false;
m_viscwt_ok = false;
@ -455,11 +367,6 @@ void PecosTransport::update_T()
m_condmix_ok = false;
}
/**
* @internal This is called the first time any transport property
* is requested from Mixture after the concentrations
* have changed.
*/
void PecosTransport::update_C()
{
// signal that concentration-dependent quantities will need to
@ -479,27 +386,8 @@ void PecosTransport::update_C()
}
}
/*************************************************************************
*
* methods to update temperature-dependent properties
*
*************************************************************************/
/**
*
* Update the temperature-dependent parts of the mixture-averaged
* thermal conductivity.
*
* Calculated as,
* \f[
* k= \mu_s (5/2 * C_{v,s}^{trans} + C_{v,s}^{rot} + C_{v,s}^{vib}
* \f]
*
*
*/
void PecosTransport::updateCond_T()
{
int k;
doublereal fivehalves = 5/2;
for (k = 0; k < m_nsp; k++) {
@ -510,14 +398,8 @@ void PecosTransport::updateCond_T()
m_condmix_ok = false;
}
/**
* Update the binary diffusion coefficients. These are evaluated
* from the polynomial fits at unit pressure (1 Pa).
*/
void PecosTransport::updateDiff_T()
{
// evaluate binary diffusion coefficients at unit pressure
int i,j;
int ic = 0;
@ -544,19 +426,6 @@ void PecosTransport::updateDiff_T()
m_diffmix_ok = false;
}
/**
*
* Update the pure-species viscosities. (Pa-s) = (kg/m/sec)
*
* Using Blottner fit for viscosity. Defines kinematic viscosity
* of the form
* \f[
* \mu_s\left(T\right) = 0.10 \exp\left(A_s\left(\log T\right)^2 + B_s\log T + C_s\right)
* \f]
* where \f$ A_s \f$, \f$ B_s \f$, and \f$ C_s \f$ are constants.
*
*/
void PecosTransport::updateSpeciesViscosities()
{
@ -574,12 +443,6 @@ void PecosTransport::updateSpeciesViscosities()
m_spvisc_ok = true;
}
/*
* read_blottner_transport_table()
* loads up A B and C for blottner fits
* hardcoded for air, will need to generalize later
*/
void PecosTransport::read_blottner_transport_table()
{
// istringstream blot
@ -701,14 +564,6 @@ void PecosTransport::read_blottner_transport_table()
}
/**
*
* Update the temperature-dependent viscosity terms.
* Updates the array of pure species viscosities, and the
* weighting functions in the viscosity mixture rule.
* The flag m_visc_ok is set to true.
*
*/
void PecosTransport::updateViscosity_T()
{
doublereal vratiokj, wratiojk, factor1;
@ -736,4 +591,3 @@ void PecosTransport::updateViscosity_T()
}
}

View file

@ -16,7 +16,6 @@ using namespace std;
namespace Cantera
{
//================================================================================================
SimpleTransport::SimpleTransport(thermo_t* thermo, int ndim) :
Transport(thermo, ndim),
tempDepType_(0),
@ -37,7 +36,7 @@ SimpleTransport::SimpleTransport(thermo_t* thermo, int ndim) :
m_nDim(1)
{
}
//================================================================================================
SimpleTransport::SimpleTransport(const SimpleTransport& right) :
Transport(),
tempDepType_(0),
@ -63,7 +62,7 @@ SimpleTransport::SimpleTransport(const SimpleTransport& right) :
*/
*this = right;
}
//================================================================================================
SimpleTransport& SimpleTransport::operator=(const SimpleTransport& right)
{
if (&right == this) {
@ -136,12 +135,12 @@ SimpleTransport& SimpleTransport::operator=(const SimpleTransport& right)
return *this;
}
//================================================================================================
Transport* SimpleTransport::duplMyselfAsTransport() const
{
return new SimpleTransport(*this);
}
//================================================================================================
SimpleTransport::~SimpleTransport()
{
for (size_t k = 0; k < m_coeffVisc_Ns.size() ; k++) {
@ -157,11 +156,7 @@ SimpleTransport::~SimpleTransport()
delete m_coeffHydroRadius_Ns[k];
}
}
//================================================================================================
// Initialize the object
/*
* This is where we dimension everything.
*/
bool SimpleTransport::initLiquid(LiquidTransportParams& tr)
{
// constant substance attributes
@ -194,10 +189,6 @@ bool SimpleTransport::initLiquid(LiquidTransportParams& tr)
throw CanteraError("SimpleTransport::initLiquid", "Unknown compositionDependence Model: " + modelName);
}
}
}
}
@ -349,9 +340,6 @@ bool SimpleTransport::initLiquid(LiquidTransportParams& tr)
}
}
m_molefracs.resize(m_nsp);
m_concentrations.resize(m_nsp);
@ -380,28 +368,8 @@ bool SimpleTransport::initLiquid(LiquidTransportParams& tr)
return true;
}
//================================================================================================
// Returns the mixture viscosity of the solution
/*
* The viscosity is computed using the general mixture rules
* specified in the variable compositionDepType_.
*
* Solvent-only:
* \f[
* \mu = \mu_0
* \f]
* Mixture-average:
* \f[
* \mu = \sum_k {\mu_k X_k}
* \f]
*
* Here \f$ \mu_k \f$ is the viscosity of pure species \e k.
*
* @see updateViscosity_T();
*/
doublereal SimpleTransport::viscosity()
{
update_T();
update_C();
@ -425,7 +393,7 @@ doublereal SimpleTransport::viscosity()
m_visc_mix_ok = true;
return m_viscmix;
}
//================================================================================================
void SimpleTransport::getSpeciesViscosities(doublereal* const visc)
{
update_T();
@ -434,7 +402,7 @@ void SimpleTransport::getSpeciesViscosities(doublereal* const visc)
}
copy(m_viscSpecies.begin(), m_viscSpecies.end(), visc);
}
//================================================================================================
void SimpleTransport::getBinaryDiffCoeffs(size_t ld, doublereal* d)
{
double bdiff;
@ -453,23 +421,7 @@ void SimpleTransport::getBinaryDiffCoeffs(size_t ld, doublereal* d)
}
}
}
//================================================================================================
// Get the electrical Mobilities (m^2/V/s).
/*
* This function returns the mobilities. In some formulations
* this is equal to the normal mobility multiplied by faraday's constant.
*
* Frequently, but not always, the mobility is calculated from the
* diffusion coefficient using the Einstein relation
*
* \f[
* \mu^e_k = \frac{F D_k}{R T}
* \f]
*
* @param mobil_e Returns the mobilities of
* the species in array \c mobil_e. The array must be
* dimensioned at least as large as the number of species.
*/
void SimpleTransport::getMobilities(doublereal* const mobil)
{
getMixDiffCoeffs(DATA_PTR(m_spwork));
@ -478,25 +430,7 @@ void SimpleTransport::getMobilities(doublereal* const mobil)
mobil[k] = c1 * m_spwork[k];
}
}
//================================================================================================
// Get the fluid mobilities (s kmol/kg).
/*
* This function returns the fluid mobilities. Usually, you have
* to multiply Faraday's constant into the resulting expression
* to general a species flux expression.
*
* Frequently, but not always, the mobility is calculated from the
* diffusion coefficient using the Einstein relation
*
* \f[
* \mu^f_k = \frac{D_k}{R T}
* \f]
*
*
* @param mobil_f Returns the mobilities of
* the species in array \c mobil. The array must be
* dimensioned at least as large as the number of species.
*/
void SimpleTransport::getFluidMobilities(doublereal* const mobil_f)
{
getMixDiffCoeffs(DATA_PTR(m_spwork));
@ -505,7 +439,7 @@ void SimpleTransport::getFluidMobilities(doublereal* const mobil_f)
mobil_f[k] = c1 * m_spwork[k];
}
}
//================================================================================================
void SimpleTransport::set_Grad_V(const doublereal* const grad_V)
{
doMigration_ = false;
@ -516,14 +450,14 @@ void SimpleTransport::set_Grad_V(const doublereal* const grad_V)
}
}
}
//================================================================================================
void SimpleTransport::set_Grad_T(const doublereal* const grad_T)
{
for (size_t a = 0; a < m_nDim; a++) {
m_Grad_T[a] = grad_T[a];
}
}
//================================================================================================
void SimpleTransport::set_Grad_X(const doublereal* const grad_X)
{
size_t itop = m_nDim * m_nsp;
@ -531,25 +465,7 @@ void SimpleTransport::set_Grad_X(const doublereal* const grad_X)
m_Grad_X[i] = grad_X[i];
}
}
//================================================================================================
// Returns the mixture thermal conductivity of the solution
/*
* The thermal is computed using the general mixture rules
* specified in the variable compositionDepType_.
*
* Solvent-only:
* \f[
* \lambda = \lambda_0
* \f]
* Mixture-average:
* \f[
* \lambda = \sum_k {\lambda_k X_k}
* \f]
*
* Here \f$ \lambda_k \f$ is the thermal conductivity of pure species \e k.
*
* @see updateCond_T();
*/
doublereal SimpleTransport::thermalConductivity()
{
update_T();
@ -570,14 +486,7 @@ doublereal SimpleTransport::thermalConductivity()
}
return m_lambda;
}
//================================================================================================
/*
* Thermal diffusion is not considered in this mixture-averaged
* model. To include thermal diffusion, use transport manager
* MultiTransport instead. This methods fills out array dt with
* zeros.
*/
void SimpleTransport::getThermalDiffCoeffs(doublereal* const dt)
{
for (size_t k = 0; k < m_nsp; k++) {
@ -585,31 +494,6 @@ void SimpleTransport::getThermalDiffCoeffs(doublereal* const dt)
}
}
//====================================================================================================================
//! Get the species diffusive velocities wrt to the averaged velocity,
//! given the gradients in mole fraction and temperature
/*!
* The average velocity can be computed on a mole-weighted
* or mass-weighted basis, or the diffusion velocities may
* be specified as relative to a specific species (i.e. a
* solvent) all according to the velocityBasis input parameter.
*
* Units for the returned velocities are m s-1.
*
* @param ndim Number of dimensions in the flux expressions
* @param grad_T Gradient of the temperature
* (length = ndim)
* @param ldx Leading dimension of the grad_X array
* (usually equal to m_nsp but not always)
* @param grad_X Gradients of the mole fraction
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* @param ldf Leading dimension of the fluxes array
* (usually equal to m_nsp but not always)
* @param Vdiff Output of the diffusive velocities.
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
*/
void SimpleTransport::getSpeciesVdiff(size_t ndim,
const doublereal* grad_T,
int ldx,
@ -634,33 +518,7 @@ void SimpleTransport::getSpeciesVdiff(size_t ndim,
}
}
}
//================================================================================================
// Get the species diffusive velocities wrt to the averaged velocity,
// given the gradients in mole fraction, temperature and electrostatic potential.
/*
* The average velocity can be computed on a mole-weighted
* or mass-weighted basis, or the diffusion velocities may
* be specified as relative to a specific species (i.e. a
* solvent) all according to the velocityBasis input parameter.
*
* Units for the returned velocities are m s-1.
*
* @param ndim Number of dimensions in the flux expressions
* @param grad_T Gradient of the temperature
* (length = ndim)
* @param ldx Leading dimension of the grad_X array
* (usually equal to m_nsp but not always)
* @param grad_X Gradients of the mole fraction
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
* @param ldf Leading dimension of the fluxes array
* (usually equal to m_nsp but not always)
* @param grad_Phi Gradients of the electrostatic potential
* (length = ndim)
* @param Vdiff Output of the species diffusion velocities
* Flat vector with the m_nsp in the inner loop.
* length = ldx * ndim
*/
void SimpleTransport::getSpeciesVdiffES(size_t ndim, const doublereal* grad_T,
int ldx, const doublereal* grad_X,
int ldf, const doublereal* grad_Phi,
@ -684,36 +542,7 @@ void SimpleTransport::getSpeciesVdiffES(size_t ndim, const doublereal* grad_T,
}
}
}
//================================================================================================
// Get the species diffusive mass fluxes wrt to the specified solution averaged velocity,
// given the gradients in mole fraction and temperature
/*
* units = kg/m2/s
*
* The diffusive mass flux of species \e k is computed from the following
* formula
*
* Usually the specified solution average velocity is the mass averaged velocity.
* This is changed in some subclasses, however.
*
* \f[
* j_k = - \rho M_k D_k \nabla X_k - Y_k V_c
* \f]
*
* where V_c is the correction velocity
*
* \f[
* V_c = - \sum_j {\rho M_j D_j \nabla X_j}
* \f]
*
*
* @param ndim The number of spatial dimensions (1, 2, or 3).
* @param grad_T The temperature gradient (ignored in this model).
* @param ldx Leading dimension of the grad_X array.
* @param grad_X Gradient of the mole fractions(length nsp * num dimensions);
* @param ldf Leading dimension of the fluxes array.
* @param fluxes Output fluxes of species.
*/
void SimpleTransport::getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
size_t ldx, const doublereal* const grad_X,
size_t ldf, doublereal* const fluxes)
@ -722,34 +551,7 @@ void SimpleTransport::getSpeciesFluxes(size_t ndim, const doublereal* const gra
set_Grad_X(grad_X);
getSpeciesFluxesExt(ldf, fluxes);
}
//================================================================================================
// Return the species diffusive mass fluxes wrt to
// the mass averaged velocity.
/*
*
* units = kg/m2/s
*
* Internally, gradients in the in mole fraction, temperature
* and electrostatic potential contribute to the diffusive flux
*
*
* The diffusive mass flux of species \e k is computed from the following
* formula
*
* \f[
* j_k = - M_k z_k u^f_k F c_k \nabla \Psi - c M_k D_k \nabla X_k - Y_k V_c
* \f]
*
* where V_c is the correction velocity
*
* \f[
* V_c = - \sum_j {M_k z_k u^f_k F c_k \nabla \Psi + c M_j D_j \nabla X_j}
* \f]
*
* @param ldf stride of the fluxes array. Must be equal to
* or greater than the number of species.
* @param fluxes Vector of calculated fluxes
*/
void SimpleTransport::getSpeciesFluxesExt(size_t ldf, doublereal* fluxes)
{
AssertThrow(ldf >= m_nsp ,"SimpleTransport::getSpeciesFluxesExt: Stride must be greater than m_nsp");
@ -829,11 +631,7 @@ void SimpleTransport::getSpeciesFluxesExt(size_t ldf, doublereal* fluxes)
"unknown velocity basis");
}
}
//================================================================================================
// Mixture-averaged diffusion coefficients [m^2/s].
/*
* Returns the simple diffusion coefficients input into the model. Nothing fancy here.
*/
void SimpleTransport::getMixDiffCoeffs(doublereal* const d)
{
update_T();
@ -846,20 +644,7 @@ void SimpleTransport::getMixDiffCoeffs(doublereal* const d)
d[k] = m_diffSpecies[k];
}
}
//================================================================================================
// Handles the effects of changes in the mixture concentration
/*
* This is called for every interface call to check whether
* the concentrations have changed. Concentrations change
* whenever the pressure or the mole fraction has changed.
* If it has changed, the recalculations should be done.
*
* Note this should be a lightweight function since it's
* part of all of the interfaces.
*
* @internal
*/
bool SimpleTransport::update_C()
{
// If the pressure has changed then the concentrations
@ -896,11 +681,6 @@ bool SimpleTransport::update_C()
return true;
}
//================================================================================================
/**
* Update the temperature-dependent parts of the mixture-averaged
* thermal conductivity.
*/
void SimpleTransport::updateCond_T()
{
if (compositionDepType_ == 0) {
@ -913,10 +693,7 @@ void SimpleTransport::updateCond_T()
m_cond_temp_ok = true;
m_cond_mix_ok = false;
}
//================================================================================================
/**
* Update the species diffusion coefficients.
*/
void SimpleTransport::updateDiff_T()
{
if (useHydroRadius_) {
@ -934,21 +711,11 @@ void SimpleTransport::updateDiff_T()
m_diff_temp_ok = true;
m_diff_mix_ok = false;
}
//================================================================================================
/**
* Update the pure-species viscosities.
*/
void SimpleTransport::updateViscosities_C()
{
}
//================================================================================================
/**
* Update the temperature-dependent viscosity terms.
* Updates the array of pure species viscosities, and the
* weighting functions in the viscosity mixture rule.
* The flag m_visc_ok is set to true.
*/
void SimpleTransport::updateViscosity_T()
{
if (compositionDepType_ == 0) {
@ -961,7 +728,7 @@ void SimpleTransport::updateViscosity_T()
m_visc_temp_ok = true;
m_visc_mix_ok = false;
}
//=================================================================================================
bool SimpleTransport::update_T()
{
doublereal t = m_thermo->temperature();
@ -990,11 +757,7 @@ bool SimpleTransport::update_T()
return true;
}
//================================================================================================
/*
* Throw an exception if this method is invoked.
* This probably indicates something is not yet implemented.
*/
doublereal SimpleTransport::err(const std::string& msg) const
{
throw CanteraError("SimpleTransport Class",
@ -1004,7 +767,5 @@ doublereal SimpleTransport::err(const std::string& msg) const
return 0.0;
}
//===================================================================================================================
}
//======================================================================================================================

View file

@ -20,7 +20,6 @@ using namespace std;
namespace Cantera
{
//====================================================================================================================
SolidTransport::SolidTransport() :
Transport() ,
m_nmobile(0),
@ -33,7 +32,7 @@ SolidTransport::SolidTransport() :
m_Elam(0)
{
}
//====================================================================================================================
SolidTransport::SolidTransport(const SolidTransport& right) :
Transport(),
m_nmobile(0),
@ -51,7 +50,7 @@ SolidTransport::SolidTransport(const SolidTransport& right) :
*/
*this = right;
}
//====================================================================================================================
SolidTransport& SolidTransport::operator=(const SolidTransport& b)
{
if (&b != this) {
@ -71,27 +70,15 @@ SolidTransport& SolidTransport::operator=(const SolidTransport& b)
return *this;
}
//====================================================================================================================
Transport* SolidTransport::duplMyselfAsTransport() const
{
SolidTransport* tr = new SolidTransport(*this);
return dynamic_cast<Transport*>(tr);
}
//====================================================================================================================
// Initialize the transport object
/*
* Here we change all of the internal dimensions to be sufficient.
* We get the object ready to do property evaluations.
* A lot of the input required to do property evaluations is
* contained in the SolidTransportData class that is
* filled in TransportFactory.
*
* @param tr Transport parameters for the phase
*/
bool SolidTransport::initSolid(SolidTransportData& tr)
{
m_thermo = tr.thermo;
tr.thermo = 0;
//m_nsp = m_thermo->nSpecies();
@ -117,8 +104,6 @@ bool SolidTransport::initSolid(SolidTransportData& tr)
return true;
}
//====================================================================================================================
void SolidTransport::setParameters(const int n, const int k, const doublereal* const p)
{
switch (n) {
@ -148,32 +133,12 @@ void SolidTransport::setParameters(const int n, const int k, const doublereal* c
}
/****************** ionConductivity ******************************/
// Returns the ionic conductivity of the phase
/*
* The thermo phase needs to be updated (temperature) prior to calling this.
* The ionConductivity calculation is handled by subclasses of
* LTPspecies as specified in the input file.
*
*/
doublereal SolidTransport::ionConductivity()
{
// LTPspecies method
return m_ionConductivity->getSpeciesTransProp();
}
/****************** electron Conductivity ******************************/
// Returns the electron conductivity of the phase
/*
* The thermo phase needs to be updated (temperature) prior to calling this.
* The ionConductivity calculation is handled by subclasses of
* LTPspecies as specified in the input file.
*
* There is also a legacy multicomponent diffusion approach to electrical conductivity.
*
*/
doublereal SolidTransport::electricalConductivity()
{
if (m_nmobile == 0) {
@ -192,17 +157,6 @@ doublereal SolidTransport::electricalConductivity()
/****************** thermalConductivity ******************************/
// Returns the thermal conductivity of the phase
/*
* The thermo phase needs to be updated (temperature) prior to calling this.
* The thermalConductivity calculation is handled by subclasses of
* LTPspecies as specified in the input file.
*
* There is also a legacy method to evaluate
* \f[
* \lambda = A T^n \exp(-E/RT)
* \f]
*/
doublereal SolidTransport::thermalConductivity()
{
if (m_Alam > 0.0) {
@ -215,40 +169,18 @@ doublereal SolidTransport::thermalConductivity()
}
}
/****************** defectDiffusivity ******************************/
// Returns the diffusivity of the phase
/*
* The thermo phase needs to be updated (temperature) prior to calling this.
* The defectDiffusivity calculation is handled by subclasses of
* LTPspecies as specified in the input file.
*
*/
doublereal SolidTransport::defectDiffusivity()
{
// LTPspecies method
return m_defectDiffusivity->getSpeciesTransProp();
}
/****************** defectActivity ******************************/
// Returns the diffusivity of the phase
/*
* The thermo phase needs to be updated (temperature) prior to calling this.
* The defectActivity calculation is handled by subclasses of
* LTPspecies as specified in the input file.
*
*/
doublereal SolidTransport::defectActivity()
{
// LTPspecies method
return m_defectActivity->getSpeciesTransProp();
}
//====================================================================================================================
/*
* Compute the mobilities of the species from the diffusion coefficients,
* using the Einstein relation.
*/
void SolidTransport::getMobilities(doublereal* const mobil)
{
getMixDiffCoeffs(mobil);
@ -259,18 +191,7 @@ void SolidTransport::getMobilities(doublereal* const mobil)
}
}
//====================================================================================================================
/*
* The diffusion coefficients are computed from
*
* \f[
* D_k = A_k T^{n_k} \exp(-E_k/RT).
* \f]
*
* The diffusion coefficients are only non-zero for species for
* which parameters have been specified using method
* setParameters.
*/
void SolidTransport::getMixDiffCoeffs(doublereal* const d)
{
size_t nsp = m_thermo->nSpecies();
@ -279,4 +200,3 @@ void SolidTransport::getMixDiffCoeffs(doublereal* const d)
}
}
}
//====================================================================================================================

View file

@ -18,10 +18,6 @@ using namespace std;
namespace Cantera
{
//////////////////// class LiquidTransport methods //////////////
Transport::Transport(thermo_t* thermo, size_t ndim) :
m_thermo(thermo),
m_ready(false),
@ -59,7 +55,6 @@ Transport* Transport::duplMyselfAsTransport() const
return new Transport(*this);
}
Transport::~Transport()
{
}
@ -69,9 +64,6 @@ bool Transport::ready()
return m_ready;
}
// Set the number of dimensions to be expected in flux expressions
/* Internal memory will be set with this value
*/
void Transport::setNDim(const int ndim)
{
m_nDim = ndim;
@ -91,17 +83,12 @@ void Transport::checkSpeciesArraySize(size_t kk) const
}
}
/* Set transport model parameters. This method may be
* overloaded in subclasses to set model-specific parameters.
*/
void Transport::setParameters(const int type, const int k,
const doublereal* const p)
{
err("setParameters");
}
void Transport::setThermo(thermo_t& thermo)
{
if (!ready()) {
@ -128,7 +115,6 @@ void Transport::setThermo(thermo_t& thermo)
}
}
doublereal Transport::err(const std::string& msg) const
{
@ -140,7 +126,6 @@ doublereal Transport::err(const std::string& msg) const
return 0.0;
}
void Transport::finalize()
{
if (!ready()) {
@ -150,12 +135,10 @@ void Transport::finalize()
"finalize has already been called.");
}
//====================================================================================================================
void Transport::getSpeciesFluxes(size_t ndim, const doublereal* const grad_T,
size_t ldx, const doublereal* const grad_X,
size_t ldf, doublereal* const fluxes)
{
err("getSpeciesFluxes");
}
//====================================================================================================================
}

View file

@ -13,33 +13,21 @@
#include <iostream>
using namespace std;
namespace Cantera
{
//! default constructor
WaterTransport::WaterTransport(thermo_t* thermo, int ndim) :
Transport(thermo, ndim)
{
initTP();
}
// Copy Constructor for the %WaterThermo object.
/*
* @param right ThermoPhase to be copied
*/
WaterTransport::WaterTransport(const WaterTransport& right) :
Transport(right.m_thermo, right.m_nDim)
{
*this = right;
}
// Assignment operator
/*
*
* @param right Reference to %WaterTransport object to be copied into the
* current one.
*/
WaterTransport& WaterTransport::operator=(const WaterTransport& right)
{
if (&right != this) {
@ -54,22 +42,11 @@ WaterTransport& WaterTransport::operator=(const WaterTransport& right)
return *this;
}
// Duplication routine for objects which inherit from %Transport
/*
* This virtual routine can be used to duplicate %Transport objects
* inherited from %Transport even if the application only has
* a pointer to %Transport to work with.
*
* These routines are basically wrappers around the derived copy
* constructor.
*/
Transport* WaterTransport::duplMyselfAsTransport() const
{
return new WaterTransport(*this);
}
// Routine to do some common initializations at the start of using
// this routine.
void WaterTransport::initTP()
{
// The expectation is that we have a VPStandardStateTP derived object
@ -103,41 +80,11 @@ void WaterTransport::initTP()
}
}
// Returns the viscosity of water at the current conditions
// (kg/m/s)
/*
* This function calculates the value of the viscosity of pure
* water at the current T and P.
*
* The formulas used are from the paper
* J. V. Sengers, J. T. R. Watson, "Improved International
* Formulations for the Viscosity and Thermal Conductivity of
* Water Substance", J. Phys. Chem. Ref. Data, 15, 1291 (1986).
*
* The formulation is accurate for all temperatures and pressures,
* for steam and for water, even near the critical point.
* Pressures above 500 MPa and temperature above 900 C are suspect.
*/
doublereal WaterTransport::viscosity()
{
return m_waterProps->viscosityWater();
}
// Returns the thermal conductivity of water at the current conditions
// (W/m/K)
/*
* This function calculates the value of the thermal conductivity of
* water at the current T and P.
*
* The formulas used are from the paper
* J. V. Sengers, J. T. R. Watson, "Improved International
* Formulations for the Viscosity and Thermal Conductivity of
* Water Substance", J. Phys. Chem. Ref. Data, 15, 1291 (1986).
*
* The formulation is accurate for all temperatures and pressures,
* for steam and for water, even near the critical point.
* Pressures above 500 MPa and temperature above 900 C are suspect.
*/
doublereal WaterTransport::thermalConductivity()
{
return m_waterProps->thermalConductivityWater();