[Doc] Clean up Doxygen documentation for ThermoPhase classes
Remove redundant documentation from overloaded methods which does not add any additional information. Reformat to to make indentation and line lengths more consistent.
This commit is contained in:
parent
78b471fbf9
commit
cd1f1fd5ac
36 changed files with 5072 additions and 10450 deletions
|
|
@ -16,12 +16,13 @@
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
//! Overloads the virtual methods of class ThermoPhase to implement the
|
||||
//! incompressible equation of state.
|
||||
//! Overloads the virtual methods of class ThermoPhase to implement the
|
||||
//! incompressible equation of state.
|
||||
/**
|
||||
* <b> Specification of Solution Thermodynamic Properties </b>
|
||||
*
|
||||
* The density is assumed to be constant, no matter what the concentration of the solution.
|
||||
* The density is assumed to be constant, no matter what the concentration of
|
||||
* the solution.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
|
|
@ -31,278 +32,109 @@ public:
|
|||
//! Constructor.
|
||||
ConstDensityThermo() {}
|
||||
|
||||
//! Copy Constructor
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
ConstDensityThermo(const ConstDensityThermo& right);
|
||||
|
||||
//! Assignment Operator
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
ConstDensityThermo& operator=(const ConstDensityThermo& right);
|
||||
|
||||
//! Duplication routine for objects which inherit from ThermoPhase
|
||||
/*!
|
||||
* This virtual routine can be used to duplicate objects
|
||||
* derived from ThermoPhase even if the application only has
|
||||
* a pointer to ThermoPhase to work with.
|
||||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//! Returns a constant corresponding to this class's equation of state
|
||||
virtual int eosType() const;
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
|
||||
/// Molar entropy. Units: J/kmol/K.
|
||||
virtual doublereal entropy_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
virtual doublereal cp_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
virtual doublereal cv_mole() const;
|
||||
|
||||
//! Return the thermodynamic pressure (Pa).
|
||||
virtual doublereal pressure() const;
|
||||
|
||||
//! Set the internally stored pressure (Pa) at constant
|
||||
//! temperature and composition
|
||||
//! Set the internally stored pressure (Pa) at constant temperature and
|
||||
//! composition
|
||||
/*!
|
||||
* @param p input Pressure (Pa)
|
||||
*/
|
||||
virtual void setPressure(doublereal p);
|
||||
|
||||
//! This method returns an array of generalized concentrations
|
||||
/*!
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
|
||||
* C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration
|
||||
* defined below and \f$ a_k \f$ are activities used in the
|
||||
* thermodynamic functions. These activity (or generalized)
|
||||
* concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions. Note that they may
|
||||
* or may not have units of concentration --- they might be
|
||||
* partial pressures, mole fractions, or surface coverages,
|
||||
* for example.
|
||||
*
|
||||
* @param c Output array of generalized concentrations. The
|
||||
* units depend upon the implementation of the
|
||||
* reaction rate expressions within the phase.
|
||||
*/
|
||||
virtual void getActivityConcentrations(doublereal* c) const;
|
||||
|
||||
//! Get the array of non-dimensional molar-based activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* @param ac Output vector of activity coefficients. Length: m_kk.
|
||||
*/
|
||||
virtual void getActivityCoefficients(doublereal* ac) const;
|
||||
|
||||
//! Get the species chemical potentials. Units: J/kmol.
|
||||
/*!
|
||||
* This function returns a vector of chemical potentials of the
|
||||
* species in solution at the current temperature, pressure
|
||||
* and mole fraction of the solution.
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Get the array of chemical potentials at unit activity for the species
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* These are the standard state chemical potentials \f$ \mu^0_k(T,P)
|
||||
* \f$. The values are evaluated at the current
|
||||
* temperature and pressure of the solution
|
||||
*
|
||||
* @param mu0 Output vector of chemical potentials.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getStandardChemPotentials(doublereal* mu0) const;
|
||||
|
||||
//! Return the standard concentration for the kth species
|
||||
/*!
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize
|
||||
* the activity (i.e., generalized) concentration. In many cases, this quantity
|
||||
* will be the same for all species in a phase - for example,
|
||||
* for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this
|
||||
* reason, this method returns a single value, instead of an
|
||||
* array. However, for phases in which the standard
|
||||
* concentration is species-specific (e.g. surface species of
|
||||
* different sizes), this method may be called with an
|
||||
* optional parameter indicating the species.
|
||||
*
|
||||
* @param k Optional parameter indicating the species. The default
|
||||
* is to assume this refers to species 0.
|
||||
* @return
|
||||
* Returns the standard Concentration in units of m3 kmol-1.
|
||||
*/
|
||||
//! Returns the standard Concentration in units of m3 kmol-1.
|
||||
//! @copydoc ThermoPhase::standardConcentration
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
//! Get the Gibbs functions for the standard
|
||||
//! state of the species at the current <I>T</I> and <I>P</I> of the solution
|
||||
/*!
|
||||
* Units are Joules/kmol
|
||||
* @param gpure Output vector of standard state Gibbs free energies
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getPureGibbs(doublereal* gpure) const {
|
||||
const vector_fp& gibbsrt = gibbs_RT();
|
||||
scale(gibbsrt.begin(), gibbsrt.end(), gpure, RT());
|
||||
}
|
||||
|
||||
//! Get the nondimensional Enthalpy functions for the species
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param hrt Output vector of nondimensional standard state enthalpies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
void getEnthalpy_RT(doublereal* hrt) const {
|
||||
const vector_fp& _h = enthalpy_RT();
|
||||
std::copy(_h.begin(), _h.end(), hrt);
|
||||
}
|
||||
|
||||
//! Get the array of nondimensional Entropy functions for the
|
||||
//! standard state species at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param sr Output vector of nondimensional standard state entropies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
void getEntropy_R(doublereal* sr) const {
|
||||
const vector_fp& _s = entropy_R();
|
||||
std::copy(_s.begin(), _s.end(), sr);
|
||||
}
|
||||
|
||||
//! Get the nondimensional Gibbs functions for the species
|
||||
//! in their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param grt Output vector of nondimensional standard state Gibbs free energies
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT(doublereal* grt) const {
|
||||
const vector_fp& gibbsrt = gibbs_RT();
|
||||
std::copy(gibbsrt.begin(), gibbsrt.end(), grt);
|
||||
}
|
||||
|
||||
//! Get the nondimensional Heat Capacities at constant
|
||||
//! pressure for the species standard states
|
||||
//! at the current <I>T</I> and <I>P</I> of the solution
|
||||
/*!
|
||||
* @param cpr Output vector of nondimensional standard state heat capacities
|
||||
* Length: m_kk.
|
||||
*/
|
||||
void getCp_R(doublereal* cpr) const {
|
||||
const vector_fp& _cpr = cp_R();
|
||||
std::copy(_cpr.begin(), _cpr.end(), cpr);
|
||||
}
|
||||
|
||||
//! Returns a reference to the vector of nondimensional
|
||||
//! enthalpies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
//! Returns a reference to the vector of nondimensional enthalpies of the
|
||||
//! reference state at the current temperature of the solution and the
|
||||
//! reference pressure for the species.
|
||||
const vector_fp& enthalpy_RT() const {
|
||||
_updateThermo();
|
||||
return m_h0_RT;
|
||||
}
|
||||
|
||||
//! Returns a reference to the vector of nondimensional
|
||||
//! Gibbs Free Energies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
//! Returns a reference to the vector of nondimensional Gibbs Free Energies
|
||||
//! of the reference state at the current temperature of the solution and
|
||||
//! the reference pressure for the species.
|
||||
const vector_fp& gibbs_RT() const {
|
||||
_updateThermo();
|
||||
return m_g0_RT;
|
||||
}
|
||||
|
||||
//! Returns a reference to the vector of nondimensional
|
||||
//! entropies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for each species.
|
||||
//! Returns a reference to the vector of nondimensional entropies of the
|
||||
//! reference state at the current temperature of the solution and the
|
||||
//! reference pressure for each species.
|
||||
const vector_fp& entropy_R() const {
|
||||
_updateThermo();
|
||||
return m_s0_R;
|
||||
}
|
||||
|
||||
//! Returns a reference to the vector of nondimensional
|
||||
//! constant pressure heat capacities of the reference state
|
||||
//! at the current temperature of the solution
|
||||
//! and reference pressure for each species.
|
||||
//! Returns a reference to the vector of nondimensional constant pressure
|
||||
//! heat capacities of the reference state at the current temperature of the
|
||||
//! solution and reference pressure for each species.
|
||||
const vector_fp& cp_R() const {
|
||||
_updateThermo();
|
||||
return m_cp0_R;
|
||||
}
|
||||
|
||||
//! Initialize the ThermoPhase object after all species have been set up
|
||||
/*!
|
||||
* @internal Initialize.
|
||||
*
|
||||
* This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called from ThermoPhase::initThermoXML(),
|
||||
* which is called from importPhase(),
|
||||
* just prior to returning from function importPhase().
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
//!This method is used by the ChemEquil equilibrium solver.
|
||||
/*!
|
||||
* It sets the state such that the chemical potentials satisfy
|
||||
* \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m}
|
||||
* \left(\frac{\lambda_m} {\hat R T}\right) \f] where
|
||||
* \f$ \lambda_m \f$ is the element potential of element m. The
|
||||
* temperature is unchanged. Any phase (ideal or not) that
|
||||
* implements this method can be equilibrated by ChemEquil.
|
||||
*
|
||||
* @param lambda_RT Input vector of dimensionless element potentials
|
||||
* The length is equal to nElements().
|
||||
*/
|
||||
virtual void setToEquilState(const doublereal* lambda_RT);
|
||||
|
||||
//! Set the equation of state parameters
|
||||
/*!
|
||||
* @internal
|
||||
* The number and meaning of these depends on the subclass.
|
||||
*
|
||||
* @param n number of parameters
|
||||
* @param c array of \a n coefficients
|
||||
*/
|
||||
virtual void setParameters(int n, doublereal* const c) {
|
||||
setDensity(c[0]);
|
||||
}
|
||||
|
||||
//! Get the equation of state parameters in a vector
|
||||
/*!
|
||||
* @internal
|
||||
* The number and meaning of these depends on the subclass.
|
||||
*
|
||||
* @param n number of parameters
|
||||
* @param c array of \a n coefficients
|
||||
*/
|
||||
virtual void getParameters(int& n, doublereal* const c) const {
|
||||
double d = density();
|
||||
c[0] = d;
|
||||
n = 1;
|
||||
}
|
||||
|
||||
//! Set equation of state parameter values from XML entries.
|
||||
/*!
|
||||
*
|
||||
* This method is called by function importPhase() when processing a phase
|
||||
* definition in an input file. It should be overloaded in subclasses to set
|
||||
* any parameters that are specific to that particular phase
|
||||
* model. Note, this method is called before the phase is
|
||||
* initialized with elements and/or species.
|
||||
*
|
||||
* @param eosdata An XML_Node object corresponding to
|
||||
* the "thermo" entry for this phase in the input file.
|
||||
*/
|
||||
virtual void setParametersFromXML(const XML_Node& eosdata);
|
||||
|
||||
protected:
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -35,19 +35,8 @@ public:
|
|||
*/
|
||||
EdgePhase(doublereal n0=1.0);
|
||||
|
||||
//! Copy Constructor
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
EdgePhase(const EdgePhase& right);
|
||||
|
||||
//! Assignment Operator
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
EdgePhase& operator=(const EdgePhase& right);
|
||||
|
||||
//! Duplicator from a ThermoPhase object
|
||||
ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//! returns the equation of state type
|
||||
|
|
@ -59,15 +48,13 @@ public:
|
|||
/*!
|
||||
* The Equation-of-State data consists of one item, the site density.
|
||||
*
|
||||
* @param thermoData Reference to an XML_Node named thermo
|
||||
* containing the equation-of-state data. The
|
||||
* XML_Node is within the phase XML_Node describing
|
||||
* the EdgePhase object.
|
||||
* @param thermoData Reference to an XML_Node named thermo containing the
|
||||
* equation-of-state data. The XML_Node is within the
|
||||
* phase XML_Node describing the EdgePhase object.
|
||||
*
|
||||
* An example of the contents of the thermoData XML_Node is provided
|
||||
* below. The units attribute is used to supply the units of the
|
||||
* site density in any convenient form. Internally it is changed
|
||||
* into MKS form.
|
||||
* An example of the contents of the thermoData XML_Node is provided below.
|
||||
* The units attribute is used to supply the units of the site density in
|
||||
* any convenient form. Internally it is changed into MKS form.
|
||||
*
|
||||
* @code
|
||||
* <thermo model="Edge">
|
||||
|
|
|
|||
|
|
@ -19,67 +19,66 @@
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
//! Class FixedChemPotSSTP represents a stoichiometric (fixed
|
||||
//! composition) incompressible substance.
|
||||
//! Class FixedChemPotSSTP represents a stoichiometric (fixed composition)
|
||||
//! incompressible substance.
|
||||
/*!
|
||||
* This class internally changes the independent degree of freedom from
|
||||
* density to pressure. This is necessary because the phase is
|
||||
* incompressible. It uses a zero volume approximation.
|
||||
* This class internally changes the independent degree of freedom from density
|
||||
* to pressure. This is necessary because the phase is incompressible. It uses a
|
||||
* zero volume approximation.
|
||||
*
|
||||
* <b> Specification of Species Standard State Properties </b>
|
||||
*
|
||||
* This class inherits from SingleSpeciesTP.
|
||||
* It uses a single value for the chemical potential which is assumed to be constant
|
||||
* with respect to temperature and pressure.
|
||||
* This class inherits from SingleSpeciesTP. It uses a single value for the
|
||||
* chemical potential which is assumed to be constant with respect to
|
||||
* temperature and pressure.
|
||||
*
|
||||
* The reference state thermodynamics is inherited from SingleSpeciesTP. However,
|
||||
* it's only used to set the initial chemical potential to the value
|
||||
* of the chemical potential at the starting conditions. Thereafter,
|
||||
* it is ignored.
|
||||
* The reference state thermodynamics is inherited from SingleSpeciesTP.
|
||||
* However, it's only used to set the initial chemical potential to the value of
|
||||
* the chemical potential at the starting conditions. Thereafter, it is ignored.
|
||||
*
|
||||
* For a zero volume material, the internal energy and the enthalpy are
|
||||
* equal to the chemical potential. The entropy, the heat capacity, and the molar volume
|
||||
* are equal to zero.
|
||||
* For a zero volume material, the internal energy and the enthalpy are equal to
|
||||
* the chemical potential. The entropy, the heat capacity, and the molar volume
|
||||
* are equal to zero.
|
||||
*
|
||||
* <b> Specification of Solution Thermodynamic Properties </b>
|
||||
*
|
||||
* All solution properties are obtained from the standard state
|
||||
* species functions, since there is only one species in the phase.
|
||||
* All solution properties are obtained from the standard state species
|
||||
* functions, since there is only one species in the phase.
|
||||
*
|
||||
* <b> Application within Kinetics Managers </b>
|
||||
*
|
||||
* The standard concentration is equal to 1.0. This means that the
|
||||
* kinetics operator works on an (activities basis). Since this
|
||||
* is a stoichiometric substance, this means that the concentration
|
||||
* of this phase drops out of kinetics expressions.
|
||||
* The standard concentration is equal to 1.0. This means that the kinetics
|
||||
* operator works on an (activities basis). Since this is a stoichiometric
|
||||
* substance, this means that the concentration of this phase drops out of
|
||||
* kinetics expressions.
|
||||
*
|
||||
* An example of a reaction using this is a sticking coefficient
|
||||
* reaction of a substance in an ideal gas phase on a surface with a bulk phase
|
||||
* species in this phase. In this case, the rate of progress for this
|
||||
* reaction, \f$ R_s \f$, may be expressed via the following equation:
|
||||
* An example of a reaction using this is a sticking coefficient reaction of a
|
||||
* substance in an ideal gas phase on a surface with a bulk phase species in
|
||||
* this phase. In this case, the rate of progress for this reaction, \f$ R_s
|
||||
* \f$, may be expressed via the following equation:
|
||||
* \f[
|
||||
* R_s = k_s C_{gas}
|
||||
* \f]
|
||||
* where the units for \f$ R_s \f$ are kmol m-2 s-1. \f$ C_{gas} \f$ has units
|
||||
* of kmol m-3. Therefore, the kinetic rate constant, \f$ k_s \f$, has
|
||||
* units of m s-1. Nowhere does the concentration of the bulk phase
|
||||
* appear in the rate constant expression, since it's a stoichiometric
|
||||
* phase, and the activity is always equal to 1.0.
|
||||
* of kmol m-3. Therefore, the kinetic rate constant, \f$ k_s \f$, has units of
|
||||
* m s-1. Nowhere does the concentration of the bulk phase appear in the rate
|
||||
* constant expression, since it's a stoichiometric phase, and the activity is
|
||||
* always equal to 1.0.
|
||||
*
|
||||
* <b> Instantiation of the Class </b>
|
||||
*
|
||||
* This phase may be instantiated by calling the default ThermoFactory routine
|
||||
* for %Cantera. This new FixedChemPotSSTP object must then have a standalone XML file
|
||||
* description an example of which is given below.
|
||||
* for %Cantera. This new FixedChemPotSSTP object must then have a standalone
|
||||
* XML file description an example of which is given below.
|
||||
*
|
||||
* It may also be created by the following code snippets. The code
|
||||
* includes the special member function setChemicalPotential( chempot), which
|
||||
* sets the chemical potential to a specific value in J / kmol.
|
||||
* It may also be created by the following code snippets. The code includes the
|
||||
* special member function setChemicalPotential( chempot), which sets the
|
||||
* chemical potential to a specific value in J / kmol.
|
||||
*
|
||||
* @code
|
||||
* XML_Node *xm = get_XML_NameID("phase", iFile + "#Li(Fixed)", 0);
|
||||
* FixedChemPotSSTP *LiFixed = new FixedChemPotSSTP(*xm);
|
||||
// Set the chemical potential to -2.3E7 J/kmol
|
||||
* // Set the chemical potential to -2.3E7 J/kmol
|
||||
* LiFixed->setChemicalPotential(-2.3E7.)
|
||||
* @endcode
|
||||
*
|
||||
|
|
@ -170,14 +169,9 @@ public:
|
|||
*/
|
||||
FixedChemPotSSTP(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
FixedChemPotSSTP(const FixedChemPotSSTP& right);
|
||||
|
||||
//! Special constructor for the FixecChemPotSSTP class setting an element chemical
|
||||
//! potential directly
|
||||
//! Special constructor for the FixecChemPotSSTP class setting an element
|
||||
//! chemical potential directly
|
||||
/*!
|
||||
* This will create a FixedChemPotSSTP consisting of a single species with the
|
||||
* stoichiometry of one of the specified atom. It will have a chemical potential
|
||||
|
|
@ -188,20 +182,8 @@ public:
|
|||
*/
|
||||
FixedChemPotSSTP(const std::string& Ename, doublereal chemPot);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
FixedChemPotSSTP(const FixedChemPotSSTP& right);
|
||||
FixedChemPotSSTP& operator=(const FixedChemPotSSTP& right);
|
||||
|
||||
//! Duplication function
|
||||
/*!
|
||||
* This virtual function is used to create a duplicate of the
|
||||
* current phase. It's used to duplicate the phase when given
|
||||
* a ThermoPhase pointer to the phase.
|
||||
*
|
||||
* @return It returns a ThermoPhase pointer.
|
||||
*/
|
||||
ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
/**
|
||||
|
|
@ -217,39 +199,22 @@ public:
|
|||
|
||||
//! Report the Pressure. Units: Pa.
|
||||
/*!
|
||||
* For an incompressible substance, the density is independent
|
||||
* of pressure. This method simply returns the stored
|
||||
* pressure value.
|
||||
* For an incompressible substance, the density is independent of pressure.
|
||||
* This method simply returns the stored pressure value.
|
||||
*/
|
||||
virtual doublereal pressure() const;
|
||||
|
||||
//! Set the pressure at constant temperature. Units: Pa.
|
||||
/*!
|
||||
* For an incompressible substance, the density is
|
||||
* independent of pressure. Therefore, this method only
|
||||
* stores the specified pressure value. It does not
|
||||
* modify the density.
|
||||
* For an incompressible substance, the density is independent of pressure.
|
||||
* Therefore, this method only stores the specified pressure value. It does
|
||||
* not modify the density.
|
||||
*
|
||||
* @param p Pressure (units - Pa)
|
||||
*/
|
||||
virtual void setPressure(doublereal p);
|
||||
|
||||
//! Returns the isothermal compressibility. Units: 1/Pa.
|
||||
/*!
|
||||
* The isothermal compressibility is defined as
|
||||
* \f[
|
||||
* \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal isothermalCompressibility() const;
|
||||
|
||||
//! Return the volumetric thermal expansion coefficient. Units: 1/K.
|
||||
/*!
|
||||
* The thermal expansion coefficient is defined as
|
||||
* \f[
|
||||
* \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal thermalExpansionCoeff() const;
|
||||
|
||||
/**
|
||||
|
|
@ -261,60 +226,41 @@ public:
|
|||
* @{
|
||||
*/
|
||||
|
||||
//! This method returns an array of generalized concentrations
|
||||
/*!
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
|
||||
* C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration
|
||||
* defined below and \f$ a_k \f$ are activities used in the
|
||||
* thermodynamic functions. These activity (or generalized)
|
||||
* concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions.
|
||||
*
|
||||
* For a stoichiometric substance, there is
|
||||
* only one species, and the generalized concentration is 1.0.
|
||||
*
|
||||
* @param c Output array of generalized concentrations. The
|
||||
* units depend upon the implementation of the
|
||||
* reaction rate expressions within the phase.
|
||||
//! @copydoc ThermoPhase::getActivityConcentrations
|
||||
/*!
|
||||
* For a stoichiometric substance, there is only one species, and the
|
||||
* generalized concentration is 1.0.
|
||||
*/
|
||||
virtual void getActivityConcentrations(doublereal* c) const;
|
||||
|
||||
//! Return the standard concentration for the kth species
|
||||
/*!
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize
|
||||
* the activity (i.e., generalized) concentration.
|
||||
* This phase assumes that the kinetics operator works on an
|
||||
* dimensionless basis. Thus, the standard concentration is
|
||||
* equal to 1.0.
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize the activity
|
||||
* (i.e., generalized) concentration. This phase assumes that the kinetics
|
||||
* operator works on an dimensionless basis. Thus, the standard
|
||||
* concentration is equal to 1.0.
|
||||
*
|
||||
* @param k Optional parameter indicating the species. The default
|
||||
* is to assume this refers to species 0.
|
||||
* @param k Optional parameter indicating the species. The default is to
|
||||
* assume this refers to species 0.
|
||||
* @return
|
||||
* Returns The standard Concentration as 1.0
|
||||
*/
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
//! Natural logarithm of the standard concentration of the kth species.
|
||||
/*!
|
||||
* @param k index of the species (defaults to zero)
|
||||
*/
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
//! Get the array of chemical potentials at unit activity for the species
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
//! Get the array of chemical potentials at unit activity for the species at
|
||||
//! their standard states at the current <I>T</I> and <I>P</I> of the
|
||||
//! solution.
|
||||
/*!
|
||||
* For a stoichiometric substance, there is no activity term in
|
||||
* the chemical potential expression, and therefore the
|
||||
* standard chemical potential and the chemical potential
|
||||
* are both equal to the molar Gibbs function.
|
||||
* For a stoichiometric substance, there is no activity term in the chemical
|
||||
* potential expression, and therefore the standard chemical potential and
|
||||
* the chemical potential are both equal to the molar Gibbs function.
|
||||
*
|
||||
* These are the standard state chemical potentials \f$ \mu^0_k(T,P)
|
||||
* \f$. The values are evaluated at the current
|
||||
* temperature and pressure of the solution
|
||||
* These are the standard state chemical potentials \f$ \mu^0_k(T,P) \f$.
|
||||
* The values are evaluated at the current temperature and pressure of the
|
||||
* solution
|
||||
*
|
||||
* @param mu0 Output vector of chemical potentials.
|
||||
* Length: m_kk.
|
||||
* @param mu0 Output vector of chemical potentials. Length: m_kk.
|
||||
*/
|
||||
virtual void getStandardChemPotentials(doublereal* mu0) const;
|
||||
|
||||
|
|
@ -338,58 +284,29 @@ public:
|
|||
/// @name Properties of the Standard State of the Species in the Solution
|
||||
//@{
|
||||
|
||||
//! Get the nondimensional Enthalpy functions for the species
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param hrt Output vector of nondimensional standard state enthalpies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEnthalpy_RT(doublereal* hrt) const;
|
||||
|
||||
//! Get the array of nondimensional Entropy functions for the
|
||||
//! standard state species at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param sr Output vector of nondimensional standard state entropies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEntropy_R(doublereal* sr) const;
|
||||
|
||||
//! Get the nondimensional Gibbs functions for the species
|
||||
//! in their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param grt Output vector of nondimensional standard state Gibbs free energies
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT(doublereal* grt) const;
|
||||
|
||||
//! Get the nondimensional Heat Capacities at constant
|
||||
//! pressure for the species standard states
|
||||
//! at the current <I>T</I> and <I>P</I> of the solution
|
||||
/*!
|
||||
* @param cpr Output vector of nondimensional standard state heat capacities
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getCp_R(doublereal* cpr) const;
|
||||
|
||||
//! Returns the vector of nondimensional Internal Energies of the standard
|
||||
//! state species at the current <I>T</I> and <I>P</I> of the solution
|
||||
//! Returns the vector of nondimensional Internal Energies of the standard
|
||||
//! state species at the current <I>T</I> and <I>P</I> of the solution
|
||||
/*!
|
||||
* For an incompressible,
|
||||
* stoichiometric substance, the molar internal energy is
|
||||
* independent of pressure. Since the thermodynamic properties
|
||||
* are specified by giving the standard-state enthalpy, the
|
||||
* term \f$ P_{ref} \hat v\f$ is subtracted from the specified reference molar
|
||||
* enthalpy to compute the standard state molar internal energy.
|
||||
* For an incompressible, stoichiometric substance, the molar internal
|
||||
* energy is independent of pressure. Since the thermodynamic properties are
|
||||
* specified by giving the standard-state enthalpy, the term \f$ P_{ref}
|
||||
* \hat v\f$ is subtracted from the specified reference molar enthalpy to
|
||||
* compute the standard state molar internal energy.
|
||||
*
|
||||
* @param urt output vector of nondimensional standard state
|
||||
* internal energies of the species. Length: m_kk.
|
||||
*/
|
||||
virtual void getIntEnergy_RT(doublereal* urt) const;
|
||||
|
||||
//! Get the molar volumes of each species in their standard
|
||||
//! states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
//! Get the molar volumes of each species in their standard states at the
|
||||
//! current <I>T</I> and <I>P</I> of the solution.
|
||||
/*
|
||||
* units = m^3 / kmol
|
||||
* units = m^3 / kmol
|
||||
*
|
||||
* We set this to zero
|
||||
*
|
||||
|
|
@ -402,81 +319,11 @@ public:
|
|||
/// @name Thermodynamic Values for the Species Reference States
|
||||
//@{
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! internal Energies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for each species.
|
||||
/*!
|
||||
* @param urt Output vector of nondimensional reference state internal
|
||||
* energies of the species. Length: m_kk
|
||||
*/
|
||||
virtual void getIntEnergy_RT_ref(doublereal* urt) const;
|
||||
|
||||
/*!
|
||||
* Returns the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*
|
||||
* This function is resolved in this class. It is assumed that the m_spthermo species thermo
|
||||
* pointer is populated and yields the reference state.
|
||||
*
|
||||
* @param hrt Output vector containing the nondimensional reference state enthalpies
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
|
||||
|
||||
/*!
|
||||
* Returns the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*
|
||||
* This function is resolved in this class. It is assumed that the m_spthermo species thermo
|
||||
* pointer is populated and yields the reference state.
|
||||
*
|
||||
* @param grt Output vector containing the nondimensional reference state
|
||||
* Gibbs Free energies. Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT_ref(doublereal* grt) const;
|
||||
|
||||
/*!
|
||||
* Returns the vector of the
|
||||
* Gibbs function of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
* units = J/kmol
|
||||
*
|
||||
* This function is resolved in this class. It is assumed that the m_spthermo species thermo
|
||||
* pointer is populated and yields the reference state.
|
||||
*
|
||||
* @param g Output vector containing the reference state
|
||||
* Gibbs Free energies. Length: m_kk. Units: J/kmol.
|
||||
*/
|
||||
virtual void getGibbs_ref(doublereal* g) const;
|
||||
|
||||
/*!
|
||||
* Returns the vector of nondimensional
|
||||
* entropies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for each species.
|
||||
*
|
||||
* This function is resolved in this class. It is assumed that the m_spthermo species thermo
|
||||
* pointer is populated and yields the reference state.
|
||||
*
|
||||
* @param er Output vector containing the nondimensional reference state
|
||||
* entropies. Length: m_kk.
|
||||
*/
|
||||
virtual void getEntropy_R_ref(doublereal* er) const;
|
||||
|
||||
/*!
|
||||
* Returns the vector of nondimensional
|
||||
* constant pressure heat capacities of the reference state
|
||||
* at the current temperature of the solution
|
||||
* and reference pressure for each species.
|
||||
*
|
||||
* This function is resolved in this class. It is assumed that the m_spthermo species thermo
|
||||
* pointer is populated and yields the reference state.
|
||||
*
|
||||
* @param cprt Output vector of nondimensional reference state
|
||||
* heat capacities at constant pressure for the species.
|
||||
* Length: m_kk
|
||||
*/
|
||||
virtual void getCp_R_ref(doublereal* cprt) const;
|
||||
|
||||
//@}
|
||||
|
|
@ -509,11 +356,11 @@ public:
|
|||
/*!
|
||||
* This method is called by function importPhase() when processing a phase
|
||||
* definition in an input file. It should be overloaded in subclasses to set
|
||||
* any parameters that are specific to that particular phase
|
||||
* model. Note, this method is called before the phase is
|
||||
* initialized with elements and/or species.
|
||||
* any parameters that are specific to that particular phase model. Note,
|
||||
* this method is called before the phase is initialized with elements
|
||||
* and/or species.
|
||||
*
|
||||
* For this phase, the chemical potential is set
|
||||
* For this phase, the chemical potential is set.
|
||||
*
|
||||
* @param eosdata An XML_Node object corresponding to
|
||||
* the "thermo" entry for this phase in the input file.
|
||||
|
|
|
|||
|
|
@ -4,12 +4,6 @@
|
|||
* employ Gibbs excess free energy based formulations
|
||||
* (see \ref thermoprops
|
||||
* and class \link Cantera::GibbsExcessVPSSTP GibbsExcessVPSSTP\endlink).
|
||||
*
|
||||
* Header file for a derived class of ThermoPhase that handles
|
||||
* variable pressure standard state methods for calculating
|
||||
* thermodynamic properties that are further based upon activities
|
||||
* based on the molality scale. These include most of the methods for
|
||||
* calculating liquid electrolyte thermodynamics.
|
||||
*/
|
||||
/*
|
||||
* Copyright (2006) Sandia Corporation. Under the terms of
|
||||
|
|
@ -25,19 +19,13 @@
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
/**
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
|
||||
/*!
|
||||
* GibbsExcessVPSSTP is a derived class of ThermoPhase that handles
|
||||
* variable pressure standard state methods for calculating
|
||||
* thermodynamic properties that are further based on
|
||||
* expressing the Excess Gibbs free energy as a function of
|
||||
* the mole fractions (or pseudo mole fractions) of constituents.
|
||||
* This category is the workhorse for describing molten salts,
|
||||
* solid-phase mixtures of semiconductors, and mixtures of miscible
|
||||
* and semi-miscible compounds.
|
||||
* GibbsExcessVPSSTP is a derived class of ThermoPhase that handles variable
|
||||
* pressure standard state methods for calculating thermodynamic properties that
|
||||
* are further based on expressing the Excess Gibbs free energy as a function of
|
||||
* the mole fractions (or pseudo mole fractions) of constituents. This category
|
||||
* is the workhorse for describing molten salts, solid-phase mixtures of
|
||||
* semiconductors, and mixtures of miscible and semi-miscible compounds.
|
||||
*
|
||||
* It includes
|
||||
* - regular solutions
|
||||
|
|
@ -46,88 +34,68 @@ namespace Cantera
|
|||
* - Wilson's equation
|
||||
* - UNIQUAC equation of state.
|
||||
*
|
||||
* This class adds additional functions onto the ThermoPhase interface
|
||||
* that handles the calculation of the excess Gibbs free energy. The ThermoPhase
|
||||
* class includes a member function, ThermoPhase::activityConvention()
|
||||
* that indicates which convention the activities are based on. The
|
||||
* default is to assume activities are based on the molar convention.
|
||||
* That default is used here.
|
||||
* This class adds additional functions onto the ThermoPhase interface that
|
||||
* handles the calculation of the excess Gibbs free energy. The ThermoPhase
|
||||
* class includes a member function, ThermoPhase::activityConvention() that
|
||||
* indicates which convention the activities are based on. The default is to
|
||||
* assume activities are based on the molar convention. That default is used
|
||||
* here.
|
||||
*
|
||||
* All of the Excess Gibbs free energy formulations in this area employ
|
||||
* symmetrical formulations.
|
||||
*
|
||||
* Chemical potentials
|
||||
* of species k, \f$ \mu_o \f$, has the following general format:
|
||||
* Chemical potentials of species k, \f$ \mu_o \f$, has the following general
|
||||
* format:
|
||||
*
|
||||
* \f[
|
||||
* \mu_k = \mu^o_k(T,P) + R T ln( \gamma_k X_k )
|
||||
* \f]
|
||||
*
|
||||
* where \f$ \gamma_k^{\triangle} \f$ is a molar based activity coefficient for species
|
||||
* \f$k\f$.
|
||||
* where \f$ \gamma_k^{\triangle} \f$ is a molar based activity coefficient for
|
||||
* species \f$k\f$.
|
||||
*
|
||||
* GibbsExcessVPSSTP contains an internal vector with the current mole
|
||||
* fraction vector. That's one of its primary usages. In order to keep the mole fraction
|
||||
* GibbsExcessVPSSTP contains an internal vector with the current mole fraction
|
||||
* vector. That's one of its primary usages. In order to keep the mole fraction
|
||||
* vector constant, all of the setState functions are redesigned at this layer.
|
||||
*
|
||||
* <H3>
|
||||
* Activity Concentrations: Relationship of ThermoPhase to %Kinetics Expressions
|
||||
* <H3>
|
||||
* Activity Concentrations: Relationship of ThermoPhase to %Kinetics Expressions
|
||||
* </H3>
|
||||
*
|
||||
* As explained in a similar discussion in the ThermoPhase class, the actual units used
|
||||
* in kinetics expressions must be specified in the ThermoPhase class for the corresponding
|
||||
* species. These units vary with the field of study. %Cantera uses the concept of
|
||||
* activity concentrations to represent this. Activity concentrations are used directly
|
||||
* in the expressions for kinetics. Standard concentrations are used as the multiplicative
|
||||
* constant that takes the activity of a species and turns it into an activity concentration.
|
||||
* Standard concentrations must not depend on the concentration of the species in the phase.
|
||||
* As explained in a similar discussion in the ThermoPhase class, the actual
|
||||
* units used in kinetics expressions must be specified in the ThermoPhase class
|
||||
* for the corresponding species. These units vary with the field of study.
|
||||
* %Cantera uses the concept of activity concentrations to represent this.
|
||||
* Activity concentrations are used directly in the expressions for kinetics.
|
||||
* Standard concentrations are used as the multiplicative constant that takes
|
||||
* the activity of a species and turns it into an activity concentration.
|
||||
* Standard concentrations must not depend on the concentration of the species
|
||||
* in the phase.
|
||||
*
|
||||
* Here we set a standard for the specification of the standard concentrations for this class
|
||||
* and all child classes underneath it. We specify here that the standard concentration is
|
||||
* equal to 1 for all species. Therefore, the activities appear directly in kinetics expressions
|
||||
* involving species in underlying GibbsExcessVPSSTP phases.
|
||||
* Here we set a standard for the specification of the standard concentrations
|
||||
* for this class and all child classes underneath it. We specify here that the
|
||||
* standard concentration is equal to 1 for all species. Therefore, the
|
||||
* activities appear directly in kinetics expressions involving species in
|
||||
* underlying GibbsExcessVPSSTP phases.
|
||||
*
|
||||
* <H3>
|
||||
* SetState Strategy
|
||||
* <H3>
|
||||
* SetState Strategy
|
||||
* </H3>
|
||||
*
|
||||
* All setState functions that set the internal state of the ThermoPhase object are
|
||||
* overloaded at this level, so that a current mole fraction vector is maintained within
|
||||
* the object.
|
||||
* All setState functions that set the internal state of the ThermoPhase object
|
||||
* are overloaded at this level, so that a current mole fraction vector is
|
||||
* maintained within the object.
|
||||
*/
|
||||
class GibbsExcessVPSSTP : public VPStandardStateTP
|
||||
{
|
||||
public:
|
||||
//! @name Constructors
|
||||
//! @{
|
||||
/*!
|
||||
* This doesn't do much more than initialize constants with
|
||||
* default values for water at 25C. Water molecular weight
|
||||
* comes from the default elements.xml file. It actually
|
||||
* differs slightly from the IAPWS95 value of 18.015268. However,
|
||||
* density conservation and therefore element conservation
|
||||
* is the more important principle to follow.
|
||||
*/
|
||||
|
||||
GibbsExcessVPSSTP() {}
|
||||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* @param b class to be copied
|
||||
*/
|
||||
GibbsExcessVPSSTP(const GibbsExcessVPSSTP& b);
|
||||
|
||||
/// Assignment operator
|
||||
/*!
|
||||
* @param b class to be copied.
|
||||
*/
|
||||
GibbsExcessVPSSTP& operator=(const GibbsExcessVPSSTP& b);
|
||||
|
||||
//! Duplication routine for objects which inherit from ThermoPhase.
|
||||
/*!
|
||||
* This virtual routine can be used to duplicate ThermoPhase objects
|
||||
* inherited from ThermoPhase even if the application only has
|
||||
* a pointer to ThermoPhase to work with.
|
||||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
//! @}
|
||||
|
||||
|
|
@ -135,14 +103,14 @@ public:
|
|||
//! @name Mechanical Properties
|
||||
//! @{
|
||||
|
||||
//! Set the internally stored pressure (Pa) at constant
|
||||
//! temperature and composition
|
||||
//! Set the internally stored pressure (Pa) at constant temperature and
|
||||
//! composition
|
||||
/*!
|
||||
* This method sets the pressure within the object.
|
||||
* The water model is a completely compressible model.
|
||||
* Also, the dielectric constant is pressure dependent.
|
||||
* This method sets the pressure within the object. The water model is a
|
||||
* completely compressible model. Also, the dielectric constant is pressure
|
||||
* dependent.
|
||||
*
|
||||
* @param p input Pressure (Pa)
|
||||
* @param p input Pressure (Pa)
|
||||
*
|
||||
* @todo Implement a variable pressure capability
|
||||
*/
|
||||
|
|
@ -150,8 +118,8 @@ public:
|
|||
|
||||
protected:
|
||||
/**
|
||||
* Calculate the density of the mixture using the partial
|
||||
* molar volumes and mole fractions as input
|
||||
* Calculate the density of the mixture using the partial molar volumes and
|
||||
* mole fractions as input
|
||||
*
|
||||
* The formula for this is
|
||||
*
|
||||
|
|
@ -159,18 +127,16 @@ protected:
|
|||
* \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}}
|
||||
* \f]
|
||||
*
|
||||
* where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are
|
||||
* the molecular weights, and \f$V_k\f$ are the pure species
|
||||
* molar volumes.
|
||||
* where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular
|
||||
* weights, and \f$V_k\f$ are the pure species molar volumes.
|
||||
*
|
||||
* Note, the basis behind this formula is that in an ideal
|
||||
* solution the partial molar volumes are equal to the pure
|
||||
* species molar volumes. We have additionally specified
|
||||
* in this class that the pure species molar volumes are
|
||||
* independent of temperature and pressure.
|
||||
* Note, the basis behind this formula is that in an ideal solution the
|
||||
* partial molar volumes are equal to the pure species molar volumes. We
|
||||
* have additionally specified in this class that the pure species molar
|
||||
* volumes are independent of temperature and pressure.
|
||||
*
|
||||
* NOTE: This is a non-virtual function, which is not a
|
||||
* member of the ThermoPhase base class.
|
||||
* NOTE: This is a non-virtual function, which is not a member of the
|
||||
* ThermoPhase base class.
|
||||
*/
|
||||
void calcDensity();
|
||||
|
||||
|
|
@ -179,42 +145,24 @@ public:
|
|||
* @}
|
||||
* @name Activities, Standard States, and Activity Concentrations
|
||||
*
|
||||
* The activity \f$a_k\f$ of a species in solution is
|
||||
* related to the chemical potential by \f[ \mu_k = \mu_k^0(T)
|
||||
* + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is
|
||||
* the chemical potential at unit activity, which depends only
|
||||
* on temperature and pressure.
|
||||
* The activity \f$a_k\f$ of a species in solution is related to the
|
||||
* chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The
|
||||
* quantity \f$\mu_k^0(T,P)\f$ is the chemical potential at unit activity,
|
||||
* which depends only on temperature and pressure.
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! This method returns an array of generalized concentrations
|
||||
/*!
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
|
||||
* C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration
|
||||
* defined below and \f$ a_k \f$ are activities used in the
|
||||
* thermodynamic functions. These activity (or generalized)
|
||||
* concentrations are used by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions. Note that they may
|
||||
* or may not have units of concentration --- they might be
|
||||
* partial pressures, mole fractions, or surface coverages,
|
||||
* for example.
|
||||
*
|
||||
* @param c Output array of generalized concentrations. The
|
||||
* units depend upon the implementation of the
|
||||
* reaction rate expressions within the phase.
|
||||
*/
|
||||
virtual void getActivityConcentrations(doublereal* c) const;
|
||||
|
||||
/**
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize
|
||||
* the generalized concentration. In many cases, this quantity
|
||||
* will be the same for all species in a phase - for example,
|
||||
* for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this
|
||||
* reason, this method returns a single value, instead of an
|
||||
* array. However, for phases in which the standard
|
||||
* concentration is species-specific (e.g. surface species of
|
||||
* different sizes), this method may be called with an
|
||||
* optional parameter indicating the species.
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize the
|
||||
* generalized concentration. In many cases, this quantity will be the same
|
||||
* for all species in a phase - for example, for an ideal gas
|
||||
* \f$ C^0_k = P/\hat R T \f$. For this reason, this method returns a single
|
||||
* value, instead of an array. However, for phases in which the standard
|
||||
* concentration is species-specific (e.g. surface species of different
|
||||
* sizes), this method may be called with an optional parameter indicating
|
||||
* the species.
|
||||
*
|
||||
* The standard concentration for defaulted to 1. In other words
|
||||
* the activity concentration is assumed to be 1.
|
||||
|
|
@ -222,18 +170,11 @@ public:
|
|||
* @param k species index. Defaults to zero.
|
||||
*/
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
/**
|
||||
* Returns the natural logarithm of the standard
|
||||
* concentration of the kth species
|
||||
*
|
||||
* @param k species index
|
||||
*/
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
//! Get the array of non-dimensional activities (molality
|
||||
//! based for this class and classes that derive from it) at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
//! Get the array of non-dimensional activities (molality based for this
|
||||
//! class and classes that derive from it) at the current solution
|
||||
//! temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* \f[
|
||||
* a_i^\triangle = \gamma_k^{\triangle} \frac{m_k}{m^\triangle}
|
||||
|
|
@ -245,19 +186,13 @@ public:
|
|||
*/
|
||||
virtual void getActivities(doublereal* ac) const;
|
||||
|
||||
//! Get the array of non-dimensional molar-based activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* @param ac Output vector of activity coefficients. Length: m_kk.
|
||||
*/
|
||||
virtual void getActivityCoefficients(doublereal* ac) const;
|
||||
|
||||
//! Get the array of temperature derivatives of the log activity coefficients
|
||||
/*!
|
||||
* This function is a virtual class, but it first appears in GibbsExcessVPSSTP
|
||||
* class and derived classes from GibbsExcessVPSSTP.
|
||||
* This function is virtual, and first appears in GibbsExcessVPSSTP.
|
||||
*
|
||||
* units = 1/Kelvin
|
||||
* units = 1/Kelvin
|
||||
*
|
||||
* @param dlnActCoeffdT Output vector of temperature derivatives of the
|
||||
* log Activity Coefficients. length = m_kk
|
||||
|
|
@ -266,42 +201,21 @@ public:
|
|||
throw NotImplementedError("GibbsExcessVPSSTP::getdlnActCoeffdT");
|
||||
}
|
||||
|
||||
//! Get the array of derivatives of the log activity coefficients with respect to the log of the species mole numbers
|
||||
/*!
|
||||
* Implementations should take the derivative of the logarithm of the activity coefficient with respect to a
|
||||
* species log mole number (with all other species mole numbers held constant). The default treatment in the
|
||||
* ThermoPhase object is to set this vector to zero.
|
||||
*
|
||||
* units = 1 / kmol
|
||||
*
|
||||
* dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log act_coeff for the <I>m</I><SUP>th</SUP>
|
||||
* species with respect to the number of moles of the <I>k</I><SUP>th</SUP> species.
|
||||
*
|
||||
* \f[
|
||||
* \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i}
|
||||
* \f]
|
||||
*
|
||||
* @param ld Number of rows in the matrix
|
||||
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
||||
* log Activity Coefficients. length = m_kk * m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN) {
|
||||
throw NotImplementedError("GibbsExcessVPSSTP::getdlnActCoeffdlnN: "
|
||||
"nonzero and nonimplemented");
|
||||
}
|
||||
|
||||
//! Get the array of log concentration-like derivatives of the
|
||||
//! log activity coefficients
|
||||
//! Get the array of log concentration-like derivatives of the log activity
|
||||
//! coefficients
|
||||
/*!
|
||||
* This function is a virtual method. For ideal mixtures
|
||||
* (unity activity coefficients), this can return zero.
|
||||
* Implementations should take the derivative of the
|
||||
* logarithm of the activity coefficient with respect to the
|
||||
* logarithm of the concentration-like variable (i.e. number of moles in
|
||||
* in a unit volume. ) that represents the standard state.
|
||||
* This quantity is to be used in conjunction with derivatives of
|
||||
* that concentration-like variable when the derivative of the chemical
|
||||
* potential is taken.
|
||||
* This function is a virtual method. For ideal mixtures (unity activity
|
||||
* coefficients), this can return zero. Implementations should take the
|
||||
* derivative of the logarithm of the activity coefficient with respect to
|
||||
* the logarithm of the concentration-like variable (i.e. number of moles in
|
||||
* in a unit volume. ) that represents the standard state. This quantity is
|
||||
* to be used in conjunction with derivatives of that concentration-like
|
||||
* variable when the derivative of the chemical potential is taken.
|
||||
*
|
||||
* units = dimensionless
|
||||
*
|
||||
|
|
@ -316,17 +230,6 @@ public:
|
|||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Get the species electrochemical potentials.
|
||||
* These are partial molar quantities.
|
||||
* This method adds a term \f$ Fz_k \phi_k \f$ to the
|
||||
* to each chemical potential.
|
||||
*
|
||||
* Units: J/kmol
|
||||
*
|
||||
* @param mu output vector containing the species electrochemical potentials.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
void getElectrochemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Return an array of partial molar volumes for the
|
||||
|
|
@ -349,88 +252,14 @@ public:
|
|||
* @{
|
||||
*/
|
||||
|
||||
//! Set the temperature (K) and pressure (Pa)
|
||||
/*!
|
||||
* Set the temperature and pressure.
|
||||
*
|
||||
* @param t Temperature (K)
|
||||
* @param p Pressure (Pa)
|
||||
*/
|
||||
virtual void setState_TP(doublereal t, doublereal p);
|
||||
|
||||
/**
|
||||
* Set the mass fractions to the specified values, and then
|
||||
* normalize them so that they sum to 1.0.
|
||||
* @param y Array of unnormalized mass fraction values (input).
|
||||
* Must have a length greater than or equal to the number of
|
||||
* species.
|
||||
*
|
||||
* @param y Input vector of mass fractions.
|
||||
* Length is m_kk.
|
||||
*/
|
||||
virtual void setMassFractions(const doublereal* const y);
|
||||
|
||||
/**
|
||||
* Set the mass fractions to the specified values without
|
||||
* normalizing. This is useful when the normalization
|
||||
* condition is being handled by some other means, for example
|
||||
* by a constraint equation as part of a larger set of
|
||||
* equations.
|
||||
*
|
||||
* @param y Input vector of mass fractions.
|
||||
* Length is m_kk.
|
||||
*/
|
||||
virtual void setMassFractions_NoNorm(const doublereal* const y);
|
||||
|
||||
/**
|
||||
* Set the mole fractions to the specified values, and then
|
||||
* normalize them so that they sum to 1.0.
|
||||
* @param x Array of unnormalized mole fraction values (input).
|
||||
* Must have a length greater than or equal to the number of
|
||||
* species.
|
||||
*
|
||||
* @param x Input vector of mole fractions.
|
||||
* Length is m_kk.
|
||||
*/
|
||||
virtual void setMoleFractions(const doublereal* const x);
|
||||
|
||||
/**
|
||||
* Set the mole fractions to the specified values without
|
||||
* normalizing. This is useful when the normalization
|
||||
* condition is being handled by some other means, for example
|
||||
* by a constraint equation as part of a larger set of
|
||||
* equations.
|
||||
*
|
||||
* @param x Input vector of mole fractions.
|
||||
* Length is m_kk.
|
||||
*/
|
||||
virtual void setMoleFractions_NoNorm(const doublereal* const x);
|
||||
|
||||
/**
|
||||
* Set the concentrations to the specified values within the
|
||||
* phase.
|
||||
*
|
||||
* @param c The input vector to this routine is in dimensional
|
||||
* units. For volumetric phases c[k] is the
|
||||
* concentration of the kth species in kmol/m3.
|
||||
* For surface phases, c[k] is the concentration
|
||||
* in kmol/m2. The length of the vector is the number
|
||||
* of species in the phase.
|
||||
*/
|
||||
virtual void setConcentrations(const doublereal* const c);
|
||||
//@}
|
||||
|
||||
/*!
|
||||
* @internal Initialize. This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called just prior to returning
|
||||
* from function importPhase().
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
private:
|
||||
|
|
@ -459,30 +288,30 @@ protected:
|
|||
//! species
|
||||
mutable vector_fp lnActCoeff_Scaled_;
|
||||
|
||||
//! Storage for the current derivative values of the
|
||||
//! gradients with respect to temperature of the
|
||||
//! log of the activity coefficients of the species
|
||||
//! Storage for the current derivative values of the gradients with respect
|
||||
//! to temperature of the log of the activity coefficients of the species
|
||||
mutable vector_fp dlnActCoeffdT_Scaled_;
|
||||
|
||||
//! Storage for the current derivative values of the
|
||||
//! gradients with respect to temperature of the
|
||||
//! log of the activity coefficients of the species
|
||||
//! Storage for the current derivative values of the gradients with respect
|
||||
//! to temperature of the log of the activity coefficients of the species
|
||||
mutable vector_fp d2lnActCoeffdT2_Scaled_;
|
||||
|
||||
//! Storage for the current derivative values of the
|
||||
//! gradients with respect to logarithm of the mole fraction of the
|
||||
//! log of the activity coefficients of the species
|
||||
//! Storage for the current derivative values of the gradients with respect
|
||||
//! to logarithm of the mole fraction of the log of the activity
|
||||
//! coefficients of the species
|
||||
mutable vector_fp dlnActCoeffdlnN_diag_;
|
||||
|
||||
//! Storage for the current derivative values of the
|
||||
//! gradients with respect to logarithm of the mole fraction of the
|
||||
//! log of the activity coefficients of the species
|
||||
//! Storage for the current derivative values of the gradients with respect
|
||||
//! to logarithm of the mole fraction of the log of the activity
|
||||
//! coefficients of the species
|
||||
mutable vector_fp dlnActCoeffdlnX_diag_;
|
||||
|
||||
//! Storage for the current derivative values of the gradients with respect to logarithm of the species mole number of the
|
||||
//! log of the activity coefficients of the species
|
||||
//! Storage for the current derivative values of the gradients with respect
|
||||
//! to logarithm of the species mole number of the log of the activity
|
||||
//! coefficients of the species
|
||||
/*!
|
||||
* dlnActCoeffdlnN_(k, m) is the derivative of ln(gamma_k) wrt ln mole number of species m
|
||||
* dlnActCoeffdlnN_(k, m) is the derivative of ln(gamma_k) wrt ln mole
|
||||
* number of species m
|
||||
*/
|
||||
mutable Array2D dlnActCoeffdlnN_;
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -15,246 +15,242 @@
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
//! Class IdealGasPhase represents low-density gases that obey the
|
||||
//! ideal gas equation of state.
|
||||
//! Class IdealGasPhase represents low-density gases that obey the ideal gas
|
||||
//! equation of state.
|
||||
/*!
|
||||
*
|
||||
* IdealGasPhase derives from class ThermoPhase,
|
||||
* and overloads the virtual methods defined there with ones that
|
||||
* use expressions appropriate for ideal gas mixtures.
|
||||
* IdealGasPhase derives from class ThermoPhase, and overloads the virtual
|
||||
* methods defined there with ones that use expressions appropriate for ideal
|
||||
* gas mixtures.
|
||||
*
|
||||
* The independent unknowns are density, mass fraction, and temperature.
|
||||
* the #setPressure() function will calculate the density consistent with
|
||||
* the current mass fraction vector and temperature and the desired pressure,
|
||||
* and then set the density.
|
||||
* The independent unknowns are density, mass fraction, and temperature. the
|
||||
* #setPressure() function will calculate the density consistent with the
|
||||
* current mass fraction vector and temperature and the desired pressure, and
|
||||
* then set the density.
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Specification of Species Standard State Properties </H2>
|
||||
* <HR>
|
||||
*
|
||||
* It is assumed that the reference state thermodynamics may be
|
||||
* obtained by a pointer to a populated species thermodynamic property
|
||||
* manager class in the base class, ThermoPhase::m_spthermo
|
||||
* (see the base class \link Cantera#SpeciesThermo SpeciesThermo \endlink for a
|
||||
* description of the specification of reference state species thermodynamics functions).
|
||||
* The reference state,
|
||||
* where the pressure is fixed at a single pressure,
|
||||
* is a key species property calculation for the Ideal Gas Equation
|
||||
* of state.
|
||||
* It is assumed that the reference state thermodynamics may be obtained by a
|
||||
* pointer to a populated species thermodynamic property manager class in the
|
||||
* base class, ThermoPhase::m_spthermo (see the base class \link
|
||||
* Cantera#SpeciesThermo SpeciesThermo \endlink for a description of the
|
||||
* specification of reference state species thermodynamics functions). The
|
||||
* reference state, where the pressure is fixed at a single pressure, is a key
|
||||
* species property calculation for the Ideal Gas Equation of state.
|
||||
*
|
||||
* This class is optimized for speed of execution. All calls to thermodynamic functions
|
||||
* first call internal routines (aka #enthalpy_RT_ref()) which return references
|
||||
* the reference state thermodynamics functions. Within these internal reference
|
||||
* state functions, the function #_updateThermo() is called, that first checks to see
|
||||
* whether the temperature has changed. If it has, it updates the internal reference
|
||||
* state thermo functions by calling the SpeciesThermo object.
|
||||
* This class is optimized for speed of execution. All calls to thermodynamic
|
||||
* functions first call internal routines (aka #enthalpy_RT_ref()) which return
|
||||
* references the reference state thermodynamics functions. Within these
|
||||
* internal reference state functions, the function #_updateThermo() is called,
|
||||
* that first checks to see whether the temperature has changed. If it has, it
|
||||
* updates the internal reference state thermo functions by calling the
|
||||
* SpeciesThermo object.
|
||||
*
|
||||
* Functions for the calculation of standard state properties for species
|
||||
* at arbitrary pressure are provided in IdealGasPhase. However, they
|
||||
* are all derived from their reference state counterparts.
|
||||
* Functions for the calculation of standard state properties for species at
|
||||
* arbitrary pressure are provided in IdealGasPhase. However, they are all
|
||||
* derived from their reference state counterparts.
|
||||
*
|
||||
* The standard state enthalpy is independent of pressure:
|
||||
* The standard state enthalpy is independent of pressure:
|
||||
*
|
||||
* \f[
|
||||
* h^o_k(T,P) = h^{ref}_k(T)
|
||||
* \f]
|
||||
* \f[
|
||||
* h^o_k(T,P) = h^{ref}_k(T)
|
||||
* \f]
|
||||
*
|
||||
* The standard state constant-pressure heat capacity is independent of pressure:
|
||||
* The standard state constant-pressure heat capacity is independent of pressure:
|
||||
*
|
||||
* \f[
|
||||
* Cp^o_k(T,P) = Cp^{ref}_k(T)
|
||||
* \f]
|
||||
* \f[
|
||||
* Cp^o_k(T,P) = Cp^{ref}_k(T)
|
||||
* \f]
|
||||
*
|
||||
* The standard state entropy depends in the following fashion on pressure:
|
||||
* The standard state entropy depends in the following fashion on pressure:
|
||||
*
|
||||
* \f[
|
||||
* S^o_k(T,P) = S^{ref}_k(T) - R \ln(\frac{P}{P_{ref}})
|
||||
* \f]
|
||||
* The standard state Gibbs free energy is obtained from the enthalpy and entropy
|
||||
* functions:
|
||||
* \f[
|
||||
* S^o_k(T,P) = S^{ref}_k(T) - R \ln(\frac{P}{P_{ref}})
|
||||
* \f]
|
||||
* The standard state Gibbs free energy is obtained from the enthalpy and entropy
|
||||
* functions:
|
||||
*
|
||||
* \f[
|
||||
* \mu^o_k(T,P) = h^o_k(T,P) - S^o_k(T,P) T
|
||||
* \f]
|
||||
* \f[
|
||||
* \mu^o_k(T,P) = h^o_k(T,P) - S^o_k(T,P) T
|
||||
* \f]
|
||||
*
|
||||
* \f[
|
||||
* \mu^o_k(T,P) = \mu^{ref}_k(T) + R T \ln( \frac{P}{P_{ref}})
|
||||
* \f]
|
||||
* \f[
|
||||
* \mu^o_k(T,P) = \mu^{ref}_k(T) + R T \ln( \frac{P}{P_{ref}})
|
||||
* \f]
|
||||
*
|
||||
* where
|
||||
* \f[
|
||||
* \mu^{ref}_k(T) = h^{ref}_k(T) - T S^{ref}_k(T)
|
||||
* \f]
|
||||
* \f[
|
||||
* \mu^{ref}_k(T) = h^{ref}_k(T) - T S^{ref}_k(T)
|
||||
* \f]
|
||||
*
|
||||
* The standard state internal energy is obtained from the enthalpy function also
|
||||
* The standard state internal energy is obtained from the enthalpy function also
|
||||
*
|
||||
* \f[
|
||||
* u^o_k(T,P) = h^o_k(T) - R T
|
||||
* \f]
|
||||
* \f[
|
||||
* u^o_k(T,P) = h^o_k(T) - R T
|
||||
* \f]
|
||||
*
|
||||
* The molar volume of a species is given by the ideal gas law
|
||||
* The molar volume of a species is given by the ideal gas law
|
||||
*
|
||||
* \f[
|
||||
* V^o_k(T,P) = \frac{R T}{P}
|
||||
* \f]
|
||||
* \f[
|
||||
* V^o_k(T,P) = \frac{R T}{P}
|
||||
* \f]
|
||||
*
|
||||
* where R is the molar gas constant. For a complete list of physical constants
|
||||
* used within %Cantera, see \ref physConstants .
|
||||
* where R is the molar gas constant. For a complete list of physical constants
|
||||
* used within %Cantera, see \ref physConstants .
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Specification of Solution Thermodynamic Properties </H2>
|
||||
* <HR>
|
||||
*
|
||||
* The activity of a species defined in the phase is given by the ideal gas law:
|
||||
* \f[
|
||||
* a_k = X_k
|
||||
* \f]
|
||||
* where \f$ X_k \f$ is the mole fraction of species <I>k</I>.
|
||||
* The chemical potential for species <I>k</I> is equal to
|
||||
* \f[
|
||||
* a_k = X_k
|
||||
* \f]
|
||||
* where \f$ X_k \f$ is the mole fraction of species <I>k</I>. The chemical
|
||||
* potential for species <I>k</I> is equal to
|
||||
*
|
||||
* \f[
|
||||
* \mu_k(T,P) = \mu^o_k(T, P) + R T \log(X_k)
|
||||
* \f]
|
||||
* \f[
|
||||
* \mu_k(T,P) = \mu^o_k(T, P) + R T \log(X_k)
|
||||
* \f]
|
||||
*
|
||||
* In terms of the reference state, the above can be rewritten
|
||||
*
|
||||
* \f[
|
||||
* \mu_k(T,P) = \mu^{ref}_k(T, P) + R T \log(\frac{P X_k}{P_{ref}})
|
||||
* \f]
|
||||
* \f[
|
||||
* \mu_k(T,P) = \mu^{ref}_k(T, P) + R T \log(\frac{P X_k}{P_{ref}})
|
||||
* \f]
|
||||
*
|
||||
* The partial molar entropy for species <I>k</I> is given by the following relation,
|
||||
*
|
||||
* \f[
|
||||
* \tilde{s}_k(T,P) = s^o_k(T,P) - R \log(X_k) = s^{ref}_k(T) - R \log(\frac{P X_k}{P_{ref}})
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{s}_k(T,P) = s^o_k(T,P) - R \log(X_k) = s^{ref}_k(T) - R \log(\frac{P X_k}{P_{ref}})
|
||||
* \f]
|
||||
*
|
||||
* The partial molar enthalpy for species <I>k</I> is
|
||||
*
|
||||
* \f[
|
||||
* \tilde{h}_k(T,P) = h^o_k(T,P) = h^{ref}_k(T)
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{h}_k(T,P) = h^o_k(T,P) = h^{ref}_k(T)
|
||||
* \f]
|
||||
*
|
||||
* The partial molar Internal Energy for species <I>k</I> is
|
||||
*
|
||||
* \f[
|
||||
* \tilde{u}_k(T,P) = u^o_k(T,P) = u^{ref}_k(T)
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{u}_k(T,P) = u^o_k(T,P) = u^{ref}_k(T)
|
||||
* \f]
|
||||
*
|
||||
* The partial molar Heat Capacity for species <I>k</I> is
|
||||
*
|
||||
* \f[
|
||||
* \tilde{Cp}_k(T,P) = Cp^o_k(T,P) = Cp^{ref}_k(T)
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{Cp}_k(T,P) = Cp^o_k(T,P) = Cp^{ref}_k(T)
|
||||
* \f]
|
||||
*
|
||||
* <HR>
|
||||
* <H2> %Application within Kinetics Managers </H2>
|
||||
* <HR>
|
||||
*
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
|
||||
* C^s_k, \f$ where \f$ C^s_k \f$ is a standard concentration
|
||||
* defined below and \f$ a_k \f$ are activities used in the
|
||||
* thermodynamic functions. These activity (or generalized)
|
||||
* concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions.
|
||||
* The activity concentration,\f$ C^a_k \f$,is given by the following expression.
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / C^s_k, \f$ where \f$
|
||||
* C^s_k \f$ is a standard concentration defined below and \f$ a_k \f$ are
|
||||
* activities used in the thermodynamic functions. These activity (or
|
||||
* generalized) concentrations are used by kinetics manager classes to compute
|
||||
* the forward and reverse rates of elementary reactions. The activity
|
||||
* concentration,\f$ C^a_k \f$,is given by the following expression.
|
||||
*
|
||||
* \f[
|
||||
* C^a_k = C^s_k X_k = \frac{P}{R T} X_k
|
||||
* \f]
|
||||
* \f[
|
||||
* C^a_k = C^s_k X_k = \frac{P}{R T} X_k
|
||||
* \f]
|
||||
*
|
||||
* The standard concentration for species <I>k</I> is independent of <I>k</I> and equal to
|
||||
* The standard concentration for species <I>k</I> is independent of <I>k</I>
|
||||
* and equal to
|
||||
*
|
||||
* \f[
|
||||
* C^s_k = C^s = \frac{P}{R T}
|
||||
* \f]
|
||||
* \f[
|
||||
* C^s_k = C^s = \frac{P}{R T}
|
||||
* \f]
|
||||
*
|
||||
* For example, a bulk-phase binary gas reaction between species j and k, producing
|
||||
* a new gas species l would have the
|
||||
* following equation for its rate of progress variable, \f$ R^1 \f$, which has
|
||||
* units of kmol m-3 s-1.
|
||||
* For example, a bulk-phase binary gas reaction between species j and k,
|
||||
* producing a new gas species l would have the following equation for its rate
|
||||
* of progress variable, \f$ R^1 \f$, which has units of kmol m-3 s-1.
|
||||
*
|
||||
* \f[
|
||||
* \f[
|
||||
* R^1 = k^1 C_j^a C_k^a = k^1 (C^s a_j) (C^s a_k)
|
||||
* \f]
|
||||
* where
|
||||
* \f[
|
||||
* C_j^a = C^s a_j \quad \mbox{and} \quad C_k^a = C^s a_k
|
||||
* \f]
|
||||
* \f]
|
||||
* where
|
||||
* \f[
|
||||
* C_j^a = C^s a_j \quad \mbox{and} \quad C_k^a = C^s a_k
|
||||
* \f]
|
||||
*
|
||||
* \f$ C_j^a \f$ is the activity concentration of species j, and
|
||||
* \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^s \f$
|
||||
* is the standard concentration. \f$ a_j \f$ is
|
||||
* the activity of species j which is equal to the mole fraction of j.
|
||||
* \f$ C_j^a \f$ is the activity concentration of species j, and
|
||||
* \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^s \f$ is the
|
||||
* standard concentration. \f$ a_j \f$ is the activity of species j which is
|
||||
* equal to the mole fraction of j.
|
||||
*
|
||||
* The reverse rate constant can then be obtained from the law of microscopic reversibility
|
||||
* and the equilibrium expression for the system.
|
||||
* The reverse rate constant can then be obtained from the law of microscopic
|
||||
* reversibility and the equilibrium expression for the system.
|
||||
*
|
||||
* \f[
|
||||
* \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
|
||||
* \f]
|
||||
* \f[
|
||||
* \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
|
||||
* \f]
|
||||
*
|
||||
* \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, associated with
|
||||
* the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ and their associated activities,
|
||||
* \f$ a_l \f$, repeated here:
|
||||
* \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant,
|
||||
* associated with the pressure dependent standard states \f$ \mu^o_l(T,P) \f$
|
||||
* and their associated activities, \f$ a_l \f$, repeated here:
|
||||
*
|
||||
* \f[
|
||||
* \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l)
|
||||
* \f]
|
||||
* \f[
|
||||
* \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l)
|
||||
* \f]
|
||||
*
|
||||
* We can switch over to expressing the equilibrium constant in terms of the reference
|
||||
* state chemical potentials
|
||||
* We can switch over to expressing the equilibrium constant in terms of the
|
||||
* reference state chemical potentials
|
||||
*
|
||||
* \f[
|
||||
* K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P}
|
||||
* \f]
|
||||
* \f[
|
||||
* K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P}
|
||||
* \f]
|
||||
*
|
||||
* The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over
|
||||
* to activity concentrations. When this is done:
|
||||
* The concentration equilibrium constant, \f$ K_c \f$, may be obtained by
|
||||
* changing over to activity concentrations. When this is done:
|
||||
*
|
||||
* \f[
|
||||
* \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 =
|
||||
* \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT}
|
||||
* \f]
|
||||
* \f[
|
||||
* \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 =
|
||||
* \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT}
|
||||
* \f]
|
||||
*
|
||||
* %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$,
|
||||
* using the second and third part of the above expression as a definition for the concentration
|
||||
* equilibrium constant.
|
||||
* %Kinetics managers will calculate the concentration equilibrium constant,
|
||||
* \f$ K_c \f$, using the second and third part of the above expression as a
|
||||
* definition for the concentration equilibrium constant.
|
||||
*
|
||||
* For completeness, the pressure equilibrium constant may be obtained as well
|
||||
* For completeness, the pressure equilibrium constant may be obtained as well
|
||||
*
|
||||
* \f[
|
||||
* \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 =
|
||||
\exp\left(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 =
|
||||
* \exp\left(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} \right)
|
||||
* \f]
|
||||
*
|
||||
* \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. However, it isn't
|
||||
* necessarily the simplest form of the equilibrium constant for other types of phases; \f$ K_c \f$ is
|
||||
* used instead because it is completely general.
|
||||
* \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases.
|
||||
* However, it isn't necessarily the simplest form of the equilibrium constant
|
||||
* for other types of phases; \f$ K_c \f$ is used instead because it is
|
||||
* completely general.
|
||||
*
|
||||
* The reverse rate of progress may be written down as
|
||||
* \f[
|
||||
* The reverse rate of progress may be written down as
|
||||
* \f[
|
||||
* R^{-1} = k^{-1} C_l^a = k^{-1} (C^o a_l)
|
||||
* \f]
|
||||
* \f]
|
||||
*
|
||||
* where we can use the concept of microscopic reversibility to
|
||||
* write the reverse rate constant in terms of the
|
||||
* forward rate constant and the concentration equilibrium
|
||||
* constant, \f$ K_c \f$.
|
||||
* where we can use the concept of microscopic reversibility to write the
|
||||
* reverse rate constant in terms of the forward rate constant and the
|
||||
* concentration equilibrium constant, \f$ K_c \f$.
|
||||
*
|
||||
* \f[
|
||||
* k^{-1} = k^1 K^1_c
|
||||
* \f]
|
||||
* \f[
|
||||
* k^{-1} = k^1 K^1_c
|
||||
* \f]
|
||||
*
|
||||
* \f$k^{-1} \f$ has units of s-1.
|
||||
* \f$k^{-1} \f$ has units of s-1.
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Instantiation of the Class </H2>
|
||||
* <HR>
|
||||
*
|
||||
* The constructor for this phase is located in the default ThermoFactory
|
||||
* for %Cantera. A new IdealGasPhase may be created by the following code
|
||||
* snippet:
|
||||
* The constructor for this phase is located in the default ThermoFactory for
|
||||
* %Cantera. A new IdealGasPhase may be created by the following code snippet:
|
||||
*
|
||||
* @code
|
||||
* XML_Node *xc = get_XML_File("silane.xml");
|
||||
|
|
@ -292,8 +288,8 @@ namespace Cantera
|
|||
* </phase>
|
||||
* @endcode
|
||||
*
|
||||
* The model attribute "IdealGas" of the thermo XML element identifies the phase as
|
||||
* being of the type handled by the IdealGasPhase object.
|
||||
* The model attribute "IdealGas" of the thermo XML element identifies the phase
|
||||
* as being of the type handled by the IdealGasPhase object.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
|
|
@ -322,41 +318,13 @@ public:
|
|||
*/
|
||||
IdealGasPhase(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
//! Copy Constructor
|
||||
/*!
|
||||
* Copy constructor for the object. Constructed
|
||||
* object will be a clone of this object, but will
|
||||
* also own all of its data.
|
||||
* This is a wrapper around the assignment operator
|
||||
*
|
||||
* @param right Object to be copied.
|
||||
*/
|
||||
IdealGasPhase(const IdealGasPhase& right);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* Assignment operator for the object. Constructed
|
||||
* object will be a clone of this object, but will
|
||||
* also own all of its data.
|
||||
*
|
||||
* @param right Object to be copied.
|
||||
*/
|
||||
IdealGasPhase& operator=(const IdealGasPhase& right);
|
||||
|
||||
//! Duplicator from the ThermoPhase parent class
|
||||
/*!
|
||||
* Given a pointer to a ThermoPhase object, this function will
|
||||
* duplicate the ThermoPhase object and all underlying structures.
|
||||
* This is basically a wrapper around the inherited copy constructor.
|
||||
*
|
||||
* @return returns a pointer to a ThermoPhase object, containing
|
||||
* a copy of the current object
|
||||
*/
|
||||
ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//! Equation of state flag.
|
||||
/*!
|
||||
* Returns the value cIdealGas, defined in mix_defs.h.
|
||||
* Returns the value cIdealGas, defined in mix_defs.h.
|
||||
*/
|
||||
virtual int eosType() const {
|
||||
return cIdealGas;
|
||||
|
|
@ -371,10 +339,9 @@ public:
|
|||
* \f[
|
||||
* \hat h(T) = \sum_k X_k \hat h^0_k(T),
|
||||
* \f]
|
||||
* and is a function only of temperature.
|
||||
* The standard-state pure-species enthalpies
|
||||
* \f$ \hat h^0_k(T) \f$ are computed by the species thermodynamic
|
||||
* property manager.
|
||||
* and is a function only of temperature. The standard-state pure-species
|
||||
* enthalpies \f$ \hat h^0_k(T) \f$ are computed by the species
|
||||
* thermodynamic property manager.
|
||||
*
|
||||
* \see SpeciesThermo
|
||||
*/
|
||||
|
|
@ -388,9 +355,8 @@ public:
|
|||
* \f[
|
||||
* \hat s(T, P) = \sum_k X_k \hat s^0_k(T) - \hat R \log (P/P^0).
|
||||
* \f]
|
||||
* The reference-state pure-species entropies
|
||||
* \f$ \hat s^0_k(T) \f$ are computed by the species thermodynamic
|
||||
* property manager.
|
||||
* The reference-state pure-species entropies \f$ \hat s^0_k(T) \f$ are
|
||||
* computed by the species thermodynamic property manager.
|
||||
* @see SpeciesThermo
|
||||
*/
|
||||
virtual doublereal entropy_mole() const;
|
||||
|
|
@ -401,9 +367,8 @@ public:
|
|||
* \f[
|
||||
* \hat c_p(t) = \sum_k \hat c^0_{p,k}(T).
|
||||
* \f]
|
||||
* The reference-state pure-species heat capacities
|
||||
* \f$ \hat c^0_{p,k}(T) \f$ are computed by the species thermodynamic
|
||||
* property manager.
|
||||
* The reference-state pure-species heat capacities \f$ \hat c^0_{p,k}(T) \f$
|
||||
* are computed by the species thermodynamic property manager.
|
||||
* @see SpeciesThermo
|
||||
*/
|
||||
virtual doublereal cp_mole() const;
|
||||
|
|
@ -430,8 +395,8 @@ public:
|
|||
|
||||
//! Set the pressure at constant temperature and composition.
|
||||
/*!
|
||||
* Units: Pa.
|
||||
* This method is implemented by setting the mass density to
|
||||
* Units: Pa.
|
||||
* This method is implemented by setting the mass density to
|
||||
* \f[
|
||||
* \rho = \frac{P \overline W}{\hat R T }.
|
||||
* \f]
|
||||
|
|
@ -444,9 +409,9 @@ public:
|
|||
|
||||
//! Set the density and pressure at constant composition.
|
||||
/*!
|
||||
* Units: kg/m^3, Pa
|
||||
* This method is implemented by setting the density to the input
|
||||
* value and setting the temperature to
|
||||
* Units: kg/m^3, Pa.
|
||||
* This method is implemented by setting the density to the input value and
|
||||
* setting the temperature to
|
||||
* \f[
|
||||
* T = \frac{P \overline W}{\hat R \rho}.
|
||||
* \f]
|
||||
|
|
@ -499,28 +464,25 @@ public:
|
|||
* \mu_k(T,P,X_k) = \mu_k^0(T,P)
|
||||
* + \hat R T \log a_k.
|
||||
* \f]
|
||||
* The quantity \f$\mu_k^0(T,P)\f$ is
|
||||
* the standard state chemical potential at unit activity.
|
||||
* It may depend on the pressure and the temperature. However,
|
||||
* it may not depend on the mole fractions of the species
|
||||
* in the solution.
|
||||
* The quantity \f$\mu_k^0(T,P)\f$ is the standard state chemical potential
|
||||
* at unit activity. It may depend on the pressure and the temperature.
|
||||
* However, it may not depend on the mole fractions of the species in the
|
||||
* solution.
|
||||
*
|
||||
* The activities are related to the generalized
|
||||
* concentrations, \f$\tilde C_k\f$, and standard
|
||||
* concentrations, \f$C^0_k\f$, by the following formula:
|
||||
* The activities are related to the generalized concentrations, \f$\tilde
|
||||
* C_k\f$, and standard concentrations, \f$C^0_k\f$, by the following
|
||||
* formula:
|
||||
*
|
||||
* \f[
|
||||
* a_k = \frac{\tilde C_k}{C^0_k}
|
||||
* \f]
|
||||
* The generalized concentrations are used in the kinetics classes
|
||||
* to describe the rates of progress of reactions involving the
|
||||
* species. Their formulation depends upon the specification
|
||||
* of the rate constants for reaction, especially the units used
|
||||
* in specifying the rate constants. The bridge between the
|
||||
* thermodynamic equilibrium expressions that use a_k and the
|
||||
* kinetics expressions which use the generalized concentrations
|
||||
* is provided by the multiplicative factor of the
|
||||
* standard concentrations.
|
||||
* The generalized concentrations are used in the kinetics classes to
|
||||
* describe the rates of progress of reactions involving the species. Their
|
||||
* formulation depends upon the specification of the rate constants for
|
||||
* reaction, especially the units used in specifying the rate constants. The
|
||||
* bridge between the thermodynamic equilibrium expressions that use a_k and
|
||||
* the kinetics expressions which use the generalized concentrations is
|
||||
* provided by the multiplicative factor of the standard concentrations.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
@ -528,22 +490,22 @@ public:
|
|||
/*!
|
||||
* For an ideal gas mixture, these are simply the actual concentrations.
|
||||
*
|
||||
* @param c Output array of generalized concentrations. The
|
||||
* units depend upon the implementation of the
|
||||
* reaction rate expressions within the phase.
|
||||
* @param c Output array of generalized concentrations. The units depend
|
||||
* upon the implementation of the reaction rate expressions within
|
||||
* the phase.
|
||||
*/
|
||||
virtual void getActivityConcentrations(doublereal* c) const {
|
||||
getConcentrations(c);
|
||||
}
|
||||
|
||||
//! Returns the standard concentration \f$ C^0_k \f$, which is used to normalize
|
||||
//! the generalized concentration.
|
||||
//! Returns the standard concentration \f$ C^0_k \f$, which is used to
|
||||
//! normalize the generalized concentration.
|
||||
/*!
|
||||
* This is defined as the concentration by which the generalized
|
||||
* concentration is normalized to produce the activity.
|
||||
* In many cases, this quantity will be the same for all species in a phase.
|
||||
* Since the activity for an ideal gas mixture is
|
||||
* simply the mole fraction, for an ideal gas \f$ C^0_k = P/\hat R T \f$.
|
||||
* concentration is normalized to produce the activity. In many cases, this
|
||||
* quantity will be the same for all species in a phase. Since the activity
|
||||
* for an ideal gas mixture is simply the mole fraction, for an ideal gas
|
||||
* \f$ C^0_k = P/\hat R T \f$.
|
||||
*
|
||||
* @param k Optional parameter indicating the species. The default
|
||||
* is to assume this refers to species 0.
|
||||
|
|
@ -552,8 +514,8 @@ public:
|
|||
*/
|
||||
virtual doublereal standardConcentration(size_t k = 0) const;
|
||||
|
||||
//! Get the array of non-dimensional activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
//! Get the array of non-dimensional activity coefficients at the current
|
||||
//! solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* For ideal gases, the activity coefficients are all equal to one.
|
||||
*
|
||||
|
|
@ -565,199 +527,36 @@ public:
|
|||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
||||
//! Get the species chemical potentials. Units: J/kmol.
|
||||
/*!
|
||||
* This function returns a vector of chemical potentials of the
|
||||
* species in solution at the current temperature, pressure
|
||||
* and mole fraction of the solution.
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Get the species partial molar enthalpies. Units: J/kmol.
|
||||
/*!
|
||||
* @param hbar Output vector of species partial molar enthalpies.
|
||||
* Length: m_kk. units are J/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
|
||||
|
||||
//! Get the species partial molar entropies. Units: J/kmol/K.
|
||||
/*!
|
||||
* @param sbar Output vector of species partial molar entropies.
|
||||
* Length = m_kk. units are J/kmol/K.
|
||||
*/
|
||||
virtual void getPartialMolarEntropies(doublereal* sbar) const;
|
||||
|
||||
//! Get the species partial molar enthalpies. Units: J/kmol.
|
||||
/*!
|
||||
* @param ubar Output vector of species partial molar internal energies.
|
||||
* Length = m_kk. units are J/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarIntEnergies(doublereal* ubar) const;
|
||||
|
||||
//! Get the partial molar heat capacities Units: J/kmol/K
|
||||
/*!
|
||||
* @param cpbar Output vector of species partial molar heat capacities at constant pressure.
|
||||
* Length = m_kk. units are J/kmol/K.
|
||||
*/
|
||||
virtual void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
||||
//! Get the species partial molar volumes. Units: m^3/kmol.
|
||||
/*!
|
||||
* @param vbar Output vector of species partial molar volumes.
|
||||
* Length = m_kk. units are m^3/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarVolumes(doublereal* vbar) const;
|
||||
|
||||
//@}
|
||||
/// @name Properties of the Standard State of the Species in the Solution
|
||||
//@{
|
||||
|
||||
//! Get the array of chemical potentials at unit activity for the
|
||||
//! species standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* These are the standard state chemical potentials \f$ \mu^0_k(T,P)
|
||||
* \f$. The values are evaluated at the current
|
||||
* temperature and pressure of the solution
|
||||
*
|
||||
* @param mu Output vector of chemical potentials.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getStandardChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Get the nondimensional Enthalpy functions for the species standard states
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param hrt Output vector of nondimensional standard state enthalpies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEnthalpy_RT(doublereal* hrt) const;
|
||||
|
||||
//! Get the array of nondimensional Entropy functions for the
|
||||
//! species standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param sr Output vector of nondimensional standard state entropies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEntropy_R(doublereal* sr) const;
|
||||
|
||||
//! Get the nondimensional Gibbs functions for the species
|
||||
//! standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param grt Output vector of nondimensional standard state Gibbs free energies
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT(doublereal* grt) const;
|
||||
|
||||
//! Get the Gibbs functions for the standard
|
||||
//! state of the species at the current <I>T</I> and <I>P</I> of the solution
|
||||
/*!
|
||||
* Units are Joules/kmol
|
||||
* @param gpure Output vector of standard state Gibbs free energies
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getPureGibbs(doublereal* gpure) const;
|
||||
|
||||
//! Returns the vector of nondimensional Internal Energies of the standard
|
||||
//! state species at the current <I>T</I> and <I>P</I> of the solution
|
||||
/*!
|
||||
* @param urt output vector of nondimensional standard state internal energies
|
||||
* of the species. Length: m_kk.
|
||||
*/
|
||||
virtual void getIntEnergy_RT(doublereal* urt) const;
|
||||
|
||||
//! Get the nondimensional Heat Capacities at constant
|
||||
//! pressure for the species standard states
|
||||
//! at the current <I>T</I> and <I>P</I> of the solution
|
||||
/*!
|
||||
* @param cpr Output vector of nondimensional standard state heat capacities
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getCp_R(doublereal* cpr) const;
|
||||
|
||||
//! Get the molar volumes of the species standard states at the current
|
||||
//! <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* units = m^3 / kmol
|
||||
*
|
||||
* @param vol Output vector containing the standard state volumes.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getStandardVolumes(doublereal* vol) const;
|
||||
|
||||
//@}
|
||||
/// @name Thermodynamic Values for the Species Reference States
|
||||
//@{
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! enthalpies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
/*!
|
||||
* @param hrt Output vector containing the nondimensional reference state
|
||||
* enthalpies. Length: m_kk.
|
||||
*/
|
||||
virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! Gibbs Free Energies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
/*!
|
||||
* @param grt Output vector containing the nondimensional reference state
|
||||
* Gibbs Free energies. Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT_ref(doublereal* grt) const;
|
||||
|
||||
//! Returns the vector of the
|
||||
//! Gibbs function of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
/*!
|
||||
* units = J/kmol
|
||||
*
|
||||
* @param g Output vector containing the reference state
|
||||
* Gibbs Free energies. Length: m_kk. Units: J/kmol.
|
||||
*/
|
||||
virtual void getGibbs_ref(doublereal* g) const;
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! entropies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for each species.
|
||||
/*!
|
||||
* @param er Output vector containing the nondimensional reference state
|
||||
* entropies. Length: m_kk.
|
||||
*/
|
||||
virtual void getEntropy_R_ref(doublereal* er) const;
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! internal Energies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for each species.
|
||||
/*!
|
||||
* @param urt Output vector of nondimensional reference state
|
||||
* internal energies of the species.
|
||||
* Length: m_kk
|
||||
*/
|
||||
virtual void getIntEnergy_RT_ref(doublereal* urt) const;
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! constant pressure heat capacities of the reference state
|
||||
//! at the current temperature of the solution
|
||||
//! and reference pressure for each species.
|
||||
/*!
|
||||
* @param cprt Output vector of nondimensional reference state
|
||||
* heat capacities at constant pressure for the species.
|
||||
* Length: m_kk
|
||||
*/
|
||||
virtual void getCp_R_ref(doublereal* cprt) const;
|
||||
|
||||
//! Get the molar volumes of the species standard states at the current
|
||||
//! <I>T</I> and <I>P_ref</I> of the solution.
|
||||
/*!
|
||||
* units = m^3 / kmol
|
||||
*
|
||||
* @param vol Output vector containing the standard state volumes.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getStandardVolumes_ref(doublereal* vol) const;
|
||||
|
||||
//@}
|
||||
|
|
@ -806,36 +605,7 @@ public:
|
|||
|
||||
//@}
|
||||
|
||||
//! Initialize the ThermoPhase object after all species have been set up
|
||||
/*!
|
||||
* @internal Initialize.
|
||||
*
|
||||
* This method performs any initialization required after all
|
||||
* species have been added. For example, it is used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species.
|
||||
* This method is called from ThermoPhase::initThermoXML(),
|
||||
* which is called from importPhase(),
|
||||
* just prior to returning from the function, importPhase().
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
//! Method used by the ChemEquil equilibrium solver.
|
||||
/*!
|
||||
* @internal
|
||||
*
|
||||
* Set mixture to an equilibrium state consistent with specified
|
||||
* element potentials and temperature.
|
||||
* It sets the state such that the chemical potentials satisfy
|
||||
* \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m}
|
||||
* \left(\frac{\lambda_m} {\hat R T}\right) \f] where
|
||||
* \f$ \lambda_m \f$ is the element potential of element m. The
|
||||
* temperature is unchanged. Any phase (ideal or not) that
|
||||
* implements this method can be equilibrated by ChemEquil.
|
||||
*
|
||||
* @param lambda_RT vector of non-dimensional element potentials
|
||||
* \f[ \lambda_m/RT \f].
|
||||
*/
|
||||
virtual void setToEquilState(const doublereal* lambda_RT);
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -4,14 +4,12 @@
|
|||
* state (see \ref thermoprops
|
||||
* and class \link Cantera::IdealMolalSoln IdealMolalSoln\endlink).
|
||||
*
|
||||
* Header file for a derived class of ThermoPhase that handles
|
||||
* variable pressure standard state methods for calculating
|
||||
* thermodynamic properties that are further based upon
|
||||
* activities on the molality scale. The Ideal molal
|
||||
* solution assumes that all molality-based activity
|
||||
* coefficients are equal to one. This turns out to be highly
|
||||
* nonlinear in the limit of the solvent mole fraction going
|
||||
* to zero.
|
||||
* Header file for a derived class of ThermoPhase that handles variable pressure
|
||||
* standard state methods for calculating thermodynamic properties that are
|
||||
* further based upon activities on the molality scale. The Ideal molal solution
|
||||
* assumes that all molality-based activity coefficients are equal to one. This
|
||||
* turns out to be highly nonlinear in the limit of the solvent mole fraction
|
||||
* going to zero.
|
||||
*/
|
||||
/*
|
||||
* Copyright (2006) Sandia Corporation. Under the terms of
|
||||
|
|
@ -27,38 +25,31 @@ namespace Cantera
|
|||
{
|
||||
|
||||
/**
|
||||
* This phase is based upon the mixing-rule assumption that
|
||||
* all molality-based activity coefficients are equal
|
||||
* to one.
|
||||
* This phase is based upon the mixing-rule assumption that all molality-based
|
||||
* activity coefficients are equal to one.
|
||||
*
|
||||
* This is a full instantiation of a ThermoPhase object.
|
||||
* The assumption is that the molality-based activity
|
||||
* coefficient is equal to one. This also implies that
|
||||
* the osmotic coefficient is equal to one.
|
||||
* This is a full instantiation of a ThermoPhase object. The assumption is that
|
||||
* the molality-based activity coefficient is equal to one. This also implies
|
||||
* that the osmotic coefficient is equal to one.
|
||||
*
|
||||
* Note, this does not mean that the solution is an
|
||||
* ideal solution. In fact, there is a singularity in
|
||||
* the formulation as
|
||||
* the solvent concentration goes to zero.
|
||||
* Note, this does not mean that the solution is an ideal solution. In fact,
|
||||
* there is a singularity in the formulation as the solvent concentration goes
|
||||
* to zero.
|
||||
*
|
||||
* The mechanical equation of state is currently assumed to
|
||||
* be that of an incompressible solution. This may change
|
||||
* in the future. Each species has its own molar volume.
|
||||
* The molar volume is a constant.
|
||||
* The mechanical equation of state is currently assumed to be that of an
|
||||
* incompressible solution. This may change in the future. Each species has its
|
||||
* own molar volume. The molar volume is a constant.
|
||||
*
|
||||
* Class IdealMolalSoln represents a condensed phase.
|
||||
* The phase and the pure species phases which
|
||||
* comprise the standard states of the species are assumed to have
|
||||
* zero volume expansivity and zero isothermal compressibility.
|
||||
* Each species does, however, have constant but distinct partial
|
||||
* molar volumes equal to their pure species molar volumes.
|
||||
* The class derives from class ThermoPhase,
|
||||
* and overloads the virtual methods defined there with ones that
|
||||
* Class IdealMolalSoln represents a condensed phase. The phase and the pure
|
||||
* species phases which comprise the standard states of the species are assumed
|
||||
* to have zero volume expansivity and zero isothermal compressibility. Each
|
||||
* species does, however, have constant but distinct partial molar volumes equal
|
||||
* to their pure species molar volumes. The class derives from class
|
||||
* ThermoPhase, and overloads the virtual methods defined there with ones that
|
||||
* use expressions appropriate for incompressible mixtures.
|
||||
*
|
||||
* The standard concentrations can have three different forms
|
||||
* depending on the value of the member attribute m_formGC, which
|
||||
* is supplied in the XML file.
|
||||
* The standard concentrations can have three different forms depending on the
|
||||
* value of the member attribute m_formGC, which is supplied in the XML file.
|
||||
*
|
||||
* <TABLE>
|
||||
* <TR><TD> m_formGC </TD><TD> ActivityConc </TD><TD> StandardConc </TD></TR>
|
||||
|
|
@ -67,13 +58,13 @@ namespace Cantera
|
|||
* <TR><TD> 2 </TD><TD> \f$ m_k / (m^{\Delta} V^0_0)\f$</TD><TD> \f$ 1.0 / V^0_0\f$ </TD></TR>
|
||||
* </TABLE>
|
||||
*
|
||||
* \f$ V^0_0 \f$ is the solvent standard molar volume. \f$ m^{\Delta} \f$ is a constant equal to a
|
||||
* molality of \f$ 1.0 \quad\mbox{gm kmol}^{-1} \f$.
|
||||
* \f$ V^0_0 \f$ is the solvent standard molar volume. \f$ m^{\Delta} \f$ is a
|
||||
* constant equal to a molality of \f$ 1.0 \quad\mbox{gm kmol}^{-1} \f$.
|
||||
*
|
||||
* The current default is to have mformGC = 2.
|
||||
*
|
||||
* The value and form of the activity concentration will affect
|
||||
* reaction rate constants involving species in this phase.
|
||||
* The value and form of the activity concentration will affect reaction rate
|
||||
* constants involving species in this phase.
|
||||
*
|
||||
* <thermo model="IdealMolalSoln">
|
||||
* <standardConc model="solvent_volume" />
|
||||
|
|
@ -98,18 +89,17 @@ public:
|
|||
/// Constructor
|
||||
IdealMolalSoln();
|
||||
|
||||
//! Copy Constructor
|
||||
IdealMolalSoln(const IdealMolalSoln&);
|
||||
|
||||
//! Assignment operator
|
||||
IdealMolalSoln& operator=(const IdealMolalSoln&);
|
||||
ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//! Constructor for phase initialization
|
||||
/*!
|
||||
* This constructor will initialize a phase, by reading the required
|
||||
* information from an input file.
|
||||
*
|
||||
* @param inputFile Name of the Input file that contains information about the phase
|
||||
* @param inputFile Name of the Input file that contains information
|
||||
* about the phase
|
||||
* @param id id of the phase within the input file
|
||||
*/
|
||||
IdealMolalSoln(const std::string& inputFile, const std::string& id = "");
|
||||
|
|
@ -125,24 +115,14 @@ public:
|
|||
*/
|
||||
IdealMolalSoln(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
//! Duplication function
|
||||
/*!
|
||||
* This virtual function is used to create a duplicate of the
|
||||
* current phase. It's used to duplicate the phase when given
|
||||
* a ThermoPhase pointer to the phase.
|
||||
*
|
||||
* @return It returns a ThermoPhase pointer.
|
||||
*/
|
||||
ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//! @}
|
||||
//! @name Molar Thermodynamic Properties of the Solution
|
||||
//! @{
|
||||
|
||||
//! Molar enthalpy of the solution. Units: J/kmol.
|
||||
/*!
|
||||
* Returns the amount of enthalpy per mole of solution.
|
||||
* For an ideal molal solution,
|
||||
* Returns the amount of enthalpy per mole of solution. For an ideal molal
|
||||
* solution,
|
||||
* \f[
|
||||
* \bar{h}(T, P, X_k) = \sum_k X_k \bar{h}_k(T)
|
||||
* \f]
|
||||
|
|
@ -157,8 +137,8 @@ public:
|
|||
|
||||
//! Molar internal energy of the solution: Units: J/kmol.
|
||||
/*!
|
||||
* Returns the amount of internal energy per mole of solution.
|
||||
* For an ideal molal solution,
|
||||
* Returns the amount of internal energy per mole of solution. For an ideal
|
||||
* molal solution,
|
||||
* \f[
|
||||
* \bar{u}(T, P, X_k) = \sum_k X_k \bar{u}_k(T)
|
||||
* \f]
|
||||
|
|
@ -169,8 +149,8 @@ public:
|
|||
|
||||
//! Molar entropy of the solution. Units: J/kmol/K.
|
||||
/*!
|
||||
* Returns the amount of entropy per mole of solution.
|
||||
* For an ideal molal solution,
|
||||
* Returns the amount of entropy per mole of solution. For an ideal molal
|
||||
* solution,
|
||||
* \f[
|
||||
* \bar{s}(T, P, X_k) = \sum_k X_k \bar{s}_k(T)
|
||||
* \f]
|
||||
|
|
@ -214,19 +194,18 @@ public:
|
|||
//@}
|
||||
/** @name Mechanical Equation of State Properties
|
||||
*
|
||||
* In this equation of state implementation, the density is a
|
||||
* function only of the mole fractions. Therefore, it can't be
|
||||
* an independent variable. Instead, the pressure is used as the
|
||||
* independent variable. Functions which try to set the thermodynamic
|
||||
* state by calling setDensity() may cause an exception to be
|
||||
* thrown.
|
||||
* In this equation of state implementation, the density is a function only
|
||||
* of the mole fractions. Therefore, it can't be an independent variable.
|
||||
* Instead, the pressure is used as the independent variable. Functions
|
||||
* which try to set the thermodynamic state by calling setDensity() may
|
||||
* cause an exception to be thrown.
|
||||
*/
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Set the pressure at constant temperature. Units: Pa.
|
||||
* This method sets a constant within the object.
|
||||
* The mass density is not a function of pressure.
|
||||
* Set the pressure at constant temperature. Units: Pa. This method sets a
|
||||
* constant within the object. The mass density is not a function of
|
||||
* pressure.
|
||||
*
|
||||
* @param p Input Pressure
|
||||
*/
|
||||
|
|
@ -234,8 +213,8 @@ public:
|
|||
|
||||
protected:
|
||||
/**
|
||||
* Calculate the density of the mixture using the partial
|
||||
* molar volumes and mole fractions as input
|
||||
* Calculate the density of the mixture using the partial molar volumes and
|
||||
* mole fractions as input
|
||||
*
|
||||
* The formula for this is
|
||||
*
|
||||
|
|
@ -243,39 +222,34 @@ protected:
|
|||
* \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}}
|
||||
* \f]
|
||||
*
|
||||
* where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are
|
||||
* the molecular weights, and \f$V_k\f$ are the pure species
|
||||
* molar volumes.
|
||||
* where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular
|
||||
* weights, and \f$V_k\f$ are the pure species molar volumes.
|
||||
*
|
||||
* Note, the basis behind this formula is that in an ideal
|
||||
* solution the partial molar volumes are equal to the pure
|
||||
* species molar volumes. We have additionally specified
|
||||
* in this class that the pure species molar volumes are
|
||||
* independent of temperature and pressure.
|
||||
* Note, the basis behind this formula is that in an ideal solution the
|
||||
* partial molar volumes are equal to the pure species molar volumes. We
|
||||
* have additionally specified in this class that the pure species molar
|
||||
* volumes are independent of temperature and pressure.
|
||||
*/
|
||||
void calcDensity();
|
||||
|
||||
public:
|
||||
/**
|
||||
* Overwritten setDensity() function is necessary because the
|
||||
* density is not an independent variable.
|
||||
* Overwritten setDensity() function is necessary because the density is not
|
||||
* an independent variable.
|
||||
*
|
||||
* This function will now throw an error condition
|
||||
*
|
||||
* @internal May have to adjust the strategy here to make
|
||||
* the eos for these materials slightly compressible, in order
|
||||
* to create a condition where the density is a function of
|
||||
* the pressure.
|
||||
*
|
||||
* This function will now throw an error condition.
|
||||
* @internal May have to adjust the strategy here to make the eos for these
|
||||
* materials slightly compressible, in order to create a condition where
|
||||
* the density is a function of the pressure.
|
||||
*
|
||||
* @param rho Input Density
|
||||
*/
|
||||
void setDensity(const doublereal rho);
|
||||
|
||||
/**
|
||||
* Overwritten setMolarDensity() function is necessary because the
|
||||
* density is not an independent variable.
|
||||
* Overwritten setMolarDensity() function is necessary because the density
|
||||
* is not an independent variable.
|
||||
*
|
||||
* This function will now throw an error condition.
|
||||
*
|
||||
|
|
@ -283,13 +257,6 @@ public:
|
|||
*/
|
||||
void setMolarDensity(const doublereal rho);
|
||||
|
||||
//! Set the temperature (K) and pressure (Pa)
|
||||
/*!
|
||||
* Set the temperature and pressure.
|
||||
*
|
||||
* @param t Temperature (K)
|
||||
* @param p Pressure (Pa)
|
||||
*/
|
||||
virtual void setState_TP(doublereal t, doublereal p);
|
||||
|
||||
//! The isothermal compressibility. Units: 1/Pa.
|
||||
|
|
@ -299,12 +266,12 @@ public:
|
|||
* \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
|
||||
* \f]
|
||||
*
|
||||
* It's equal to zero for this model, since the molar volume
|
||||
* doesn't change with pressure or temperature.
|
||||
* It's equal to zero for this model, since the molar volume doesn't change
|
||||
* with pressure or temperature.
|
||||
*/
|
||||
virtual doublereal isothermalCompressibility() const;
|
||||
|
||||
//! The thermal expansion coefficient. Units: 1/K.
|
||||
//! The thermal expansion coefficient. Units: 1/K.
|
||||
/*!
|
||||
* The thermal expansion coefficient is defined as
|
||||
*
|
||||
|
|
@ -312,8 +279,8 @@ public:
|
|||
* \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
|
||||
* \f]
|
||||
*
|
||||
* It's equal to zero for this model, since the molar volume
|
||||
* doesn't change with pressure or temperature.
|
||||
* It's equal to zero for this model, since the molar volume doesn't change
|
||||
* with pressure or temperature.
|
||||
*/
|
||||
virtual doublereal thermalExpansionCoeff() const;
|
||||
|
||||
|
|
@ -321,61 +288,29 @@ public:
|
|||
* @}
|
||||
* @name Activities and Activity Concentrations
|
||||
*
|
||||
* The activity \f$a_k\f$ of a species in solution is
|
||||
* related to the chemical potential by \f[ \mu_k = \mu_k^0(T)
|
||||
* + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T)\f$ is
|
||||
* the chemical potential at unit activity, which depends only
|
||||
* on temperature and the pressure.
|
||||
* The activity \f$a_k\f$ of a species in solution is related to the
|
||||
* chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The
|
||||
* quantity \f$\mu_k^0(T)\f$ is the chemical potential at unit activity,
|
||||
* which depends only on temperature and the pressure.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*!
|
||||
* This method returns an array of generalized concentrations
|
||||
* \f$ C_k\f$ that are defined such that
|
||||
* \f$ a_k = C_k / C^0_k, \f$ where \f$ C^0_k \f$
|
||||
* is a standard concentration
|
||||
* defined below. These generalized concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions.
|
||||
*
|
||||
* @param c Array of generalized concentrations. The
|
||||
* units depend upon the implementation of the
|
||||
* reaction rate expressions within the phase.
|
||||
*/
|
||||
virtual void getActivityConcentrations(doublereal* c) const;
|
||||
|
||||
/**
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize
|
||||
* the generalized concentration. In many cases, this quantity
|
||||
* will be the same for all species in a phase - for example,
|
||||
* for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this
|
||||
* reason, this method returns a single value, instead of an
|
||||
* array. However, for phases in which the standard
|
||||
* concentration is species-specific (e.g. surface species of
|
||||
* different sizes), this method may be called with an
|
||||
* optional parameter indicating the species.
|
||||
*
|
||||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
/*!
|
||||
* Get the array of non-dimensional activities at
|
||||
* the current solution temperature, pressure, and
|
||||
* solution concentration.
|
||||
* Get the array of non-dimensional activities at the current solution
|
||||
* temperature, pressure, and solution concentration.
|
||||
*
|
||||
* (note solvent is on molar scale)
|
||||
*
|
||||
* @param ac Output activity coefficients.
|
||||
* Length: m_kk.
|
||||
* @param ac Output activity coefficients. Length: m_kk.
|
||||
*/
|
||||
virtual void getActivities(doublereal* ac) const;
|
||||
|
||||
/*!
|
||||
* Get the array of non-dimensional molality-based
|
||||
* activity coefficients at the current solution temperature,
|
||||
* pressure, and solution concentration.
|
||||
*
|
||||
* Get the array of non-dimensional molality-based activity coefficients at
|
||||
* the current solution temperature, pressure, and solution concentration.
|
||||
*
|
||||
* (note solvent is on molar scale. The solvent molar
|
||||
* based activity coefficient is returned).
|
||||
|
|
@ -391,8 +326,8 @@ public:
|
|||
|
||||
//!Get the species chemical potentials: Units: J/kmol.
|
||||
/*!
|
||||
* This function returns a vector of chemical potentials of the
|
||||
* species in solution.
|
||||
* This function returns a vector of chemical potentials of the species in
|
||||
* solution.
|
||||
*
|
||||
* \f[
|
||||
* \mu_k = \mu^{o}_k(T,P) + R T \ln(\frac{m_k}{m^\Delta})
|
||||
|
|
@ -409,23 +344,22 @@ public:
|
|||
*
|
||||
* Units: J/kmol.
|
||||
*
|
||||
* @param mu Output vector of species chemical potentials.
|
||||
* Length: m_kk.
|
||||
* @param mu Output vector of species chemical potentials. Length: m_kk.
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Returns an array of partial molar enthalpies for the species in the mixture.
|
||||
//! Returns an array of partial molar enthalpies for the species in the
|
||||
//! mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* species standard state enthalpies.
|
||||
* Units (J/kmol). For this phase, the partial molar enthalpies are equal to
|
||||
* the species standard state enthalpies.
|
||||
* \f[
|
||||
* \bar h_k(T,P) = \hat h^{ref}_k(T) + (P - P_{ref}) \hat V^0_k
|
||||
* \f]
|
||||
* The reference-state pure-species enthalpies, \f$ \hat h^{ref}_k(T) \f$,
|
||||
* at the reference pressure,\f$ P_{ref} \f$,
|
||||
* are computed by the species thermodynamic
|
||||
* property manager. They are polynomial functions of temperature.
|
||||
* at the reference pressure,\f$ P_{ref} \f$, are computed by the species
|
||||
* thermodynamic property manager. They are polynomial functions of
|
||||
* temperature.
|
||||
* @see SpeciesThermo
|
||||
*
|
||||
* @param hbar Output vector of partial molar enthalpies.
|
||||
|
|
@ -433,16 +367,16 @@ public:
|
|||
*/
|
||||
virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
|
||||
|
||||
//! Returns an array of partial molar entropies of the species in the solution. Units: J/kmol.
|
||||
//! Returns an array of partial molar entropies of the species in the
|
||||
//! solution. Units: J/kmol.
|
||||
/*!
|
||||
*
|
||||
* Maxwell's equations provide an insight in how to calculate this
|
||||
* (p.215 Smith and Van Ness)
|
||||
* \f[
|
||||
* \frac{d(\mu_k)}{dT} = -\bar{s}_i
|
||||
* \f]
|
||||
* For this phase, the partial molar entropies are equal to the
|
||||
* standard state species entropies plus the ideal molal solution contribution.
|
||||
* For this phase, the partial molar entropies are equal to the standard
|
||||
* state species entropies plus the ideal molal solution contribution.
|
||||
*
|
||||
* \f[
|
||||
* \bar{s}_k(T,P) = s^0_k(T) - R \ln( \frac{m_k}{m^{\triangle}} )
|
||||
|
|
@ -451,12 +385,11 @@ public:
|
|||
* \bar{s}_w(T,P) = s^0_w(T) - R ((X_w - 1.0) / X_w)
|
||||
* \f]
|
||||
*
|
||||
* The subscript, w, refers to the solvent species. \f$ X_w \f$ is
|
||||
* the mole fraction of solvent.
|
||||
* The reference-state pure-species entropies,\f$ s^0_k(T) \f$,
|
||||
* at the reference pressure, \f$ P_{ref} \f$, are computed by the
|
||||
* species thermodynamic
|
||||
* property manager. They are polynomial functions of temperature.
|
||||
* The subscript, w, refers to the solvent species. \f$ X_w \f$ is the mole
|
||||
* fraction of solvent. The reference-state pure-species entropies,\f$
|
||||
* s^0_k(T) \f$, at the reference pressure, \f$ P_{ref} \f$, are computed by
|
||||
* the species thermodynamic property manager. They are polynomial functions
|
||||
* of temperature.
|
||||
* @see SpeciesThermo
|
||||
*
|
||||
* @param sbar Output vector of partial molar entropies.
|
||||
|
|
@ -466,8 +399,8 @@ public:
|
|||
|
||||
// partial molar volumes of the species Units: m^3 kmol-1.
|
||||
/*!
|
||||
* For this solution, the partial molar volumes are equal to the
|
||||
* constant species molar volumes.
|
||||
* For this solution, the partial molar volumes are equal to the constant
|
||||
* species molar volumes.
|
||||
*
|
||||
* Units: m^3 kmol-1.
|
||||
* @param vbar Output vector of partial molar volumes.
|
||||
|
|
@ -476,18 +409,16 @@ public:
|
|||
|
||||
//! Partial molar heat capacity of the solution:. UnitsL J/kmol/K
|
||||
/*!
|
||||
* The kth partial molar heat capacity is equal to
|
||||
* the temperature derivative of the partial molar
|
||||
* enthalpy of the kth species in the solution at constant
|
||||
* P and composition (p. 220 Smith and Van Ness).
|
||||
* \f[
|
||||
* The kth partial molar heat capacity is equal to the temperature
|
||||
* derivative of the partial molar enthalpy of the kth species in the
|
||||
* solution at constant P and composition (p. 220 Smith and Van Ness).
|
||||
* \f[
|
||||
* \bar{Cp}_k(T,P) = {Cp}^0_k(T)
|
||||
* \f]
|
||||
* \f]
|
||||
*
|
||||
* For this solution, this is equal to the reference state
|
||||
* heat capacities.
|
||||
* For this solution, this is equal to the reference state heat capacities.
|
||||
*
|
||||
* Units: J/kmol/K
|
||||
* Units: J/kmol/K
|
||||
*
|
||||
* @param cpbar Output vector of partial molar heat capacities.
|
||||
* Length: m_kk.
|
||||
|
|
@ -498,55 +429,16 @@ public:
|
|||
//! @name Chemical Equilibrium
|
||||
//! @{
|
||||
|
||||
/**
|
||||
* This method is used by the ChemEquil equilibrium solver.
|
||||
* It sets the state such that the chemical potentials satisfy
|
||||
* \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m}
|
||||
* \left(\frac{\lambda_m} {\hat R T}\right) \f] where
|
||||
* \f$ \lambda_m \f$ is the element potential of element m. The
|
||||
* temperature is unchanged. Any phase (ideal or not) that
|
||||
* implements this method can be equilibrated by ChemEquil.
|
||||
*
|
||||
* Not implemented.
|
||||
*
|
||||
* @param lambda_RT vector of Nondimensional element potentials.
|
||||
*/
|
||||
virtual void setToEquilState(const doublereal* lambda_RT) {
|
||||
throw NotImplementedError("IdealMolalSoln::setToEquilState");
|
||||
}
|
||||
|
||||
//@}
|
||||
|
||||
/*
|
||||
* -------------- Utilities -------------------------------
|
||||
*/
|
||||
// -------------- Utilities -------------------------------
|
||||
|
||||
//! Initialization routine for an IdealMolalSoln phase.
|
||||
/*!
|
||||
* This internal routine is responsible for setting up
|
||||
* the internal storage. This is reimplemented from the ThermoPhase
|
||||
* class.
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
//! Import and initialize an IdealMolalSoln phase
|
||||
//! specification in an XML tree into the current object.
|
||||
/*!
|
||||
* This routine is called from importPhase() to finish
|
||||
* up the initialization of the thermo object. It reads in the
|
||||
* species molar volumes.
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a
|
||||
* complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
virtual void initThermoXML(XML_Node& phaseNode, const std::string& id="");
|
||||
|
||||
//! Report the molar volume of species k
|
||||
|
|
@ -567,15 +459,13 @@ public:
|
|||
//@}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Species molar volume \f$ m^3 kmol^{-1} \f$
|
||||
*/
|
||||
//! Species molar volume \f$ m^3 kmol^{-1} \f$
|
||||
vector_fp m_speciesMolarVolume;
|
||||
|
||||
/**
|
||||
* The standard concentrations can have three different forms
|
||||
* depending on the value of the member attribute m_formGC, which
|
||||
* is supplied in the XML file.
|
||||
* The standard concentrations can have three different forms depending on
|
||||
* the value of the member attribute m_formGC, which is supplied in the XML
|
||||
* file.
|
||||
*
|
||||
* <TABLE>
|
||||
* <TR><TD> m_formGC </TD><TD> ActivityConc </TD><TD> StandardConc </TD></TR>
|
||||
|
|
@ -591,14 +481,10 @@ public:
|
|||
int IMS_typeCutoff_;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Temporary array used in equilibrium calculations
|
||||
*/
|
||||
//! Temporary array used in equilibrium calculations
|
||||
mutable vector_fp m_pp;
|
||||
|
||||
/**
|
||||
* vector of size m_kk, used as a temporary holding area.
|
||||
*/
|
||||
//! vector of size m_kk, used as a temporary holding area.
|
||||
mutable vector_fp m_tmpV;
|
||||
|
||||
//! Logarithm of the molal activity coefficients
|
||||
|
|
@ -617,21 +503,16 @@ public:
|
|||
//! gamma_k minimum for the cutoff process at the zero solvent point
|
||||
doublereal IMS_gamma_k_min_;
|
||||
|
||||
//! Parameter in the polyExp cutoff treatment
|
||||
/*!
|
||||
* This is the slope of the f function at the zero solvent point
|
||||
* Default value is 0.6
|
||||
*/
|
||||
//! Parameter in the polyExp cutoff treatment. This is the slope of the f
|
||||
//! function at the zero solvent point. Default value is 0.6
|
||||
doublereal IMS_slopefCut_;
|
||||
|
||||
//! Parameter in the polyExp cutoff treatment
|
||||
/*!
|
||||
* This is the slope of the g function at the zero solvent point
|
||||
* Default value is 0.0
|
||||
*/
|
||||
//! Parameter in the polyExp cutoff treatment. This is the slope of the g
|
||||
//! function at the zero solvent point. Default value is 0.0
|
||||
doublereal IMS_slopegCut_;
|
||||
|
||||
//! @name Parameters in the polyExp cutoff treatment having to do with rate of exp decay
|
||||
//! @name Parameters in the polyExp cutoff treatment having to do with rate
|
||||
//! of exp decay
|
||||
//! @{
|
||||
doublereal IMS_cCut_;
|
||||
doublereal IMS_dfCut_;
|
||||
|
|
@ -665,8 +546,8 @@ private:
|
|||
|
||||
//! Calculate parameters for cutoff treatments of activity coefficients
|
||||
/*!
|
||||
* Some cutoff treatments for the activity coefficients
|
||||
* actually require some calculations to create a consistent treatment.
|
||||
* Some cutoff treatments for the activity coefficients actually require
|
||||
* some calculations to create a consistent treatment.
|
||||
*
|
||||
* This routine is called during the setup to calculate these parameters
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -30,21 +30,20 @@ const int cIdealSolidSolnPhase2 = 5012;
|
|||
//@}
|
||||
|
||||
/**
|
||||
* Class IdealSolidSolnPhase represents a condensed phase ideal
|
||||
* solution compound. The phase and the pure species phases which
|
||||
* comprise the standard states of the species are assumed to have
|
||||
* zero volume expansivity and zero isothermal compressibility.
|
||||
* Each species does, however, have constant but distinct partial
|
||||
* molar volumes equal to their pure species molar volumes.
|
||||
* The class derives from class ThermoPhase,
|
||||
* and overloads the virtual methods defined there with ones that
|
||||
* use expressions appropriate for ideal solution mixtures.
|
||||
* Class IdealSolidSolnPhase represents a condensed phase ideal solution
|
||||
* compound. The phase and the pure species phases which comprise the standard
|
||||
* states of the species are assumed to have zero volume expansivity and zero
|
||||
* isothermal compressibility. Each species does, however, have constant but
|
||||
* distinct partial molar volumes equal to their pure species molar volumes. The
|
||||
* class derives from class ThermoPhase, and overloads the virtual methods
|
||||
* defined there with ones that use expressions appropriate for ideal solution
|
||||
* mixtures.
|
||||
*
|
||||
* The generalized concentrations can have three different forms
|
||||
* depending on the value of the member attribute #m_formGC, which
|
||||
* is supplied in the constructor and in the XML file.
|
||||
* The value and form of the generalized concentration will affect
|
||||
* reaction rate constants involving species in this phase.
|
||||
* The generalized concentrations can have three different forms depending on
|
||||
* the value of the member attribute #m_formGC, which is supplied in the
|
||||
* constructor and in the XML file. The value and form of the generalized
|
||||
* concentration will affect reaction rate constants involving species in this
|
||||
* phase.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
|
|
@ -93,17 +92,8 @@ public:
|
|||
*/
|
||||
IdealSolidSolnPhase(XML_Node& root, const std::string& id="", int formCG=0);
|
||||
|
||||
//! Copy Constructor
|
||||
IdealSolidSolnPhase(const IdealSolidSolnPhase&);
|
||||
|
||||
//! Assignment operator
|
||||
IdealSolidSolnPhase& operator=(const IdealSolidSolnPhase&);
|
||||
|
||||
/*!
|
||||
* Base Class Duplication Function
|
||||
*
|
||||
* Given a pointer to ThermoPhase, this function can duplicate the object.
|
||||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
/**
|
||||
|
|
@ -116,10 +106,9 @@ public:
|
|||
//! @{
|
||||
|
||||
/**
|
||||
* Molar enthalpy of the solution. Units: J/kmol.
|
||||
* For an ideal, constant partial molar volume solution mixture with
|
||||
* pure species phases which exhibit zero volume expansivity and
|
||||
* zero isothermal compressibility:
|
||||
* Molar enthalpy of the solution. Units: J/kmol. For an ideal, constant
|
||||
* partial molar volume solution mixture with pure species phases which
|
||||
* exhibit zero volume expansivity and zero isothermal compressibility:
|
||||
* \f[
|
||||
* \hat h(T,P) = \sum_k X_k \hat h^0_k(T) + (P - P_{ref}) (\sum_k X_k \hat V^0_k)
|
||||
* \f]
|
||||
|
|
@ -131,9 +120,9 @@ public:
|
|||
virtual doublereal enthalpy_mole() const;
|
||||
|
||||
/**
|
||||
* Molar entropy of the solution. Units: J/kmol/K.
|
||||
* For an ideal, constant partial molar volume solution mixture with
|
||||
* pure species phases which exhibit zero volume expansivity:
|
||||
* Molar entropy of the solution. Units: J/kmol/K. For an ideal, constant
|
||||
* partial molar volume solution mixture with pure species phases which
|
||||
* exhibit zero volume expansivity:
|
||||
* \f[
|
||||
* \hat s(T, P, X_k) = \sum_k X_k \hat s^0_k(T) - \hat R \sum_k X_k log(X_k)
|
||||
* \f]
|
||||
|
|
@ -146,9 +135,9 @@ public:
|
|||
virtual doublereal entropy_mole() const;
|
||||
|
||||
/**
|
||||
* Molar Gibbs free energy of the solution. Units: J/kmol.
|
||||
* For an ideal, constant partial molar volume solution mixture with
|
||||
* pure species phases which exhibit zero volume expansivity:
|
||||
* Molar Gibbs free energy of the solution. Units: J/kmol. For an ideal,
|
||||
* constant partial molar volume solution mixture with pure species phases
|
||||
* which exhibit zero volume expansivity:
|
||||
* \f[
|
||||
* \hat g(T, P) = \sum_k X_k \hat g^0_k(T,P) + \hat R T \sum_k X_k log(X_k)
|
||||
* \f]
|
||||
|
|
@ -168,19 +157,17 @@ public:
|
|||
* \f[
|
||||
* \hat c_p(T,P) = \sum_k X_k \hat c^0_{p,k}(T) .
|
||||
* \f]
|
||||
* The heat capacity is independent of pressure.
|
||||
* The reference-state pure-species heat capacities
|
||||
* \f$ \hat c^0_{p,k}(T) \f$ are computed by the species thermodynamic
|
||||
* property manager.
|
||||
* The heat capacity is independent of pressure. The reference-state pure-
|
||||
* species heat capacities \f$ \hat c^0_{p,k}(T) \f$ are computed by the
|
||||
* species thermodynamic property manager.
|
||||
* @see SpeciesThermo
|
||||
*/
|
||||
virtual doublereal cp_mole() const;
|
||||
|
||||
/**
|
||||
* Molar heat capacity at constant volume of the solution.
|
||||
* Units: J/kmol/K.
|
||||
* For an ideal, constant partial molar volume solution mixture with
|
||||
* pure species phases which exhibit zero volume expansivity:
|
||||
* Molar heat capacity at constant volume of the solution. Units: J/kmol/K.
|
||||
* For an ideal, constant partial molar volume solution mixture with pure
|
||||
* species phases which exhibit zero volume expansivity:
|
||||
* \f[ \hat c_v(T,P) = \hat c_p(T,P) \f]
|
||||
* The two heat capacities are equal.
|
||||
*/
|
||||
|
|
@ -191,36 +178,34 @@ public:
|
|||
//@}
|
||||
/** @name Mechanical Equation of State Properties
|
||||
*
|
||||
* In this equation of state implementation, the density is a
|
||||
* function only of the mole fractions. Therefore, it can't be
|
||||
* an independent variable. Instead, the pressure is used as the
|
||||
* independent variable. Functions which try to set the thermodynamic
|
||||
* state by calling setDensity() may cause an exception to be
|
||||
* thrown.
|
||||
* In this equation of state implementation, the density is a function only
|
||||
* of the mole fractions. Therefore, it can't be an independent variable.
|
||||
* Instead, the pressure is used as the independent variable. Functions
|
||||
* which try to set the thermodynamic state by calling setDensity() may
|
||||
* cause an exception to be thrown.
|
||||
*/
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Pressure. Units: Pa.
|
||||
* For this incompressible system, we return the internally stored
|
||||
* independent value of the pressure.
|
||||
* Pressure. Units: Pa. For this incompressible system, we return the
|
||||
* internally stored independent value of the pressure.
|
||||
*/
|
||||
virtual doublereal pressure() const {
|
||||
return m_Pcurrent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the pressure at constant temperature. Units: Pa.
|
||||
* This method sets a constant within the object.
|
||||
* The mass density is not a function of pressure.
|
||||
* Set the pressure at constant temperature. Units: Pa. This method sets a
|
||||
* constant within the object. The mass density is not a function of
|
||||
* pressure.
|
||||
*
|
||||
* @param p Input Pressure (Pa)
|
||||
*/
|
||||
virtual void setPressure(doublereal p);
|
||||
|
||||
/**
|
||||
* Calculate the density of the mixture using the partial
|
||||
* molar volumes and mole fractions as input
|
||||
* Calculate the density of the mixture using the partial molar volumes and
|
||||
* mole fractions as input
|
||||
*
|
||||
* The formula for this is
|
||||
*
|
||||
|
|
@ -228,36 +213,33 @@ public:
|
|||
* \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}}
|
||||
* \f]
|
||||
*
|
||||
* where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are
|
||||
* the molecular weights, and \f$V_k\f$ are the pure species
|
||||
* molar volumes.
|
||||
* where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular
|
||||
* weights, and \f$V_k\f$ are the pure species molar volumes.
|
||||
*
|
||||
* Note, the basis behind this formula is that in an ideal
|
||||
* solution the partial molar volumes are equal to the pure
|
||||
* species molar volumes. We have additionally specified
|
||||
* in this class that the pure species molar volumes are
|
||||
* independent of temperature and pressure.
|
||||
* Note, the basis behind this formula is that in an ideal solution the
|
||||
* partial molar volumes are equal to the pure species molar volumes. We
|
||||
* have additionally specified in this class that the pure species molar
|
||||
* volumes are independent of temperature and pressure.
|
||||
*/
|
||||
void calcDensity();
|
||||
|
||||
/**
|
||||
* Overwritten setDensity() function is necessary because the
|
||||
* density is not an independent variable.
|
||||
* Overwritten setDensity() function is necessary because the density is not
|
||||
* an independent variable.
|
||||
*
|
||||
* This function will now throw an error condition
|
||||
*
|
||||
* @internal May have to adjust the strategy here to make
|
||||
* the eos for these materials slightly compressible, in order
|
||||
* to create a condition where the density is a function of
|
||||
* the pressure.
|
||||
* @internal May have to adjust the strategy here to make the eos for these
|
||||
* materials slightly compressible, in order to create a condition where
|
||||
* the density is a function of the pressure.
|
||||
*
|
||||
* @param rho Input density
|
||||
*/
|
||||
virtual void setDensity(const doublereal rho);
|
||||
|
||||
/**
|
||||
* Overwritten setMolarDensity() function is necessary because the
|
||||
* density is not an independent variable.
|
||||
* Overwritten setMolarDensity() function is necessary because the density
|
||||
* is not an independent variable.
|
||||
*
|
||||
* This function will now throw an error condition.
|
||||
*
|
||||
|
|
@ -265,39 +247,10 @@ public:
|
|||
*/
|
||||
virtual void setMolarDensity(const doublereal rho);
|
||||
|
||||
//! Set the mole fractions
|
||||
/*!
|
||||
* @param x Input vector of mole fractions.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void setMoleFractions(const doublereal* const x);
|
||||
|
||||
//! Set the mole fractions, but don't normalize them to one.
|
||||
/*!
|
||||
* @param x Input vector of mole fractions.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void setMoleFractions_NoNorm(const doublereal* const x);
|
||||
|
||||
//! Set the mass fractions, and normalize them to one.
|
||||
/*!
|
||||
* @param y Input vector of mass fractions.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void setMassFractions(const doublereal* const y);
|
||||
|
||||
//! Set the mass fractions, but don't normalize them to one
|
||||
/*!
|
||||
* @param y Input vector of mass fractions.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void setMassFractions_NoNorm(const doublereal* const y);
|
||||
|
||||
//! Set the concentration,
|
||||
/*!
|
||||
* @param c Input vector of concentrations.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void setConcentrations(const doublereal* const c);
|
||||
|
||||
//@}
|
||||
|
|
@ -305,71 +258,65 @@ public:
|
|||
/**
|
||||
* @name Chemical Potentials and Activities
|
||||
*
|
||||
* The activity \f$a_k\f$ of a species in solution is
|
||||
* related to the chemical potential by
|
||||
* The activity \f$a_k\f$ of a species in solution is related to the
|
||||
* chemical potential by
|
||||
* \f[
|
||||
* \mu_k(T,P,X_k) = \mu_k^0(T,P)
|
||||
* + \hat R T \log a_k.
|
||||
* \f]
|
||||
* The quantity \f$\mu_k^0(T,P)\f$ is
|
||||
* the standard state chemical potential at unit activity.
|
||||
* It may depend on the pressure and the temperature. However,
|
||||
* it may not depend on the mole fractions of the species
|
||||
* in the solid solution.
|
||||
* The quantity \f$\mu_k^0(T,P)\f$ is the standard state chemical potential
|
||||
* at unit activity. It may depend on the pressure and the temperature.
|
||||
* However, it may not depend on the mole fractions of the species in the
|
||||
* solid solution.
|
||||
*
|
||||
* The activities are related to the generalized
|
||||
* concentrations, \f$\tilde C_k\f$, and standard
|
||||
* concentrations, \f$C^0_k\f$, by the following formula:
|
||||
* The activities are related to the generalized concentrations, \f$\tilde
|
||||
* C_k\f$, and standard concentrations, \f$C^0_k\f$, by the following
|
||||
* formula:
|
||||
*
|
||||
* \f[
|
||||
* a_k = \frac{\tilde C_k}{C^0_k}
|
||||
* \f]
|
||||
* The generalized concentrations are used in the kinetics classes
|
||||
* to describe the rates of progress of reactions involving the
|
||||
* species. Their formulation depends upon the specification
|
||||
* of the rate constants for reaction, especially the units used
|
||||
* in specifying the rate constants. The bridge between the
|
||||
* thermodynamic equilibrium expressions that use a_k and the
|
||||
* kinetics expressions which use the generalized concentrations
|
||||
* is provided by the multiplicative factor of the
|
||||
* standard concentrations.
|
||||
* The generalized concentrations are used in the kinetics classes to
|
||||
* describe the rates of progress of reactions involving the species. Their
|
||||
* formulation depends upon the specification of the rate constants for
|
||||
* reaction, especially the units used in specifying the rate constants. The
|
||||
* bridge between the thermodynamic equilibrium expressions that use a_k and
|
||||
* the kinetics expressions which use the generalized concentrations is
|
||||
* provided by the multiplicative factor of the standard concentrations.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* This method returns the array of generalized
|
||||
* concentrations. The generalized concentrations are used
|
||||
* in the evaluation of the rates of progress for reactions
|
||||
* involving species in this phase. The generalized
|
||||
* concentration divided by the standard concentration is also
|
||||
* equal to the activity of species.
|
||||
* This method returns the array of generalized concentrations. The
|
||||
* generalized concentrations are used in the evaluation of the rates of
|
||||
* progress for reactions involving species in this phase. The generalized
|
||||
* concentration divided by the standard concentration is also equal to the
|
||||
* activity of species.
|
||||
*
|
||||
* For this implementation the activity is defined to be the
|
||||
* mole fraction of the species. The generalized concentration
|
||||
* is defined to be equal to the mole fraction divided by
|
||||
* the partial molar volume. The generalized concentrations
|
||||
* for species in this phase therefore have units of
|
||||
* kmol m<SUP>-3</SUP>. Rate constants must reflect this fact.
|
||||
* For this implementation the activity is defined to be the mole fraction
|
||||
* of the species. The generalized concentration is defined to be equal to
|
||||
* the mole fraction divided by the partial molar volume. The generalized
|
||||
* concentrations for species in this phase therefore have units of kmol
|
||||
* m<SUP>-3</SUP>. Rate constants must reflect this fact.
|
||||
*
|
||||
* On a general note, the following must be true.
|
||||
* For an ideal solution, the generalized concentration must consist
|
||||
* of the mole fraction multiplied by a constant. The constant may be
|
||||
* fairly arbitrarily chosen, with differences adsorbed into the
|
||||
* reaction rate expression. 1/V_N, 1/V_k, or 1 are equally good,
|
||||
* as long as the standard concentration is adjusted accordingly.
|
||||
* However, it must be a constant (and not the concentration, btw,
|
||||
* which is a function of the mole fractions) in order for the
|
||||
* ideal solution properties to hold at the same time having the
|
||||
* standard concentration to be independent of the mole fractions.
|
||||
* On a general note, the following must be true. For an ideal solution, the
|
||||
* generalized concentration must consist of the mole fraction multiplied by
|
||||
* a constant. The constant may be fairly arbitrarily chosen, with
|
||||
* differences adsorbed into the reaction rate expression. 1/V_N, 1/V_k, or
|
||||
* 1 are equally good, as long as the standard concentration is adjusted
|
||||
* accordingly. However, it must be a constant (and not the concentration,
|
||||
* btw, which is a function of the mole fractions) in order for the ideal
|
||||
* solution properties to hold at the same time having the standard
|
||||
* concentration to be independent of the mole fractions.
|
||||
*
|
||||
* In this implementation the form of the generalized concentrations
|
||||
* depend upon the member attribute, #m_formGC.
|
||||
*
|
||||
* HKM Note: We have absorbed the pressure dependence of the pure species
|
||||
* state into the thermodynamics functions. Therefore the
|
||||
* standard state on which the activities are based depend
|
||||
* on both temperature and pressure. If we hadn't, it would have
|
||||
* appeared in this function in a very awkward exp[] format.
|
||||
* state into the thermodynamics functions. Therefore the standard
|
||||
* state on which the activities are based depend on both temperature
|
||||
* and pressure. If we hadn't, it would have appeared in this
|
||||
* function in a very awkward exp[] format.
|
||||
*
|
||||
* @param c Pointer to array of doubles of length m_kk, which on exit
|
||||
* will contain the generalized concentrations.
|
||||
|
|
@ -384,20 +331,18 @@ public:
|
|||
* species molar volume. Units for the standard concentration are kmol
|
||||
* m<SUP>-3</SUP>.
|
||||
*
|
||||
* @param k Species number: this is a require parameter,
|
||||
* a change from the ThermoPhase base class, where it was
|
||||
* an optional parameter.
|
||||
* @param k Species number: this is a require parameter, a change from the
|
||||
* ThermoPhase base class, where it was an optional parameter.
|
||||
*/
|
||||
virtual doublereal standardConcentration(size_t k) const;
|
||||
|
||||
/**
|
||||
* The reference (ie standard) concentration \f$ C^0_k \f$ used to normalize
|
||||
* the generalized concentration. In many cases, this quantity
|
||||
* will be the same for all species in a phase.
|
||||
* However, for this case, we will return a distinct concentration
|
||||
* for each species. (clone of the standard concentration ->
|
||||
* suggest changing the name). This is the inverse of the species molar
|
||||
* volume.
|
||||
* the generalized concentration. In many cases, this quantity will be the
|
||||
* same for all species in a phase. However, for this case, we will return a
|
||||
* distinct concentration for each species. (clone of the standard
|
||||
* concentration -> suggest changing the name). This is the inverse of the
|
||||
* species molar volume.
|
||||
*
|
||||
* @param k Species index.
|
||||
*/
|
||||
|
|
@ -447,7 +392,8 @@ public:
|
|||
* \f$ \mu^{ref}_k(T)\f$ is the chemical potential of pure
|
||||
* species <I>k</I> at the reference pressure, \f$P_{ref}\f$.
|
||||
*
|
||||
* @param mu Output vector of dimensionless chemical potentials. Length = m_kk.
|
||||
* @param mu Output vector of dimensionless chemical potentials.
|
||||
* Length = m_kk.
|
||||
*/
|
||||
virtual void getChemPotentials_RT(doublereal* mu) const;
|
||||
|
||||
|
|
@ -455,18 +401,18 @@ public:
|
|||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
||||
//! Returns an array of partial molar enthalpies for the species in the mixture.
|
||||
//! Returns an array of partial molar enthalpies for the species in the
|
||||
//! mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* pure species enthalpies
|
||||
* Units (J/kmol). For this phase, the partial molar enthalpies are equal to
|
||||
* the pure species enthalpies
|
||||
* \f[
|
||||
* \bar h_k(T,P) = \hat h^{ref}_k(T) + (P - P_{ref}) \hat V^0_k
|
||||
* \f]
|
||||
* The reference-state pure-species enthalpies, \f$ \hat h^{ref}_k(T) \f$,
|
||||
* at the reference pressure,\f$ P_{ref} \f$,
|
||||
* are computed by the species thermodynamic
|
||||
* property manager. They are polynomial functions of temperature.
|
||||
* at the reference pressure,\f$ P_{ref} \f$, are computed by the species
|
||||
* thermodynamic property manager. They are polynomial functions of
|
||||
* temperature.
|
||||
* @see SpeciesThermo
|
||||
*
|
||||
* @param hbar Output vector containing partial molar enthalpies.
|
||||
|
|
@ -476,16 +422,16 @@ public:
|
|||
|
||||
/**
|
||||
* Returns an array of partial molar entropies of the species in the
|
||||
* solution. Units: J/kmol/K.
|
||||
* For this phase, the partial molar entropies are equal to the
|
||||
* pure species entropies plus the ideal solution contribution.
|
||||
* solution. Units: J/kmol/K. For this phase, the partial molar entropies
|
||||
* are equal to the pure species entropies plus the ideal solution
|
||||
* contribution.
|
||||
* \f[
|
||||
* \bar s_k(T,P) = \hat s^0_k(T) - R log(X_k)
|
||||
* \f]
|
||||
* The reference-state pure-species entropies,\f$ \hat s^{ref}_k(T) \f$,
|
||||
* at the reference pressure, \f$ P_{ref} \f$, are computed by the
|
||||
* species thermodynamic
|
||||
* property manager. They are polynomial functions of temperature.
|
||||
* The reference-state pure-species entropies,\f$ \hat s^{ref}_k(T) \f$, at
|
||||
* the reference pressure, \f$ P_{ref} \f$, are computed by the species
|
||||
* thermodynamic property manager. They are polynomial functions of
|
||||
* temperature.
|
||||
* @see SpeciesThermo
|
||||
*
|
||||
* @param sbar Output vector containing partial molar entropies.
|
||||
|
|
@ -494,11 +440,9 @@ public:
|
|||
virtual void getPartialMolarEntropies(doublereal* sbar) const;
|
||||
|
||||
/**
|
||||
* Returns an array of partial molar Heat Capacities at constant
|
||||
* pressure of the species in the
|
||||
* solution. Units: J/kmol/K.
|
||||
* For this phase, the partial molar heat capacities are equal
|
||||
* to the standard state heat capacities.
|
||||
* Returns an array of partial molar Heat Capacities at constant pressure of
|
||||
* the species in the solution. Units: J/kmol/K. For this phase, the partial
|
||||
* molar heat capacities are equal to the standard state heat capacities.
|
||||
*
|
||||
* @param cpbar Output vector of partial heat capacities. Length: m_kk.
|
||||
*/
|
||||
|
|
@ -520,14 +464,12 @@ public:
|
|||
//@{
|
||||
|
||||
/**
|
||||
* Get the standard state chemical potentials of the species.
|
||||
* This is the array of chemical potentials at unit activity
|
||||
* \f$ \mu^0_k(T,P) \f$.
|
||||
* We define these here as the chemical potentials of the pure
|
||||
* species at the temperature and pressure of the solution.
|
||||
* This function is used in the evaluation of the
|
||||
* equilibrium constant Kc. Therefore, Kc will also depend
|
||||
* on T and P. This is the norm for liquid and solid systems.
|
||||
* Get the standard state chemical potentials of the species. This is the
|
||||
* array of chemical potentials at unit activity \f$ \mu^0_k(T,P) \f$. We
|
||||
* define these here as the chemical potentials of the pure species at the
|
||||
* temperature and pressure of the solution. This function is used in the
|
||||
* evaluation of the equilibrium constant Kc. Therefore, Kc will also depend
|
||||
* on T and P. This is the norm for liquid and solid systems.
|
||||
*
|
||||
* units = J / kmol
|
||||
*
|
||||
|
|
@ -538,78 +480,64 @@ public:
|
|||
getPureGibbs(mu0);
|
||||
}
|
||||
|
||||
//! Get the array of nondimensional Enthalpy functions for the standard state species
|
||||
//! at the current <I>T</I> and <I>P</I> of the solution.
|
||||
//! Get the array of nondimensional Enthalpy functions for the standard
|
||||
//! state species at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* We assume an incompressible constant partial molar
|
||||
* volume here:
|
||||
* We assume an incompressible constant partial molar volume here:
|
||||
* \f[
|
||||
* h^0_k(T,P) = h^{ref}_k(T) + (P - P_{ref}) * V_k
|
||||
* \f]
|
||||
* where \f$V_k\f$ is the molar volume of pure species <I>k</I>.
|
||||
* \f$ h^{ref}_k(T)\f$ is the enthalpy of the pure
|
||||
* species <I>k</I> at the reference pressure, \f$P_{ref}\f$.
|
||||
* \f$ h^{ref}_k(T)\f$ is the enthalpy of the pure species <I>k</I> at the
|
||||
* reference pressure, \f$P_{ref}\f$.
|
||||
*
|
||||
* @param hrt Vector of length m_kk, which on return hrt[k]
|
||||
* will contain the nondimensional
|
||||
* standard state enthalpy of species k.
|
||||
* @param hrt Vector of length m_kk, which on return hrt[k] will contain the
|
||||
* nondimensional standard state enthalpy of species k.
|
||||
*/
|
||||
void getEnthalpy_RT(doublereal* hrt) const;
|
||||
|
||||
//! Get the nondimensional Entropies for the species
|
||||
//! standard states at the current T and P of the solution.
|
||||
//! Get the nondimensional Entropies for the species standard states at the
|
||||
//! current T and P of the solution.
|
||||
/*!
|
||||
* Note, this is equal to the reference state entropies
|
||||
* due to the zero volume expansivity:
|
||||
* i.e., (dS/dP)_T = (dV/dT)_P = 0.0
|
||||
* Note, this is equal to the reference state entropies due to the zero
|
||||
* volume expansivity: i.e., (dS/dP)_T = (dV/dT)_P = 0.0
|
||||
*
|
||||
* @param sr Vector of length m_kk, which on return sr[k]
|
||||
* will contain the nondimensional
|
||||
* standard state entropy for species k.
|
||||
* @param sr Vector of length m_kk, which on return sr[k] will contain the
|
||||
* nondimensional standard state entropy for species k.
|
||||
*/
|
||||
void getEntropy_R(doublereal* sr) const;
|
||||
|
||||
/**
|
||||
* Get the nondimensional Gibbs function for the species
|
||||
* standard states at the current T and P of the solution.
|
||||
* Get the nondimensional Gibbs function for the species standard states at
|
||||
* the current T and P of the solution.
|
||||
*
|
||||
* \f[
|
||||
* \mu^0_k(T,P) = \mu^{ref}_k(T) + (P - P_{ref}) * V_k
|
||||
* \f]
|
||||
* where \f$V_k\f$ is the molar volume of pure species <I>k</I>.
|
||||
* \f$ \mu^{ref}_k(T)\f$ is the chemical potential of pure
|
||||
* species <I>k</I> at the reference pressure, \f$P_{ref}\f$.
|
||||
*
|
||||
* @param grt Vector of length m_kk, which on return sr[k]
|
||||
* will contain the nondimensional
|
||||
* standard state Gibbs function for species k.
|
||||
*/
|
||||
virtual void getGibbs_RT(doublereal* grt) const;
|
||||
|
||||
/**
|
||||
* Get the Gibbs functions for the pure species
|
||||
* at the current <I>T</I> and <I>P</I> of the solution.
|
||||
* We assume an incompressible constant partial molar
|
||||
* volume here:
|
||||
* \f[
|
||||
* \mu^0_k(T,P) = \mu^{ref}_k(T) + (P - P_{ref}) * V_k
|
||||
* \f]
|
||||
* where \f$V_k\f$ is the molar volume of pure species <I>k</I>.
|
||||
* \f$ \mu^{ref}_k(T)\f$ is the chemical potential of pure
|
||||
* species <I>k</I> at the reference pressure, \f$P_{ref}\f$.
|
||||
* \f$ \mu^{ref}_k(T)\f$ is the chemical potential of pure species <I>k</I>
|
||||
* at the reference pressure, \f$P_{ref}\f$.
|
||||
*
|
||||
* @param gpure Output vector of Gibbs functions for species
|
||||
* Length: m_kk.
|
||||
* @param grt Vector of length m_kk, which on return sr[k] will contain the
|
||||
* nondimensional standard state Gibbs function for species k.
|
||||
*/
|
||||
virtual void getGibbs_RT(doublereal* grt) const;
|
||||
|
||||
/**
|
||||
* Get the Gibbs functions for the pure species at the current <I>T</I> and
|
||||
* <I>P</I> of the solution. We assume an incompressible constant partial
|
||||
* molar volume here:
|
||||
* \f[
|
||||
* \mu^0_k(T,P) = \mu^{ref}_k(T) + (P - P_{ref}) * V_k
|
||||
* \f]
|
||||
* where \f$V_k\f$ is the molar volume of pure species <I>k</I>.
|
||||
* \f$ \mu^{ref}_k(T)\f$ is the chemical potential of pure species <I>k</I>
|
||||
* at the reference pressure, \f$P_{ref}\f$.
|
||||
*
|
||||
* @param gpure Output vector of Gibbs functions for species. Length: m_kk.
|
||||
*/
|
||||
virtual void getPureGibbs(doublereal* gpure) const;
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! internal Energies of the standard state at the current
|
||||
//! temperature and pressure of the solution for each species.
|
||||
/*!
|
||||
* @param urt Output vector of standard state nondimensional internal energies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getIntEnergy_RT(doublereal* urt) const;
|
||||
|
||||
/**
|
||||
|
|
@ -619,106 +547,40 @@ public:
|
|||
* Cp^0_k(T,P) = Cp^{ref}_k(T)
|
||||
* \f]
|
||||
* where \f$V_k\f$ is the molar volume of pure species <I>k</I>.
|
||||
* \f$ Cp^{ref}_k(T)\f$ is the constant pressure heat capacity
|
||||
* of species <I>k</I> at the reference pressure, \f$p_{ref}\f$.
|
||||
* \f$ Cp^{ref}_k(T)\f$ is the constant pressure heat capacity of species
|
||||
* <I>k</I> at the reference pressure, \f$p_{ref}\f$.
|
||||
*
|
||||
* @param cpr Vector of length m_kk, which on return cpr[k]
|
||||
* will contain the nondimensional
|
||||
* constant pressure heat capacity for species k.
|
||||
* @param cpr Vector of length m_kk, which on return cpr[k] will contain the
|
||||
* nondimensional constant pressure heat capacity for species k.
|
||||
*/
|
||||
void getCp_R(doublereal* cpr) const;
|
||||
|
||||
/**
|
||||
* Get the molar volumes of each species in their standard
|
||||
* states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
* units = m^3 / kmol
|
||||
*
|
||||
* @param vol Output vector of standard state volumes.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getStandardVolumes(doublereal* vol) const;
|
||||
|
||||
//@}
|
||||
/// @name Thermodynamic Values for the Species Reference States
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Returns the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*
|
||||
* @param hrt Output vector containing reference nondimensional enthalpies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
|
||||
|
||||
/**
|
||||
* Returns the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*
|
||||
* @param grt Output vector containing reference nondimensional Gibbs free energies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT_ref(doublereal* grt) const;
|
||||
|
||||
/**
|
||||
* Returns the vector of the
|
||||
* Gibbs function of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
* units = J/kmol
|
||||
*
|
||||
* @param g Output vector containing reference Gibbs free energies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_ref(doublereal* g) const;
|
||||
|
||||
/**
|
||||
* Returns the vector of nondimensional
|
||||
* entropies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*
|
||||
* @param er Output vector containing reference nondimensional entropies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEntropy_R_ref(doublereal* er) const;
|
||||
|
||||
/**
|
||||
* Returns the vector of nondimensional
|
||||
* internal Energies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for each species.
|
||||
*
|
||||
* @param urt Output vector containing reference nondimensional internal energies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getIntEnergy_RT_ref(doublereal* urt) const;
|
||||
|
||||
/**
|
||||
* Returns the vector of nondimensional
|
||||
* constant pressure heat capacities of the reference state
|
||||
* at the current temperature of the solution
|
||||
* and reference pressure for the species.
|
||||
*
|
||||
* @param cprt Output vector containing reference nondimensional heat capacities.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getCp_R_ref(doublereal* cprt) const;
|
||||
|
||||
/**
|
||||
* Returns a reference to the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature.
|
||||
* Real reason for its existence is that it also checks
|
||||
* to see if a recalculation of the reference thermodynamics
|
||||
* functions needs to be done.
|
||||
* Returns a reference to the vector of nondimensional enthalpies of the
|
||||
* reference state at the current temperature. Real reason for its existence
|
||||
* is that it also checks to see if a recalculation of the reference
|
||||
* thermodynamics functions needs to be done.
|
||||
*/
|
||||
const vector_fp& enthalpy_RT_ref() const;
|
||||
|
||||
/**
|
||||
* Returns a reference to the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature.
|
||||
* Real reason for its existence is that it also checks
|
||||
* to see if a recalculation of the reference thermodynamics
|
||||
* functions needs to be done.
|
||||
* Returns a reference to the vector of nondimensional enthalpies of the
|
||||
* reference state at the current temperature. Real reason for its existence
|
||||
* is that it also checks to see if a recalculation of the reference
|
||||
* thermodynamics functions needs to be done.
|
||||
*/
|
||||
const vector_fp& gibbs_RT_ref() const {
|
||||
_updateThermo();
|
||||
|
|
@ -726,20 +588,18 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a reference to the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature.
|
||||
* Real reason for its existence is that it also checks
|
||||
* to see if a recalculation of the reference thermodynamics
|
||||
* functions needs to be done.
|
||||
* Returns a reference to the vector of nondimensional enthalpies of the
|
||||
* reference state at the current temperature. Real reason for its existence
|
||||
* is that it also checks to see if a recalculation of the reference
|
||||
* thermodynamics functions needs to be done.
|
||||
*/
|
||||
const vector_fp& entropy_R_ref() const;
|
||||
|
||||
/**
|
||||
* Returns a reference to the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature.
|
||||
* Real reason for its existence is that it also checks
|
||||
* to see if a recalculation of the reference thermodynamics
|
||||
* functions needs to be done.
|
||||
* Returns a reference to the vector of nondimensional enthalpies of the
|
||||
* reference state at the current temperature. Real reason for its existence
|
||||
* is that it also checks to see if a recalculation of the reference
|
||||
* thermodynamics functions needs to be done.
|
||||
*/
|
||||
const vector_fp& cp_R_ref() const {
|
||||
_updateThermo();
|
||||
|
|
@ -759,33 +619,8 @@ public:
|
|||
/// @name Utility Functions
|
||||
//@{
|
||||
|
||||
/**
|
||||
* @internal Import and initialize a ThermoPhase object using an XML
|
||||
* tree. Here we read extra information about the XML description of a
|
||||
* phase. Regular information about elements and species and their
|
||||
* reference state thermodynamic information have already been read at
|
||||
* this point. For example, we do not need to call this function for
|
||||
* ideal gas equations of state. This function is called from
|
||||
* importPhase() after the elements and the species are initialized
|
||||
* with default ideal solution level data.
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a complete XML
|
||||
* tree description of the phase, including all of the
|
||||
* species data. In other words while "phase" must point to
|
||||
* an XML phase object, it must have sibling nodes
|
||||
* "speciesData" that describe the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done to see if
|
||||
* phaseNode is pointing to the phase with the correct id.
|
||||
*/
|
||||
virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
/**
|
||||
* Set mixture to an equilibrium state consistent with specified
|
||||
* element potentials and the temperature.
|
||||
*
|
||||
* @param lambda_RT vector of non-dimensional element potentials
|
||||
* \f$ \lambda_m/RT \f$.
|
||||
*/
|
||||
virtual void setToEquilState(const doublereal* lambda_RT);
|
||||
|
||||
/**
|
||||
|
|
@ -826,10 +661,10 @@ protected:
|
|||
int m_formGC;
|
||||
|
||||
/**
|
||||
* Value of the reference pressure for all species in this phase.
|
||||
* The T dependent polynomials are evaluated at the reference
|
||||
* pressure. Note, because this is a single value, all species
|
||||
* are required to have the same reference pressure.
|
||||
* Value of the reference pressure for all species in this phase. The T
|
||||
* dependent polynomials are evaluated at the reference pressure. Note,
|
||||
* because this is a single value, all species are required to have the same
|
||||
* reference pressure.
|
||||
*/
|
||||
doublereal m_Pref;
|
||||
|
||||
|
|
@ -851,22 +686,18 @@ protected:
|
|||
//! Vector containing the species reference enthalpies at T = m_tlast
|
||||
mutable vector_fp m_h0_RT;
|
||||
|
||||
/**
|
||||
* Vector containing the species reference constant pressure
|
||||
* heat capacities at T = m_tlast
|
||||
*/
|
||||
//! Vector containing the species reference constant pressure heat
|
||||
//! capacities at T = m_tlast
|
||||
mutable vector_fp m_cp0_R;
|
||||
|
||||
//! Vector containing the species reference Gibbs functions at T = m_tlast
|
||||
//! Vector containing the species reference Gibbs functions at T = m_tlast
|
||||
mutable vector_fp m_g0_RT;
|
||||
|
||||
//! Vector containing the species reference entropies at T = m_tlast
|
||||
mutable vector_fp m_s0_R;
|
||||
|
||||
/**
|
||||
* Vector containing the species reference exp(-G/RT) functions
|
||||
* at T = m_tlast
|
||||
*/
|
||||
//! Vector containing the species reference exp(-G/RT) functions at
|
||||
//! T = m_tlast
|
||||
mutable vector_fp m_expg0_RT;
|
||||
|
||||
//! Vector of potential energies for the species.
|
||||
|
|
@ -879,12 +710,11 @@ private:
|
|||
/// @name Utility Functions
|
||||
//@{
|
||||
/**
|
||||
* This function gets called for every call to functions in this
|
||||
* class. It checks to see whether the temperature has changed and
|
||||
* thus the reference thermodynamics functions for all of the species
|
||||
* must be recalculated.
|
||||
* If the temperature has changed, the species thermo manager is called
|
||||
* to recalculate G, Cp, H, and S at the current temperature.
|
||||
* This function gets called for every call to functions in this class. It
|
||||
* checks to see whether the temperature has changed and thus the reference
|
||||
* thermodynamics functions for all of the species must be recalculated. If
|
||||
* the temperature has changed, the species thermo manager is called to
|
||||
* recalculate G, Cp, H, and S at the current temperature.
|
||||
*/
|
||||
void _updateThermo() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,119 +42,69 @@ public:
|
|||
*/
|
||||
//! @{
|
||||
|
||||
/// Constructor.
|
||||
IdealSolnGasVPSS();
|
||||
|
||||
/// Create an object from an XML input file
|
||||
IdealSolnGasVPSS(const std::string& infile, std::string id="");
|
||||
|
||||
/// Copy Constructor.
|
||||
IdealSolnGasVPSS(const IdealSolnGasVPSS&);
|
||||
|
||||
/// Assignment operator
|
||||
IdealSolnGasVPSS& operator=(const IdealSolnGasVPSS&);
|
||||
|
||||
//! Duplication routine
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//@}
|
||||
//! @name Utilities (IdealSolnGasVPSS)
|
||||
//@{
|
||||
/**
|
||||
* Equation of state type flag. The base class returns
|
||||
* zero. Subclasses should define this to return a unique
|
||||
* non-zero value. Constants defined for this purpose are
|
||||
* listed in mix_defs.h.
|
||||
*/
|
||||
|
||||
virtual int eosType() const;
|
||||
|
||||
//! @}
|
||||
//! @name Molar Thermodynamic Properties
|
||||
//! @{
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
doublereal enthalpy_mole() const;
|
||||
|
||||
/// Molar entropy. Units: J/kmol/K.
|
||||
doublereal entropy_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
doublereal cp_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
doublereal cv_mole() const;
|
||||
|
||||
//! @}
|
||||
//! @name Mechanical Properties
|
||||
//! @{
|
||||
|
||||
//! Set the pressure in the fluid
|
||||
/*!
|
||||
* @param p pressure in pascals.
|
||||
*/
|
||||
void setPressure(doublereal p);
|
||||
|
||||
//! Returns the isothermal compressibility. Units: 1/Pa.
|
||||
/*!
|
||||
* The isothermal compressibility is defined as
|
||||
* \f[
|
||||
* \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal isothermalCompressibility() const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Calculate the density of the mixture using the partial
|
||||
* molar volumes and mole fractions as input
|
||||
*
|
||||
* The formula for this is
|
||||
* Calculate the density of the mixture using the partial molar volumes and
|
||||
* mole fractions as input. The formula for this is
|
||||
*
|
||||
* \f[
|
||||
* \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}}
|
||||
* \f]
|
||||
*
|
||||
* where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are
|
||||
* the molecular weights, and \f$V_k\f$ are the pure species
|
||||
* molar volumes.
|
||||
* where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular
|
||||
* weights, and \f$V_k\f$ are the pure species molar volumes.
|
||||
*
|
||||
* Note, the basis behind this formula is that in an ideal
|
||||
* solution the partial molar volumes are equal to the
|
||||
* species standard state molar volumes.
|
||||
* The species molar volumes may be functions
|
||||
* of temperature and pressure.
|
||||
* Note, the basis behind this formula is that in an ideal solution the
|
||||
* partial molar volumes are equal to the species standard state molar
|
||||
* volumes. The species molar volumes may be functions of temperature and
|
||||
* pressure.
|
||||
*/
|
||||
virtual void calcDensity();
|
||||
//! @}
|
||||
|
||||
public:
|
||||
//! This method returns an array of generalized concentrations
|
||||
/*!
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
|
||||
* C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration
|
||||
* defined below and \f$ a_k \f$ are activities used in the
|
||||
* thermodynamic functions. These activity (or generalized)
|
||||
* concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions. Note that they may
|
||||
* or may not have units of concentration --- they might be
|
||||
* partial pressures, mole fractions, or surface coverages,
|
||||
* for example.
|
||||
*
|
||||
* @param c Output array of generalized concentrations. The
|
||||
* units depend upon the implementation of the
|
||||
* reaction rate expressions within the phase.
|
||||
*/
|
||||
virtual void getActivityConcentrations(doublereal* c) const;
|
||||
|
||||
//! Returns the standard concentration \f$ C^0_k \f$, which is used to normalize
|
||||
//! the generalized concentration.
|
||||
//! Returns the standard concentration \f$ C^0_k \f$, which is used to
|
||||
//! normalize the generalized concentration.
|
||||
/*!
|
||||
* This is defined as the concentration by which the generalized
|
||||
* concentration is normalized to produce the activity.
|
||||
* In many cases, this quantity will be the same for all species in a phase.
|
||||
* Since the activity for an ideal gas mixture is
|
||||
* simply the mole fraction, for an ideal gas \f$ C^0_k = P/\hat R T \f$.
|
||||
* concentration is normalized to produce the activity. In many cases, this
|
||||
* quantity will be the same for all species in a phase. Since the activity
|
||||
* for an ideal gas mixture is simply the mole fraction, for an ideal gas
|
||||
* \f$ C^0_k = P/\hat R T \f$.
|
||||
*
|
||||
* @param k Optional parameter indicating the species. The default
|
||||
* is to assume this refers to species 0.
|
||||
|
|
@ -163,8 +113,8 @@ public:
|
|||
*/
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
//! Get the array of non-dimensional activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
//! Get the array of non-dimensional activity coefficients at the current
|
||||
//! solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* For ideal gases, the activity coefficients are all equal to one.
|
||||
*
|
||||
|
|
@ -176,144 +126,29 @@ public:
|
|||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
||||
//! Get the array of non-dimensional species chemical potentials
|
||||
//! These are partial molar Gibbs free energies.
|
||||
/*!
|
||||
* \f$ \mu_k / \hat R T \f$.
|
||||
* Units: unitless
|
||||
*
|
||||
* We close the loop on this function, here, calling
|
||||
* getChemPotentials() and then dividing by RT. No need for child
|
||||
* classes to handle.
|
||||
*
|
||||
* @param mu Output vector of non-dimensional species chemical potentials
|
||||
* Length: m_kk.
|
||||
*/
|
||||
void getChemPotentials_RT(doublereal* mu) const;
|
||||
|
||||
//! Get the species chemical potentials. Units: J/kmol.
|
||||
/*!
|
||||
* This function returns a vector of chemical potentials of the
|
||||
* species in solution at the current temperature, pressure
|
||||
* and mole fraction of the solution.
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Get the species partial molar enthalpies. Units: J/kmol.
|
||||
/*!
|
||||
* @param hbar Output vector of species partial molar enthalpies.
|
||||
* Length: m_kk. units are J/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
|
||||
|
||||
//! Get the species partial molar entropies. Units: J/kmol/K.
|
||||
/*!
|
||||
* @param sbar Output vector of species partial molar entropies.
|
||||
* Length = m_kk. units are J/kmol/K.
|
||||
*/
|
||||
virtual void getPartialMolarEntropies(doublereal* sbar) const;
|
||||
|
||||
//! Get the species partial molar enthalpies. Units: J/kmol.
|
||||
/*!
|
||||
* @param ubar Output vector of species partial molar internal energies.
|
||||
* Length = m_kk. units are J/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarIntEnergies(doublereal* ubar) const;
|
||||
|
||||
//! Get the partial molar heat capacities Units: J/kmol/K
|
||||
/*!
|
||||
* @param cpbar Output vector of species partial molar heat capacities
|
||||
* at constant pressure.
|
||||
* Length = m_kk. units are J/kmol/K.
|
||||
*/
|
||||
virtual void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
||||
//! Get the species partial molar volumes. Units: m^3/kmol.
|
||||
/*!
|
||||
* @param vbar Output vector of species partial molar volumes.
|
||||
* Length = m_kk. units are m^3/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarVolumes(doublereal* vbar) const;
|
||||
//@}
|
||||
|
||||
public:
|
||||
//! @name Initialization Methods - For Internal use
|
||||
/*!
|
||||
* The following methods are used in the process of constructing
|
||||
* the phase and setting its parameters from a specification in an
|
||||
* input file. They are not normally used in application programs.
|
||||
* To see how they are used, see importPhase().
|
||||
* The following methods are used in the process of constructing the phase
|
||||
* and setting its parameters from a specification in an input file. They
|
||||
* are not normally used in application programs. To see how they are used,
|
||||
* see importPhase().
|
||||
*/
|
||||
//@{
|
||||
|
||||
//! Set equation of state parameter values from XML entries.
|
||||
/*!
|
||||
* This method is called by function importPhase() when processing a phase
|
||||
* definition in an input file. It should be overloaded in subclasses to
|
||||
* set any parameters that are specific to that particular phase model.
|
||||
*
|
||||
* @param thermoNode An XML_Node object corresponding to
|
||||
* the "thermo" entry for this phase in the input file.
|
||||
*/
|
||||
virtual void setParametersFromXML(const XML_Node& thermoNode);
|
||||
|
||||
//! @internal Initialize the object
|
||||
/*!
|
||||
* This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called just prior to returning
|
||||
* from function importPhase().
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
//!This method is used by the ChemEquil equilibrium solver.
|
||||
/*!
|
||||
* It sets the state such that the chemical potentials satisfy
|
||||
* \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m}
|
||||
* \left(\frac{\lambda_m} {\hat R T}\right) \f] where
|
||||
* \f$ \lambda_m \f$ is the element potential of element m. The
|
||||
* temperature is unchanged. Any phase (ideal or not) that
|
||||
* implements this method can be equilibrated by ChemEquil.
|
||||
*
|
||||
* @param lambda_RT Input vector of dimensionless element potentials
|
||||
* The length is equal to nElements().
|
||||
*/
|
||||
void setToEquilState(const doublereal* lambda_RT);
|
||||
|
||||
//! Initialize a ThermoPhase object, potentially reading activity
|
||||
//! coefficient information from an XML database.
|
||||
/*!
|
||||
* This routine initializes the lengths in the current object and
|
||||
* then calls the parent routine.
|
||||
* This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called just prior to returning
|
||||
* from function importPhase().
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a
|
||||
* complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1,15 +1,8 @@
|
|||
/**
|
||||
* @file IonsFromNeutralVPSSTP.h
|
||||
* Header for intermediate ThermoPhase object for phases which
|
||||
* consist of ions whose thermodynamics is calculated from neutral molecule thermodynamics.
|
||||
* (see \ref thermoprops
|
||||
* and class \link Cantera::IonsFromNeutralVPSSTP IonsFromNeutralVPSSTP\endlink).
|
||||
*
|
||||
* Header file for a derived class of ThermoPhase that handles
|
||||
* variable pressure standard state methods for calculating
|
||||
* thermodynamic properties that are further based upon activities
|
||||
* based on the molality scale. These include most of the methods for
|
||||
* calculating liquid electrolyte thermodynamics.
|
||||
* @file IonsFromNeutralVPSSTP.h Header for intermediate ThermoPhase object for
|
||||
* phases which consist of ions whose thermodynamics is calculated from
|
||||
* neutral molecule thermodynamics. (see \ref thermoprops and class \link
|
||||
* Cantera::IonsFromNeutralVPSSTP IonsFromNeutralVPSSTP\endlink).
|
||||
*/
|
||||
/*
|
||||
* Copyright (2006) Sandia Corporation. Under the terms of
|
||||
|
|
@ -26,9 +19,9 @@ namespace Cantera
|
|||
|
||||
//! enums for molten salt ion solution types
|
||||
/*!
|
||||
* Types identify how complicated the solution is. If there
|
||||
* is just mixing on one of the sublattices but not the other,
|
||||
* then the math is considerably simpler.
|
||||
* Types identify how complicated the solution is. If there is just mixing on
|
||||
* one of the sublattices but not the other, then the math is considerably
|
||||
* simpler.
|
||||
*/
|
||||
enum IonSolnType_enumType {
|
||||
cIonSolnType_PASSTHROUGH = 2000 ,
|
||||
|
|
@ -38,36 +31,31 @@ enum IonSolnType_enumType {
|
|||
};
|
||||
|
||||
/*!
|
||||
* The IonsFromNeutralVPSSTP is a derived class of ThermoPhase
|
||||
* that handles the specification of the chemical potentials for
|
||||
* ionic species, given a specification of the chemical potentials
|
||||
* for the same phase expressed in terms of combinations of the
|
||||
* ionic species that represent neutral molecules. It's expected
|
||||
* that the neutral molecules will be represented in terms of
|
||||
* an excess Gibbs free energy approximation that is a derivative
|
||||
* of the GbbsExcessVPSSTP object. All of the e Excess Gibbs free
|
||||
* energy formulations in this area employ
|
||||
* symmetrical formulations.
|
||||
* The IonsFromNeutralVPSSTP is a derived class of ThermoPhase that handles the
|
||||
* specification of the chemical potentials for ionic species, given a
|
||||
* specification of the chemical potentials for the same phase expressed in
|
||||
* terms of combinations of the ionic species that represent neutral molecules.
|
||||
* It's expected that the neutral molecules will be represented in terms of an
|
||||
* excess Gibbs free energy approximation that is a derivative of the
|
||||
* GibbsExcessVPSSTP object. All of the excess Gibbs free energy formulations in
|
||||
* this area employ symmetrical formulations.
|
||||
*
|
||||
* This class is used for molten salts.
|
||||
* This class is used for molten salts.
|
||||
*
|
||||
* This object actually employs 4 different mole fraction types.
|
||||
* This object actually employs 4 different mole fraction types.
|
||||
*
|
||||
* 1. There is a mole fraction associated the the cations and
|
||||
* anions and neutrals from this ThermoPhase object. This
|
||||
* is the normal mole fraction vector for this object.
|
||||
* Note, however, it isn't the appropriate mole fraction
|
||||
* vector to use even for obtaining the correct ideal
|
||||
* free energies of mixing.
|
||||
* 2. There is a mole fraction vector associated with the
|
||||
* neutral molecule ThermoPhase object.
|
||||
* 3. There is a mole fraction vector associated with the
|
||||
* cation lattice.
|
||||
* 4. There is a mole fraction vector associated with the
|
||||
* anion lattice
|
||||
* 1. There is a mole fraction associated the the cations and anions and
|
||||
* neutrals from this ThermoPhase object. This is the normal mole fraction
|
||||
* vector for this object. Note, however, it isn't the appropriate mole
|
||||
* fraction vector to use even for obtaining the correct ideal free energies
|
||||
* of mixing.
|
||||
* 2. There is a mole fraction vector associated with the neutral molecule
|
||||
* ThermoPhase object.
|
||||
* 3. There is a mole fraction vector associated with the cation lattice.
|
||||
* 4. There is a mole fraction vector associated with the anion lattice
|
||||
*
|
||||
* This object can translate between any of the four mole
|
||||
* fraction representations.
|
||||
* This object can translate between any of the four mole fraction
|
||||
* representations.
|
||||
*/
|
||||
class IonsFromNeutralVPSSTP : public GibbsExcessVPSSTP
|
||||
{
|
||||
|
|
@ -80,26 +68,23 @@ public:
|
|||
*/
|
||||
IonsFromNeutralVPSSTP();
|
||||
|
||||
//! Construct and initialize an IonsFromNeutralVPSSTP object
|
||||
//! directly from an ASCII input file
|
||||
//! Construct and initialize an IonsFromNeutralVPSSTP object directly from
|
||||
//! an ASCII input file
|
||||
/*!
|
||||
* This constructor is a shell around the routine initThermo(), with a
|
||||
* reference to the XML database to get the info for the phase.
|
||||
* This constructor is a shell around the routine initThermo(), with a
|
||||
* reference to the XML database to get the info for the phase.
|
||||
*
|
||||
* @param inputFile Name of the input file containing the phase XML data
|
||||
* to set up the object
|
||||
* to set up the object
|
||||
* @param id ID of the phase in the input file. Defaults to the
|
||||
* empty string.
|
||||
* @param neutralPhase The object takes a neutralPhase ThermoPhase
|
||||
* object as input. It can either take a pointer
|
||||
* to an existing object in the parameter list,
|
||||
* in which case it does not own the object, or
|
||||
* it can construct a neutral Phase as a slave
|
||||
* object, in which case, it does own the slave
|
||||
* object, for purposes of who gets to destroy
|
||||
* the object.
|
||||
* If this parameter is zero, then a slave
|
||||
* neutral phase object is created and used.
|
||||
* empty string.
|
||||
* @param neutralPhase The object takes a neutralPhase ThermoPhase object
|
||||
* as input. It can either take a pointer to an existing object in the
|
||||
* parameter list, in which case it does not own the object, or it can
|
||||
* construct a neutral Phase as a slave object, in which case, it does
|
||||
* own the slave object, for purposes of who gets to destroy the object.
|
||||
* If this parameter is zero, then a slave neutral phase object is
|
||||
* created and used.
|
||||
*/
|
||||
IonsFromNeutralVPSSTP(const std::string& inputFile,
|
||||
const std::string& id = "",
|
||||
|
|
@ -108,44 +93,23 @@ public:
|
|||
//! Construct and initialize an IonsFromNeutralVPSSTP object
|
||||
//! directly from an XML database
|
||||
/*!
|
||||
* @param phaseRoot XML phase node containing the description of the phase
|
||||
* @param id id attribute containing the name of the phase.
|
||||
* (default is the empty string)
|
||||
* @param neutralPhase The object takes a neutralPhase ThermoPhase
|
||||
* object as input. It can either take a pointer
|
||||
* to an existing object in the parameter list,
|
||||
* in which case it does not own the object, or
|
||||
* it can construct a neutral Phase as a slave
|
||||
* object, in which case, it does own the slave
|
||||
* object, for purposes of who gets to destroy
|
||||
* the object.
|
||||
* If this parameter is zero, then a slave
|
||||
* neutral phase object is created and used.
|
||||
* @param phaseRoot XML phase node containing the description of the phase
|
||||
* @param id id attribute containing the name of the phase.
|
||||
* (default is the empty string)
|
||||
* @param neutralPhase The object takes a neutralPhase ThermoPhase object
|
||||
* as input. It can either take a pointer to an existing object in the
|
||||
* parameter list, in which case it does not own the object, or it can
|
||||
* construct a neutral Phase as a slave object, in which case, it does
|
||||
* own the slave object, for purposes of who gets to destroy the object.
|
||||
* If this parameter is zero, then a slave neutral phase object is
|
||||
* created and used.
|
||||
*/
|
||||
IonsFromNeutralVPSSTP(XML_Node& phaseRoot, const std::string& id = "",
|
||||
ThermoPhase* neutralPhase = 0);
|
||||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* @param b class to be copied
|
||||
*/
|
||||
IonsFromNeutralVPSSTP(const IonsFromNeutralVPSSTP& b);
|
||||
|
||||
/// Assignment operator
|
||||
/*!
|
||||
* @param b class to be copied.
|
||||
*/
|
||||
IonsFromNeutralVPSSTP& operator=(const IonsFromNeutralVPSSTP& b);
|
||||
|
||||
/// Destructor.
|
||||
virtual ~IonsFromNeutralVPSSTP();
|
||||
|
||||
//! Duplication routine for objects which inherit from ThermoPhase.
|
||||
/*!
|
||||
* This virtual routine can be used to duplicate ThermoPhase objects
|
||||
* inherited from ThermoPhase even if the application only has
|
||||
* a pointer to ThermoPhase to work with.
|
||||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
// @}
|
||||
|
|
@ -156,52 +120,39 @@ public:
|
|||
|
||||
//! Initialization of an IonsFromNeutralVPSSTP phase using an XML file
|
||||
/*!
|
||||
* This routine is a precursor to initThermo(XML_Node*)
|
||||
* routine, which does most of the work.
|
||||
* This routine is a precursor to initThermo(XML_Node*) routine, which does
|
||||
* most of the work.
|
||||
*
|
||||
* @param inputFile XML file containing the description of the phase
|
||||
* @param id Optional parameter identifying the name of the
|
||||
* phase. If none is given, the first XML
|
||||
* phase element will be used.
|
||||
* @param id Optional parameter identifying the name of the phase. If none
|
||||
* is given, the first XML phase element will be used.
|
||||
*/
|
||||
void constructPhaseFile(std::string inputFile, std::string id);
|
||||
|
||||
//! Import and initialize an IonsFromNeutralVPSSTP phase
|
||||
//! specification in an XML tree into the current object.
|
||||
//! Import and initialize an IonsFromNeutralVPSSTP phase specification in an
|
||||
//! XML tree into the current object.
|
||||
/*!
|
||||
* Here we read an XML description of the phase.
|
||||
* We import descriptions of the elements that make up the
|
||||
* species in a phase.
|
||||
* We import information about the species, including their
|
||||
* reference state thermodynamic polynomials. We then freeze
|
||||
* the state of the species.
|
||||
* Here we read an XML description of the phase. We import descriptions of
|
||||
* the elements that make up the species in a phase. We import information
|
||||
* about the species, including their reference state thermodynamic
|
||||
* polynomials. We then freeze the state of the species.
|
||||
*
|
||||
* Then, we read the species molar volumes from the XML
|
||||
* tree to finish the initialization.
|
||||
* Then, we read the species molar volumes from the XML tree to finish the
|
||||
* initialization.
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
* @param phaseNode This object must be the phase node of a complete XML
|
||||
* tree description of the phase, including all of the species
|
||||
* data. In other words while "phase" must point to an XML phase
|
||||
* object, it must have sibling nodes "speciesData" that
|
||||
* describe the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done to see if
|
||||
* phaseNode is pointing to the phase with the correct id.
|
||||
*/
|
||||
void constructPhaseXML(XML_Node& phaseNode, std::string id);
|
||||
|
||||
//! @name Utilities
|
||||
//! @{
|
||||
|
||||
//! Equation of state type flag.
|
||||
/*!
|
||||
* The ThermoPhase base class returns
|
||||
* zero. Subclasses should define this to return a unique
|
||||
* non-zero value. Known constants defined for this purpose are
|
||||
* listed in mix_defs.h. The MolalityVPSSTP class also returns
|
||||
* zero, as it is a non-complete class.
|
||||
*/
|
||||
virtual int eosType() const;
|
||||
|
||||
//! @}
|
||||
|
|
@ -214,16 +165,9 @@ public:
|
|||
*/
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
|
||||
//! Molar entropy. Units: J/kmol/K.
|
||||
virtual doublereal entropy_mole() const;
|
||||
|
||||
//! Molar Gibbs free Energy for an ideal gas. Units = J/kmol.
|
||||
virtual doublereal gibbs_mole() const;
|
||||
|
||||
//! Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
virtual doublereal cp_mole() const;
|
||||
|
||||
//! Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
virtual doublereal cv_mole() const;
|
||||
|
||||
/**
|
||||
|
|
@ -238,36 +182,22 @@ public:
|
|||
* @{
|
||||
*/
|
||||
|
||||
//! Get the array of non-dimensional molar-based activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* @param ac Output vector of activity coefficients. Length: m_kk.
|
||||
*/
|
||||
virtual void getActivityCoefficients(doublereal* ac) const;
|
||||
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
||||
//! Get the species chemical potentials. Units: J/kmol.
|
||||
/*!
|
||||
* This function returns a vector of chemical potentials of the
|
||||
* species in solution at the current temperature, pressure
|
||||
* and mole fraction of the solution.
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Returns an array of partial molar enthalpies for the species
|
||||
//! in the mixture.
|
||||
//! Returns an array of partial molar enthalpies for the species in the
|
||||
//! mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* standard state enthalpies modified by the derivative of the
|
||||
* molality-based activity coefficient wrt temperature
|
||||
* For this phase, the partial molar enthalpies are equal to the standard
|
||||
* state enthalpies modified by the derivative of the molality-based
|
||||
* activity coefficient wrt temperature
|
||||
*
|
||||
* \f[
|
||||
* \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
|
|
@ -278,14 +208,14 @@ public:
|
|||
*/
|
||||
virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
|
||||
|
||||
//! Returns an array of partial molar entropies for the species
|
||||
//! in the mixture.
|
||||
//! Returns an array of partial molar entropies for the species in the
|
||||
//! mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* standard state enthalpies modified by the derivative of the
|
||||
* activity coefficient wrt temperature
|
||||
* For this phase, the partial molar enthalpies are equal to the standard
|
||||
* state enthalpies modified by the derivative of the activity coefficient
|
||||
* wrt temperature
|
||||
*
|
||||
* \f[
|
||||
* \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
|
|
@ -298,87 +228,30 @@ public:
|
|||
*/
|
||||
virtual void getPartialMolarEntropies(doublereal* sbar) const;
|
||||
|
||||
//! Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along
|
||||
//! a line in parameter space or along a line in physical space
|
||||
/*!
|
||||
* @param dTds Input of temperature change along the path
|
||||
* @param dXds Input vector of changes in mole fraction along the path. length = m_kk
|
||||
* Along the path length it must be the case that the mole fractions sum to one.
|
||||
* @param dlnActCoeffds Output vector of the directional derivatives of the
|
||||
* log Activity Coefficients along the path. length = m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds,
|
||||
doublereal* dlnActCoeffds) const;
|
||||
|
||||
//! Get the array of log concentration-like derivatives of the
|
||||
//! log activity coefficients - diagonal component
|
||||
/*!
|
||||
* For ideal mixtures (unity activity coefficients), this can return zero.
|
||||
* Implementations should take the derivative of the logarithm of the
|
||||
* activity coefficient with respect to the logarithm of the mole
|
||||
* fraction. This quantity is to be used in conjunction with derivatives
|
||||
* of that concentration-like variable when the derivative of the chemical
|
||||
* potential is taken.
|
||||
*
|
||||
* units = dimensionless
|
||||
*
|
||||
* @param dlnActCoeffdlnX_diag Output vector of log(mole fraction)
|
||||
* derivatives of the log Activity Coefficients.
|
||||
* length = m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const;
|
||||
|
||||
//! Get the array of log concentration-like derivatives of the
|
||||
//! log activity coefficients - diagonal components
|
||||
/*!
|
||||
* For ideal mixtures (unity activity coefficients), this can return zero.
|
||||
* Implementations should take the derivative of the logarithm of the
|
||||
* activity coefficient with respect to the logarithm of the species mole
|
||||
* numbe. This routine just does the diagonal entries.
|
||||
*
|
||||
* units = dimensionless
|
||||
*
|
||||
* @param dlnActCoeffdlnN_diag Output vector of diagonal components of the log(mole fraction)
|
||||
* derivatives of the log Activity Coefficients.
|
||||
* length = m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const;
|
||||
|
||||
//! Get the array of derivatives of the ln activity coefficients with respect to the ln species mole numbers
|
||||
/*!
|
||||
* Implementations should take the derivative of the logarithm of the activity coefficient with respect to a
|
||||
* log of a species mole number (with all other species mole numbers held constant)
|
||||
*
|
||||
* units = 1 / kmol
|
||||
*
|
||||
* dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log act_coeff for the <I>m</I><SUP>th</SUP>
|
||||
* species with respect to the number of moles of the <I>k</I><SUP>th</SUP> species.
|
||||
*
|
||||
* \f[
|
||||
* \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i}
|
||||
* \f]
|
||||
*
|
||||
* @param ld Number of rows in the matrix
|
||||
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
||||
* log Activity Coefficients. length = m_kk * m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN);
|
||||
//! @}
|
||||
|
||||
//! Get the Salt Dissociation Coefficients
|
||||
//! Get the Salt Dissociation Coefficients.
|
||||
//! Returns the vector of dissociation coefficients and vector of charges
|
||||
/*!
|
||||
* @param fm_neutralMolec_ions Returns the formula matrix for the composition of neutral molecules
|
||||
* in terms of the ions.
|
||||
* @param charges Returns a vector containing the charges of all species in this phase
|
||||
* @param neutMolIndex Returns the vector fm_invert_ionForNeutral
|
||||
* This is the mapping between ion species and neutral molecule for quick invert.
|
||||
* @param fm_neutralMolec_ions Returns the formula matrix for the
|
||||
* composition of neutral molecules in terms of the ions.
|
||||
* @param charges Returns a vector containing the charges of
|
||||
* all species in this phase
|
||||
* @param neutMolIndex Returns the vector fm_invert_ionForNeutral
|
||||
* This is the mapping between ion species and neutral molecule for
|
||||
* quick invert.
|
||||
*/
|
||||
void getDissociationCoeffs(vector_fp& fm_neutralMolec_ions, vector_fp& charges, std::vector<size_t>& neutMolIndex) const;
|
||||
|
||||
//! Return the current value of the neutral mole fraction vector
|
||||
/*!
|
||||
* @param neutralMoleculeMoleFractions Vector of neutral molecule mole fractions.
|
||||
* @param neutralMoleculeMoleFractions Vector of neutral molecule mole
|
||||
* fractions.
|
||||
*/
|
||||
void getNeutralMolecMoleFractions(vector_fp& neutralMoleculeMoleFractions) const {
|
||||
neutralMoleculeMoleFractions = NeutralMolecMoleFractions_;
|
||||
|
|
@ -386,20 +259,18 @@ public:
|
|||
|
||||
//! Calculate neutral molecule mole fractions
|
||||
/*!
|
||||
* This routine calculates the neutral molecule mole
|
||||
* fraction given the vector of ion mole fractions,
|
||||
* i.e., the mole fractions from this ThermoPhase.
|
||||
* Note, this routine basically assumes that there
|
||||
* is charge neutrality. If there isn't, then it wouldn't
|
||||
* make much sense.
|
||||
* This routine calculates the neutral molecule mole fraction given the
|
||||
* vector of ion mole fractions, i.e., the mole fractions from this
|
||||
* ThermoPhase. Note, this routine basically assumes that there is charge
|
||||
* neutrality. If there isn't, then it wouldn't make much sense.
|
||||
*
|
||||
* for the case of cIonSolnType_SINGLEANION, some slough
|
||||
* in the charge neutrality is allowed. The cation number
|
||||
* is followed, while the difference in charge neutrality
|
||||
* is dumped into the anion mole number to fix the imbalance.
|
||||
* for the case of cIonSolnType_SINGLEANION, some slough in the charge
|
||||
* neutrality is allowed. The cation number is followed, while the
|
||||
* difference in charge neutrality is dumped into the anion mole number to
|
||||
* fix the imbalance.
|
||||
*
|
||||
* @param dx input vector of ion mole fraction gradients
|
||||
* @param dy output Vector of neutral molecule mole fraction gradients
|
||||
* @param dx input vector of ion mole fraction gradients
|
||||
* @param dy output Vector of neutral molecule mole fraction gradients
|
||||
*/
|
||||
void getNeutralMoleculeMoleGrads(const doublereal* const dx, doublereal* const dy) const;
|
||||
|
||||
|
|
@ -427,17 +298,8 @@ public:
|
|||
|
||||
virtual void setTemperature(const doublereal t);
|
||||
virtual void setPressure(doublereal p);
|
||||
|
||||
//! Set the temperature (K) and pressure (Pa)
|
||||
/*!
|
||||
* Setting the pressure may involve the solution of a nonlinear equation.
|
||||
*
|
||||
* @param t Temperature (K)
|
||||
* @param p Pressure (Pa)
|
||||
*/
|
||||
virtual void setState_TP(doublereal t, doublereal p);
|
||||
|
||||
|
||||
//! Calculate ion mole fractions from neutral molecule mole fractions.
|
||||
/*!
|
||||
* @param mf Dump the mole fractions into this vector.
|
||||
|
|
@ -446,109 +308,27 @@ public:
|
|||
|
||||
//! Calculate neutral molecule mole fractions
|
||||
/*!
|
||||
* This routine calculates the neutral molecule mole
|
||||
* fraction given the vector of ion mole fractions,
|
||||
* i.e., the mole fractions from this ThermoPhase.
|
||||
* Note, this routine basically assumes that there
|
||||
* is charge neutrality. If there isn't, then it wouldn't
|
||||
* make much sense.
|
||||
* This routine calculates the neutral molecule mole fraction given the
|
||||
* vector of ion mole fractions, i.e., the mole fractions from this
|
||||
* ThermoPhase. Note, this routine basically assumes that there is charge
|
||||
* neutrality. If there isn't, then it wouldn't make much sense.
|
||||
*
|
||||
* for the case of cIonSolnType_SINGLEANION, some slough
|
||||
* in the charge neutrality is allowed. The cation number
|
||||
* is followed, while the difference in charge neutrality
|
||||
* is dumped into the anion mole number to fix the imbalance.
|
||||
* for the case of cIonSolnType_SINGLEANION, some slough in the charge
|
||||
* neutrality is allowed. The cation number is followed, while the
|
||||
* difference in charge neutrality is dumped into the anion mole number to
|
||||
* fix the imbalance.
|
||||
*/
|
||||
virtual void calcNeutralMoleculeMoleFractions() const;
|
||||
|
||||
/**
|
||||
* Set the mass fractions to the specified values, and then
|
||||
* normalize them so that they sum to 1.0.
|
||||
* @param y Array of unnormalized mass fraction values (input).
|
||||
* Must have a length greater than or equal to the number of
|
||||
* species.
|
||||
*
|
||||
* @param y Input vector of mass fractions.
|
||||
* Length is m_kk.
|
||||
*/
|
||||
virtual void setMassFractions(const doublereal* const y);
|
||||
|
||||
/**
|
||||
* Set the mass fractions to the specified values without
|
||||
* normalizing. This is useful when the normalization
|
||||
* condition is being handled by some other means, for example
|
||||
* by a constraint equation as part of a larger set of
|
||||
* equations.
|
||||
*
|
||||
* @param y Input vector of mass fractions.
|
||||
* Length is m_kk.
|
||||
*/
|
||||
virtual void setMassFractions_NoNorm(const doublereal* const y);
|
||||
|
||||
/**
|
||||
* Set the mole fractions to the specified values, and then
|
||||
* normalize them so that they sum to 1.0.
|
||||
* @param x Array of unnormalized mole fraction values (input).
|
||||
* Must have a length greater than or equal to the number of
|
||||
* species.
|
||||
*
|
||||
* @param x Input vector of mole fractions.
|
||||
* Length is m_kk.
|
||||
*/
|
||||
virtual void setMoleFractions(const doublereal* const x);
|
||||
|
||||
/**
|
||||
* Set the mole fractions to the specified values without
|
||||
* normalizing. This is useful when the normalization
|
||||
* condition is being handled by some other means, for example
|
||||
* by a constraint equation as part of a larger set of
|
||||
* equations.
|
||||
*
|
||||
* @param x Input vector of mole fractions.
|
||||
* Length is m_kk.
|
||||
*/
|
||||
virtual void setMoleFractions_NoNorm(const doublereal* const x);
|
||||
|
||||
/**
|
||||
* Set the concentrations to the specified values within the phase.
|
||||
*
|
||||
* @param c The input vector to this routine is in dimensional
|
||||
* units. For volumetric phases c[k] is the
|
||||
* concentration of the kth species in kmol/m3.
|
||||
* For surface phases, c[k] is the concentration
|
||||
* in kmol/m2. The length of the vector is the number
|
||||
* of species in the phase.
|
||||
*/
|
||||
virtual void setConcentrations(const doublereal* const c);
|
||||
|
||||
//@}
|
||||
|
||||
/*!
|
||||
* @internal Initialize. This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called just prior to returning
|
||||
* from function importPhase().
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
/**
|
||||
* Import and initialize a ThermoPhase object
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a
|
||||
* complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
private:
|
||||
|
|
@ -558,28 +338,28 @@ private:
|
|||
|
||||
//! Update the activity coefficients
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* natural logarithm of the activity coefficients
|
||||
* This function will be called to update the internally stored natural
|
||||
* logarithm of the activity coefficients
|
||||
*/
|
||||
void s_update_lnActCoeff() const;
|
||||
|
||||
//! Update the temperature derivative of the ln activity coefficients
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* temperature derivative of the natural logarithm of the activity coefficients
|
||||
* This function will be called to update the internally stored temperature
|
||||
* derivative of the natural logarithm of the activity coefficients
|
||||
*/
|
||||
void s_update_dlnActCoeffdT() const;
|
||||
|
||||
//! Update the change in the ln activity coefficients
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* change of the natural logarithm of the activity coefficients
|
||||
* w.r.t a change in state (temp, mole fraction, etc)
|
||||
* This function will be called to update the internally stored change of
|
||||
* the natural logarithm of the activity coefficients w.r.t a change in
|
||||
* state (temp, mole fraction, etc)
|
||||
*/
|
||||
void s_update_dlnActCoeff() const;
|
||||
|
||||
//! Update the derivative of the log of the activity coefficients
|
||||
//! wrt log(mole fraction)
|
||||
//! Update the derivative of the log of the activity coefficients wrt
|
||||
//! log(mole fraction)
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* derivative of the natural logarithm of the activity coefficients
|
||||
|
|
@ -587,29 +367,29 @@ private:
|
|||
*/
|
||||
void s_update_dlnActCoeff_dlnX_diag() const;
|
||||
|
||||
//! Update the derivative of the log of the activity coefficients
|
||||
//! wrt log(number of moles) - diagonal components
|
||||
//! Update the derivative of the log of the activity coefficients wrt
|
||||
//! log(number of moles) - diagonal components
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* derivative of the natural logarithm of the activity coefficients
|
||||
* wrt logarithm of the number of moles of given species.
|
||||
* This function will be called to update the internally stored derivative
|
||||
* of the natural logarithm of the activity coefficients wrt logarithm of
|
||||
* the number of moles of given species.
|
||||
*/
|
||||
void s_update_dlnActCoeff_dlnN_diag() const;
|
||||
|
||||
//! Update the derivative of the log of the activity coefficients
|
||||
//! wrt log(number of moles) - diagonal components
|
||||
//! wrt log(number of moles) - diagonal components
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* derivative of the natural logarithm of the activity coefficients
|
||||
* wrt logarithm of the number of moles of given species.
|
||||
* This function will be called to update the internally stored derivative
|
||||
* of the natural logarithm of the activity coefficients wrt logarithm of
|
||||
* the number of moles of given species.
|
||||
*/
|
||||
void s_update_dlnActCoeff_dlnN() const;
|
||||
|
||||
protected:
|
||||
//! Ion solution type
|
||||
/*!
|
||||
* There is either mixing on the anion, cation, or both lattices.
|
||||
* There is also a passthrough option
|
||||
* There is either mixing on the anion, cation, or both lattices.
|
||||
* There is also a passthrough option
|
||||
*
|
||||
* Defaults to cIonSolnType_SINGLEANION, so that LiKCl can be hardwired
|
||||
*/
|
||||
|
|
@ -617,8 +397,8 @@ protected:
|
|||
|
||||
//! Number of neutral molecule species
|
||||
/*!
|
||||
* This is equal to the number of species in the
|
||||
* neutralMoleculePhase_ ThermoPhase.
|
||||
* This is equal to the number of species in the neutralMoleculePhase_
|
||||
* ThermoPhase.
|
||||
*/
|
||||
size_t numNeutralMoleculeSpecies_;
|
||||
|
||||
|
|
@ -633,36 +413,33 @@ protected:
|
|||
/*!
|
||||
* fm_neutralMolec_ions[ i + jNeut * m_kk ]
|
||||
*
|
||||
* This is the number of ions of type i in the neutral
|
||||
* molecule jNeut.
|
||||
* This is the number of ions of type i in the neutral molecule jNeut.
|
||||
*/
|
||||
vector_fp fm_neutralMolec_ions_;
|
||||
|
||||
//! Mapping between ion species and neutral molecule for quick invert.
|
||||
/*!
|
||||
* fm_invert_ionForNeutral returns vector of int. Each element represents
|
||||
* an ionic species and stores the value of the corresponding neutral
|
||||
* molecule
|
||||
* fm_invert_ionForNeutral returns vector of int. Each element represents an
|
||||
* ionic species and stores the value of the corresponding neutral molecule
|
||||
*
|
||||
* For the case of fm_invert_simple_ = true, we assume that there
|
||||
* is a quick way to invert the formula matrix so that we can
|
||||
* quickly calculate the neutral molecule mole fraction
|
||||
* given the ion mole fraction vector.
|
||||
* For the case of fm_invert_simple_ = true, we assume that there is a quick
|
||||
* way to invert the formula matrix so that we can quickly calculate the
|
||||
* neutral molecule mole fraction given the ion mole fraction vector.
|
||||
*
|
||||
* We assume that for a selected set of ion species, that that
|
||||
* ion is only in the neutral molecule, jNeut.
|
||||
* We assume that for a selected set of ion species, that that ion is only
|
||||
* in the neutral molecule, jNeut.
|
||||
*
|
||||
* therefore,
|
||||
* therefore,
|
||||
*
|
||||
* NeutralMolecMoleFractions_[jNeut] += moleFractions_[i_ion] / fmij;
|
||||
* NeutralMolecMoleFractions_[jNeut] += moleFractions_[i_ion] / fmij;
|
||||
*
|
||||
* where fmij is the number of ions in neutral molecule jNeut.
|
||||
* where fmij is the number of ions in neutral molecule jNeut.
|
||||
*
|
||||
* Thus, we formulate the neutral molecule mole fraction NeutralMolecMoleFractions_[]
|
||||
* vector from this association. We further assume that there are
|
||||
* no other associations. If fm_invert_simple_ is not true,
|
||||
* then we need to do a formal inversion which takes a great
|
||||
* deal of time and is not currently implemented.
|
||||
* Thus, we formulate the neutral molecule mole fraction
|
||||
* NeutralMolecMoleFractions_[] vector from this association. We further
|
||||
* assume that there are no other associations. If fm_invert_simple_ is not
|
||||
* true, then we need to do a formal inversion which takes a great deal of
|
||||
* time and is not currently implemented.
|
||||
*/
|
||||
std::vector<size_t> fm_invert_ionForNeutral;
|
||||
|
||||
|
|
@ -675,11 +452,8 @@ protected:
|
|||
//! List of the species in this ThermoPhase which are anion species
|
||||
std::vector<size_t> anionList_;
|
||||
|
||||
//! List of the species in this ThermoPhase which are passed
|
||||
//! through to the neutralMoleculePhase ThermoPhase.
|
||||
/*!
|
||||
* These have neutral charges.
|
||||
*/
|
||||
//! List of the species in this ThermoPhase which are passed through to the
|
||||
//! neutralMoleculePhase ThermoPhase. These have neutral charges.
|
||||
std::vector<size_t> passThroughList_;
|
||||
|
||||
public:
|
||||
|
|
@ -692,7 +466,8 @@ public:
|
|||
|
||||
private:
|
||||
GibbsExcessVPSSTP* geThermo;
|
||||
// Temporary vectors that I don't want to allocate every time the function is called
|
||||
// Temporary vectors that I don't want to allocate every time the function
|
||||
// is called
|
||||
mutable vector_fp y_;
|
||||
mutable vector_fp dlnActCoeff_NeutralMolecule_;
|
||||
mutable vector_fp dX_NeutralMolecule_;
|
||||
|
|
@ -709,8 +484,8 @@ private:
|
|||
|
||||
//! Storage vector for the neutral molecule chemical potentials
|
||||
/*!
|
||||
* This vector is used as a temporary storage area when calculating the ion chemical
|
||||
* potentials.
|
||||
* This vector is used as a temporary storage area when calculating the ion
|
||||
* chemical potentials.
|
||||
*
|
||||
* - Units = Joules/kmol
|
||||
* - Length = numNeutralMoleculeSpecies_
|
||||
|
|
@ -719,8 +494,8 @@ private:
|
|||
|
||||
//! Storage vector for the neutral molecule ln activity coefficients
|
||||
/*!
|
||||
* This vector is used as a temporary storage area when calculating the ion chemical
|
||||
* potentials and activity coefficients
|
||||
* This vector is used as a temporary storage area when calculating the ion
|
||||
* chemical potentials and activity coefficients
|
||||
*
|
||||
* - Units = none
|
||||
* - Length = numNeutralMoleculeSpecies_
|
||||
|
|
@ -729,25 +504,30 @@ private:
|
|||
|
||||
//! Storage vector for the neutral molecule d ln activity coefficients dT
|
||||
/*!
|
||||
* This vector is used as a temporary storage area when calculating the ion derivatives
|
||||
* This vector is used as a temporary storage area when calculating the ion
|
||||
* derivatives
|
||||
*
|
||||
* - Units = 1/Kelvin
|
||||
* - Length = numNeutralMoleculeSpecies_
|
||||
*/
|
||||
mutable vector_fp dlnActCoeffdT_NeutralMolecule_;
|
||||
|
||||
//! Storage vector for the neutral molecule d ln activity coefficients dX - diagonal component
|
||||
//! Storage vector for the neutral molecule d ln activity coefficients dX -
|
||||
//! diagonal component
|
||||
/*!
|
||||
* This vector is used as a temporary storage area when calculating the ion derivatives
|
||||
* This vector is used as a temporary storage area when calculating the ion
|
||||
* derivatives
|
||||
*
|
||||
* - Units = none
|
||||
* - Length = numNeutralMoleculeSpecies_
|
||||
*/
|
||||
mutable vector_fp dlnActCoeffdlnX_diag_NeutralMolecule_;
|
||||
|
||||
//! Storage vector for the neutral molecule d ln activity coefficients dlnN - diagonal component
|
||||
//! Storage vector for the neutral molecule d ln activity coefficients dlnN
|
||||
//! - diagonal component
|
||||
/*!
|
||||
* This vector is used as a temporary storage area when calculating the ion derivatives
|
||||
* This vector is used as a temporary storage area when calculating the ion
|
||||
* derivatives
|
||||
*
|
||||
* - Units = none
|
||||
* - Length = numNeutralMoleculeSpecies_
|
||||
|
|
@ -756,7 +536,8 @@ private:
|
|||
|
||||
//! Storage vector for the neutral molecule d ln activity coefficients dlnN
|
||||
/*!
|
||||
* This vector is used as a temporary storage area when calculating the ion derivatives
|
||||
* This vector is used as a temporary storage area when calculating the ion
|
||||
* derivatives
|
||||
*
|
||||
* - Units = none
|
||||
* - Length = numNeutralMoleculeSpecies_
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* @file LatticePhase.h
|
||||
* Header for a simple thermodynamics model of a bulk phase derived from ThermoPhase,
|
||||
* assuming a lattice of solid atoms
|
||||
* (see \ref thermoprops and class \link Cantera::LatticePhase LatticePhase\endlink).
|
||||
* @file LatticePhase.h Header for a simple thermodynamics model of a bulk
|
||||
* phase derived from ThermoPhase, assuming a lattice of solid atoms (see
|
||||
* \ref thermoprops and class \link Cantera::LatticePhase
|
||||
* LatticePhase\endlink).
|
||||
*/
|
||||
|
||||
// Copyright 2005 California Institute of Technology
|
||||
|
|
@ -16,180 +16,180 @@
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
//! A simple thermodynamic model for a bulk phase,
|
||||
//! assuming a lattice of solid atoms
|
||||
//! A simple thermodynamic model for a bulk phase, assuming a lattice of solid
|
||||
//! atoms
|
||||
/*!
|
||||
* The bulk consists of a matrix of equivalent sites whose molar density
|
||||
* does not vary with temperature or pressure. The thermodynamics
|
||||
* obeys the ideal solution laws. The phase and the pure species phases which
|
||||
* comprise the standard states of the species are assumed to have
|
||||
* zero volume expansivity and zero isothermal compressibility.
|
||||
* The bulk consists of a matrix of equivalent sites whose molar density does
|
||||
* not vary with temperature or pressure. The thermodynamics obeys the ideal
|
||||
* solution laws. The phase and the pure species phases which comprise the
|
||||
* standard states of the species are assumed to have zero volume expansivity
|
||||
* and zero isothermal compressibility.
|
||||
*
|
||||
* The density of matrix sites is given by the variable \f$ C_o \f$,
|
||||
* which has SI units of kmol m-3.
|
||||
* The density of matrix sites is given by the variable \f$ C_o \f$, which has
|
||||
* SI units of kmol m-3.
|
||||
*
|
||||
* <b> Specification of Species Standard State Properties </b>
|
||||
*
|
||||
* It is assumed that the reference state thermodynamics may be
|
||||
* obtained by a pointer to a populated species thermodynamic property
|
||||
* manager class (see ThermoPhase::m_spthermo). However, how to relate pressure
|
||||
* changes to the reference state thermodynamics is within this class.
|
||||
* It is assumed that the reference state thermodynamics may be obtained by a
|
||||
* pointer to a populated species thermodynamic property manager class (see
|
||||
* ThermoPhase::m_spthermo). However, how to relate pressure changes to the
|
||||
* reference state thermodynamics is within this class.
|
||||
*
|
||||
* Pressure is defined as an independent variable in this phase. However, it has
|
||||
* no effect on any quantities, as the molar concentration is a constant.
|
||||
* Pressure is defined as an independent variable in this phase. However, it has
|
||||
* no effect on any quantities, as the molar concentration is a constant.
|
||||
*
|
||||
* The standard state enthalpy function is given by the following relation,
|
||||
* which has a weak dependence on the system pressure, \f$P\f$.
|
||||
*
|
||||
* \f[
|
||||
* h^o_k(T,P) =
|
||||
* h^{ref}_k(T) + \left( \frac{P - P_{ref}}{C_o} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* h^o_k(T,P) =
|
||||
* h^{ref}_k(T) + \left( \frac{P - P_{ref}}{C_o} \right)
|
||||
* \f]
|
||||
*
|
||||
* For an incompressible substance, the molar internal energy is
|
||||
* independent of pressure. Since the thermodynamic properties
|
||||
* are specified by giving the standard-state enthalpy, the
|
||||
* term \f$ \frac{P_{ref}}{C_o} \f$ is subtracted from the specified reference molar
|
||||
* enthalpy to compute the standard state molar internal energy:
|
||||
* For an incompressible substance, the molar internal energy is independent of
|
||||
* pressure. Since the thermodynamic properties are specified by giving the
|
||||
* standard-state enthalpy, the term \f$ \frac{P_{ref}}{C_o} \f$ is subtracted
|
||||
* from the specified reference molar enthalpy to compute the standard state
|
||||
* molar internal energy:
|
||||
*
|
||||
* \f[
|
||||
* u^o_k(T,P) = h^{ref}_k(T) - \frac{P_{ref}}{C_o}
|
||||
* \f]
|
||||
* \f[
|
||||
* u^o_k(T,P) = h^{ref}_k(T) - \frac{P_{ref}}{C_o}
|
||||
* \f]
|
||||
*
|
||||
* The standard state heat capacity, internal energy, and entropy are independent
|
||||
* of pressure. The standard state Gibbs free energy is obtained
|
||||
* The standard state heat capacity, internal energy, and entropy are
|
||||
* independent of pressure. The standard state Gibbs free energy is obtained
|
||||
* from the enthalpy and entropy functions.
|
||||
*
|
||||
* The standard state molar volume is independent of temperature, pressure,
|
||||
* and species identity:
|
||||
* The standard state molar volume is independent of temperature, pressure, and
|
||||
* species identity:
|
||||
*
|
||||
* \f[
|
||||
* V^o_k(T,P) = \frac{1.0}{C_o}
|
||||
* \f]
|
||||
* \f[
|
||||
* V^o_k(T,P) = \frac{1.0}{C_o}
|
||||
* \f]
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Specification of Solution Thermodynamic Properties </H2>
|
||||
* <HR>
|
||||
*
|
||||
* The activity of species \f$ k \f$ defined in the phase, \f$ a_k \f$, is
|
||||
* given by the ideal solution law:
|
||||
* The activity of species \f$ k \f$ defined in the phase, \f$ a_k \f$, is given
|
||||
* by the ideal solution law:
|
||||
*
|
||||
* \f[
|
||||
* a_k = X_k ,
|
||||
* \f]
|
||||
* \f[
|
||||
* a_k = X_k ,
|
||||
* \f]
|
||||
*
|
||||
* where \f$ X_k \f$ is the mole fraction of species <I>k</I>.
|
||||
* The chemical potential for species <I>k</I> is equal to
|
||||
* where \f$ X_k \f$ is the mole fraction of species <I>k</I>. The chemical
|
||||
* potential for species <I>k</I> is equal to
|
||||
*
|
||||
* \f[
|
||||
* \mu_k(T,P) = \mu^o_k(T, P) + R T \log(X_k)
|
||||
* \f]
|
||||
* \f[
|
||||
* \mu_k(T,P) = \mu^o_k(T, P) + R T \log(X_k)
|
||||
* \f]
|
||||
*
|
||||
* The partial molar entropy for species <I>k</I> is given by the following relation,
|
||||
* The partial molar entropy for species <I>k</I> is given by the following
|
||||
* relation,
|
||||
*
|
||||
* \f[
|
||||
* \tilde{s}_k(T,P) = s^o_k(T,P) - R \log(X_k) = s^{ref}_k(T) - R \log(X_k)
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{s}_k(T,P) = s^o_k(T,P) - R \log(X_k) = s^{ref}_k(T) - R \log(X_k)
|
||||
* \f]
|
||||
*
|
||||
* The partial molar enthalpy for species <I>k</I> is
|
||||
*
|
||||
* \f[
|
||||
* \tilde{h}_k(T,P) = h^o_k(T,P) = h^{ref}_k(T) + \left( \frac{P - P_{ref}}{C_o} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{h}_k(T,P) = h^o_k(T,P) = h^{ref}_k(T) + \left( \frac{P - P_{ref}}{C_o} \right)
|
||||
* \f]
|
||||
*
|
||||
* The partial molar Internal Energy for species <I>k</I> is
|
||||
*
|
||||
* \f[
|
||||
* \tilde{u}_k(T,P) = u^o_k(T,P) = u^{ref}_k(T)
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{u}_k(T,P) = u^o_k(T,P) = u^{ref}_k(T)
|
||||
* \f]
|
||||
*
|
||||
* The partial molar Heat Capacity for species <I>k</I> is
|
||||
*
|
||||
* \f[
|
||||
* \tilde{Cp}_k(T,P) = Cp^o_k(T,P) = Cp^{ref}_k(T)
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{Cp}_k(T,P) = Cp^o_k(T,P) = Cp^{ref}_k(T)
|
||||
* \f]
|
||||
*
|
||||
* The partial molar volume is independent of temperature, pressure,
|
||||
* and species identity:
|
||||
* The partial molar volume is independent of temperature, pressure, and species
|
||||
* identity:
|
||||
*
|
||||
* \f[
|
||||
* \tilde{V}_k(T,P) = V^o_k(T,P) = \frac{1.0}{C_o}
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{V}_k(T,P) = V^o_k(T,P) = \frac{1.0}{C_o}
|
||||
* \f]
|
||||
*
|
||||
* It is assumed that the reference state thermodynamics may be
|
||||
* obtained by a pointer to a populated species thermodynamic property
|
||||
* manager class (see ThermoPhase::m_spthermo). How to relate pressure
|
||||
* changes to the reference state thermodynamics is resolved at this level.
|
||||
* It is assumed that the reference state thermodynamics may be obtained by a
|
||||
* pointer to a populated species thermodynamic property manager class (see
|
||||
* ThermoPhase::m_spthermo). How to relate pressure changes to the reference
|
||||
* state thermodynamics is resolved at this level.
|
||||
*
|
||||
* Pressure is defined as an independent variable in this phase. However, it only
|
||||
* has a weak dependence on the enthalpy, and doesn't effect the molar
|
||||
* concentration.
|
||||
* Pressure is defined as an independent variable in this phase. However, it
|
||||
* only has a weak dependence on the enthalpy, and doesn't effect the molar
|
||||
* concentration.
|
||||
*
|
||||
* <HR>
|
||||
* <H2> %Application within Kinetics Managers </H2>
|
||||
* <HR>
|
||||
*
|
||||
* \f$ C^a_k\f$ are defined such that \f$ C^a_k = a_k = X_k \f$
|
||||
* \f$ C^s_k \f$, the standard concentration, is
|
||||
* defined to be equal to one. \f$ a_k \f$ are activities used in the
|
||||
* thermodynamic functions. These activity (or generalized)
|
||||
* concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions.
|
||||
* The activity concentration,\f$ C^a_k \f$, is given by the following expression.
|
||||
* \f$ C^a_k\f$ are defined such that \f$ C^a_k = a_k = X_k \f$. \f$ C^s_k \f$,
|
||||
* the standard concentration, is defined to be equal to one. \f$ a_k \f$ are
|
||||
* activities used in the thermodynamic functions. These activity (or
|
||||
* generalized) concentrations are used by kinetics manager classes to compute
|
||||
* the forward and reverse rates of elementary reactions. The activity
|
||||
* concentration,\f$ C^a_k \f$, is given by the following expression.
|
||||
*
|
||||
* \f[
|
||||
* C^a_k = C^s_k X_k = X_k
|
||||
* \f]
|
||||
* \f[
|
||||
* C^a_k = C^s_k X_k = X_k
|
||||
* \f]
|
||||
*
|
||||
* The standard concentration for species <I>k</I> is identically one
|
||||
*
|
||||
* \f[
|
||||
* C^s_k = C^s = 1.0
|
||||
* \f]
|
||||
* \f[
|
||||
* C^s_k = C^s = 1.0
|
||||
* \f]
|
||||
*
|
||||
* For example, a bulk-phase binary gas reaction between species j and k, producing
|
||||
* a new species l would have the
|
||||
* following equation for its rate of progress variable, \f$ R^1 \f$, which has
|
||||
* units of kmol m-3 s-1.
|
||||
* For example, a bulk-phase binary gas reaction between species j and k,
|
||||
* producing a new species l would have the following equation for its rate of
|
||||
* progress variable, \f$ R^1 \f$, which has units of kmol m-3 s-1.
|
||||
*
|
||||
* \f[
|
||||
* \f[
|
||||
* R^1 = k^1 C_j^a C_k^a = k^1 X_j X_k
|
||||
* \f]
|
||||
* \f]
|
||||
*
|
||||
* The reverse rate constant can then be obtained from the law of microscopic reversibility
|
||||
* and the equilibrium expression for the system.
|
||||
* The reverse rate constant can then be obtained from the law of microscopic
|
||||
* reversibility and the equilibrium expression for the system.
|
||||
*
|
||||
* \f[
|
||||
* \frac{X_j X_k}{ X_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
|
||||
* \f]
|
||||
* \f[
|
||||
* \frac{X_j X_k}{ X_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
|
||||
* \f]
|
||||
*
|
||||
* \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, associated with
|
||||
* the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ and their associated activities,
|
||||
* \f$ a_l \f$, repeated here:
|
||||
* \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant,
|
||||
* associated with the pressure dependent standard states \f$ \mu^o_l(T,P) \f$
|
||||
* and their associated activities,
|
||||
* \f$ a_l \f$, repeated here:
|
||||
*
|
||||
* \f[
|
||||
* \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l)
|
||||
* \f]
|
||||
* \f[
|
||||
* \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l)
|
||||
* \f]
|
||||
*
|
||||
* The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over
|
||||
* to activity concentrations. When this is done:
|
||||
* The concentration equilibrium constant, \f$ K_c \f$, may be obtained by
|
||||
* changing over to activity concentrations. When this is done:
|
||||
*
|
||||
* \f[
|
||||
* \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 =
|
||||
* \exp(\frac{\mu^{o}_l - \mu^{o}_j - \mu^{o}_k}{R T} )
|
||||
* \f]
|
||||
*
|
||||
* %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$,
|
||||
* using the second and third part of the above expression as a definition for the concentration
|
||||
* equilibrium constant.
|
||||
* %Kinetics managers will calculate the concentration equilibrium constant, \f$
|
||||
* K_c \f$, using the second and third part of the above expression as a
|
||||
* definition for the concentration equilibrium constant.
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Instantiation of the Class </H2>
|
||||
* <HR>
|
||||
*
|
||||
* The constructor for this phase is located in the default ThermoFactory
|
||||
* for %Cantera. A new LatticePhase object may be created by the following code snippet:
|
||||
* The constructor for this phase is located in the default ThermoFactory for
|
||||
* %Cantera. A new LatticePhase object may be created by the following code
|
||||
* snippet:
|
||||
*
|
||||
* @code
|
||||
* XML_Node *xc = get_XML_File("O_lattice_SiO2.xml");
|
||||
|
|
@ -206,14 +206,14 @@ namespace Cantera
|
|||
* LatticePhase *o_lattice = new LatticePhase(*xs);
|
||||
* @endcode
|
||||
*
|
||||
* The XML file used in this example is listed in the next section
|
||||
* The XML file used in this example is listed in the next section
|
||||
*
|
||||
* <HR>
|
||||
* <H2> XML Example </H2>
|
||||
* <HR>
|
||||
*
|
||||
* An example of an XML Element named phase setting up a LatticePhase object named "O_lattice_SiO2"
|
||||
* is given below.
|
||||
* An example of an XML Element named phase setting up a LatticePhase object
|
||||
* named "O_lattice_SiO2" is given below.
|
||||
*
|
||||
* @code
|
||||
* <!-- phase O_lattice_SiO2 -->
|
||||
|
|
@ -232,8 +232,8 @@ namespace Cantera
|
|||
* </phase>
|
||||
* @endcode
|
||||
*
|
||||
* The model attribute "Lattice" of the thermo XML element identifies the phase as
|
||||
* being of the type handled by the LatticePhase object.
|
||||
* The model attribute "Lattice" of the thermo XML element identifies the phase
|
||||
* as being of the type handled by the LatticePhase object.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
|
|
@ -243,17 +243,9 @@ public:
|
|||
//! Base Empty constructor
|
||||
LatticePhase();
|
||||
|
||||
//! Copy Constructor
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
LatticePhase(const LatticePhase& right);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
LatticePhase& operator=(const LatticePhase& right);
|
||||
ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//! Full constructor for a lattice phase
|
||||
/*!
|
||||
|
|
@ -269,14 +261,6 @@ public:
|
|||
*/
|
||||
LatticePhase(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
//! Duplication function
|
||||
/*!
|
||||
* This virtual function is used to create a duplicate of the
|
||||
* current phase. It's used to duplicate the phase when given
|
||||
* a ThermoPhase pointer to the phase.
|
||||
*/
|
||||
ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//! Equation of state flag. Returns the value cLattice
|
||||
virtual int eosType() const {
|
||||
return cLattice;
|
||||
|
|
@ -293,10 +277,9 @@ public:
|
|||
* \hat h(T,P) = \sum_k X_k \hat h^0_k(T,P),
|
||||
* \f]
|
||||
*
|
||||
* The standard-state pure-species Enthalpies
|
||||
* \f$ \hat h^0_k(T,P) \f$ are computed first by the species reference
|
||||
* state thermodynamic property manager and then a small pressure dependent term is
|
||||
* added in.
|
||||
* The standard-state pure-species Enthalpies \f$ \hat h^0_k(T,P) \f$ are
|
||||
* computed first by the species reference state thermodynamic property
|
||||
* manager and then a small pressure dependent term is added in.
|
||||
*
|
||||
* \see SpeciesThermo
|
||||
*/
|
||||
|
|
@ -309,10 +292,10 @@ public:
|
|||
* \f[
|
||||
* \hat s(T, P, X_k) = \sum_k X_k \hat s^0_k(T) - \hat R \sum_k X_k log(X_k)
|
||||
* \f]
|
||||
* The reference-state pure-species entropies
|
||||
* \f$ \hat s^0_k(T,p_{ref}) \f$ are computed by the species thermodynamic
|
||||
* property manager. The pure species entropies are independent of
|
||||
* pressure since the volume expansivities are equal to zero.
|
||||
* The reference-state pure-species entropies \f$ \hat s^0_k(T,p_{ref}) \f$
|
||||
* are computed by the species thermodynamic property manager. The pure
|
||||
* species entropies are independent of pressure since the volume
|
||||
* expansivities are equal to zero.
|
||||
*
|
||||
* Units: J/kmol/K.
|
||||
*
|
||||
|
|
@ -328,10 +311,9 @@ public:
|
|||
* \f[
|
||||
* \hat c_p(T,P) = \sum_k X_k \hat c^0_{p,k}(T) .
|
||||
* \f]
|
||||
* The heat capacity is independent of pressure.
|
||||
* The reference-state pure-species heat capacities
|
||||
* \f$ \hat c^0_{p,k}(T) \f$ are computed by the species thermodynamic
|
||||
* property manager.
|
||||
* The heat capacity is independent of pressure. The reference-state pure-
|
||||
* species heat capacities \f$ \hat c^0_{p,k}(T) \f$ are computed by the
|
||||
* species thermodynamic property manager.
|
||||
*
|
||||
* @see SpeciesThermo
|
||||
*/
|
||||
|
|
@ -353,12 +335,11 @@ public:
|
|||
//@}
|
||||
/// @name Mechanical Equation of State Properties
|
||||
/**
|
||||
* In this equation of state implementation, the density is a
|
||||
* function only of the mole fractions. Therefore, it can't be
|
||||
* an independent variable. Instead, the pressure is used as the
|
||||
* independent variable. Functions which try to set the thermodynamic
|
||||
* state by calling setDensity() may cause an exception to be
|
||||
* thrown.
|
||||
* In this equation of state implementation, the density is a function only
|
||||
* of the mole fractions. Therefore, it can't be an independent variable.
|
||||
* Instead, the pressure is used as the independent variable. Functions
|
||||
* which try to set the thermodynamic state by calling setDensity() may
|
||||
* cause an exception to be thrown.
|
||||
*/
|
||||
//@{
|
||||
|
||||
|
|
@ -371,18 +352,18 @@ public:
|
|||
return m_Pcurrent;
|
||||
}
|
||||
|
||||
//! Set the internally stored pressure (Pa) at constant
|
||||
//! temperature and composition
|
||||
//! Set the internally stored pressure (Pa) at constant temperature and
|
||||
//! composition
|
||||
/*!
|
||||
* This method sets the pressure within the object.
|
||||
* The mass density is not a function of pressure.
|
||||
* This method sets the pressure within the object. The mass density is not
|
||||
* a function of pressure.
|
||||
*
|
||||
* @param p Input Pressure (Pa)
|
||||
*/
|
||||
virtual void setPressure(doublereal p);
|
||||
|
||||
//! Calculate the density of the mixture using the partial
|
||||
//! molar volumes and mole fractions as input
|
||||
//! Calculate the density of the mixture using the partial molar volumes and
|
||||
//! mole fractions as input
|
||||
/*!
|
||||
* The formula for this is
|
||||
*
|
||||
|
|
@ -390,78 +371,33 @@ public:
|
|||
* \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}}
|
||||
* \f]
|
||||
*
|
||||
* where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are
|
||||
* the molecular weights, and \f$V_k\f$ are the pure species
|
||||
* molar volumes.
|
||||
* where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular
|
||||
* weights, and \f$V_k\f$ are the pure species molar volumes.
|
||||
*
|
||||
* Note, the basis behind this formula is that in an ideal
|
||||
* solution the partial molar volumes are equal to the pure
|
||||
* species molar volumes. We have additionally specified
|
||||
* in this class that the pure species molar volumes are
|
||||
* independent of temperature and pressure.
|
||||
* Note, the basis behind this formula is that in an ideal solution the
|
||||
* partial molar volumes are equal to the pure species molar volumes. We
|
||||
* have additionally specified in this class that the pure species molar
|
||||
* volumes are independent of temperature and pressure.
|
||||
*/
|
||||
doublereal calcDensity();
|
||||
|
||||
//! Set the mole fractions
|
||||
/*!
|
||||
* @param x Input vector of mole fractions.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void setMoleFractions(const doublereal* const x);
|
||||
|
||||
//! Set the mole fractions, but don't normalize them to one.
|
||||
/*!
|
||||
* @param x Input vector of mole fractions.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void setMoleFractions_NoNorm(const doublereal* const x);
|
||||
|
||||
//! Set the mass fractions, and normalize them to one.
|
||||
/*!
|
||||
* @param y Input vector of mass fractions.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void setMassFractions(const doublereal* const y);
|
||||
|
||||
//! Set the mass fractions, but don't normalize them to one
|
||||
/*!
|
||||
* @param y Input vector of mass fractions.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void setMassFractions_NoNorm(const doublereal* const y);
|
||||
|
||||
//! Set the concentration,
|
||||
/*!
|
||||
* @param c Input vector of concentrations.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void setConcentrations(const doublereal* const c);
|
||||
|
||||
//@}
|
||||
/// @name Activities, Standard States, and Activity Concentrations
|
||||
/**
|
||||
* The activity \f$a_k\f$ of a species in solution is
|
||||
* related to the chemical potential by \f[ \mu_k = \mu_k^0(T)
|
||||
* + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is
|
||||
* the chemical potential at unit activity, which depends only
|
||||
* on temperature and the pressure.
|
||||
* Activity is assumed to be molality-based here.
|
||||
* The activity \f$a_k\f$ of a species in solution is related to the
|
||||
* chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The
|
||||
* quantity \f$\mu_k^0(T,P)\f$ is the chemical potential at unit activity,
|
||||
* which depends only on temperature and the pressure. Activity is assumed
|
||||
* to be molality-based here.
|
||||
*/
|
||||
//@{
|
||||
|
||||
/**
|
||||
* This method returns an array of generalized concentrations
|
||||
* \f$ C_k\f$ that are defined such that
|
||||
* \f$ a_k = C_k / C^0_k, \f$ where \f$ C^0_k \f$
|
||||
* is a standard concentration
|
||||
* defined below. These generalized concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions.
|
||||
*
|
||||
* @param c Array of generalized concentrations. The
|
||||
* units depend upon the implementation of the
|
||||
* reaction rate expressions within the phase.
|
||||
*/
|
||||
virtual void getActivityConcentrations(doublereal* c) const;
|
||||
|
||||
//! Return the standard concentration for the kth species
|
||||
|
|
@ -469,14 +405,13 @@ public:
|
|||
* The standard concentration \f$ C^0_k \f$ used to normalize
|
||||
* the activity (i.e., generalized) concentration for use
|
||||
*
|
||||
* For the time being, we will use the concentration of pure
|
||||
* solvent for the the standard concentration of all species.
|
||||
* This has the effect of making mass-action reaction rates
|
||||
* based on the molality of species proportional to the
|
||||
* molality of the species.
|
||||
* For the time being, we will use the concentration of pure solvent for the
|
||||
* the standard concentration of all species. This has the effect of making
|
||||
* mass-action reaction rates based on the molality of species proportional
|
||||
* to the molality of the species.
|
||||
*
|
||||
* @param k Optional parameter indicating the species. The default
|
||||
* is to assume this refers to species 0.
|
||||
* @param k Optional parameter indicating the species. The default is to
|
||||
* assume this refers to species 0.
|
||||
* @return
|
||||
* Returns the standard Concentration in units of
|
||||
* m<SUP>3</SUP> kmol<SUP>-1</SUP>.
|
||||
|
|
@ -484,12 +419,6 @@ public:
|
|||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
//! Returns the natural logarithm of the standard
|
||||
//! concentration of the kth species
|
||||
/*!
|
||||
* @param k Species index
|
||||
*/
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
//! Get the array of non-dimensional activity coefficients at
|
||||
|
|
@ -507,9 +436,9 @@ public:
|
|||
|
||||
//! Get the species chemical potentials. Units: J/kmol.
|
||||
/*!
|
||||
* This function returns a vector of chemical potentials of the
|
||||
* species in solid solution at the current temperature, pressure
|
||||
* and mole fraction of the solid solution.
|
||||
* This function returns a vector of chemical potentials of the species in
|
||||
* solid solution at the current temperature, pressure and mole fraction of
|
||||
* the solid solution.
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
|
|
@ -521,18 +450,16 @@ public:
|
|||
//@{
|
||||
|
||||
/**
|
||||
* Returns an array of partial molar enthalpies for the species
|
||||
* in the mixture.
|
||||
* Units (J/kmol)
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* pure species enthalpies
|
||||
* \f[
|
||||
* Returns an array of partial molar enthalpies for the species in the
|
||||
* mixture. Units (J/kmol). For this phase, the partial molar enthalpies are
|
||||
* equal to the pure species enthalpies
|
||||
* \f[
|
||||
* \bar h_k(T,P) = \hat h^{ref}_k(T) + (P - P_{ref}) \hat V^0_k
|
||||
* \f]
|
||||
* The reference-state pure-species enthalpies, \f$ \hat h^{ref}_k(T) \f$,
|
||||
* at the reference pressure,\f$ P_{ref} \f$,
|
||||
* are computed by the species thermodynamic
|
||||
* property manager. They are polynomial functions of temperature.
|
||||
* at the reference pressure,\f$ P_{ref} \f$, are computed by the species
|
||||
* thermodynamic property manager. They are polynomial functions of
|
||||
* temperature.
|
||||
* @see SpeciesThermo
|
||||
*
|
||||
* @param hbar Output vector containing partial molar enthalpies.
|
||||
|
|
@ -542,16 +469,16 @@ public:
|
|||
|
||||
/**
|
||||
* Returns an array of partial molar entropies of the species in the
|
||||
* solution. Units: J/kmol/K.
|
||||
* For this phase, the partial molar entropies are equal to the
|
||||
* pure species entropies plus the ideal solution contribution.
|
||||
* \f[
|
||||
* solution. Units: J/kmol/K. For this phase, the partial molar entropies
|
||||
* are equal to the pure species entropies plus the ideal solution
|
||||
* contribution.
|
||||
* \f[
|
||||
* \bar s_k(T,P) = \hat s^0_k(T) - R log(X_k)
|
||||
* \f]
|
||||
* The reference-state pure-species entropies,\f$ \hat s^{ref}_k(T) \f$,
|
||||
* at the reference pressure, \f$ P_{ref} \f$, are computed by the
|
||||
* species thermodynamic
|
||||
* property manager. They are polynomial functions of temperature.
|
||||
* The reference-state pure-species entropies,\f$ \hat s^{ref}_k(T) \f$, at
|
||||
* the reference pressure, \f$ P_{ref} \f$, are computed by the species
|
||||
* thermodynamic property manager. They are polynomial functions of
|
||||
* temperature.
|
||||
* @see SpeciesThermo
|
||||
*
|
||||
* @param sbar Output vector containing partial molar entropies.
|
||||
|
|
@ -560,126 +487,100 @@ public:
|
|||
virtual void getPartialMolarEntropies(doublereal* sbar) const;
|
||||
|
||||
/**
|
||||
* Returns an array of partial molar Heat Capacities at constant
|
||||
* pressure of the species in the
|
||||
* solution. Units: J/kmol/K.
|
||||
* For this phase, the partial molar heat capacities are equal
|
||||
* to the standard state heat capacities.
|
||||
* Returns an array of partial molar Heat Capacities at constant pressure of
|
||||
* the species in the solution. Units: J/kmol/K. For this phase, the partial
|
||||
* molar heat capacities are equal to the standard state heat capacities.
|
||||
*
|
||||
* @param cpbar Output vector of partial heat capacities. Length: m_kk.
|
||||
*/
|
||||
virtual void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
||||
//! Return an array of partial molar volumes for the
|
||||
//! species in the mixture. Units: m^3/kmol.
|
||||
/*!
|
||||
* @param vbar Output vector of species partial molar volumes.
|
||||
* Length = m_kk. units are m^3/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarVolumes(doublereal* vbar) const;
|
||||
|
||||
//! Get the array of chemical potentials at unit activity for the
|
||||
//! species standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* These are the standard state chemical potentials \f$ \mu^0_k(T,P)
|
||||
* \f$. The values are evaluated at the current
|
||||
* temperature and pressure of the solution
|
||||
*
|
||||
* @param mu Output vector of chemical potentials.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getStandardChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Get the Gibbs functions for the standard
|
||||
//! state of the species at the current <I>T</I> and <I>P</I> of the solution
|
||||
/*!
|
||||
* Units are Joules/kmol
|
||||
* @param gpure Output vector of standard state Gibbs free energies
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getPureGibbs(doublereal* gpure) const;
|
||||
|
||||
//@}
|
||||
/// @name Properties of the Standard State of the Species in the Solution
|
||||
//@{
|
||||
|
||||
//! Get the nondimensional Enthalpy functions for the species standard states
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
//! Get the nondimensional Enthalpy functions for the species standard
|
||||
//! states at their standard states at the current <I>T</I> and <I>P</I> of
|
||||
//! the solution.
|
||||
/*!
|
||||
* A small pressure dependent term is added onto the reference state enthalpy
|
||||
* to get the pressure dependence of this term.
|
||||
* A small pressure dependent term is added onto the reference state enthalpy
|
||||
* to get the pressure dependence of this term.
|
||||
*
|
||||
* \f[
|
||||
* h^o_k(T,P) = h^{ref}_k(T) + \left( \frac{P - P_{ref}}{C_o} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* h^o_k(T,P) = h^{ref}_k(T) + \left( \frac{P - P_{ref}}{C_o} \right)
|
||||
* \f]
|
||||
*
|
||||
* The reference state thermodynamics is
|
||||
* obtained by a pointer to a populated species thermodynamic property
|
||||
* manager class (see ThermoPhase::m_spthermo). How to relate pressure
|
||||
* changes to the reference state thermodynamics is resolved at this level.
|
||||
* The reference state thermodynamics is obtained by a pointer to a
|
||||
* populated species thermodynamic property manager class (see
|
||||
* ThermoPhase::m_spthermo). How to relate pressure changes to the reference
|
||||
* state thermodynamics is resolved at this level.
|
||||
*
|
||||
* @param hrt Output vector of nondimensional standard state enthalpies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEnthalpy_RT(doublereal* hrt) const;
|
||||
|
||||
//! Get the array of nondimensional Entropy functions for the
|
||||
//! species standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
//! Get the array of nondimensional Entropy functions for the species
|
||||
//! standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* The entropy of the standard state is defined as independent of
|
||||
* pressure here.
|
||||
* The entropy of the standard state is defined as independent of
|
||||
* pressure here.
|
||||
*
|
||||
* \f[
|
||||
* s^o_k(T,P) = s^{ref}_k(T)
|
||||
* \f]
|
||||
* \f[
|
||||
* s^o_k(T,P) = s^{ref}_k(T)
|
||||
* \f]
|
||||
*
|
||||
* The reference state thermodynamics is
|
||||
* obtained by a pointer to a populated species thermodynamic property
|
||||
* manager class (see ThermoPhase::m_spthermo). How to relate pressure
|
||||
* changes to the reference state thermodynamics is resolved at this level.
|
||||
* The reference state thermodynamics is obtained by a pointer to a
|
||||
* populated species thermodynamic property manager class (see
|
||||
* ThermoPhase::m_spthermo). How to relate pressure changes to the reference
|
||||
* state thermodynamics is resolved at this level.
|
||||
*
|
||||
* @param sr Output vector of nondimensional standard state entropies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEntropy_R(doublereal* sr) const;
|
||||
|
||||
//! Get the nondimensional Gibbs functions for the species
|
||||
//! standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
//! Get the nondimensional Gibbs functions for the species standard states
|
||||
//! at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* The standard Gibbs free energies are obtained from the enthalpy
|
||||
* and entropy formulation.
|
||||
* The standard Gibbs free energies are obtained from the enthalpy and
|
||||
* entropy formulation.
|
||||
*
|
||||
* \f[
|
||||
* g^o_k(T,P) = h^{o}_k(T,P) - T s^{o}_k(T,P)
|
||||
* \f]
|
||||
* \f[
|
||||
* g^o_k(T,P) = h^{o}_k(T,P) - T s^{o}_k(T,P)
|
||||
* \f]
|
||||
*
|
||||
* @param grt Output vector of nondimensional standard state Gibbs free energies
|
||||
* Length: m_kk.
|
||||
* @param grt Output vector of nondimensional standard state Gibbs free
|
||||
* energies. Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT(doublereal* grt) const;
|
||||
|
||||
//! Get the nondimensional Heat Capacities at constant
|
||||
//! pressure for the species standard states
|
||||
//! at the current <I>T</I> and <I>P</I> of the solution
|
||||
//! Get the nondimensional Heat Capacities at constant pressure for the
|
||||
//! species standard states at the current <I>T</I> and <I>P</I> of the
|
||||
//! solution
|
||||
/*!
|
||||
* The heat capacity of the standard state is independent of pressure
|
||||
* The heat capacity of the standard state is independent of pressure
|
||||
*
|
||||
* \f[
|
||||
* Cp^o_k(T,P) = Cp^{ref}_k(T)
|
||||
* \f]
|
||||
* \f[
|
||||
* Cp^o_k(T,P) = Cp^{ref}_k(T)
|
||||
* \f]
|
||||
*
|
||||
* The reference state thermodynamics is
|
||||
* obtained by a pointer to a populated species thermodynamic property
|
||||
* manager class (see ThermoPhase::m_spthermo). How to relate pressure
|
||||
* changes to the reference state thermodynamics is resolved at this level.
|
||||
* The reference state thermodynamics is obtained by a pointer to a
|
||||
* populated species thermodynamic property manager class (see
|
||||
* ThermoPhase::m_spthermo). How to relate pressure changes to the reference
|
||||
* state thermodynamics is resolved at this level.
|
||||
*
|
||||
* @param cpr Output vector of nondimensional standard state heat capacities
|
||||
* Length: m_kk.
|
||||
* @param cpr Output vector of nondimensional standard state heat
|
||||
* capacities. Length: m_kk.
|
||||
*/
|
||||
virtual void getCp_R(doublereal* cpr) const;
|
||||
|
||||
//! Get the molar volumes of the species standard states at the current
|
||||
//! <I>T</I> and <I>P</I> of the solution.
|
||||
//! Get the molar volumes of the species standard states at the current
|
||||
//! <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* units = m^3 / kmol
|
||||
*
|
||||
|
|
@ -692,40 +593,17 @@ public:
|
|||
/// @name Thermodynamic Values for the Species Reference States
|
||||
//@{
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! Enthalpies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the phase.
|
||||
/*!
|
||||
* @return Output vector of nondimensional reference state
|
||||
* Enthalpies of the species.
|
||||
* Length: m_kk
|
||||
*/
|
||||
const vector_fp& enthalpy_RT_ref() const;
|
||||
|
||||
//! Returns a reference to the dimensionless reference state Gibbs free energy vector.
|
||||
//! Returns a reference to the dimensionless reference state Gibbs free
|
||||
//! energy vector.
|
||||
/*!
|
||||
* This function is part of the layer that checks/recalculates the reference
|
||||
* state thermo functions.
|
||||
*/
|
||||
const vector_fp& gibbs_RT_ref() const;
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! Gibbs Free Energies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
/*!
|
||||
* @param grt Output vector containing the nondimensional reference state
|
||||
* Gibbs Free energies. Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT_ref(doublereal* grt) const;
|
||||
|
||||
//! Returns the vector of the Gibbs function of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
/*!
|
||||
* units = J/kmol
|
||||
*
|
||||
* @param g Output vector containing the reference state
|
||||
* Gibbs Free energies. Length: m_kk. Units: J/kmol.
|
||||
*/
|
||||
virtual void getGibbs_ref(doublereal* g) const;
|
||||
|
||||
//! Returns a reference to the dimensionless reference state Entropy vector.
|
||||
|
|
@ -735,7 +613,8 @@ public:
|
|||
*/
|
||||
const vector_fp& entropy_R_ref() const;
|
||||
|
||||
//! Returns a reference to the dimensionless reference state Heat Capacity vector.
|
||||
//! Returns a reference to the dimensionless reference state Heat Capacity
|
||||
//! vector.
|
||||
/*!
|
||||
* This function is part of the layer that checks/recalculates the reference
|
||||
* state thermo functions.
|
||||
|
|
@ -746,44 +625,7 @@ public:
|
|||
/// @name Utilities for Initialization of the Object
|
||||
//@{
|
||||
|
||||
//! Initialize the ThermoPhase object after all species have been set up
|
||||
/*!
|
||||
* @internal Initialize.
|
||||
*
|
||||
* This method performs any initialization required after all
|
||||
* species have been added. For example, it is used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species.
|
||||
* This method is called from ThermoPhase::initThermoXML(),
|
||||
* which is called from importPhase(),
|
||||
* just prior to returning from the function, importPhase().
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
//! Import and initialize a ThermoPhase object using an XML tree.
|
||||
/*!
|
||||
* Here we read extra information about the XML description
|
||||
* of a phase. Regular information about elements and species
|
||||
* and their reference state thermodynamic information
|
||||
* have already been read at this point.
|
||||
* For example, we do not need to call this function for
|
||||
* ideal gas equations of state.
|
||||
* This function is called from importPhase()
|
||||
* after the elements and the
|
||||
* species are initialized with default ideal solution
|
||||
* level data.
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a
|
||||
* complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
//! Set the equation of state parameters from the argument list
|
||||
|
|
@ -818,8 +660,8 @@ public:
|
|||
* model. Note, this method is called before the phase is
|
||||
* initialized with elements and/or species.
|
||||
*
|
||||
* For this phase, the molar density of the phase is specified in this block,
|
||||
* and is a required parameter.
|
||||
* For this phase, the molar density of the phase is specified in this
|
||||
* block, and is a required parameter.
|
||||
*
|
||||
* @param eosdata An XML_Node object corresponding to
|
||||
* the "thermo" entry for this phase in the input file.
|
||||
|
|
@ -844,10 +686,10 @@ protected:
|
|||
|
||||
//! The current pressure
|
||||
/*!
|
||||
* Since the density isn't a function of pressure, but only of the
|
||||
* mole fractions, we need to independently specify the pressure.
|
||||
* The density variable which is inherited as part of the State class,
|
||||
* m_dens, is always kept current whenever T, P, or X[] change.
|
||||
* Since the density isn't a function of pressure, but only of the mole
|
||||
* fractions, we need to independently specify the pressure. The density
|
||||
* variable which is inherited as part of the State class, m_dens, is always
|
||||
* kept current whenever T, P, or X[] change.
|
||||
*/
|
||||
doublereal m_Pcurrent;
|
||||
|
||||
|
|
@ -860,7 +702,8 @@ protected:
|
|||
//! Temporary storage for the reference state Gibbs energies
|
||||
mutable vector_fp m_g0_RT;
|
||||
|
||||
//! Temporary storage for the reference state entropies at the current temperature
|
||||
//! Temporary storage for the reference state entropies at the current
|
||||
//! temperature
|
||||
mutable vector_fp m_s0_R;
|
||||
|
||||
//! String name for the species which represents a vacancy in the lattice
|
||||
|
|
@ -886,8 +729,8 @@ protected:
|
|||
private:
|
||||
//! Update the species reference state thermodynamic functions
|
||||
/*!
|
||||
* The polynomials for the standard state functions are only
|
||||
* reevaluated if the temperature has changed.
|
||||
* The polynomials for the standard state functions are only reevaluated if
|
||||
* the temperature has changed.
|
||||
*/
|
||||
void _updateThermo() const;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
/**
|
||||
* @file LatticeSolidPhase.h
|
||||
* Header for a simple thermodynamics model of a bulk solid phase
|
||||
* derived from ThermoPhase,
|
||||
* assuming an ideal solution model based on a lattice of solid atoms
|
||||
* (see \ref thermoprops and class \link Cantera::LatticeSolidPhase LatticeSolidPhase\endlink).
|
||||
* @file LatticeSolidPhase.h Header for a simple thermodynamics model of a bulk
|
||||
* solid phase derived from ThermoPhase, assuming an ideal solution model
|
||||
* based on a lattice of solid atoms (see \ref thermoprops and class \link
|
||||
* Cantera::LatticeSolidPhase LatticeSolidPhase\endlink).
|
||||
*/
|
||||
|
||||
// Copyright 2005 California Institute of Technology
|
||||
|
|
@ -17,85 +16,96 @@
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
//! A phase that is comprised of a fixed additive combination of other lattice phases
|
||||
//! A phase that is comprised of a fixed additive combination of other lattice
|
||||
//! phases
|
||||
/*!
|
||||
* This is the main way %Cantera describes semiconductors and other solid phases.
|
||||
* This ThermoPhase object calculates its properties as a sum over other LatticePhase objects. Each of the LatticePhase
|
||||
* objects is a ThermoPhase object by itself.
|
||||
* This is the main way %Cantera describes semiconductors and other solid
|
||||
* phases. This ThermoPhase object calculates its properties as a sum over other
|
||||
* LatticePhase objects. Each of the LatticePhase objects is a ThermoPhase
|
||||
* object by itself.
|
||||
*
|
||||
* The results from this LatticeSolidPhase model reduces to the LatticePhase model when there is one
|
||||
* lattice phase and the molar densities of the sublattice and the molar density within the LatticeSolidPhase
|
||||
* have the same values.
|
||||
* The results from this LatticeSolidPhase model reduces to the LatticePhase
|
||||
* model when there is one lattice phase and the molar densities of the
|
||||
* sublattice and the molar density within the LatticeSolidPhase have the same
|
||||
* values.
|
||||
*
|
||||
* The mole fraction vector is redefined witin the the LatticeSolidPhase object. Each of the mole
|
||||
* fractions sum to one on each of the sublattices. The routine getMoleFraction() and setMoleFraction()
|
||||
* have been redefined to use this convention.
|
||||
* The mole fraction vector is redefined witin the the LatticeSolidPhase object.
|
||||
* Each of the mole fractions sum to one on each of the sublattices. The
|
||||
* routine getMoleFraction() and setMoleFraction() have been redefined to use
|
||||
* this convention.
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Specification of Species Standard State Properties </H2>
|
||||
* <HR>
|
||||
*
|
||||
* The standard state properties are calculated in the normal way for each of the sublattices. The normal way
|
||||
* here means that a thermodynamic polynomial in temperature is developed. Also, a constant volume approximation
|
||||
* for the pressure dependence is assumed. All of these properties are on a Joules per kmol of sublattice
|
||||
* constituent basis.
|
||||
* The standard state properties are calculated in the normal way for each of
|
||||
* the sublattices. The normal way here means that a thermodynamic polynomial in
|
||||
* temperature is developed. Also, a constant volume approximation for the
|
||||
* pressure dependence is assumed. All of these properties are on a Joules per
|
||||
* kmol of sublattice constituent basis.
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Specification of Solution Thermodynamic Properties </H2>
|
||||
* <HR>
|
||||
|
||||
* The sum over the LatticePhase objects is carried out by weighting each LatticePhase object
|
||||
* value with the molar density (kmol m-3) of its LatticePhase. Then the resulting quantity is divided by
|
||||
* the molar density of the total compound. The LatticeSolidPhase object therefore only contains a
|
||||
* listing of the number of LatticePhase object
|
||||
* that comprises the solid, and it contains a value for the molar density of the entire mixture.
|
||||
* This is the same thing as saying that
|
||||
*
|
||||
* \f[
|
||||
* L_i = L^{solid} \theta_i
|
||||
* \f]
|
||||
* The sum over the LatticePhase objects is carried out by weighting each
|
||||
* LatticePhase object value with the molar density (kmol m-3) of its
|
||||
* LatticePhase. Then the resulting quantity is divided by the molar density of
|
||||
* the total compound. The LatticeSolidPhase object therefore only contains a
|
||||
* listing of the number of LatticePhase object that comprises the solid, and it
|
||||
* contains a value for the molar density of the entire mixture. This is the
|
||||
* same thing as saying that
|
||||
*
|
||||
* \f$ L_i \f$ is the molar volume of the ith lattice. \f$ L^{solid} \f$ is the molar volume of the entire
|
||||
* solid. \f$ \theta_i \f$ is a fixed weighting factor for the ith lattice representing the lattice
|
||||
* stoichiometric coefficient. For this object the \f$ \theta_i \f$ values are fixed.
|
||||
* \f[
|
||||
* L_i = L^{solid} \theta_i
|
||||
* \f]
|
||||
*
|
||||
* Let's take FeS2 as an example, which may be thought of as a combination of two lattices: Fe and S lattice.
|
||||
* The Fe sublattice has a molar density of 1 gmol cm-3. The S sublattice has a molar density of 2 gmol cm-3.
|
||||
* We then define the LatticeSolidPhase object as having a nominal composition of FeS2, and having a
|
||||
* molar density of 1 gmol cm-3. All quantities pertaining to the FeS2 compound will be have weights
|
||||
* associated with the sublattices. The Fe sublattice will have a weight of 1.0 associated with it. The
|
||||
* S sublattice will have a weight of 2.0 associated with it.
|
||||
* \f$ L_i \f$ is the molar volume of the ith lattice. \f$ L^{solid} \f$ is the
|
||||
* molar volume of the entire solid. \f$ \theta_i \f$ is a fixed weighting
|
||||
* factor for the ith lattice representing the lattice stoichiometric
|
||||
* coefficient. For this object the \f$ \theta_i \f$ values are fixed.
|
||||
*
|
||||
* Let's take FeS2 as an example, which may be thought of as a combination of
|
||||
* two lattices: Fe and S lattice. The Fe sublattice has a molar density of 1
|
||||
* gmol cm-3. The S sublattice has a molar density of 2 gmol cm-3. We then
|
||||
* define the LatticeSolidPhase object as having a nominal composition of FeS2,
|
||||
* and having a molar density of 1 gmol cm-3. All quantities pertaining to the
|
||||
* FeS2 compound will be have weights associated with the sublattices. The Fe
|
||||
* sublattice will have a weight of 1.0 associated with it. The S sublattice
|
||||
* will have a weight of 2.0 associated with it.
|
||||
*
|
||||
* <HR>
|
||||
* <H3> Specification of Solution Density Properties </H3>
|
||||
* <HR>
|
||||
*
|
||||
* Currently, molar density is not a constant within the object, even though the species molar volumes are a
|
||||
* constant. The basic idea is that a swelling of one of the sublattices will result in a swelling of
|
||||
* of all of the lattices. Therefore, the molar volumes of the individual lattices are not independent of
|
||||
* one another.
|
||||
* Currently, molar density is not a constant within the object, even though the
|
||||
* species molar volumes are a constant. The basic idea is that a swelling of
|
||||
* one of the sublattices will result in a swelling of of all of the lattices.
|
||||
* Therefore, the molar volumes of the individual lattices are not independent
|
||||
* of one another.
|
||||
*
|
||||
* The molar volume of the Lattice solid is calculated from the following formula
|
||||
* The molar volume of the Lattice solid is calculated from the following
|
||||
* formula
|
||||
*
|
||||
* \f[
|
||||
* V = \sum_i{ \theta_i V_i^{lattice}}
|
||||
* \f]
|
||||
*
|
||||
* where \f$ V_i^{lattice} \f$ is the molar volume of the ith sublattice. This is calculated from the
|
||||
* following standard formula.
|
||||
* where \f$ V_i^{lattice} \f$ is the molar volume of the ith sublattice. This
|
||||
* is calculated from the following standard formula.
|
||||
*
|
||||
* \f[
|
||||
* V_i = \sum_k{ X_k V_k}
|
||||
* \f]
|
||||
*
|
||||
* \f[
|
||||
* V_i = \sum_k{ X_k V_k}
|
||||
* \f]
|
||||
* where k is a species in the ith sublattice.
|
||||
*
|
||||
* where k is a species in the ith sublattice.
|
||||
* The mole fraction vector is redefined witin the the LatticeSolidPhase object.
|
||||
* Each of the mole fractions sum to one on each of the sublattices. The
|
||||
* routine getMoleFraction() and setMoleFraction() have been redefined to use
|
||||
* this convention.
|
||||
*
|
||||
* The mole fraction vector is redefined witin the the LatticeSolidPhase object. Each of the mole
|
||||
* fractions sum to one on each of the sublattices. The routine getMoleFraction() and setMoleFraction()
|
||||
* have been redefined to use this convention.
|
||||
*
|
||||
* (This object is still under construction)
|
||||
* (This object is still under construction)
|
||||
*/
|
||||
class LatticeSolidPhase : public ThermoPhase
|
||||
{
|
||||
|
|
@ -103,29 +113,9 @@ public:
|
|||
//! Base empty constructor
|
||||
LatticeSolidPhase();
|
||||
|
||||
//! Copy Constructor
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
LatticeSolidPhase(const LatticeSolidPhase& right);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
LatticeSolidPhase& operator=(const LatticeSolidPhase& right);
|
||||
|
||||
//! Destructor
|
||||
virtual ~LatticeSolidPhase();
|
||||
|
||||
//! Duplication function
|
||||
/*!
|
||||
* This virtual function is used to create a duplicate of the
|
||||
* current phase. It's used to duplicate the phase when given
|
||||
* a ThermoPhase pointer to the phase.
|
||||
*
|
||||
* @return It returns a ThermoPhase pointer.
|
||||
*/
|
||||
ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//! Equation of state type flag.
|
||||
|
|
@ -136,41 +126,13 @@ public:
|
|||
return cLatticeSolid;
|
||||
}
|
||||
|
||||
//! Minimum temperature for which the thermodynamic data for the species
|
||||
//! or phase are valid.
|
||||
/*!
|
||||
* If no argument is supplied, the
|
||||
* value returned will be the lowest temperature at which the
|
||||
* data for \e all species are valid. Otherwise, the value
|
||||
* will be only for species \a k. This function is a wrapper
|
||||
* that calls the species thermo minTemp function.
|
||||
*
|
||||
* @param k index of the species. Default is -1, which will return the max of the min value
|
||||
* over all species.
|
||||
*/
|
||||
virtual doublereal minTemp(size_t k = npos) const;
|
||||
|
||||
//! Maximum temperature for which the thermodynamic data for the species
|
||||
//! are valid.
|
||||
/*!
|
||||
* If no argument is supplied, the
|
||||
* value returned will be the highest temperature at which the
|
||||
* data for \e all species are valid. Otherwise, the value
|
||||
* will be only for species \a k. This function is a wrapper
|
||||
* that calls the species thermo maxTemp function.
|
||||
*
|
||||
* @param k index of the species. Default is -1, which will return the min of the max value
|
||||
* over all species.
|
||||
*/
|
||||
virtual doublereal maxTemp(size_t k = npos) const;
|
||||
|
||||
//! Returns the reference pressure in Pa. This function is a wrapper
|
||||
//! that calls the species thermo refPressure function.
|
||||
virtual doublereal refPressure() const;
|
||||
|
||||
//! This method returns the convention used in specification
|
||||
//! of the standard state, of which there are currently two,
|
||||
//! temperature based, and variable pressure based.
|
||||
//! This method returns the convention used in specification of the standard
|
||||
//! state, of which there are currently two, temperature based, and variable
|
||||
//! pressure based.
|
||||
/*!
|
||||
* All of the thermo is determined by slave ThermoPhase routines.
|
||||
*/
|
||||
|
|
@ -180,8 +142,8 @@ public:
|
|||
|
||||
//! Return the Molar Enthalpy. Units: J/kmol.
|
||||
/*!
|
||||
* The molar enthalpy is determined by the following formula, where \f$ \theta_n \f$ is the
|
||||
* lattice stoichiometric coefficient of the nth lattice
|
||||
* The molar enthalpy is determined by the following formula, where \f$
|
||||
* \theta_n \f$ is the lattice stoichiometric coefficient of the nth lattice
|
||||
*
|
||||
* \f[
|
||||
* \tilde h(T,P) = {\sum_n \theta_n \tilde h_n(T,P) }
|
||||
|
|
@ -195,14 +157,15 @@ public:
|
|||
|
||||
//! Return the Molar Internal Energy. Units: J/kmol.
|
||||
/*!
|
||||
* The molar enthalpy is determined by the following formula, where \f$ \theta_n \f$ is the
|
||||
* lattice stoichiometric coefficient of the nth lattice
|
||||
* The molar enthalpy is determined by the following formula, where \f$
|
||||
* \theta_n \f$ is the lattice stoichiometric coefficient of the nth lattice
|
||||
*
|
||||
* \f[
|
||||
* \tilde u(T,P) = {\sum_n \theta_n \tilde u_n(T,P) }
|
||||
* \f]
|
||||
*
|
||||
* \f$ \tilde u_n(T,P) \f$ is the internal energy of the n<SUP>th</SUP> lattice.
|
||||
* \f$ \tilde u_n(T,P) \f$ is the internal energy of the n<SUP>th</SUP>
|
||||
* lattice.
|
||||
*
|
||||
* units J/kmol
|
||||
*/
|
||||
|
|
@ -210,8 +173,8 @@ public:
|
|||
|
||||
//! Return the Molar Entropy. Units: J/kmol/K.
|
||||
/*!
|
||||
* The molar enthalpy is determined by the following formula, where \f$ \theta_n \f$ is the
|
||||
* lattice stoichiometric coefficient of the nth lattice
|
||||
* The molar enthalpy is determined by the following formula, where \f$
|
||||
* \theta_n \f$ is the lattice stoichiometric coefficient of the nth lattice
|
||||
*
|
||||
* \f[
|
||||
* \tilde s(T,P) = \sum_n \theta_n \tilde s_n(T,P)
|
||||
|
|
@ -225,8 +188,9 @@ public:
|
|||
|
||||
//! Return the Molar Gibbs energy. Units: J/kmol.
|
||||
/*!
|
||||
* The molar Gibbs free energy is determined by the following formula, where \f$ \theta_n \f$ is the
|
||||
* lattice stoichiometric coefficient of the nth lattice
|
||||
* The molar Gibbs free energy is determined by the following formula, where
|
||||
* \f$ \theta_n \f$ is the lattice stoichiometric coefficient of the nth
|
||||
* lattice
|
||||
*
|
||||
* \f[
|
||||
* \tilde h(T,P) = {\sum_n \theta_n \tilde h_n(T,P) }
|
||||
|
|
@ -240,9 +204,9 @@ public:
|
|||
|
||||
//! Return the constant pressure heat capacity. Units: J/kmol/K
|
||||
/*!
|
||||
* The molar constant pressure heat capacity is determined by the following formula, where \f$ C_n \f$ is the
|
||||
* lattice molar density of the nth lattice, and \f$ C_T \f$ is the molar density
|
||||
* of the solid compound.
|
||||
* The molar constant pressure heat capacity is determined by the following
|
||||
* formula, where \f$ C_n \f$ is the lattice molar density of the nth
|
||||
* lattice, and \f$ C_T \f$ is the molar density of the solid compound.
|
||||
*
|
||||
* \f[
|
||||
* \tilde c_{p,n}(T,P) = \frac{\sum_n C_n \tilde c_{p,n}(T,P) }{C_T},
|
||||
|
|
@ -256,9 +220,9 @@ public:
|
|||
|
||||
//! Return the constant volume heat capacity. Units: J/kmol/K
|
||||
/*!
|
||||
* The molar constant volume heat capacity is determined by the following formula, where \f$ C_n \f$ is the
|
||||
* lattice molar density of the nth lattice, and \f$ C_T \f$ is the molar density
|
||||
* of the solid compound.
|
||||
* The molar constant volume heat capacity is determined by the following
|
||||
* formula, where \f$ C_n \f$ is the lattice molar density of the nth
|
||||
* lattice, and \f$ C_T \f$ is the molar density of the solid compound.
|
||||
*
|
||||
* \f[
|
||||
* \tilde c_{v,n}(T,P) = \frac{\sum_n C_n \tilde c_{v,n}(T,P) }{C_T},
|
||||
|
|
@ -282,7 +246,6 @@ public:
|
|||
|
||||
//! Set the pressure at constant temperature. Units: Pa.
|
||||
/*!
|
||||
*
|
||||
* @param p Pressure (units - Pa)
|
||||
*/
|
||||
virtual void setPressure(doublereal p);
|
||||
|
|
@ -299,86 +262,47 @@ public:
|
|||
*/
|
||||
doublereal calcDensity();
|
||||
|
||||
//! Set the mole fractions to the specified values, and then
|
||||
//! normalize them so that they sum to 1.0 for each of the subphases
|
||||
//! Set the mole fractions to the specified values, and then normalize them
|
||||
//! so that they sum to 1.0 for each of the subphases
|
||||
/*!
|
||||
* On input, the mole fraction vector is assumed to sum to one for each of the sublattices. The sublattices
|
||||
* are updated with this mole fraction vector. The mole fractions are also stored within this object, after
|
||||
* they are normalized to one by dividing by the number of sublattices.
|
||||
* On input, the mole fraction vector is assumed to sum to one for each of
|
||||
* the sublattices. The sublattices are updated with this mole fraction
|
||||
* vector. The mole fractions are also stored within this object, after they
|
||||
* are normalized to one by dividing by the number of sublattices.
|
||||
*
|
||||
* @param x Input vector of mole fractions. There is no restriction
|
||||
* on the sum of the mole fraction vector. Internally,
|
||||
* this object will pass portions of this vector to the sublattices which assume that the portions
|
||||
* individually sum to one.
|
||||
* Length is m_kk.
|
||||
* @param x Input vector of mole fractions. There is no restriction on the
|
||||
* sum of the mole fraction vector. Internally, this object will
|
||||
* pass portions of this vector to the sublattices which assume
|
||||
* that the portions individually sum to one. Length is m_kk.
|
||||
*/
|
||||
virtual void setMoleFractions(const doublereal* const x);
|
||||
|
||||
//! Get the species mole fraction vector.
|
||||
/*!
|
||||
* On output the mole fraction vector will sum to one for each of the subphases which make up this phase.
|
||||
* On output the mole fraction vector will sum to one for each of the
|
||||
* subphases which make up this phase.
|
||||
*
|
||||
* @param x On return, x contains the mole fractions. Must have a
|
||||
* length greater than or equal to the number of species.
|
||||
* @param x On return, x contains the mole fractions. Must have a length
|
||||
* greater than or equal to the number of species.
|
||||
*/
|
||||
virtual void getMoleFractions(doublereal* const x) const;
|
||||
|
||||
//! The mole fraction of species k.
|
||||
/*!
|
||||
* If k is outside the valid
|
||||
* range, an exception will be thrown. Note that it is
|
||||
* somewhat more efficient to call getMoleFractions if the
|
||||
* mole fractions of all species are desired.
|
||||
* @param k species index
|
||||
*/
|
||||
doublereal moleFraction(const int k) const {
|
||||
throw NotImplementedError("LatticeSolidPhase::moleFraction");
|
||||
}
|
||||
|
||||
//! Get the species mass fractions.
|
||||
/*!
|
||||
* @param y On return, y contains the mass fractions. Array \a y must have a length
|
||||
* greater than or equal to the number of species.
|
||||
*/
|
||||
void getMassFractions(doublereal* const y) const {
|
||||
throw NotImplementedError("LatticeSolidPhase::getMassFractions");
|
||||
}
|
||||
|
||||
//! Mass fraction of species k.
|
||||
/*!
|
||||
* If k is outside the valid range, an exception will be thrown. Note that it is
|
||||
* somewhat more efficient to call getMassFractions if the mass fractions of all species are desired.
|
||||
*
|
||||
* @param k species index
|
||||
*/
|
||||
doublereal massFraction(const int k) const {
|
||||
throw NotImplementedError("LatticeSolidPhase::massFraction");
|
||||
}
|
||||
|
||||
//! Set the mass fractions to the specified values, and then
|
||||
//! normalize them so that they sum to 1.0.
|
||||
/*!
|
||||
* @param y Array of unnormalized mass fraction values (input).
|
||||
* Must have a length greater than or equal to the number of species.
|
||||
* Input vector of mass fractions. There is no restriction
|
||||
* on the sum of the mass fraction vector. Internally,
|
||||
* the State object will normalize this vector before
|
||||
* storing its contents.
|
||||
* Length is m_kk.
|
||||
*/
|
||||
virtual void setMassFractions(const doublereal* const y) {
|
||||
throw NotImplementedError("LatticeSolidPhase::setMassFractions");
|
||||
}
|
||||
|
||||
//! Set the mass fractions to the specified values without normalizing.
|
||||
/*!
|
||||
* This is useful when the normalization
|
||||
* condition is being handled by some other means, for example
|
||||
* by a constraint equation as part of a larger set of equations.
|
||||
*
|
||||
* @param y Input vector of mass fractions.
|
||||
* Length is m_kk.
|
||||
*/
|
||||
virtual void setMassFractions_NoNorm(const doublereal* const y) {
|
||||
throw NotImplementedError("LatticeSolidPhase::setMassFractions_NoNorm");
|
||||
}
|
||||
|
|
@ -395,58 +319,36 @@ public:
|
|||
throw NotImplementedError("LatticeSolidPhase::setConcentrations");
|
||||
}
|
||||
|
||||
//! This method returns an array of generalized activity concentrations
|
||||
/*!
|
||||
* The generalized activity concentrations,
|
||||
* \f$ C^a_k \f$, are defined such that \f$ a_k = C^a_k /
|
||||
* C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration
|
||||
* defined below and \f$ a_k \f$ are activities used in the
|
||||
* thermodynamic functions. These activity (or generalized)
|
||||
* concentrations are used by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions. Note that they may
|
||||
* or may not have units of concentration --- they might be
|
||||
* partial pressures, mole fractions, or surface coverages,
|
||||
* for example.
|
||||
*
|
||||
* @param c Output array of generalized concentrations. The
|
||||
* units depend upon the implementation of the
|
||||
* reaction rate expressions within the phase.
|
||||
*/
|
||||
virtual void getActivityConcentrations(doublereal* c) const;
|
||||
|
||||
//! Get the array of non-dimensional molar-based activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* @param ac Output vector of activity coefficients. Length: m_kk.
|
||||
*/
|
||||
virtual void getActivityCoefficients(doublereal* ac) const;
|
||||
|
||||
//! Get the species chemical potentials. Units: J/kmol.
|
||||
/*!
|
||||
* This function returns a vector of chemical potentials of the
|
||||
* species in solution at the current temperature, pressure
|
||||
* and mole fraction of the solution.
|
||||
* This function returns a vector of chemical potentials of the species in
|
||||
* solution at the current temperature, pressure and mole fraction of the
|
||||
* solution.
|
||||
*
|
||||
* This returns the underlying lattice chemical potentials, as the units are kmol-1 of
|
||||
* the sublattice species.
|
||||
* This returns the underlying lattice chemical potentials, as the units are
|
||||
* kmol-1 of the sublattice species.
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
* @param mu Output vector of species chemical potentials. Length: m_kk.
|
||||
* Units: J/kmol
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Returns an array of partial molar enthalpies for the species in the mixture.
|
||||
//! Returns an array of partial molar enthalpies for the species in the
|
||||
//! mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* pure species enthalpies
|
||||
* Units (J/kmol). For this phase, the partial molar enthalpies are equal to
|
||||
* the pure species enthalpies
|
||||
* \f[
|
||||
* \bar h_k(T,P) = \hat h^{ref}_k(T) + (P - P_{ref}) \hat V^0_k
|
||||
* \f]
|
||||
* The reference-state pure-species enthalpies, \f$ \hat h^{ref}_k(T) \f$,
|
||||
* at the reference pressure,\f$ P_{ref} \f$,
|
||||
* are computed by the species thermodynamic
|
||||
* property manager. They are polynomial functions of temperature.
|
||||
* at the reference pressure,\f$ P_{ref} \f$, are computed by the species
|
||||
* thermodynamic property manager. They are polynomial functions of
|
||||
* temperature.
|
||||
* @see SpeciesThermo
|
||||
*
|
||||
* @param hbar Output vector containing partial molar enthalpies.
|
||||
|
|
@ -456,16 +358,16 @@ public:
|
|||
|
||||
/**
|
||||
* Returns an array of partial molar entropies of the species in the
|
||||
* solution. Units: J/kmol/K.
|
||||
* For this phase, the partial molar entropies are equal to the
|
||||
* pure species entropies plus the ideal solution contribution.
|
||||
* solution. Units: J/kmol/K. For this phase, the partial molar entropies
|
||||
* are equal to the pure species entropies plus the ideal solution
|
||||
* contribution.
|
||||
* \f[
|
||||
* \bar s_k(T,P) = \hat s^0_k(T) - R log(X_k)
|
||||
* \f]
|
||||
* The reference-state pure-species entropies,\f$ \hat s^{ref}_k(T) \f$,
|
||||
* at the reference pressure, \f$ P_{ref} \f$, are computed by the
|
||||
* species thermodynamic
|
||||
* property manager. They are polynomial functions of temperature.
|
||||
* The reference-state pure-species entropies,\f$ \hat s^{ref}_k(T) \f$, at
|
||||
* the reference pressure, \f$ P_{ref} \f$, are computed by the species
|
||||
* thermodynamic property manager. They are polynomial functions of
|
||||
* temperature.
|
||||
* @see SpeciesThermo
|
||||
*
|
||||
* @param sbar Output vector containing partial molar entropies.
|
||||
|
|
@ -474,113 +376,51 @@ public:
|
|||
virtual void getPartialMolarEntropies(doublereal* sbar) const;
|
||||
|
||||
/**
|
||||
* Returns an array of partial molar Heat Capacities at constant
|
||||
* pressure of the species in the
|
||||
* solution. Units: J/kmol/K.
|
||||
* For this phase, the partial molar heat capacities are equal
|
||||
* to the standard state heat capacities.
|
||||
* Returns an array of partial molar Heat Capacities at constant pressure of
|
||||
* the species in the solution. Units: J/kmol/K. For this phase, the partial
|
||||
* molar heat capacities are equal to the standard state heat capacities.
|
||||
*
|
||||
* @param cpbar Output vector of partial heat capacities. Length: m_kk.
|
||||
*/
|
||||
virtual void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
||||
/**
|
||||
* returns an array of partial molar volumes of the species
|
||||
* in the solution. Units: m^3 kmol-1.
|
||||
* returns an array of partial molar volumes of the species in the solution.
|
||||
* Units: m^3 kmol-1.
|
||||
*
|
||||
* For this solution, thepartial molar volumes are equal to the
|
||||
* constant species molar volumes.
|
||||
* For this solution, thepartial molar volumes are equal to the constant
|
||||
* species molar volumes.
|
||||
*
|
||||
* @param vbar Output vector of partial molar volumes. Length: m_kk.
|
||||
*/
|
||||
virtual void getPartialMolarVolumes(doublereal* vbar) const;
|
||||
|
||||
//! Get the array of standard state chemical potentials at unit activity for the species
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
//! Get the array of standard state chemical potentials at unit activity for
|
||||
//! the species at their standard states at the current <I>T</I> and
|
||||
//! <I>P</I> of the solution.
|
||||
/*!
|
||||
* These are the standard state chemical potentials \f$ \mu^0_k(T,P)
|
||||
* \f$. The values are evaluated at the current
|
||||
* temperature and pressure of the solution.
|
||||
* These are the standard state chemical potentials \f$ \mu^0_k(T,P) \f$.
|
||||
* The values are evaluated at the current temperature and pressure of the
|
||||
* solution.
|
||||
*
|
||||
* This returns the underlying lattice standard chemical potentials, as the units are kmol-1 of
|
||||
* the sublattice species.
|
||||
* This returns the underlying lattice standard chemical potentials, as the
|
||||
* units are kmol-1 of the sublattice species.
|
||||
*
|
||||
* @param mu0 Output vector of chemical potentials.
|
||||
* Length: m_kk. Units: J/kmol
|
||||
* Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
virtual void getStandardChemPotentials(doublereal* mu0) const;
|
||||
|
||||
//! Return the standard concentration for the kth species
|
||||
/*!
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize
|
||||
* the activity (i.e., generalized) concentration. In many cases, this quantity
|
||||
* will be the same for all species in a phase - for example,
|
||||
* for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this
|
||||
* reason, this method returns a single value, instead of an
|
||||
* array. However, for phases in which the standard
|
||||
* concentration is species-specific (e.g. surface species of
|
||||
* different sizes), this method may be called with an
|
||||
* optional parameter indicating the species.
|
||||
*
|
||||
* @param k Optional parameter indicating the species. The default
|
||||
* is to assume this refers to species 0.
|
||||
* @return
|
||||
* Returns the standard concentration. The units are by definition
|
||||
* dependent on the ThermoPhase and kinetics manager representation.
|
||||
*/
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
//! Natural logarithm of the standard concentration of the kth species.
|
||||
/*!
|
||||
* @param k index of the species (defaults to zero)
|
||||
*/
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
//@}
|
||||
/// @name Thermodynamic Values for the Species Reference States
|
||||
//@{
|
||||
|
||||
//! Returns the vector of nondimensional enthalpies of the reference state at the current
|
||||
//! temperature of the solution and the reference pressure for the species.
|
||||
/*!
|
||||
* This function fills in its one entry in hrt[] by calling
|
||||
* the underlying species thermo function for the
|
||||
* dimensionless Gibbs free energy, calculated from the
|
||||
* dimensionless enthalpy and entropy.
|
||||
*
|
||||
* @param grt Vector of dimensionless Gibbs free energies of the reference state
|
||||
* length = m_kk
|
||||
*/
|
||||
virtual void getGibbs_RT_ref(doublereal* grt) const;
|
||||
|
||||
//! Returns the vector of the Gibbs function of the reference state at the current
|
||||
//! temperatureof the solution and the reference pressure for the species.
|
||||
/*!
|
||||
* units = J/kmol
|
||||
*
|
||||
* This function fills in its one entry in g[] by calling the underlying species thermo
|
||||
* functions for the Gibbs free energy, calculated from enthalpy and the
|
||||
* entropy, and the multiplying by RT.
|
||||
*
|
||||
* @param g Vector of Gibbs free energies of the reference state.
|
||||
* length = m_kk
|
||||
*/
|
||||
virtual void getGibbs_ref(doublereal* g) const;
|
||||
|
||||
//! Initialize the ThermoPhase object after all species have been set up
|
||||
/*!
|
||||
* @internal Initialize.
|
||||
*
|
||||
* This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called from ThermoPhase::initThermoXML(),
|
||||
* which is called from importPhase(),
|
||||
* just prior to returning from function importPhase().
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
//! Initialize vectors that depend on the number of species and sublattices
|
||||
|
|
@ -594,35 +434,16 @@ public:
|
|||
*/
|
||||
virtual void installSlavePhases(XML_Node* phaseNode);
|
||||
|
||||
//! Set equation of state parameter values from XML entries.
|
||||
/*!
|
||||
* This method is called by function importPhase() when processing a phase
|
||||
* definition in an input file. It should be overloaded in subclasses to set
|
||||
* any parameters that are specific to that particular phase
|
||||
* model. Note, this method is called before the phase is
|
||||
* initialized with elements and/or species.
|
||||
*
|
||||
* @param eosdata An XML_Node object corresponding to
|
||||
* the "thermo" entry for this phase in the input file.
|
||||
*/
|
||||
virtual void setParametersFromXML(const XML_Node& eosdata);
|
||||
|
||||
//! Set the Lattice mole fractions using a string
|
||||
/*!
|
||||
* @param n Integer value of the lattice whose mole fractions are being set
|
||||
* @param x string containing Name:value pairs that will specify the mole fractions
|
||||
* of species on a particular lattice
|
||||
* @param n Integer value of the lattice whose mole fractions are being set
|
||||
* @param x string containing Name:value pairs that will specify the mole
|
||||
* fractions of species on a particular lattice
|
||||
*/
|
||||
void setLatticeMoleFractionsByName(int n, const std::string& x);
|
||||
|
||||
//! Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
|
||||
/*!
|
||||
* The 298K heat of formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k Species k
|
||||
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar
|
||||
*/
|
||||
virtual void modifyOneHf298SS(const size_t k, const doublereal Hf298New);
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
/**
|
||||
* @file MargulesVPSSTP.h
|
||||
* Header for intermediate ThermoPhase object for phases which
|
||||
* employ Gibbs excess free energy based formulations
|
||||
* (see \ref thermoprops
|
||||
* and class \link Cantera::MargulesVPSSTP MargulesVPSSTP\endlink).
|
||||
*
|
||||
* Header file for a derived class of ThermoPhase that handles
|
||||
* variable pressure standard state methods for calculating
|
||||
* thermodynamic properties that are further based upon activities
|
||||
* based on the molality scale. These include most of the methods for
|
||||
* calculating liquid electrolyte thermodynamics.
|
||||
* @file MargulesVPSSTP.h (see \ref thermoprops and class \link
|
||||
* Cantera::MargulesVPSSTP MargulesVPSSTP\endlink).
|
||||
*/
|
||||
/*
|
||||
* Copyright (2006) Sandia Corporation. Under the terms of
|
||||
|
|
@ -24,256 +15,223 @@
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
/**
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
|
||||
//! MargulesVPSSTP is a derived class of GibbsExcessVPSSTP that employs
|
||||
//! the Margules approximation for the excess Gibbs free energy
|
||||
//! MargulesVPSSTP is a derived class of GibbsExcessVPSSTP that employs the
|
||||
//! Margules approximation for the excess Gibbs free energy
|
||||
/*!
|
||||
* MargulesVPSSTP derives from class GibbsExcessVPSSTP which is derived
|
||||
* from VPStandardStateTP,
|
||||
* and overloads the virtual methods defined there with ones that
|
||||
* use expressions appropriate for the Margules Excess Gibbs free energy
|
||||
* MargulesVPSSTP derives from class GibbsExcessVPSSTP which is derived from
|
||||
* VPStandardStateTP, and overloads the virtual methods defined there with ones
|
||||
* that use expressions appropriate for the Margules Excess Gibbs free energy
|
||||
* approximation.
|
||||
*
|
||||
* The independent unknowns are pressure, temperature, and mass fraction.
|
||||
*
|
||||
* Several concepts are introduced. The first concept is there are temporary
|
||||
* variables for holding the species standard state values
|
||||
* of Cp, H, S, G, and V at the
|
||||
* last temperature and pressure called. These functions are not recalculated
|
||||
* if a new call is made using the previous temperature and pressure. Currently,
|
||||
* these variables and the calculation method are handled by the VPSSMgr class,
|
||||
* for which VPStandardStateTP owns a pointer to.
|
||||
*
|
||||
* To support the above functionality, pressure and temperature variables,
|
||||
* m_plast_ss and m_tlast_ss, are kept which store the last pressure and temperature
|
||||
* used in the evaluation of standard state properties.
|
||||
*
|
||||
* This class is usually used for nearly incompressible phases. For those phases, it
|
||||
* makes sense to change the equation of state independent variable from
|
||||
* density to pressure. The variable m_Pcurrent contains the current value of the
|
||||
* pressure within the phase.
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Specification of Species Standard State Properties </H2>
|
||||
* <HR>
|
||||
*
|
||||
* All species are defined to have standard states that depend upon both
|
||||
* the temperature and the pressure. The Margules approximation assumes
|
||||
* symmetric standard states, where all of the standard state assume
|
||||
* that the species are in pure component states at the temperature
|
||||
* and pressure of the solution. I don't think it prevents, however,
|
||||
* some species from being dilute in the solution.
|
||||
* All species are defined to have standard states that depend upon both the
|
||||
* temperature and the pressure. The Margules approximation assumes symmetric
|
||||
* standard states, where all of the standard state assume that the species are
|
||||
* in pure component states at the temperature and pressure of the solution. I
|
||||
* don't think it prevents, however, some species from being dilute in the
|
||||
* solution.
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Specification of Solution Thermodynamic Properties </H2>
|
||||
* <HR>
|
||||
*
|
||||
* The molar excess Gibbs free energy is given by the following formula which is a sum over interactions <I>i</I>.
|
||||
* Each of the interactions are binary interactions involving two of the species in the phase, denoted, <I>Ai</I>
|
||||
* and <I>Bi</I>.
|
||||
* This is the generalization of the Margules formulation for a phase
|
||||
* that has more than 2 species.
|
||||
* The molar excess Gibbs free energy is given by the following formula which is
|
||||
* a sum over interactions <I>i</I>. Each of the interactions are binary
|
||||
* interactions involving two of the species in the phase, denoted, <I>Ai</I>
|
||||
* and <I>Bi</I>. This is the generalization of the Margules formulation for a
|
||||
* phase that has more than 2 species.
|
||||
*
|
||||
* \f[
|
||||
* G^E = \sum_i \left( H_{Ei} - T S_{Ei} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* H^E_i = n X_{Ai} X_{Bi} \left( h_{o,i} + h_{1,i} X_{Bi} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* S^E_i = n X_{Ai} X_{Bi} \left( s_{o,i} + s_{1,i} X_{Bi} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* G^E = \sum_i \left( H_{Ei} - T S_{Ei} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* H^E_i = n X_{Ai} X_{Bi} \left( h_{o,i} + h_{1,i} X_{Bi} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* S^E_i = n X_{Ai} X_{Bi} \left( s_{o,i} + s_{1,i} X_{Bi} \right)
|
||||
* \f]
|
||||
*
|
||||
* where n is the total moles in the solution.
|
||||
*
|
||||
* The activity of a species defined in the phase is given by an excess
|
||||
* Gibbs free energy formulation.
|
||||
* The activity of a species defined in the phase is given by an excess Gibbs
|
||||
* free energy formulation.
|
||||
*
|
||||
* \f[
|
||||
* a_k = \gamma_k X_k
|
||||
* \f]
|
||||
* \f[
|
||||
* a_k = \gamma_k X_k
|
||||
* \f]
|
||||
*
|
||||
* where
|
||||
*
|
||||
* \f[
|
||||
* R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i}
|
||||
* \f]
|
||||
* \f[
|
||||
* R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i}
|
||||
* \f]
|
||||
*
|
||||
* Taking the derivatives results in the following expression
|
||||
*
|
||||
* \f[
|
||||
* R T \ln( \gamma_k )= \sum_i \left( \left( \delta_{Ai,k} X_{Bi} + \delta_{Bi,k} X_{Ai} - X_{Ai} X_{Bi} \right)
|
||||
* \left( g^E_{o,i} + g^E_{1,i} X_{Bi} \right) +
|
||||
* \left( \delta_{Bi,k} - X_{Bi} \right) X_{Ai} X_{Bi} g^E_{1,i} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* R T \ln( \gamma_k )= \sum_i \left( \left( \delta_{Ai,k} X_{Bi} + \delta_{Bi,k} X_{Ai} - X_{Ai} X_{Bi} \right)
|
||||
* \left( g^E_{o,i} + g^E_{1,i} X_{Bi} \right) +
|
||||
* \left( \delta_{Bi,k} - X_{Bi} \right) X_{Ai} X_{Bi} g^E_{1,i} \right)
|
||||
* \f]
|
||||
* where
|
||||
* \f$ g^E_{o,i} = h_{o,i} - T s_{o,i} \f$ and \f$ g^E_{1,i} = h_{1,i} - T s_{1,i} \f$
|
||||
* and where \f$ X_k \f$ is the mole fraction of species <I>k</I>.
|
||||
* \f$ g^E_{o,i} = h_{o,i} - T s_{o,i} \f$ and
|
||||
* \f$ g^E_{1,i} = h_{1,i} - T s_{1,i} \f$ and where
|
||||
* \f$ X_k \f$ is the mole fraction of species <I>k</I>.
|
||||
*
|
||||
* This object inherits from the class VPStandardStateTP. Therefore, the specification and
|
||||
* calculation of all standard state and reference state values are handled at that level. Various functional
|
||||
* forms for the standard state are permissible.
|
||||
* The chemical potential for species <I>k</I> is equal to
|
||||
* This object inherits from the class VPStandardStateTP. Therefore, the
|
||||
* specification and calculation of all standard state and reference state
|
||||
* values are handled at that level. Various functional forms for the standard
|
||||
* state are permissible. The chemical potential for species <I>k</I> is equal
|
||||
* to
|
||||
*
|
||||
* \f[
|
||||
* \mu_k(T,P) = \mu^o_k(T, P) + R T \ln(\gamma_k X_k)
|
||||
* \f]
|
||||
* \f[
|
||||
* \mu_k(T,P) = \mu^o_k(T, P) + R T \ln(\gamma_k X_k)
|
||||
* \f]
|
||||
*
|
||||
* The partial molar entropy for species <I>k</I> is given by the following relation,
|
||||
* The partial molar entropy for species <I>k</I> is given by
|
||||
*
|
||||
* \f[
|
||||
* \tilde{s}_k(T,P) = s^o_k(T,P) - R \ln( \gamma_k X_k )
|
||||
* - R T \frac{d \ln(\gamma_k) }{dT}
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{s}_k(T,P) = s^o_k(T,P) - R \ln( \gamma_k X_k )
|
||||
* - R T \frac{d \ln(\gamma_k) }{dT}
|
||||
* \f]
|
||||
*
|
||||
* The partial molar enthalpy for species <I>k</I> is given by
|
||||
*
|
||||
* \f[
|
||||
* \tilde{h}_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{h}_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
* \f]
|
||||
*
|
||||
* The partial molar volume for species <I>k</I> is
|
||||
* The partial molar volume for species <I>k</I> is
|
||||
*
|
||||
* \f[
|
||||
* \tilde V_k(T,P) = V^o_k(T,P) + R T \frac{d \ln(\gamma_k) }{dP}
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde V_k(T,P) = V^o_k(T,P) + R T \frac{d \ln(\gamma_k) }{dP}
|
||||
* \f]
|
||||
*
|
||||
* The partial molar Heat Capacity for species <I>k</I> is
|
||||
*
|
||||
* \f[
|
||||
* \tilde{C}_{p,k}(T,P) = C^o_{p,k}(T,P) - 2 R T \frac{d \ln( \gamma_k )}{dT}
|
||||
* - R T^2 \frac{d^2 \ln(\gamma_k) }{{dT}^2}
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{C}_{p,k}(T,P) = C^o_{p,k}(T,P) - 2 R T \frac{d \ln( \gamma_k )}{dT}
|
||||
* - R T^2 \frac{d^2 \ln(\gamma_k) }{{dT}^2}
|
||||
* \f]
|
||||
*
|
||||
* <HR>
|
||||
* <H2> %Application within Kinetics Managers </H2>
|
||||
* <HR>
|
||||
*
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
|
||||
* C^s_k, \f$ where \f$ C^s_k \f$ is a standard concentration
|
||||
* defined below and \f$ a_k \f$ are activities used in the
|
||||
* thermodynamic functions. These activity (or generalized)
|
||||
* concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions.
|
||||
* The activity concentration,\f$ C^a_k \f$,is given by the following expression.
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / C^s_k, \f$ where
|
||||
* \f$ C^s_k \f$ is a standard concentration defined below and \f$ a_k \f$ are
|
||||
* activities used in the thermodynamic functions. These activity (or
|
||||
* generalized) concentrations are used by kinetics manager classes to compute
|
||||
* the forward and reverse rates of elementary reactions. The activity
|
||||
* concentration,\f$ C^a_k \f$,is given by the following expression.
|
||||
*
|
||||
* \f[
|
||||
* C^a_k = C^s_k X_k = \frac{P}{R T} X_k
|
||||
* \f]
|
||||
* \f[
|
||||
* C^a_k = C^s_k X_k = \frac{P}{R T} X_k
|
||||
* \f]
|
||||
*
|
||||
* The standard concentration for species <I>k</I> is independent of <I>k</I> and equal to
|
||||
*
|
||||
* \f[
|
||||
* C^s_k = C^s = \frac{P}{R T}
|
||||
* \f]
|
||||
* \f[
|
||||
* C^s_k = C^s = \frac{P}{R T}
|
||||
* \f]
|
||||
*
|
||||
* For example, a bulk-phase binary gas reaction between species j and k, producing
|
||||
* a new gas species l would have the
|
||||
* following equation for its rate of progress variable, \f$ R^1 \f$, which has
|
||||
* units of kmol m-3 s-1.
|
||||
* For example, a bulk-phase binary gas reaction between species j and k,
|
||||
* producing a new gas species l would have the following equation for its rate
|
||||
* of progress variable, \f$ R^1 \f$, which has units of kmol m-3 s-1.
|
||||
*
|
||||
* \f[
|
||||
* \f[
|
||||
* R^1 = k^1 C_j^a C_k^a = k^1 (C^s a_j) (C^s a_k)
|
||||
* \f]
|
||||
* where
|
||||
* \f[
|
||||
* C_j^a = C^s a_j \mbox{\quad and \quad} C_k^a = C^s a_k
|
||||
* \f]
|
||||
* \f]
|
||||
* where
|
||||
* \f[
|
||||
* C_j^a = C^s a_j \mbox{\quad and \quad} C_k^a = C^s a_k
|
||||
* \f]
|
||||
*
|
||||
* \f$ C_j^a \f$ is the activity concentration of species j, and
|
||||
* \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^s \f$
|
||||
* is the standard concentration. \f$ a_j \f$ is
|
||||
* the activity of species j which is equal to the mole fraction of j.
|
||||
* \f$ C_j^a \f$ is the activity concentration of species j, and \f$ C_k^a \f$
|
||||
* is the activity concentration of species k. \f$ C^s \f$ is the standard
|
||||
* concentration. \f$ a_j \f$ is the activity of species j which is equal to the
|
||||
* mole fraction of j.
|
||||
*
|
||||
* The reverse rate constant can then be obtained from the law of microscopic reversibility
|
||||
* and the equilibrium expression for the system.
|
||||
* The reverse rate constant can then be obtained from the law of microscopic
|
||||
* reversibility and the equilibrium expression for the system.
|
||||
*
|
||||
* \f[
|
||||
* \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
|
||||
* \f]
|
||||
* \f[
|
||||
* \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
|
||||
* \f]
|
||||
*
|
||||
* \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, associated with
|
||||
* the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ and their associated activities,
|
||||
* \f$ a_l \f$, repeated here:
|
||||
* \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant,
|
||||
* associated with the pressure dependent standard states \f$ \mu^o_l(T,P) \f$
|
||||
* and their associated activities, \f$ a_l \f$, repeated here:
|
||||
*
|
||||
* \f[
|
||||
* \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l)
|
||||
* \f]
|
||||
* \f[
|
||||
* \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l)
|
||||
* \f]
|
||||
*
|
||||
* We can switch over to expressing the equilibrium constant in terms of the reference
|
||||
* state chemical potentials
|
||||
* We can switch over to expressing the equilibrium constant in terms of the
|
||||
* reference state chemical potentials
|
||||
*
|
||||
* \f[
|
||||
* K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P}
|
||||
* \f]
|
||||
* \f[
|
||||
* K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P}
|
||||
* \f]
|
||||
*
|
||||
* The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over
|
||||
* to activity concentrations. When this is done:
|
||||
* The concentration equilibrium constant, \f$ K_c \f$, may be obtained by
|
||||
* changing over to activity concentrations. When this is done:
|
||||
*
|
||||
* \f[
|
||||
* \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 =
|
||||
* \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT}
|
||||
* \f]
|
||||
* \f[
|
||||
* \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 =
|
||||
* \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT}
|
||||
* \f]
|
||||
*
|
||||
* %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$,
|
||||
* using the second and third part of the above expression as a definition for the concentration
|
||||
* equilibrium constant.
|
||||
* %Kinetics managers will calculate the concentration equilibrium constant, \f$
|
||||
* K_c \f$, using the second and third part of the above expression as a
|
||||
* definition for the concentration equilibrium constant.
|
||||
*
|
||||
* For completeness, the pressure equilibrium constant may be obtained as well
|
||||
* For completeness, the pressure equilibrium constant may be obtained as well
|
||||
*
|
||||
* \f[
|
||||
* \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} )
|
||||
* \f]
|
||||
* \f[
|
||||
* \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} )
|
||||
* \f]
|
||||
*
|
||||
* \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. However, it isn't
|
||||
* necessarily the simplest form of the equilibrium constant for other types of phases; \f$ K_c \f$ is
|
||||
* used instead because it is completely general.
|
||||
* \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases.
|
||||
* However, it isn't necessarily the simplest form of the equilibrium constant
|
||||
* for other types of phases; \f$ K_c \f$ is used instead because it is
|
||||
* completely general.
|
||||
*
|
||||
* The reverse rate of progress may be written down as
|
||||
* \f[
|
||||
* The reverse rate of progress may be written down as
|
||||
* \f[
|
||||
* R^{-1} = k^{-1} C_l^a = k^{-1} (C^o a_l)
|
||||
* \f]
|
||||
* \f]
|
||||
*
|
||||
* where we can use the concept of microscopic reversibility to
|
||||
* write the reverse rate constant in terms of the
|
||||
* forward reate constant and the concentration equilibrium
|
||||
* constant, \f$ K_c \f$.
|
||||
* where we can use the concept of microscopic reversibility to write the
|
||||
* reverse rate constant in terms of the forward reate constant and the
|
||||
* concentration equilibrium constant, \f$ K_c \f$.
|
||||
*
|
||||
* \f[
|
||||
* k^{-1} = k^1 K^1_c
|
||||
* \f]
|
||||
* \f[
|
||||
* k^{-1} = k^1 K^1_c
|
||||
* \f]
|
||||
*
|
||||
* \f$k^{-1} \f$ has units of s-1.
|
||||
* \f$k^{-1} \f$ has units of s-1.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
class MargulesVPSSTP : public GibbsExcessVPSSTP
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
/*!
|
||||
* This doesn't do much more than initialize constants with
|
||||
* default values for water at 25C. Water molecular weight
|
||||
* comes from the default elements.xml file. It actually
|
||||
* differs slightly from the IAPWS95 value of 18.015268. However,
|
||||
* density conservation and therefore element conservation
|
||||
* is the more important principle to follow.
|
||||
*/
|
||||
MargulesVPSSTP();
|
||||
|
||||
//! Construct and initialize a MargulesVPSSTP ThermoPhase object
|
||||
//! directly from an XML input file
|
||||
//! Construct and initialize a MargulesVPSSTP ThermoPhase object directly
|
||||
//! from an XML input file
|
||||
/*!
|
||||
* Working constructors
|
||||
*
|
||||
* The two constructors below are the normal way
|
||||
* the phase initializes itself. They are shells that call
|
||||
* the routine initThermo(), with a reference to the
|
||||
* XML database to get the info for the phase.
|
||||
* The two constructors below are the normal way the phase initializes
|
||||
* itself. They are shells that call the routine initThermo(), with a
|
||||
* reference to the XML database to get the info for the phase.
|
||||
*
|
||||
* @param inputFile Name of the input file containing the phase XML data
|
||||
* to set up the object
|
||||
|
|
@ -282,8 +240,8 @@ public:
|
|||
*/
|
||||
MargulesVPSSTP(const std::string& inputFile, const std::string& id = "");
|
||||
|
||||
//! Construct and initialize a MargulesVPSSTP ThermoPhase object
|
||||
//! directly from an XML database
|
||||
//! Construct and initialize a MargulesVPSSTP ThermoPhase object directly
|
||||
//! from an XML database
|
||||
/*!
|
||||
* @param phaseRef XML phase node containing the description of the phase
|
||||
* @param id id attribute containing the name of the phase.
|
||||
|
|
@ -291,124 +249,83 @@ public:
|
|||
*/
|
||||
MargulesVPSSTP(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working copy constructor
|
||||
*
|
||||
* @param b class to be copied
|
||||
*/
|
||||
MargulesVPSSTP(const MargulesVPSSTP& b);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* @param b class to be copied.
|
||||
*/
|
||||
MargulesVPSSTP& operator=(const MargulesVPSSTP& b);
|
||||
|
||||
//! Duplication routine for objects which inherit from ThermoPhase.
|
||||
/*!
|
||||
* This virtual routine can be used to duplicate ThermoPhase objects
|
||||
* inherited from ThermoPhase even if the application only has
|
||||
* a pointer to ThermoPhase to work with.
|
||||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//! @name Molar Thermodynamic Properties
|
||||
//! @{
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
|
||||
/// Molar entropy. Units: J/kmol.
|
||||
virtual doublereal entropy_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
virtual doublereal cp_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
virtual doublereal cv_mole() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Activities, Standard States, and Activity Concentrations
|
||||
*
|
||||
* The activity \f$a_k\f$ of a species in solution is
|
||||
* related to the chemical potential by \f[ \mu_k = \mu_k^0(T)
|
||||
* + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is
|
||||
* the chemical potential at unit activity, which depends only
|
||||
* on temperature and pressure.
|
||||
* The activity \f$a_k\f$ of a species in solution is related to the
|
||||
* chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The
|
||||
* quantity \f$\mu_k^0(T,P)\f$ is the chemical potential at unit activity,
|
||||
* which depends only on temperature and pressure.
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! Get the array of non-dimensional molar-based ln activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* @param lnac Output vector of ln activity coefficients. Length: m_kk.
|
||||
*/
|
||||
virtual void getLnActivityCoefficients(doublereal* lnac) const;
|
||||
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
||||
//! Get the species chemical potentials. Units: J/kmol.
|
||||
/*!
|
||||
* This function returns a vector of chemical potentials of the
|
||||
* species in solution at the current temperature, pressure
|
||||
* and mole fraction of the solution.
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Returns an array of partial molar enthalpies for the species
|
||||
//! in the mixture.
|
||||
//! Returns an array of partial molar enthalpies for the species in the
|
||||
//! mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* standard state enthalpies modified by the derivative of the
|
||||
* molality-based activity coefficient wrt temperature
|
||||
* For this phase, the partial molar enthalpies are equal to the standard
|
||||
* state enthalpies modified by the derivative of the molality-based
|
||||
* activity coefficient wrt temperature
|
||||
*
|
||||
* \f[
|
||||
* \f[
|
||||
* \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
* \f]
|
||||
* \f]
|
||||
*
|
||||
* @param hbar Vector of returned partial molar enthalpies
|
||||
* (length m_kk, units = J/kmol)
|
||||
*/
|
||||
virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
|
||||
|
||||
//! Returns an array of partial molar entropies for the species
|
||||
//! in the mixture.
|
||||
//! Returns an array of partial molar entropies for the species in the
|
||||
//! mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* standard state enthalpies modified by the derivative of the
|
||||
* activity coefficient wrt temperature
|
||||
* For this phase, the partial molar enthalpies are equal to the standard
|
||||
* state enthalpies modified by the derivative of the activity coefficient
|
||||
* wrt temperature
|
||||
*
|
||||
* \f[
|
||||
* \f[
|
||||
* \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
* - R \ln( \gamma_k X_k)
|
||||
* - R T \frac{d \ln(\gamma_k) }{dT}
|
||||
* \f]
|
||||
* \f]
|
||||
*
|
||||
* @param sbar Vector of returned partial molar entropies
|
||||
* (length m_kk, units = J/kmol/K)
|
||||
*/
|
||||
virtual void getPartialMolarEntropies(doublereal* sbar) const;
|
||||
|
||||
//! Returns an array of partial molar entropies for the species
|
||||
//! in the mixture.
|
||||
//! Returns an array of partial molar entropies for the species in the
|
||||
//! mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* standard state enthalpies modified by the derivative of the
|
||||
* activity coefficient wrt temperature
|
||||
* For this phase, the partial molar enthalpies are equal to the standard
|
||||
* state enthalpies modified by the derivative of the activity coefficient
|
||||
* wrt temperature
|
||||
*
|
||||
* \f[
|
||||
* ???????????????
|
||||
|
|
@ -423,161 +340,38 @@ public:
|
|||
*/
|
||||
virtual void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
||||
//! Return an array of partial molar volumes for the
|
||||
//! species in the mixture. Units: m^3/kmol.
|
||||
/*!
|
||||
* Frequently, for this class of thermodynamics representations,
|
||||
* the excess Volume due to mixing is zero. Here, we set it as
|
||||
* a default. It may be overridden in derived classes.
|
||||
*
|
||||
* @param vbar Output vector of species partial molar volumes.
|
||||
* Length = m_kk. units are m^3/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarVolumes(doublereal* vbar) const;
|
||||
|
||||
//! Get the species electrochemical potentials.
|
||||
/*!
|
||||
* These are partial molar quantities.
|
||||
* This method adds a term \f$ Fz_k \phi_k \f$ to the
|
||||
* to each chemical potential.
|
||||
*
|
||||
* Units: J/kmol
|
||||
*
|
||||
* @param mu output vector containing the species electrochemical potentials.
|
||||
* Length: m_kk., units = J/kmol
|
||||
*/
|
||||
void getElectrochemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Get the array of temperature second derivatives of the log activity coefficients
|
||||
//! Get the array of temperature second derivatives of the log activity
|
||||
//! coefficients
|
||||
/*!
|
||||
* This function is a virtual class, but it first appears in GibbsExcessVPSSTP
|
||||
* class and derived classes from GibbsExcessVPSSTP.
|
||||
*
|
||||
* units = 1/Kelvin
|
||||
*
|
||||
* @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of the
|
||||
* log Activity Coefficients. length = m_kk
|
||||
* @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of
|
||||
* the log Activity Coefficients. length = m_kk
|
||||
*/
|
||||
virtual void getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const;
|
||||
|
||||
//! Get the array of temperature derivatives of the log activity coefficients
|
||||
/*!
|
||||
* This function is a virtual class, but it first appears in GibbsExcessVPSSTP
|
||||
* class and derived classes from GibbsExcessVPSSTP.
|
||||
*
|
||||
* units = 1/Kelvin
|
||||
*
|
||||
* @param dlnActCoeffdT Output vector of temperature derivatives of the
|
||||
* log Activity Coefficients. length = m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdT(doublereal* dlnActCoeffdT) const;
|
||||
|
||||
/// @}
|
||||
/// @name Initialization
|
||||
/// The following methods are used in the process of constructing
|
||||
/// the phase and setting its parameters from a specification in an
|
||||
/// input file. They are not normally used in application programs.
|
||||
/// To see how they are used, see importPhase()
|
||||
/// @name Initialization The following methods are used in the process of
|
||||
/// constructing the phase and setting its parameters from a
|
||||
/// specification in an input file. They are not normally used in
|
||||
/// application programs. To see how they are used, see importPhase()
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
* @internal Initialize. This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called just prior to returning
|
||||
* from function importPhase().
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
/**
|
||||
* Import and initialize a ThermoPhase object
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a
|
||||
* complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
//! @}
|
||||
//! @name Derivatives of Thermodynamic Variables needed for Applications
|
||||
//! @{
|
||||
|
||||
//! Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along
|
||||
//! a line in parameter space or along a line in physical space
|
||||
/*!
|
||||
*
|
||||
* @param dTds Input of temperature change along the path
|
||||
* @param dXds Input vector of changes in mole fraction along the path. length = m_kk
|
||||
* Along the path length it must be the case that the mole fractions sum to one.
|
||||
* @param dlnActCoeffds Output vector of the directional derivatives of the
|
||||
* log Activity Coefficients along the path. length = m_kk
|
||||
* units are 1/units(s). if s is a physical coordinate then the units are 1/m.
|
||||
*/
|
||||
virtual void getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const;
|
||||
|
||||
//! Get the array of log concentration-like derivatives of the
|
||||
//! log activity coefficients - diagonal component
|
||||
/*!
|
||||
* This function is a virtual method. For ideal mixtures
|
||||
* (unity activity coefficients), this can return zero.
|
||||
* Implementations should take the derivative of the
|
||||
* logarithm of the activity coefficient with respect to the
|
||||
* logarithm of the mole fraction.
|
||||
*
|
||||
* units = dimensionless
|
||||
*
|
||||
* @param dlnActCoeffdlnX_diag Output vector of the diagonal component of the log(mole fraction)
|
||||
* derivatives of the log Activity Coefficients.
|
||||
* length = m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const;
|
||||
|
||||
//! Get the array of derivatives of the log activity coefficients wrt mole numbers - diagonal only
|
||||
/*!
|
||||
* This function is a virtual method. For ideal mixtures
|
||||
* (unity activity coefficients), this can return zero.
|
||||
* Implementations should take the derivative of the
|
||||
* logarithm of the activity coefficient with respect to the
|
||||
* logarithm of the concentration-like variable (i.e. mole fraction,
|
||||
* molality, etc.) that represents the standard state.
|
||||
*
|
||||
* units = dimensionless
|
||||
*
|
||||
* @param dlnActCoeffdlnN_diag Output vector of the diagonal entries for the log(mole fraction)
|
||||
* derivatives of the log Activity Coefficients.
|
||||
* length = m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const;
|
||||
|
||||
//! Get the array of derivatives of the ln activity coefficients with respect to the ln species mole numbers
|
||||
/*!
|
||||
* Implementations should take the derivative of the logarithm of the activity coefficient with respect to a
|
||||
* log of a species mole number (with all other species mole numbers held constant)
|
||||
*
|
||||
* units = 1 / kmol
|
||||
*
|
||||
* dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log act_coeff for the <I>m</I><SUP>th</SUP>
|
||||
* species with respect to the number of moles of the <I>k</I><SUP>th</SUP> species.
|
||||
*
|
||||
* \f[
|
||||
* \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i}
|
||||
* \f]
|
||||
*
|
||||
* @param ld Number of rows in the matrix
|
||||
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
||||
* log Activity Coefficients. length = m_kk * m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN);
|
||||
|
||||
//@}
|
||||
|
|
@ -585,65 +379,65 @@ public:
|
|||
private:
|
||||
//! Process an XML node called "binaryNeutralSpeciesParameters"
|
||||
/*!
|
||||
* This node contains all of the parameters necessary to describe
|
||||
* the Margules model for a particular binary interaction.
|
||||
* This function reads the XML file and writes the coefficients
|
||||
* it finds to an internal data structures.
|
||||
* This node contains all of the parameters necessary to describe the
|
||||
* Margules model for a particular binary interaction. This function reads
|
||||
* the XML file and writes the coefficients it finds to an internal data
|
||||
* structures.
|
||||
*
|
||||
* @param xmlBinarySpecies Reference to the XML_Node named "binaryNeutralSpeciesParameters"
|
||||
* containing the binary interaction
|
||||
*/
|
||||
void readXMLBinarySpecies(XML_Node& xmlBinarySpecies);
|
||||
|
||||
//! Resize internal arrays within the object that depend upon the number
|
||||
//! of binary Margules interaction terms
|
||||
//! Resize internal arrays within the object that depend upon the number of
|
||||
//! binary Margules interaction terms
|
||||
/*!
|
||||
* @param num Number of binary Margules interaction terms
|
||||
*/
|
||||
void resizeNumInteractions(const size_t num);
|
||||
|
||||
//! Initialize lengths of local variables after all species have
|
||||
//! been identified.
|
||||
//! Initialize lengths of local variables after all species have been
|
||||
//! identified.
|
||||
void initLengths();
|
||||
|
||||
//! Update the activity coefficients
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* natural logarithm of the activity coefficients
|
||||
* This function will be called to update the internally stored natural
|
||||
* logarithm of the activity coefficients
|
||||
*/
|
||||
void s_update_lnActCoeff() const;
|
||||
|
||||
//! Update the derivative of the log of the activity coefficients wrt T
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* derivative of the natural logarithm of the activity coefficients
|
||||
* wrt temperature.
|
||||
* This function will be called to update the internally stored derivative
|
||||
* of the natural logarithm of the activity coefficients wrt temperature.
|
||||
*/
|
||||
void s_update_dlnActCoeff_dT() const;
|
||||
|
||||
//! Update the derivative of the log of the activity coefficients
|
||||
//! wrt log(mole fraction)
|
||||
//! Update the derivative of the log of the activity coefficients wrt
|
||||
//! log(mole fraction)
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* derivative of the natural logarithm of the activity coefficients
|
||||
* wrt logarithm of the mole fractions.
|
||||
* This function will be called to update the internally stored derivative
|
||||
* of the natural logarithm of the activity coefficients wrt logarithm of
|
||||
* the mole fractions.
|
||||
*/
|
||||
void s_update_dlnActCoeff_dlnX_diag() const;
|
||||
|
||||
//! Update the derivative of the log of the activity coefficients
|
||||
//! wrt log(moles) - diagonal only
|
||||
//! Update the derivative of the log of the activity coefficients wrt
|
||||
//! log(moles) - diagonal only
|
||||
/*!
|
||||
* This function will be called to update the internally stored diagonal entries for the
|
||||
* derivative of the natural logarithm of the activity coefficients
|
||||
* wrt logarithm of the moles.
|
||||
* This function will be called to update the internally stored diagonal
|
||||
* entries for the derivative of the natural logarithm of the activity
|
||||
* coefficients wrt logarithm of the moles.
|
||||
*/
|
||||
void s_update_dlnActCoeff_dlnN_diag() const;
|
||||
|
||||
//! Update the derivative of the log of the activity coefficients wrt log(moles_m)
|
||||
//! Update the derivative of the log of the activity coefficients wrt
|
||||
//! log(moles_m)
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* derivative of the natural logarithm of the activity coefficients
|
||||
* wrt logarithm of the mole number of species
|
||||
* This function will be called to update the internally stored derivative
|
||||
* of the natural logarithm of the activity coefficients wrt logarithm of
|
||||
* the mole number of species
|
||||
*/
|
||||
void s_update_dlnActCoeff_dlnN() const;
|
||||
|
||||
|
|
@ -701,15 +495,15 @@ protected:
|
|||
|
||||
//! vector of species indices representing species A in the interaction
|
||||
/*!
|
||||
* Each Margules excess Gibbs free energy term involves two species, A and B.
|
||||
* This vector identifies species A.
|
||||
* Each Margules excess Gibbs free energy term involves two species, A and
|
||||
* B. This vector identifies species A.
|
||||
*/
|
||||
std::vector<size_t> m_pSpecies_A_ij;
|
||||
|
||||
//! vector of species indices representing species B in the interaction
|
||||
/*!
|
||||
* Each Margules excess Gibbs free energy term involves two species, A and B.
|
||||
* This vector identifies species B.
|
||||
* Each Margules excess Gibbs free energy term involves two species, A and
|
||||
* B. This vector identifies species B.
|
||||
*/
|
||||
std::vector<size_t> m_pSpecies_B_ij;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@
|
|||
namespace Cantera
|
||||
{
|
||||
/**
|
||||
* Class MaskellSolidSolnPhase represents a condensed phase
|
||||
* non-ideal solution with 2 species following the thermodynamic
|
||||
* model described in Maskell, Shaw, and Tye, Manganese Dioxide Electrode -- IX,
|
||||
* Electrochimica Acta 28(2) pp 231-235, 1983.
|
||||
* Class MaskellSolidSolnPhase represents a condensed phase non-ideal solution
|
||||
* with 2 species following the thermodynamic model described in Maskell, Shaw,
|
||||
* and Tye, Manganese Dioxide Electrode -- IX, Electrochimica Acta 28(2) pp
|
||||
* 231-235, 1983.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
|
|
@ -31,68 +31,28 @@ class MaskellSolidSolnPhase : public VPStandardStateTP
|
|||
public:
|
||||
MaskellSolidSolnPhase();
|
||||
|
||||
//! Copy Constructor
|
||||
MaskellSolidSolnPhase(const MaskellSolidSolnPhase&);
|
||||
|
||||
//! Assignment operator
|
||||
MaskellSolidSolnPhase& operator=(const MaskellSolidSolnPhase&);
|
||||
|
||||
/*!
|
||||
* Base Class Duplication Function
|
||||
*
|
||||
* Given a pointer to ThermoPhase, this function can duplicate the object.
|
||||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
/**
|
||||
* This method returns the array of generalized
|
||||
* concentrations. The generalized concentrations are used
|
||||
* in the evaluation of the rates of progress for reactions
|
||||
* involving species in this phase. The generalized
|
||||
* concentration divided by the standard concentration is also
|
||||
* equal to the activity of species.
|
||||
*
|
||||
* @param c Pointer to array of doubles of length m_kk, which on exit
|
||||
* will contain the generalized concentrations.
|
||||
*/
|
||||
virtual void getActivityConcentrations(doublereal* c) const;
|
||||
|
||||
//! Return the standard concentration for the kth species
|
||||
/*!
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize the
|
||||
* generalized concentration.
|
||||
*
|
||||
* @param k Species number: this is an optional parameter,
|
||||
*/
|
||||
virtual doublereal standardConcentration(size_t k=0) const { return 1.0; }
|
||||
|
||||
//! Natural logarithm of the standard concentration of the kth species.
|
||||
/*!
|
||||
* @param k index of the species (defaults to zero)
|
||||
*/
|
||||
virtual doublereal logStandardConc(size_t k=0) const { return 0.0; }
|
||||
|
||||
//! @name Molar Thermodynamic Properties of the Solution
|
||||
//! @{
|
||||
/**
|
||||
* Molar enthalpy of the solution. Units: J/kmol.
|
||||
*/
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
|
||||
/**
|
||||
* Molar entropy of the solution. Units: J/kmol/K.
|
||||
*/
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
virtual doublereal entropy_mole() const;
|
||||
|
||||
//@}
|
||||
/** @name Mechanical Equation of State Properties
|
||||
*
|
||||
* In this equation of state implementation, the density is a
|
||||
* function only of the mole fractions. Therefore, it can't be
|
||||
* an independent variable. Instead, the pressure is used as the
|
||||
* independent variable. Functions which try to set the thermodynamic
|
||||
* state by calling setDensity() may cause an exception to be
|
||||
* thrown.
|
||||
* In this equation of state implementation, the density is a function only
|
||||
* of the mole fractions. Therefore, it can't be an independent variable.
|
||||
* Instead, the pressure is used as the independent variable. Functions
|
||||
* which try to set the thermodynamic state by calling setDensity() may
|
||||
* cause an exception to be thrown.
|
||||
*/
|
||||
//@{
|
||||
|
||||
|
|
@ -106,25 +66,20 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the pressure at constant temperature. Units: Pa.
|
||||
* This method sets a constant within the object.
|
||||
* The mass density is not a function of pressure.
|
||||
* Set the pressure at constant temperature. Units: Pa. This method sets a
|
||||
* constant within the object. The mass density is not a function of
|
||||
* pressure.
|
||||
*
|
||||
* @param p Input Pressure (Pa)
|
||||
*/
|
||||
virtual void setPressure(doublereal p);
|
||||
|
||||
/**
|
||||
* Overwritten setDensity() function is necessary because the
|
||||
* density is not an independent variable.
|
||||
* Overwritten setDensity() function is necessary because the density is not
|
||||
* an independent variable.
|
||||
*
|
||||
* This function will now throw an error condition
|
||||
*
|
||||
* @internal May have to adjust the strategy here to make
|
||||
* the eos for these materials slightly compressible, in order
|
||||
* to create a condition where the density is a function of
|
||||
* the pressure.
|
||||
*
|
||||
* @param rho Input density
|
||||
*/
|
||||
virtual void setDensity(const doublereal rho);
|
||||
|
|
@ -132,8 +87,8 @@ public:
|
|||
virtual void calcDensity();
|
||||
|
||||
/**
|
||||
* Overwritten setMolarDensity() function is necessary because the
|
||||
* density is not an independent variable.
|
||||
* Overwritten setMolarDensity() function is necessary because the density
|
||||
* is not an independent variable.
|
||||
*
|
||||
* This function will now throw an error condition.
|
||||
*
|
||||
|
|
@ -148,120 +103,35 @@ public:
|
|||
* @{
|
||||
*/
|
||||
|
||||
//! Get the array of species activity coefficients
|
||||
/*!
|
||||
* @param ac output vector of activity coefficients. Length: m_kk
|
||||
*/
|
||||
virtual void getActivityCoefficients(doublereal* ac) const;
|
||||
|
||||
/**
|
||||
* Get the species chemical potentials. Units: J/kmol.
|
||||
*
|
||||
* @param mu Output vector of chemical potentials.
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
/**
|
||||
* Get the array of non-dimensional species solution
|
||||
* chemical potentials at the current T and P
|
||||
*
|
||||
* @param mu Output vector of dimensionless chemical potentials. Length = m_kk.
|
||||
*/
|
||||
virtual void getChemPotentials_RT(doublereal* mu) const;
|
||||
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
||||
//! Returns an array of partial molar enthalpies for the species in the mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* @param hbar Output vector containing partial molar enthalpies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
|
||||
|
||||
/**
|
||||
* Returns an array of partial molar entropies of the species in the
|
||||
* solution. Units: J/kmol/K.
|
||||
*
|
||||
* @param sbar Output vector containing partial molar entropies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getPartialMolarEntropies(doublereal* sbar) const;
|
||||
|
||||
/**
|
||||
* Returns an array of partial molar Heat Capacities at constant
|
||||
* pressure of the species in the
|
||||
* solution. Units: J/kmol/K.
|
||||
*
|
||||
* @param cpbar Output vector of partial heat capacities. Length: m_kk.
|
||||
*/
|
||||
virtual void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
||||
/**
|
||||
* returns an array of partial molar volumes of the species
|
||||
* in the solution. Units: m^3 kmol-1.
|
||||
*
|
||||
* @param vbar Output vector of partial molar volumes. Length: m_kk.
|
||||
*/
|
||||
virtual void getPartialMolarVolumes(doublereal* vbar) const;
|
||||
|
||||
//! Get the Gibbs functions for the standard
|
||||
//! state of the species at the current <I>T</I> and <I>P</I> of the solution
|
||||
/*!
|
||||
* Units are Joules/kmol
|
||||
* @param gpure Output vector of standard state Gibbs free energies
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getPureGibbs(doublereal* gpure) const;
|
||||
|
||||
//! Get the array of chemical potentials at unit activity for the species
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* These are the standard state chemical potentials \f$ \mu^0_k(T,P)
|
||||
* \f$. The values are evaluated at the current
|
||||
* temperature and pressure of the solution
|
||||
*
|
||||
* @param mu Output vector of chemical potentials.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getStandardChemPotentials(doublereal* mu) const;
|
||||
|
||||
//@}
|
||||
/// @name Utility Functions
|
||||
//@{
|
||||
|
||||
/**
|
||||
* @internal Import and initialize a ThermoPhase object using an XML
|
||||
* tree. Here we read extra information about the XML description of a
|
||||
* phase. Regular information about elements and species and their
|
||||
* reference state thermodynamic information have already been read at
|
||||
* this point. For example, we do not need to call this function for
|
||||
* ideal gas equations of state. This function is called from
|
||||
* importPhase() after the elements and the species are initialized
|
||||
* with default ideal solution level data.
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a complete XML
|
||||
* tree description of the phase, including all of the
|
||||
* species data. In other words while "phase" must point to
|
||||
* an XML phase object, it must have sibling nodes
|
||||
* "speciesData" that describe the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done to see if
|
||||
* phaseNode is pointing to the phase with the correct id.
|
||||
*/
|
||||
virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
|
||||
void set_h_mix(const doublereal hmix) { h_mixing = hmix; }
|
||||
//@}
|
||||
|
||||
private:
|
||||
/**
|
||||
* m_Pcurrent = The current pressure
|
||||
* Since the density isn't a function of pressure, but only of the
|
||||
* mole fractions, we need to independently specify the pressure.
|
||||
* m_Pcurrent = The current pressure. Since the density isn't a function of
|
||||
* pressure, but only of the mole fractions, we need to independently
|
||||
* specify the pressure.
|
||||
*/
|
||||
doublereal m_Pcurrent;
|
||||
|
||||
|
|
@ -274,10 +144,8 @@ private:
|
|||
//! Vector containing the species reference enthalpies at T = m_tlast
|
||||
mutable vector_fp m_h0_RT;
|
||||
|
||||
/**
|
||||
* Vector containing the species reference constant pressure
|
||||
* heat capacities at T = m_tlast
|
||||
*/
|
||||
//! Vector containing the species reference constant pressure heat
|
||||
//! capacities at T = m_tlast
|
||||
mutable vector_fp m_cp0_R;
|
||||
|
||||
//! Vector containing the species reference Gibbs functions at T = m_tlast
|
||||
|
|
@ -286,7 +154,8 @@ private:
|
|||
//! Vector containing the species reference entropies at T = m_tlast
|
||||
mutable vector_fp m_s0_R;
|
||||
|
||||
//! Value of the enthalpy change on mixing due to protons changing from type B to type A configurations.
|
||||
//! Value of the enthalpy change on mixing due to protons changing from type
|
||||
//! B to type A configurations.
|
||||
doublereal h_mixing;
|
||||
|
||||
//! Index of the species whose mole fraction defines the extent of reduction r
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
//! Duplicator
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const {
|
||||
MetalPhase* idg = new MetalPhase(*this);
|
||||
return (ThermoPhase*) idg;
|
||||
|
|
|
|||
|
|
@ -19,19 +19,19 @@
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
//! Class MetalSHEelectrons represents electrons within
|
||||
//! a metal, adjacent to an aqueous electrolyte, that are consistent with the SHE reference electrode.
|
||||
//! Class MetalSHEelectrons represents electrons within a metal, adjacent to an
|
||||
//! aqueous electrolyte, that are consistent with the SHE reference electrode.
|
||||
/*!
|
||||
* The class is based on the electron having a chemical potential
|
||||
* equal to one-half of the entropy of the H<SUP>2</SUP> gas at the system pressure
|
||||
* The class is based on the electron having a chemical potential equal to one-
|
||||
* half of the entropy of the H<SUP>2</SUP> gas at the system pressure
|
||||
*
|
||||
* <b> Specification of Species Standard State Properties </b>
|
||||
*
|
||||
* This class inherits from SingleSpeciesTP.
|
||||
* It is assumed that the reference state thermodynamics may be
|
||||
* obtained by a pointer to a populated species thermodynamic property
|
||||
* manager class (see ThermoPhase::m_spthermo). How to relate pressure
|
||||
* changes to the reference state thermodynamics is resolved at this level.
|
||||
* This class inherits from SingleSpeciesTP. It is assumed that the reference
|
||||
* state thermodynamics may be obtained by a pointer to a populated species
|
||||
* thermodynamic property manager class (see ThermoPhase::m_spthermo). How to
|
||||
* relate pressure changes to the reference state thermodynamics is resolved at
|
||||
* this level.
|
||||
*
|
||||
* The enthalpy function is given by the following relation.
|
||||
*
|
||||
|
|
@ -39,20 +39,20 @@ namespace Cantera
|
|||
* h^o_k(T,P) = h^{ref}_k(T)
|
||||
* \f]
|
||||
*
|
||||
* The standard state constant-pressure heat capacity is independent of pressure:
|
||||
* The standard state constant-pressure heat capacity is independent of pressure:
|
||||
*
|
||||
* \f[
|
||||
* Cp^o_k(T,P) = Cp^{ref}_k(T)
|
||||
* \f]
|
||||
*
|
||||
* The standard state entropy depends in the following fashion on pressure:
|
||||
* The standard state entropy depends in the following fashion on pressure:
|
||||
*
|
||||
* \f[
|
||||
* S^o_k(T,P) = S^{ref}_k(T) - R \ln(\frac{P}{P_{ref}})
|
||||
* \f]
|
||||
*
|
||||
* The standard state Gibbs free energy is obtained from the enthalpy and entropy
|
||||
* functions:
|
||||
* The standard state Gibbs free energy is obtained from the enthalpy and
|
||||
* entropy functions:
|
||||
*
|
||||
* \f[
|
||||
* \mu^o_k(T,P) = h^o_k(T,P) - S^o_k(T,P) T
|
||||
|
|
@ -67,7 +67,7 @@ namespace Cantera
|
|||
* \mu^{ref}_k(T) = h^{ref}_k(T) - T S^{ref}_k(T)
|
||||
* \f]
|
||||
*
|
||||
* The standard state internal energy is obtained from the enthalpy function also
|
||||
* The standard state internal energy is obtained from the enthalpy function also
|
||||
*
|
||||
* \f[
|
||||
* u^o_k(T,P) = h^o_k(T) - R T
|
||||
|
|
@ -75,28 +75,26 @@ namespace Cantera
|
|||
*
|
||||
* <b> Specification of Solution Thermodynamic Properties </b>
|
||||
*
|
||||
* All solution properties are obtained from the standard state
|
||||
* species functions, since there is only one species in the phase.
|
||||
* All solution properties are obtained from the standard state species
|
||||
* functions, since there is only one species in the phase.
|
||||
*
|
||||
* <b> %Application within Kinetics Managers </b>
|
||||
*
|
||||
* The standard concentration is equal to 1.0. This means that the
|
||||
* kinetics operator works on an activities basis. Since this
|
||||
* is a stoichiometric substance, this means that the concentration
|
||||
* of this phase drops out of kinetics expressions since the activity is
|
||||
* always equal to one.
|
||||
* The standard concentration is equal to 1.0. This means that the kinetics
|
||||
* operator works on an activities basis. Since this is a stoichiometric
|
||||
* substance, this means that the concentration of this phase drops out of
|
||||
* kinetics expressions since the activity is always equal to one.
|
||||
*
|
||||
* This is what is expected of electrons. The only effect that this class will
|
||||
* have on reactions is in terms of the standard state chemical potential, which
|
||||
* is equal to 1/2 of the H2 gas chemical potential, and the voltage assigned
|
||||
* to the electron, which is the voltage of the metal.
|
||||
* This is what is expected of electrons. The only effect that this class will
|
||||
* have on reactions is in terms of the standard state chemical potential, which
|
||||
* is equal to 1/2 of the H2 gas chemical potential, and the voltage assigned to
|
||||
* the electron, which is the voltage of the metal.
|
||||
*
|
||||
* <b> Instantiation of the Class </b>
|
||||
*
|
||||
* The constructor for this phase is located in the default ThermoFactory
|
||||
* for %Cantera. A new MetalSHEelectrons object may be created by
|
||||
* the following code snippets, where the file metalSHEelectrons.xml exists
|
||||
* in a local directory:
|
||||
* The constructor for this phase is located in the default ThermoFactory for
|
||||
* %Cantera. A new MetalSHEelectrons object may be created by the following code
|
||||
* snippets, where the file metalSHEelectrons.xml exists in a local directory:
|
||||
*
|
||||
* @code
|
||||
* MetalSHEelectrons *eMetal = new MetalSHEelectrons("metalSHEelectrons.xml", "");
|
||||
|
|
@ -114,8 +112,8 @@ namespace Cantera
|
|||
* ThermoPhase *eMetal = newPhase("MetalSHEelectrons.xml", "MetalSHEelectrons");
|
||||
* @endcode
|
||||
*
|
||||
* Additionally, this phase may be created without including an XML file with
|
||||
* the special command, where the default file is embedded into this object.
|
||||
* Additionally, this phase may be created without including an XML file with
|
||||
* the special command, where the default file is embedded into this object.
|
||||
*
|
||||
* @code
|
||||
* MetalSHEelectrons *eMetal = new MetalSHEelectrons("MetalSHEelectrons_default.xml", "");
|
||||
|
|
@ -123,11 +121,10 @@ namespace Cantera
|
|||
*
|
||||
* <b> XML Example </b>
|
||||
*
|
||||
* The phase model name for this is called MetalSHEelectrons. It must be supplied
|
||||
* as the model attribute of the thermo XML element entry.
|
||||
* Within the phase XML block,
|
||||
* the density of the phase must be specified though it's not used. An example of an XML file
|
||||
* this phase is given below.
|
||||
* The phase model name for this is called MetalSHEelectrons. It must be
|
||||
* supplied as the model attribute of the thermo XML element entry. Within the
|
||||
* phase XML block, the density of the phase must be specified though it's not
|
||||
* used. An example of an XML file this phase is given below.
|
||||
*
|
||||
* @code
|
||||
* <?xml version="1.0"?>
|
||||
|
|
@ -171,8 +168,8 @@ namespace Cantera
|
|||
* </ctml>
|
||||
* @endcode
|
||||
*
|
||||
* The model attribute, "MetalSHEelectrons", on the thermo element
|
||||
* identifies the phase as being a MetalSHEelectrons object.
|
||||
* The model attribute, "MetalSHEelectrons", on the thermo element identifies
|
||||
* the phase as being a MetalSHEelectrons object.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
|
|
@ -199,26 +196,8 @@ public:
|
|||
*/
|
||||
MetalSHEelectrons(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
MetalSHEelectrons(const MetalSHEelectrons& right);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
MetalSHEelectrons& operator=(const MetalSHEelectrons& right);
|
||||
|
||||
//! Duplication function
|
||||
/*!
|
||||
* This virtual function is used to create a duplicate of the
|
||||
* current phase. It's used to duplicate the phase when given
|
||||
* a ThermoPhase pointer to the phase.
|
||||
*
|
||||
* @return It returns a ThermoPhase pointer.
|
||||
*/
|
||||
ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
/**
|
||||
|
|
@ -233,38 +212,22 @@ public:
|
|||
|
||||
//! Report the Pressure. Units: Pa.
|
||||
/*!
|
||||
* For an incompressible substance, the density is independent of
|
||||
* pressure. This method simply returns the stored pressure value.
|
||||
* For an incompressible substance, the density is independent of pressure.
|
||||
* This method simply returns the stored pressure value.
|
||||
*/
|
||||
virtual doublereal pressure() const;
|
||||
|
||||
//! Set the pressure at constant temperature. Units: Pa.
|
||||
/*!
|
||||
* For an incompressible substance, the density is
|
||||
* independent of pressure. Therefore, this method only
|
||||
* stores the specified pressure value. It does not
|
||||
* modify the density.
|
||||
* For an incompressible substance, the density is independent of pressure.
|
||||
* Therefore, this method only stores the specified pressure value. It does
|
||||
* not modify the density.
|
||||
*
|
||||
* @param p Pressure (units - Pa)
|
||||
*/
|
||||
virtual void setPressure(doublereal p);
|
||||
|
||||
//! Returns the isothermal compressibility. Units: 1/Pa.
|
||||
/*!
|
||||
* The isothermal compressibility is defined as
|
||||
* \f[
|
||||
* \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal isothermalCompressibility() const;
|
||||
|
||||
//! Return the volumetric thermal expansion coefficient. Units: 1/K.
|
||||
/*!
|
||||
* The thermal expansion coefficient is defined as
|
||||
* \f[
|
||||
* \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal thermalExpansionCoeff() const;
|
||||
|
||||
//! @}
|
||||
|
|
@ -276,30 +239,27 @@ public:
|
|||
|
||||
//! This method returns an array of generalized concentrations
|
||||
/*!
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
|
||||
* C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration
|
||||
* defined below and \f$ a_k \f$ are activities used in the
|
||||
* thermodynamic functions. These activity (or generalized)
|
||||
* concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions.
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / C^0_k, \f$ where
|
||||
* \f$ C^0_k \f$ is a standard concentration defined below and \f$ a_k \f$
|
||||
* are activities used in the thermodynamic functions. These activity (or
|
||||
* generalized) concentrations are used by kinetics manager classes to
|
||||
* compute the forward and reverse rates of elementary reactions.
|
||||
*
|
||||
* For a stoichiometric substance, there is
|
||||
* only one species, and the generalized concentration is 1.0.
|
||||
* For a stoichiometric substance, there is only one species, and the
|
||||
* generalized concentration is 1.0.
|
||||
*
|
||||
* @param c Output array of generalized concentrations. The
|
||||
* units depend upon the implementation of the
|
||||
* reaction rate expressions within the phase.
|
||||
* @param c Output array of generalized concentrations. The units depend
|
||||
* upon the implementation of the reaction rate expressions within
|
||||
* the phase.
|
||||
*/
|
||||
virtual void getActivityConcentrations(doublereal* c) const;
|
||||
|
||||
//! Return the standard concentration for the kth species
|
||||
/*!
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize
|
||||
* the activity (i.e., generalized) concentration.
|
||||
* This phase assumes that the kinetics operator works on an
|
||||
* dimensionless basis. Thus, the standard concentration is
|
||||
* equal to 1.0.
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize the activity
|
||||
* (i.e., generalized) concentration. This phase assumes that the kinetics
|
||||
* operator works on an dimensionless basis. Thus, the standard
|
||||
* concentration is equal to 1.0.
|
||||
*
|
||||
* @param k Optional parameter indicating the species. The default
|
||||
* is to assume this refers to species 0.
|
||||
|
|
@ -314,17 +274,17 @@ public:
|
|||
*/
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
//! Get the array of chemical potentials at unit activity for the species
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
//! Get the array of chemical potentials at unit activity for the species at
|
||||
//! their standard states at the current <I>T</I> and <I>P</I> of the
|
||||
//! solution.
|
||||
/*!
|
||||
* For a stoichiometric substance, there is no activity term in
|
||||
* the chemical potential expression, and therefore the
|
||||
* standard chemical potential and the chemical potential
|
||||
* are both equal to the molar Gibbs function.
|
||||
* For a stoichiometric substance, there is no activity term in the chemical
|
||||
* potential expression, and therefore the standard chemical potential and
|
||||
* the chemical potential are both equal to the molar Gibbs function.
|
||||
*
|
||||
* These are the standard state chemical potentials \f$ \mu^0_k(T,P)
|
||||
* \f$. The values are evaluated at the current
|
||||
* temperature and pressure of the solution
|
||||
* These are the standard state chemical potentials \f$ \mu^0_k(T,P) \f$.
|
||||
* The values are evaluated at the current temperature and pressure of the
|
||||
* solution
|
||||
*
|
||||
* @param mu0 Output vector of chemical potentials.
|
||||
* Length: m_kk.
|
||||
|
|
@ -335,48 +295,19 @@ public:
|
|||
/// @name Properties of the Standard State of the Species in the Solution
|
||||
//@{
|
||||
|
||||
//! Get the nondimensional Enthalpy functions for the species
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param hrt Output vector of nondimensional standard state enthalpies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEnthalpy_RT(doublereal* hrt) const;
|
||||
|
||||
//! Get the array of nondimensional Entropy functions for the
|
||||
//! standard state species at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param sr Output vector of nondimensional standard state entropies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEntropy_R(doublereal* sr) const;
|
||||
|
||||
//! Get the nondimensional Gibbs functions for the species
|
||||
//! in their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param grt Output vector of nondimensional standard state Gibbs free energies
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT(doublereal* grt) const;
|
||||
|
||||
//! Get the nondimensional Heat Capacities at constant
|
||||
//! pressure for the species standard states
|
||||
//! at the current <I>T</I> and <I>P</I> of the solution
|
||||
/*!
|
||||
* @param cpr Output vector of nondimensional standard state heat capacities
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getCp_R(doublereal* cpr) const;
|
||||
|
||||
//! Returns the vector of nondimensional Internal Energies of the standard
|
||||
//! state species at the current <I>T</I> and <I>P</I> of the solution
|
||||
//! Returns the vector of nondimensional Internal Energies of the standard
|
||||
//! state species at the current <I>T</I> and <I>P</I> of the solution
|
||||
/*!
|
||||
* For an incompressible,
|
||||
* stoichiometric substance, the molar internal energy is
|
||||
* independent of pressure. Since the thermodynamic properties
|
||||
* are specified by giving the standard-state enthalpy, the
|
||||
* term \f$ P_{ref} \hat v\f$ is subtracted from the specified reference molar
|
||||
* enthalpy to compute the standard state molar internal energy.
|
||||
* For an incompressible, stoichiometric substance, the molar internal
|
||||
* energy is independent of pressure. Since the thermodynamic properties are
|
||||
* specified by giving the standard-state enthalpy, the term \f$ P_{ref}
|
||||
* \hat v\f$ is subtracted from the specified reference molar enthalpy to
|
||||
* compute the standard state molar internal energy.
|
||||
*
|
||||
* @param urt output vector of nondimensional standard state
|
||||
* internal energies of the species. Length: m_kk.
|
||||
|
|
@ -387,14 +318,6 @@ public:
|
|||
/// @name Thermodynamic Values for the Species Reference States
|
||||
//@{
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! internal Energies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for each species.
|
||||
/*!
|
||||
* @param urt Output vector of nondimensional reference state
|
||||
* internal energies of the species.
|
||||
* Length: m_kk
|
||||
*/
|
||||
virtual void getIntEnergy_RT_ref(doublereal* urt) const;
|
||||
// @}
|
||||
|
||||
|
|
@ -402,8 +325,7 @@ public:
|
|||
|
||||
//! Make the default XML tree
|
||||
/*!
|
||||
* @return Returns a malloced XML tree containing the
|
||||
* default info.
|
||||
* @returns a malloced XML tree containing the default info.
|
||||
*/
|
||||
static XML_Node* makeDefaultXMLTree();
|
||||
|
||||
|
|
@ -432,13 +354,7 @@ public:
|
|||
|
||||
//! Set equation of state parameter values from XML entries.
|
||||
/*!
|
||||
* This method is called by function importPhase() when processing a phase
|
||||
* definition in an input file. It should be overloaded in subclasses to set
|
||||
* any parameters that are specific to that particular phase
|
||||
* model. Note, this method is called before the phase is
|
||||
* initialized with elements and/or species.
|
||||
*
|
||||
* For this phase, the density of the phase is specified in this block.
|
||||
* For this phase, the density of the phase is specified in this block.
|
||||
*
|
||||
* @param eosdata An XML_Node object corresponding to
|
||||
* the "thermo" entry for this phase in the input file.
|
||||
|
|
|
|||
|
|
@ -20,27 +20,25 @@
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
//! Class MineralEQ3 represents a stoichiometric (fixed
|
||||
//! composition) incompressible substance based on EQ3's parameterization
|
||||
//! Class MineralEQ3 represents a stoichiometric (fixed composition)
|
||||
//! incompressible substance based on EQ3's parameterization
|
||||
/*!
|
||||
* This class inherits from SingleSpeciesSSTP class.
|
||||
* EQ's parameterization is mapped onto the Shomate polynomial class.
|
||||
* This class inherits from SingleSpeciesTP class. EQ's parameterization is
|
||||
* mapped onto the Shomate polynomial class.
|
||||
*
|
||||
* <b> Specification of Species Standard State Properties </b>
|
||||
*
|
||||
* This class inherits from SingleSpeciesTP.
|
||||
* It is assumed that the reference state thermodynamics may be
|
||||
* obtained by a pointer to a populated species thermodynamic property
|
||||
* manager class (see ThermoPhase::m_spthermo). How to relate pressure
|
||||
* changes to the reference state thermodynamics is resolved at this level.
|
||||
* This class inherits from SingleSpeciesTP. It is assumed that the reference
|
||||
* state thermodynamics may be obtained by a pointer to a populated species
|
||||
* thermodynamic property manager class (see ThermoPhase::m_spthermo). How to
|
||||
* relate pressure changes to the reference state thermodynamics is resolved at
|
||||
* this level.
|
||||
*
|
||||
* For an incompressible,
|
||||
* stoichiometric substance, the molar internal energy is
|
||||
* independent of pressure. Since the thermodynamic properties
|
||||
* are specified by giving the standard-state enthalpy, the
|
||||
* term \f$ P_0 \hat v\f$ is subtracted from the specified molar
|
||||
* enthalpy to compute the molar internal energy. The entropy is
|
||||
* assumed to be independent of the pressure.
|
||||
* For an incompressible, stoichiometric substance, the molar internal energy is
|
||||
* independent of pressure. Since the thermodynamic properties are specified by
|
||||
* giving the standard-state enthalpy, the term \f$ P_0 \hat v\f$ is subtracted
|
||||
* from the specified molar enthalpy to compute the molar internal energy. The
|
||||
* entropy is assumed to be independent of the pressure.
|
||||
*
|
||||
* The enthalpy function is given by the following relation.
|
||||
*
|
||||
|
|
@ -49,45 +47,44 @@ namespace Cantera
|
|||
* h^{ref}_k(T) + \tilde v \left( P - P_{ref} \right)
|
||||
* \f]
|
||||
*
|
||||
* For an incompressible,
|
||||
* stoichiometric substance, the molar internal energy is
|
||||
* independent of pressure. Since the thermodynamic properties
|
||||
* are specified by giving the standard-state enthalpy, the
|
||||
* term \f$ P_{ref} \tilde v\f$ is subtracted from the specified reference molar
|
||||
* enthalpy to compute the molar internal energy.
|
||||
* For an incompressible, stoichiometric substance, the molar internal energy is
|
||||
* independent of pressure. Since the thermodynamic properties are specified by
|
||||
* giving the standard-state enthalpy, the term \f$ P_{ref} \tilde v\f$ is
|
||||
* subtracted from the specified reference molar enthalpy to compute the molar
|
||||
* internal energy.
|
||||
*
|
||||
* \f[
|
||||
* u^o_k(T,P) = h^{ref}_k(T) - P_{ref} \tilde v
|
||||
* \f]
|
||||
*
|
||||
* The standard state heat capacity and entropy are independent
|
||||
* of pressure. The standard state Gibbs free energy is obtained
|
||||
* from the enthalpy and entropy functions.
|
||||
* The standard state heat capacity and entropy are independent of pressure. The
|
||||
* standard state Gibbs free energy is obtained from the enthalpy and entropy
|
||||
* functions.
|
||||
*
|
||||
* <b> Specification of Solution Thermodynamic Properties </b>
|
||||
*
|
||||
* All solution properties are obtained from the standard state
|
||||
* species functions, since there is only one species in the phase.
|
||||
* All solution properties are obtained from the standard state species
|
||||
* functions, since there is only one species in the phase.
|
||||
*
|
||||
* <b> %Application within Kinetics Managers </b>
|
||||
*
|
||||
* The standard concentration is equal to 1.0. This means that the
|
||||
* kinetics operator works on an (activities basis). Since this
|
||||
* is a stoichiometric substance, this means that the concentration
|
||||
* of this phase drops out of kinetics expressions.
|
||||
* The standard concentration is equal to 1.0. This means that the kinetics
|
||||
* operator works on an (activities basis). Since this is a stoichiometric
|
||||
* substance, this means that the concentration of this phase drops out of
|
||||
* kinetics expressions.
|
||||
*
|
||||
* An example of a reaction using this is a sticking coefficient
|
||||
* reaction of a substance in an ideal gas phase on a surface with a bulk phase
|
||||
* species in this phase. In this case, the rate of progress for this
|
||||
* reaction, \f$ R_s \f$, may be expressed via the following equation:
|
||||
* An example of a reaction using this is a sticking coefficient reaction of a
|
||||
* substance in an ideal gas phase on a surface with a bulk phase species in
|
||||
* this phase. In this case, the rate of progress for this reaction,
|
||||
* \f$ R_s \f$, may be expressed via the following equation:
|
||||
* \f[
|
||||
* R_s = k_s C_{gas}
|
||||
* \f]
|
||||
* where the units for \f$ R_s \f$ are kmol m-2 s-1. \f$ C_{gas} \f$ has units
|
||||
* of kmol m-3. Therefore, the kinetic rate constant, \f$ k_s \f$, has
|
||||
* units of m s-1. Nowhere does the concentration of the bulk phase
|
||||
* appear in the rate constant expression, since it's a stoichiometric
|
||||
* phase and the activity is always equal to 1.0.
|
||||
* of kmol m-3. Therefore, the kinetic rate constant, \f$ k_s \f$, has units of
|
||||
* m s-1. Nowhere does the concentration of the bulk phase appear in the rate
|
||||
* constant expression, since it's a stoichiometric phase and the activity is
|
||||
* always equal to 1.0.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
|
|
@ -114,26 +111,8 @@ public:
|
|||
*/
|
||||
MineralEQ3(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
MineralEQ3(const MineralEQ3& right);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
MineralEQ3& operator=(const MineralEQ3& right);
|
||||
|
||||
//! Duplication function
|
||||
/*!
|
||||
* This virtual function is used to create a duplicate of the
|
||||
* current phase. It's used to duplicate the phase when given
|
||||
* a ThermoPhase pointer to the phase.
|
||||
*
|
||||
* @return It returns a ThermoPhase pointer.
|
||||
*/
|
||||
ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
/**
|
||||
|
|
@ -148,76 +127,56 @@ public:
|
|||
|
||||
//! Report the Pressure. Units: Pa.
|
||||
/*!
|
||||
* For an incompressible substance, the density is independent
|
||||
* of pressure. This method simply returns the stored
|
||||
* pressure value.
|
||||
* For an incompressible substance, the density is independent of pressure.
|
||||
* This method simply returns the stored pressure value.
|
||||
*/
|
||||
virtual doublereal pressure() const;
|
||||
|
||||
//! Set the pressure at constant temperature. Units: Pa.
|
||||
/*!
|
||||
* For an incompressible substance, the density is
|
||||
* independent of pressure. Therefore, this method only
|
||||
* stores the specified pressure value. It does not
|
||||
* modify the density.
|
||||
* For an incompressible substance, the density is independent of pressure.
|
||||
* Therefore, this method only stores the specified pressure value. It does
|
||||
* not modify the density.
|
||||
*
|
||||
* @param p Pressure (units - Pa)
|
||||
*/
|
||||
virtual void setPressure(doublereal p);
|
||||
|
||||
//! Returns the isothermal compressibility. Units: 1/Pa.
|
||||
/*!
|
||||
* The isothermal compressibility is defined as
|
||||
* \f[
|
||||
* \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal isothermalCompressibility() const;
|
||||
|
||||
//! Return the volumetric thermal expansion coefficient. Units: 1/K.
|
||||
/*!
|
||||
* The thermal expansion coefficient is defined as
|
||||
* \f[
|
||||
* \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal thermalExpansionCoeff() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Activities, Standard States, and Activity Concentrations
|
||||
*
|
||||
* This section is largely handled by parent classes, since there
|
||||
* is only one species. Therefore, the activity is equal to one.
|
||||
* This section is largely handled by parent classes, since there is only
|
||||
* one species. Therefore, the activity is equal to one.
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! This method returns an array of generalized concentrations
|
||||
/*!
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
|
||||
* C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration
|
||||
* defined below and \f$ a_k \f$ are activities used in the
|
||||
* thermodynamic functions. These activity (or generalized)
|
||||
* concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions.
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / C^0_k, \f$ where
|
||||
* \f$ C^0_k \f$ is a standard concentration defined below and \f$ a_k \f$
|
||||
* are activities used in the thermodynamic functions. These activity (or
|
||||
* generalized) concentrations are used by kinetics manager classes to
|
||||
* compute the forward and reverse rates of elementary reactions.
|
||||
*
|
||||
* For a stoichiometric substance, there is
|
||||
* only one species, and the generalized concentration is 1.0.
|
||||
* For a stoichiometric substance, there is only one species, and the
|
||||
* generalized concentration is 1.0.
|
||||
*
|
||||
* @param c Output array of generalized concentrations. The
|
||||
* units depend upon the implementation of the
|
||||
* reaction rate expressions within the phase.
|
||||
* @param c Output array of generalized concentrations. The units depend
|
||||
* upon the implementation of the reaction rate expressions within
|
||||
* the phase.
|
||||
*/
|
||||
virtual void getActivityConcentrations(doublereal* c) const;
|
||||
|
||||
//! Return the standard concentration for the kth species
|
||||
/*!
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize
|
||||
* the activity (i.e., generalized) concentration.
|
||||
* This phase assumes that the kinetics operator works on an
|
||||
* dimensionless basis. Thus, the standard concentration is
|
||||
* equal to 1.0.
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize the activity
|
||||
* (i.e., generalized) concentration. This phase assumes that the kinetics
|
||||
* operator works on an dimensionless basis. Thus, the standard
|
||||
* concentration is equal to 1.0.
|
||||
*
|
||||
* @param k Optional parameter indicating the species. The default
|
||||
* is to assume this refers to species 0.
|
||||
|
|
@ -225,20 +184,15 @@ public:
|
|||
* Returns The standard Concentration as 1.0
|
||||
*/
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
//! Natural logarithm of the standard concentration of the kth species.
|
||||
/*!
|
||||
* @param k index of the species (defaults to zero)
|
||||
*/
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
//! Get the array of chemical potentials at unit activity for the species
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
//! Get the array of chemical potentials at unit activity for the species at
|
||||
//! their standard states at the current <I>T</I> and <I>P</I> of the
|
||||
//! solution.
|
||||
/*!
|
||||
* For a stoichiometric substance, there is no activity term in
|
||||
* the chemical potential expression, and therefore the
|
||||
* standard chemical potential and the chemical potential
|
||||
* are both equal to the molar Gibbs function.
|
||||
* For a stoichiometric substance, there is no activity term in the chemical
|
||||
* potential expression, and therefore the standard chemical potential and
|
||||
* the chemical potential are both equal to the molar Gibbs function.
|
||||
*
|
||||
* These are the standard state chemical potentials \f$ \mu^0_k(T,P)
|
||||
* \f$. The values are evaluated at the current
|
||||
|
|
@ -253,51 +207,22 @@ public:
|
|||
/// @name Properties of the Standard State of the Species in the Solution
|
||||
//@{
|
||||
|
||||
//! Get the nondimensional Enthalpy functions for the species
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param hrt Output vector of nondimensional standard state enthalpies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEnthalpy_RT(doublereal* hrt) const;
|
||||
|
||||
//! Get the array of nondimensional Entropy functions for the
|
||||
//! standard state species at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param sr Output vector of nondimensional standard state entropies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEntropy_R(doublereal* sr) const;
|
||||
|
||||
//! Get the nondimensional Gibbs functions for the species
|
||||
//! in their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param grt Output vector of nondimensional standard state Gibbs free energies
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT(doublereal* grt) const;
|
||||
|
||||
//! Get the nondimensional Heat Capacities at constant
|
||||
//! pressure for the species standard states
|
||||
//! at the current <I>T</I> and <I>P</I> of the solution
|
||||
/*!
|
||||
* @param cpr Output vector of nondimensional standard state heat capacities
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getCp_R(doublereal* cpr) const;
|
||||
|
||||
//! Returns the vector of nondimensional Internal Energies of the standard
|
||||
//! state species at the current <I>T</I> and <I>P</I> of the solution
|
||||
/*!
|
||||
* For an incompressible,
|
||||
* stoichiometric substance, the molar internal energy is
|
||||
* independent of pressure. Since the thermodynamic properties
|
||||
* are specified by giving the standard-state enthalpy, the
|
||||
* term \f$ P_{ref} \hat v\f$ is subtracted from the specified reference molar
|
||||
* For an incompressible, stoichiometric substance, the molar internal
|
||||
* energy is independent of pressure. Since the thermodynamic properties are
|
||||
* specified by giving the standard-state enthalpy, the term
|
||||
* \f$ P_{ref} \hat v\f$ is subtracted from the specified reference molar
|
||||
* enthalpy to compute the standard state molar internal energy.
|
||||
*
|
||||
* @param urt output vector of nondimensional standard state
|
||||
* internal energies of the species. Length: m_kk.
|
||||
* @param urt output vector of nondimensional standard state internal
|
||||
* energies of the species. Length: m_kk.
|
||||
*/
|
||||
virtual void getIntEnergy_RT(doublereal* urt) const;
|
||||
|
||||
|
|
@ -305,35 +230,12 @@ public:
|
|||
/// @name Thermodynamic Values for the Species Reference States
|
||||
//@{
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! internal Energies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for each species.
|
||||
/*!
|
||||
* @param urt Output vector of nondimensional reference state
|
||||
* internal energies of the species.
|
||||
* Length: m_kk
|
||||
*/
|
||||
virtual void getIntEnergy_RT_ref(doublereal* urt) const;
|
||||
//! @}
|
||||
|
||||
//! Initialize the phase parameters from an XML file.
|
||||
//! @copydoc ThermoPhase::initThermoXML
|
||||
/*!
|
||||
* initThermoXML() (virtual from ThermoPhase)
|
||||
*
|
||||
* This gets called from importPhase(). It processes the XML file
|
||||
* after the species are set up. This is the main routine for
|
||||
* reading in activity coefficient parameters.
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a
|
||||
* complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
* This is the main routine for reading in activity coefficient parameters.
|
||||
*/
|
||||
virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
|
|
@ -360,18 +262,9 @@ public:
|
|||
*/
|
||||
virtual void getParameters(int& n, doublereal* const c) const;
|
||||
|
||||
//! Set equation of state parameter values from XML entries.
|
||||
//! @copydoc ThermoPhase::setParametersFromXML
|
||||
/*!
|
||||
* This method is called by function importPhase() when processing a phase
|
||||
* definition in an input file. It should be overloaded in subclasses to set
|
||||
* any parameters that are specific to that particular phase
|
||||
* model. Note, this method is called before the phase is
|
||||
* initialized with elements and/or species.
|
||||
*
|
||||
* For this phase, the density of the phase is specified in this block.
|
||||
*
|
||||
* @param eosdata An XML_Node object corresponding to
|
||||
* the "thermo" entry for this phase in the input file.
|
||||
* For this phase, the density of the phase is specified in this block.
|
||||
*/
|
||||
virtual void setParametersFromXML(const XML_Node& eosdata);
|
||||
doublereal LookupGe(const std::string& elemName);
|
||||
|
|
@ -380,8 +273,8 @@ public:
|
|||
protected:
|
||||
//! Value of the Absolute Gibbs Free Energy NIST scale at T_r and P_r
|
||||
/*!
|
||||
* This is the NIST scale value of Gibbs free energy at T_r = 298.15
|
||||
* and P_r = 1 atm.
|
||||
* This is the NIST scale value of Gibbs free energy at T_r = 298.15
|
||||
* and P_r = 1 atm.
|
||||
*
|
||||
* J kmol-1
|
||||
*/
|
||||
|
|
@ -395,19 +288,19 @@ protected:
|
|||
|
||||
//! Input Value of deltaG of Formation at Tr and Pr (cal gmol-1)
|
||||
/*!
|
||||
* Tr = 298.15 Pr = 1 atm
|
||||
* Tr = 298.15 Pr = 1 atm
|
||||
*
|
||||
* This is the delta G for the formation reaction of the
|
||||
* ion from elements in their stable state at Tr, Pr.
|
||||
* This is the delta G for the formation reaction of the ion from elements
|
||||
* in their stable state at Tr, Pr.
|
||||
*/
|
||||
doublereal m_deltaG_formation_pr_tr;
|
||||
|
||||
//! Input Value of deltaH of Formation at Tr and Pr (cal gmol-1)
|
||||
/*!
|
||||
* Tr = 298.15 Pr = 1 atm
|
||||
* Tr = 298.15 Pr = 1 atm
|
||||
*
|
||||
* This is the delta H for the formation reaction of the
|
||||
* ion from elements in their stable state at Tr, Pr.
|
||||
* This is the delta H for the formation reaction of the ion from elements
|
||||
* in their stable state at Tr, Pr.
|
||||
*/
|
||||
doublereal m_deltaH_formation_pr_tr;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
/**
|
||||
* @file MixedSolventElectrolyte.h
|
||||
* Header for intermediate ThermoPhase object for phases which
|
||||
* employ Gibbs excess free energy based formulations
|
||||
* (see \ref thermoprops
|
||||
* and class \link Cantera::MargulesVPSSTP MargulesVPSSTP\endlink).
|
||||
*
|
||||
* Header file for a derived class of ThermoPhase that handles
|
||||
* variable pressure standard state methods for calculating
|
||||
* thermodynamic properties that are further based upon activities
|
||||
* based on the molality scale. These include most of the methods for
|
||||
* calculating liquid electrolyte thermodynamics.
|
||||
* @file MixedSolventElectrolyte.h (see \ref thermoprops and class \link
|
||||
* Cantera::MixedSolventElectrolyte MixedSolventElectrolyte \endlink).
|
||||
*/
|
||||
/*
|
||||
* Copyright (2006) Sandia Corporation. Under the terms of
|
||||
|
|
@ -24,245 +15,211 @@
|
|||
|
||||
namespace Cantera
|
||||
{
|
||||
/**
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
|
||||
//! MixedSolventElectrolyte is a derived class of GibbsExcessVPSSTP that employs
|
||||
//! the DH and local Marguless approximations for the excess Gibbs free energy
|
||||
//! MixedSolventElectrolyte is a derived class of GibbsExcessVPSSTP that employs
|
||||
//! the DH and local Marguless approximations for the excess Gibbs free energy
|
||||
/*!
|
||||
* MixedSolventElectrolyte derives from class GibbsExcessVPSSTP which is derived
|
||||
* from VPStandardStateTP,
|
||||
* and overloads the virtual methods defined there with ones that
|
||||
* use expressions appropriate for the Margules Excess Gibbs free energy
|
||||
* approximation.
|
||||
* from VPStandardStateTP.
|
||||
*
|
||||
* The independent unknowns are pressure, temperature, and mass fraction.
|
||||
*
|
||||
* Several concepts are introduced. The first concept is there are temporary
|
||||
* variables for holding the species standard state values
|
||||
* of Cp, H, S, G, and V at the
|
||||
* last temperature and pressure called. These functions are not recalculated
|
||||
* if a new call is made using the previous temperature and pressure. Currently,
|
||||
* these variables and the calculation method are handled by the VPSSMgr class,
|
||||
* for which VPStandardStateTP owns a pointer to.
|
||||
*
|
||||
* To support the above functionality, pressure and temperature variables,
|
||||
* m_plast_ss and m_tlast_ss, are kept which store the last pressure and temperature
|
||||
* used in the evaluation of standard state properties.
|
||||
*
|
||||
* This class is usually used for nearly incompressible phases. For those phases, it
|
||||
* makes sense to change the equation of state independent variable from
|
||||
* density to pressure. The variable m_Pcurrent contains the current value of the
|
||||
* pressure within the phase.
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Specification of Species Standard State Properties </H2>
|
||||
* <HR>
|
||||
*
|
||||
* All species are defined to have standard states that depend upon both
|
||||
* the temperature and the pressure. The Margules approximation assumes
|
||||
* symmetric standard states, where all of the standard state assume
|
||||
* that the species are in pure component states at the temperature
|
||||
* and pressure of the solution. I don't think it prevents, however,
|
||||
* some species from being dilute in the solution.
|
||||
* All species are defined to have standard states that depend upon both the
|
||||
* temperature and the pressure. The Margules approximation assumes symmetric
|
||||
* standard states, where all of the standard state assume that the species are
|
||||
* in pure component states at the temperature and pressure of the solution. I
|
||||
* don't think it prevents, however, some species from being dilute in the
|
||||
* solution.
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Specification of Solution Thermodynamic Properties </H2>
|
||||
* <HR>
|
||||
*
|
||||
* The molar excess Gibbs free energy is given by the following formula which is a sum over interactions <I>i</I>.
|
||||
* Each of the interactions are binary interactions involving two of the species in the phase, denoted, <I>Ai</I>
|
||||
* and <I>Bi</I>.
|
||||
* This is the generalization of the Margules formulation for a phase
|
||||
* that has more than 2 species.
|
||||
* The molar excess Gibbs free energy is given by the following formula which is
|
||||
* a sum over interactions <I>i</I>. Each of the interactions are binary
|
||||
* interactions involving two of the species in the phase, denoted, <I>Ai</I>
|
||||
* and <I>Bi</I>. This is the generalization of the Margules formulation for a
|
||||
* phase that has more than 2 species.
|
||||
*
|
||||
* \f[
|
||||
* G^E = \sum_i \left( H_{Ei} - T S_{Ei} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* H^E_i = n X_{Ai} X_{Bi} \left( h_{o,i} + h_{1,i} X_{Bi} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* S^E_i = n X_{Ai} X_{Bi} \left( s_{o,i} + s_{1,i} X_{Bi} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* G^E = \sum_i \left( H_{Ei} - T S_{Ei} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* H^E_i = n X_{Ai} X_{Bi} \left( h_{o,i} + h_{1,i} X_{Bi} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* S^E_i = n X_{Ai} X_{Bi} \left( s_{o,i} + s_{1,i} X_{Bi} \right)
|
||||
* \f]
|
||||
*
|
||||
* where n is the total moles in the solution.
|
||||
*
|
||||
* The activity of a species defined in the phase is given by an excess
|
||||
* Gibbs free energy formulation.
|
||||
* The activity of a species defined in the phase is given by an excess Gibbs
|
||||
* free energy formulation.
|
||||
*
|
||||
* \f[
|
||||
* a_k = \gamma_k X_k
|
||||
* \f]
|
||||
* \f[
|
||||
* a_k = \gamma_k X_k
|
||||
* \f]
|
||||
*
|
||||
* where
|
||||
*
|
||||
* \f[
|
||||
* R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i}
|
||||
* \f]
|
||||
* \f[
|
||||
* R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i}
|
||||
* \f]
|
||||
*
|
||||
* Taking the derivatives results in the following expression
|
||||
*
|
||||
* \f[
|
||||
* R T \ln( \gamma_k )= \sum_i \left( \left( \delta_{Ai,k} X_{Bi} + \delta_{Bi,k} X_{Ai} - X_{Ai} X_{Bi} \right)
|
||||
* \left( g^E_{o,i} + g^E_{1,i} X_{Bi} \right) +
|
||||
* \left( \delta_{Bi,k} - X_{Bi} \right) X_{Ai} X_{Bi} g^E_{1,i} \right)
|
||||
* \f]
|
||||
* where
|
||||
* \f$ g^E_{o,i} = h_{o,i} - T s_{o,i} \f$ and \f$ g^E_{1,i} = h_{1,i} - T s_{1,i} \f$
|
||||
* and where \f$ X_k \f$ is the mole fraction of species <I>k</I>.
|
||||
* \f[
|
||||
* R T \ln( \gamma_k )= \sum_i \left( \left( \delta_{Ai,k} X_{Bi} + \delta_{Bi,k} X_{Ai} - X_{Ai} X_{Bi} \right)
|
||||
* \left( g^E_{o,i} + g^E_{1,i} X_{Bi} \right) +
|
||||
* \left( \delta_{Bi,k} - X_{Bi} \right) X_{Ai} X_{Bi} g^E_{1,i} \right)
|
||||
* \f]
|
||||
* where \f$ g^E_{o,i} = h_{o,i} - T s_{o,i} \f$ and
|
||||
* \f$ g^E_{1,i} = h_{1,i} - T s_{1,i} \f$ and where \f$ X_k \f$ is the mole
|
||||
* fraction of species <I>k</I>.
|
||||
*
|
||||
* This object inherits from the class VPStandardStateTP. Therefore, the specification and
|
||||
* calculation of all standard state and reference state values are handled at that level. Various functional
|
||||
* forms for the standard state are permissible.
|
||||
* The chemical potential for species <I>k</I> is equal to
|
||||
* This object inherits from the class VPStandardStateTP. Therefore, the
|
||||
* specification and calculation of all standard state and reference state
|
||||
* values are handled at that level. Various functional forms for the standard
|
||||
* state are permissible. The chemical potential for species <I>k</I> is equal
|
||||
* to
|
||||
*
|
||||
* \f[
|
||||
* \mu_k(T,P) = \mu^o_k(T, P) + R T \ln(\gamma_k X_k)
|
||||
* \f]
|
||||
* \f[
|
||||
* \mu_k(T,P) = \mu^o_k(T, P) + R T \ln(\gamma_k X_k)
|
||||
* \f]
|
||||
*
|
||||
* The partial molar entropy for species <I>k</I> is given by the following relation,
|
||||
*
|
||||
* \f[
|
||||
* \tilde{s}_k(T,P) = s^o_k(T,P) - R \ln( \gamma_k X_k )
|
||||
* - R T \frac{d \ln(\gamma_k) }{dT}
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{s}_k(T,P) = s^o_k(T,P) - R \ln( \gamma_k X_k )
|
||||
* - R T \frac{d \ln(\gamma_k) }{dT}
|
||||
* \f]
|
||||
*
|
||||
* The partial molar enthalpy for species <I>k</I> is given by
|
||||
*
|
||||
* \f[
|
||||
* \tilde{h}_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{h}_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
* \f]
|
||||
*
|
||||
* The partial molar volume for species <I>k</I> is
|
||||
*
|
||||
* \f[
|
||||
* \tilde V_k(T,P) = V^o_k(T,P) + R T \frac{d \ln(\gamma_k) }{dP}
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde V_k(T,P) = V^o_k(T,P) + R T \frac{d \ln(\gamma_k) }{dP}
|
||||
* \f]
|
||||
*
|
||||
* The partial molar Heat Capacity for species <I>k</I> is
|
||||
*
|
||||
* \f[
|
||||
* \tilde{C}_{p,k}(T,P) = C^o_{p,k}(T,P) - 2 R T \frac{d \ln( \gamma_k )}{dT}
|
||||
* - R T^2 \frac{d^2 \ln(\gamma_k) }{{dT}^2}
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{C}_{p,k}(T,P) = C^o_{p,k}(T,P) - 2 R T \frac{d \ln( \gamma_k )}{dT}
|
||||
* - R T^2 \frac{d^2 \ln(\gamma_k) }{{dT}^2}
|
||||
* \f]
|
||||
*
|
||||
* <HR>
|
||||
* <H2> %Application within Kinetics Managers </H2>
|
||||
* <HR>
|
||||
*
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
|
||||
* C^s_k, \f$ where \f$ C^s_k \f$ is a standard concentration
|
||||
* defined below and \f$ a_k \f$ are activities used in the
|
||||
* thermodynamic functions. These activity (or generalized)
|
||||
* concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions.
|
||||
* The activity concentration,\f$ C^a_k \f$,is given by the following expression.
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / C^s_k, \f$ where
|
||||
* \f$ C^s_k \f$ is a standard concentration defined below and \f$ a_k \f$ are
|
||||
* activities used in the thermodynamic functions. These activity (or
|
||||
* generalized) concentrations are used by kinetics manager classes to compute
|
||||
* the forward and reverse rates of elementary reactions. The activity
|
||||
* concentration, \f$ C^a_k \f$, is given by the following expression.
|
||||
*
|
||||
* \f[
|
||||
* C^a_k = C^s_k X_k = \frac{P}{R T} X_k
|
||||
* \f]
|
||||
* \f[
|
||||
* C^a_k = C^s_k X_k = \frac{P}{R T} X_k
|
||||
* \f]
|
||||
*
|
||||
* The standard concentration for species <I>k</I> is independent of <I>k</I> and equal to
|
||||
* The standard concentration for species <I>k</I> is independent of <I>k</I>
|
||||
* and equal to
|
||||
*
|
||||
* \f[
|
||||
* C^s_k = C^s = \frac{P}{R T}
|
||||
* \f]
|
||||
* \f[
|
||||
* C^s_k = C^s = \frac{P}{R T}
|
||||
* \f]
|
||||
*
|
||||
* For example, a bulk-phase binary gas reaction between species j and k, producing
|
||||
* a new gas species l would have the
|
||||
* following equation for its rate of progress variable, \f$ R^1 \f$, which has
|
||||
* units of kmol m-3 s-1.
|
||||
* For example, a bulk-phase binary gas reaction between species j and k,
|
||||
* producing a new gas species l would have the following equation for its rate
|
||||
* of progress variable, \f$ R^1 \f$, which has units of kmol m-3 s-1.
|
||||
*
|
||||
* \f[
|
||||
* \f[
|
||||
* R^1 = k^1 C_j^a C_k^a = k^1 (C^s a_j) (C^s a_k)
|
||||
* \f]
|
||||
* where
|
||||
* \f[
|
||||
* \f]
|
||||
* where
|
||||
* \f[
|
||||
* C_j^a = C^s a_j \mbox{\quad and \quad} C_k^a = C^s a_k
|
||||
* \f]
|
||||
* \f]
|
||||
*
|
||||
* \f$ C_j^a \f$ is the activity concentration of species j, and
|
||||
* \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^s \f$
|
||||
* is the standard concentration. \f$ a_j \f$ is
|
||||
* the activity of species j which is equal to the mole fraction of j.
|
||||
* \f$ C_j^a \f$ is the activity concentration of species j, and \f$ C_k^a \f$
|
||||
* is the activity concentration of species k. \f$ C^s \f$ is the standard
|
||||
* concentration. \f$ a_j \f$ is the activity of species j which is equal to the
|
||||
* mole fraction of j.
|
||||
*
|
||||
* The reverse rate constant can then be obtained from the law of microscopic reversibility
|
||||
* and the equilibrium expression for the system.
|
||||
* The reverse rate constant can then be obtained from the law of microscopic
|
||||
* reversibility and the equilibrium expression for the system.
|
||||
*
|
||||
* \f[
|
||||
* \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
|
||||
* \f]
|
||||
* \f[
|
||||
* \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
|
||||
* \f]
|
||||
*
|
||||
* \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, associated with
|
||||
* the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ and their associated activities,
|
||||
* \f$ a_l \f$, repeated here:
|
||||
* \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant,
|
||||
* associated with the pressure dependent standard states \f$ \mu^o_l(T,P) \f$
|
||||
* and their associated activities, \f$ a_l \f$, repeated here:
|
||||
*
|
||||
* \f[
|
||||
* \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l)
|
||||
* \f]
|
||||
* \f[
|
||||
* \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l)
|
||||
* \f]
|
||||
*
|
||||
* We can switch over to expressing the equilibrium constant in terms of the reference
|
||||
* state chemical potentials
|
||||
* We can switch over to expressing the equilibrium constant in terms of the
|
||||
* reference state chemical potentials
|
||||
*
|
||||
* \f[
|
||||
* K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P}
|
||||
* \f]
|
||||
* \f[
|
||||
* K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P}
|
||||
* \f]
|
||||
*
|
||||
* The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over
|
||||
* to activity concentrations. When this is done:
|
||||
* The concentration equilibrium constant, \f$ K_c \f$, may be obtained by
|
||||
* changing over to activity concentrations. When this is done:
|
||||
*
|
||||
* \f[
|
||||
* \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 =
|
||||
* \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT}
|
||||
* \f]
|
||||
* \f[
|
||||
* \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 =
|
||||
* \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT}
|
||||
* \f]
|
||||
*
|
||||
* Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$,
|
||||
* using the second and third part of the above expression as a definition for the concentration
|
||||
* equilibrium constant.
|
||||
* Kinetics managers will calculate the concentration equilibrium constant, \f$
|
||||
* K_c \f$, using the second and third part of the above expression as a
|
||||
* definition for the concentration equilibrium constant.
|
||||
*
|
||||
* For completeness, the pressure equilibrium constant may be obtained as well
|
||||
* For completeness, the pressure equilibrium constant may be obtained as well
|
||||
*
|
||||
* \f[
|
||||
* \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} )
|
||||
* \f]
|
||||
* \f[
|
||||
* \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} )
|
||||
* \f]
|
||||
*
|
||||
* \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. However, it isn't
|
||||
* necessarily the simplest form of the equilibrium constant for other types of phases; \f$ K_c \f$ is
|
||||
* used instead because it is completely general.
|
||||
* \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases.
|
||||
* However, it isn't necessarily the simplest form of the equilibrium constant
|
||||
* for other types of phases; \f$ K_c \f$ is used instead because it is
|
||||
* completely general.
|
||||
*
|
||||
* The reverse rate of progress may be written down as
|
||||
* \f[
|
||||
* The reverse rate of progress may be written down as
|
||||
* \f[
|
||||
* R^{-1} = k^{-1} C_l^a = k^{-1} (C^o a_l)
|
||||
* \f]
|
||||
* \f]
|
||||
*
|
||||
* where we can use the concept of microscopic reversibility to
|
||||
* write the reverse rate constant in terms of the
|
||||
* forward reate constant and the concentration equilibrium
|
||||
* constant, \f$ K_c \f$.
|
||||
* where we can use the concept of microscopic reversibility to write the
|
||||
* reverse rate constant in terms of the forward reate constant and the
|
||||
* concentration equilibrium constant, \f$ K_c \f$.
|
||||
*
|
||||
* \f[
|
||||
* k^{-1} = k^1 K^1_c
|
||||
* \f]
|
||||
* \f[
|
||||
* k^{-1} = k^1 K^1_c
|
||||
* \f]
|
||||
*
|
||||
* \f$k^{-1} \f$ has units of s-1.
|
||||
* \f$k^{-1} \f$ has units of s-1.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
class MixedSolventElectrolyte : public MolarityIonicVPSSTP
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
/*!
|
||||
* This doesn't do much more than initialize constants with
|
||||
* default values for water at 25C. Water molecular weight
|
||||
* comes from the default elements.xml file. It actually
|
||||
* differs slightly from the IAPWS95 value of 18.015268. However,
|
||||
* density conservation and therefore element conservation
|
||||
* is the more important principle to follow.
|
||||
*/
|
||||
MixedSolventElectrolyte();
|
||||
|
||||
//! Construct and initialize a MixedSolventElectrolyte ThermoPhase object
|
||||
|
|
@ -285,179 +242,58 @@ public:
|
|||
*/
|
||||
MixedSolventElectrolyte(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* @param b class to be copied
|
||||
*/
|
||||
MixedSolventElectrolyte(const MixedSolventElectrolyte& b);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* @param b class to be copied.
|
||||
*/
|
||||
MixedSolventElectrolyte& operator=(const MixedSolventElectrolyte& b);
|
||||
|
||||
//! Duplication routine for objects which inherit from ThermoPhase.
|
||||
/*!
|
||||
* This virtual routine can be used to duplicate ThermoPhase objects
|
||||
* inherited from ThermoPhase even if the application only has
|
||||
* a pointer to ThermoPhase to work with.
|
||||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//! @name Molar Thermodynamic Properties
|
||||
//! @{
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
|
||||
/// Molar entropy. Units: J/kmol.
|
||||
virtual doublereal entropy_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
virtual doublereal cp_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
virtual doublereal cv_mole() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Activities, Standard States, and Activity Concentrations
|
||||
*
|
||||
* The activity \f$a_k\f$ of a species in solution is
|
||||
* related to the chemical potential by \f[ \mu_k = \mu_k^0(T)
|
||||
* + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is
|
||||
* the chemical potential at unit activity, which depends only
|
||||
* on temperature and pressure.
|
||||
* The activity \f$a_k\f$ of a species in solution is related to the
|
||||
* chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The
|
||||
* quantity \f$\mu_k^0(T,P)\f$ is the chemical potential at unit activity,
|
||||
* which depends only on temperature and pressure.
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! Get the array of non-dimensional molar-based activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* @param ac Output vector of activity coefficients. Length: m_kk.
|
||||
*/
|
||||
virtual void getActivityCoefficients(doublereal* ac) const;
|
||||
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
||||
//! Get the species chemical potentials. Units: J/kmol.
|
||||
/*!
|
||||
* This function returns a vector of chemical potentials of the
|
||||
* species in solution at the current temperature, pressure
|
||||
* and mole fraction of the solution.
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Returns an array of partial molar enthalpies for the species
|
||||
//! in the mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* standard state enthalpies modified by the derivative of the
|
||||
* molality-based activity coefficient wrt temperature
|
||||
*
|
||||
* \f[
|
||||
* \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
* \f]
|
||||
*
|
||||
* @param hbar Vector of returned partial molar enthalpies
|
||||
* (length m_kk, units = J/kmol)
|
||||
*/
|
||||
virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
|
||||
|
||||
//! Returns an array of partial molar entropies for the species
|
||||
//! in the mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* standard state enthalpies modified by the derivative of the
|
||||
* activity coefficient wrt temperature
|
||||
*
|
||||
* \f[
|
||||
* \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
* - R \ln( \gamma_k X_k)
|
||||
* - R T \frac{d \ln(\gamma_k) }{dT}
|
||||
* \f]
|
||||
*
|
||||
* @param sbar Vector of returned partial molar entropies
|
||||
* (length m_kk, units = J/kmol/K)
|
||||
*/
|
||||
virtual void getPartialMolarEntropies(doublereal* sbar) const;
|
||||
|
||||
//! Returns an array of partial molar entropies for the species
|
||||
//! in the mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* standard state enthalpies modified by the derivative of the
|
||||
* activity coefficient wrt temperature
|
||||
*
|
||||
* \f[
|
||||
* ???????????????
|
||||
* \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
* - R \ln( \gamma_k X_k)
|
||||
* - R T \frac{d \ln(\gamma_k) }{dT}
|
||||
* ???????????????
|
||||
* \f]
|
||||
*
|
||||
* @param cpbar Vector of returned partial molar heat capacities
|
||||
* (length m_kk, units = J/kmol/K)
|
||||
*/
|
||||
virtual void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
||||
//! Return an array of partial molar volumes for the
|
||||
//! species in the mixture. Units: m^3/kmol.
|
||||
/*!
|
||||
* Frequently, for this class of thermodynamics representations,
|
||||
* the excess Volume due to mixing is zero. Here, we set it as
|
||||
* a default. It may be overridden in derived classes.
|
||||
*
|
||||
* @param vbar Output vector of species partial molar volumes.
|
||||
* Length = m_kk. units are m^3/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarVolumes(doublereal* vbar) const;
|
||||
|
||||
//! Get the species electrochemical potentials.
|
||||
/*!
|
||||
* These are partial molar quantities.
|
||||
* This method adds a term \f$ Fz_k \phi_k \f$ to the
|
||||
* to each chemical potential.
|
||||
*
|
||||
* Units: J/kmol
|
||||
*
|
||||
* @param mu output vector containing the species electrochemical potentials.
|
||||
* Length: m_kk., units = J/kmol
|
||||
*/
|
||||
void getElectrochemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Get the array of temperature second derivatives of the log activity coefficients
|
||||
//! Get the array of temperature second derivatives of the log activity
|
||||
//! coefficients
|
||||
/*!
|
||||
* This function is a virtual class, but it first appears in GibbsExcessVPSSTP
|
||||
* class and derived classes from GibbsExcessVPSSTP.
|
||||
* units = 1/Kelvin
|
||||
*
|
||||
* units = 1/Kelvin
|
||||
*
|
||||
* @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of the
|
||||
* log Activity Coefficients. length = m_kk
|
||||
* @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of
|
||||
* the log Activity Coefficients. length = m_kk
|
||||
*
|
||||
*/
|
||||
virtual void getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const;
|
||||
|
||||
//! Get the array of temperature derivatives of the log activity coefficients
|
||||
/*!
|
||||
* This function is a virtual class, but it first appears in GibbsExcessVPSSTP
|
||||
* class and derived classes from GibbsExcessVPSSTP.
|
||||
* This is a virtual function, which first appears in GibbsExcessVPSSTP.
|
||||
*
|
||||
* units = 1/Kelvin
|
||||
* units = 1/Kelvin
|
||||
*
|
||||
* @param dlnActCoeffdT Output vector of temperature derivatives of the
|
||||
* log Activity Coefficients. length = m_kk
|
||||
|
|
@ -466,39 +302,13 @@ public:
|
|||
|
||||
//! @}
|
||||
//! @name Initialization
|
||||
/// The following methods are used in the process of constructing
|
||||
/// the phase and setting its parameters from a specification in an
|
||||
/// input file. They are not normally used in application programs.
|
||||
/// To see how they are used, see importPhase().
|
||||
/// The following methods are used in the process of constructing the phase
|
||||
/// and setting its parameters from a specification in an input file. They
|
||||
/// are not normally used in application programs. To see how they are used,
|
||||
/// see importPhase().
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
* @internal Initialize. This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called just prior to returning
|
||||
* from function importPhase().
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
/**
|
||||
* Import and initialize a ThermoPhase object
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a
|
||||
* complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
/**
|
||||
|
|
@ -507,84 +317,22 @@ public:
|
|||
* @{
|
||||
*/
|
||||
|
||||
//! Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along
|
||||
//! a line in parameter space or along a line in physical space
|
||||
/*!
|
||||
*
|
||||
* @param dTds Input of temperature change along the path
|
||||
* @param dXds Input vector of changes in mole fraction along the path. length = m_kk
|
||||
* Along the path length it must be the case that the mole fractions sum to one.
|
||||
* @param dlnActCoeffds Output vector of the directional derivatives of the
|
||||
* log Activity Coefficients along the path. length = m_kk
|
||||
* units are 1/units(s). if s is a physical coordinate then the units are 1/m.
|
||||
*/
|
||||
virtual void getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const;
|
||||
|
||||
//! Get the array of log concentration-like derivatives of the
|
||||
//! log activity coefficients - diagonal component
|
||||
/*!
|
||||
* This function is a virtual method. For ideal mixtures
|
||||
* (unity activity coefficients), this can return zero.
|
||||
* Implementations should take the derivative of the
|
||||
* logarithm of the activity coefficient with respect to the
|
||||
* logarithm of the mole fraction.
|
||||
*
|
||||
* units = dimensionless
|
||||
*
|
||||
* @param dlnActCoeffdlnX_diag Output vector of the diagonal component of the log(mole fraction)
|
||||
* derivatives of the log Activity Coefficients.
|
||||
* length = m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const;
|
||||
|
||||
//! Get the array of derivatives of the log activity coefficients wrt mole numbers - diagonal only
|
||||
/*!
|
||||
* This function is a virtual method. For ideal mixtures
|
||||
* (unity activity coefficients), this can return zero.
|
||||
* Implementations should take the derivative of the
|
||||
* logarithm of the activity coefficient with respect to the
|
||||
* logarithm of the concentration-like variable (i.e. mole fraction,
|
||||
* molality, etc.) that represents the standard state.
|
||||
*
|
||||
* units = dimensionless
|
||||
*
|
||||
* @param dlnActCoeffdlnN_diag Output vector of the diagonal entries for the log(mole fraction)
|
||||
* derivatives of the log Activity Coefficients.
|
||||
* length = m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const;
|
||||
|
||||
//! Get the array of derivatives of the log activity coefficients with respect to the ln species mole numbers
|
||||
/*!
|
||||
* Implementations should take the derivative of the logarithm of the activity coefficient with respect to a
|
||||
* log of a species mole number (with all other species mole numbers held constant)
|
||||
*
|
||||
* units = 1 / kmol
|
||||
*
|
||||
* dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log act_coeff for the <I>m</I><SUP>th</SUP>
|
||||
* species with respect to the number of moles of the <I>k</I><SUP>th</SUP> species.
|
||||
*
|
||||
* \f[
|
||||
* \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i}
|
||||
* \f]
|
||||
*
|
||||
* @param ld Number of rows in the matrix
|
||||
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
||||
* log Activity Coefficients. length = m_kk * m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN);
|
||||
//@}
|
||||
|
||||
private:
|
||||
//! Process an XML node called "binaryNeutralSpeciesParameters"
|
||||
/*!
|
||||
* This node contains all of the parameters necessary to describe
|
||||
* the Margules model for a particular binary interaction.
|
||||
* This function reads the XML file and writes the coefficients
|
||||
* it finds to an internal data structures.
|
||||
* This node contains all of the parameters necessary to describe the
|
||||
* Margules model for a particular binary interaction. This function reads
|
||||
* the XML file and writes the coefficients it finds to an internal data
|
||||
* structures.
|
||||
*
|
||||
* @param xmlBinarySpecies Reference to the XML_Node named "binaryNeutralSpeciesParameters"
|
||||
* containing the binary interaction
|
||||
* @param xmlBinarySpecies Reference to the XML_Node named
|
||||
* "binaryNeutralSpeciesParameters" containing the binary interaction
|
||||
*/
|
||||
void readXMLBinarySpecies(XML_Node& xmlBinarySpecies);
|
||||
|
||||
|
|
@ -595,48 +343,47 @@ private:
|
|||
*/
|
||||
void resizeNumInteractions(const size_t num);
|
||||
|
||||
//! Initialize lengths of local variables after all species have
|
||||
//! been identified.
|
||||
//! Initialize lengths of local variables after all species have been
|
||||
//! identified.
|
||||
void initLengths();
|
||||
|
||||
//! Update the activity coefficients
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* natural logarithm of the activity coefficients
|
||||
* This function will be called to update the internally stored natural
|
||||
* logarithm of the activity coefficients
|
||||
*/
|
||||
void s_update_lnActCoeff() const;
|
||||
|
||||
//! Update the derivative of the log of the activity coefficients wrt T
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* derivative of the natural logarithm of the activity coefficients
|
||||
* wrt temperature.
|
||||
* This function will be called to update the internally stored derivative
|
||||
* of the natural logarithm of the activity coefficients wrt temperature.
|
||||
*/
|
||||
void s_update_dlnActCoeff_dT() const;
|
||||
|
||||
//! Update the derivative of the log of the activity coefficients
|
||||
//! wrt log(mole fraction)
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* derivative of the natural logarithm of the activity coefficients
|
||||
* wrt logarithm of the mole fractions.
|
||||
* This function will be called to update the internally stored derivative
|
||||
* of the natural logarithm of the activity coefficients wrt logarithm of
|
||||
* the mole fractions.
|
||||
*/
|
||||
void s_update_dlnActCoeff_dlnX_diag() const;
|
||||
|
||||
//! Update the derivative of the log of the activity coefficients
|
||||
//! wrt log(moles) - diagonal only
|
||||
/*!
|
||||
* This function will be called to update the internally stored diagonal entries for the
|
||||
* derivative of the natural logarithm of the activity coefficients
|
||||
* wrt logarithm of the moles.
|
||||
* This function will be called to update the internally stored diagonal
|
||||
* entries for the derivative of the natural logarithm of the activity
|
||||
* coefficients wrt logarithm of the moles.
|
||||
*/
|
||||
void s_update_dlnActCoeff_dlnN_diag() const;
|
||||
|
||||
//! Update the derivative of the log of the activity coefficients wrt log(moles_m)
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* derivative of the natural logarithm of the activity coefficients
|
||||
* wrt logarithm of the mole number of species
|
||||
* This function will be called to update the internally stored derivative
|
||||
* of the natural logarithm of the activity coefficients wrt logarithm of
|
||||
* the mole number of species
|
||||
*/
|
||||
void s_update_dlnActCoeff_dlnN() const;
|
||||
|
||||
|
|
@ -644,65 +391,65 @@ protected:
|
|||
//! number of binary interaction expressions
|
||||
size_t numBinaryInteractions_;
|
||||
|
||||
//! Enthalpy term for the binary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Enthalpy term for the binary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_HE_b_ij;
|
||||
|
||||
//! Enthalpy term for the ternary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Enthalpy term for the ternary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_HE_c_ij;
|
||||
|
||||
//! Enthalpy term for the quaternary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Enthalpy term for the quaternary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_HE_d_ij;
|
||||
|
||||
//! Entropy term for the binary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Entropy term for the binary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_SE_b_ij;
|
||||
|
||||
//! Entropy term for the ternary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Entropy term for the ternary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_SE_c_ij;
|
||||
|
||||
//! Entropy term for the quaternary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Entropy term for the quaternary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_SE_d_ij;
|
||||
|
||||
//! Enthalpy term for the binary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Enthalpy term for the binary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_VHE_b_ij;
|
||||
|
||||
//! Enthalpy term for the ternary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Enthalpy term for the ternary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_VHE_c_ij;
|
||||
|
||||
//! Enthalpy term for the quaternary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Enthalpy term for the quaternary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_VHE_d_ij;
|
||||
|
||||
//! Entropy term for the binary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Entropy term for the binary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_VSE_b_ij;
|
||||
|
||||
//! Entropy term for the ternary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Entropy term for the ternary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_VSE_c_ij;
|
||||
|
||||
//! Entropy term for the quaternary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Entropy term for the quaternary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_VSE_d_ij;
|
||||
|
||||
//! vector of species indices representing species A in the interaction
|
||||
/*!
|
||||
* Each Margules excess Gibbs free energy term involves two species, A and B.
|
||||
* This vector identifies species A.
|
||||
* Each Margules excess Gibbs free energy term involves two species, A and
|
||||
* B. This vector identifies species A.
|
||||
*/
|
||||
std::vector<size_t> m_pSpecies_A_ij;
|
||||
|
||||
//! vector of species indices representing species B in the interaction
|
||||
/*!
|
||||
* Each Margules excess Gibbs free energy term involves two species, A and B.
|
||||
* This vector identifies species B.
|
||||
* Each Margules excess Gibbs free energy term involves two species, A and
|
||||
* B. This vector identifies species B.
|
||||
*/
|
||||
std::vector<size_t> m_pSpecies_B_ij;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,30 +39,29 @@ namespace Cantera
|
|||
/**
|
||||
* @ingroup thermoprops
|
||||
*
|
||||
* This is a filter class for ThermoPhase that implements some preparatory
|
||||
* steps for efficiently handling mixture of gases that whose standard states
|
||||
* are defined as ideal gases, but which describe also non-ideal solutions.
|
||||
* In addition a multicomponent liquid phase below the critical temperature of the
|
||||
* mixture is also allowed. The main subclass is currently a mixture Redlich-Kwong class.
|
||||
* This is a filter class for ThermoPhase that implements some preparatory steps
|
||||
* for efficiently handling mixture of gases that whose standard states are
|
||||
* defined as ideal gases, but which describe also non-ideal solutions. In
|
||||
* addition a multicomponent liquid phase below the critical temperature of the
|
||||
* mixture is also allowed. The main subclass is currently a mixture Redlich-
|
||||
* Kwong class.
|
||||
*
|
||||
* Several concepts are introduced. The first concept is there are temporary
|
||||
* variables for holding the species standard state values
|
||||
* of Cp, H, S, G, and V at the last temperature and pressure called. These functions are not recalculated
|
||||
* if a new call is made using the previous temperature and pressure.
|
||||
* Several concepts are introduced. The first concept is there are temporary
|
||||
* variables for holding the species standard state values of Cp, H, S, G, and V
|
||||
* at the last temperature and pressure called. These functions are not
|
||||
* recalculated if a new call is made using the previous temperature and
|
||||
* pressure.
|
||||
*
|
||||
* The other concept is that the current state of the mixture is tracked.
|
||||
* The state variable is either GAS, LIQUID, or SUPERCRIT fluid. Additionally,
|
||||
* the variable LiquidContent is used and may vary between 0 and 1.
|
||||
* The other concept is that the current state of the mixture is tracked. The
|
||||
* state variable is either GAS, LIQUID, or SUPERCRIT fluid. Additionally, the
|
||||
* variable LiquidContent is used and may vary between 0 and 1.
|
||||
*
|
||||
* To support the above functionality, pressure and temperature variables,
|
||||
* m_Plast_ss and m_Tlast_ss, are kept which store the last pressure and temperature
|
||||
* used in the evaluation of standard state properties.
|
||||
*
|
||||
* Typically, only one liquid phase is allowed to be formed within these classes.
|
||||
* Additionally, there is an inherent contradiction between three phase models and
|
||||
* the ThermoPhase class. The ThermoPhase class is really only meant to represent a
|
||||
* single instantiation of a phase. The three phase models may be in equilibrium with
|
||||
* multiple phases of the fluid in equilibrium with each other. This has yet to be resolved.
|
||||
* Typically, only one liquid phase is allowed to be formed within these
|
||||
* classes. Additionally, there is an inherent contradiction between three phase
|
||||
* models and the ThermoPhase class. The ThermoPhase class is really only meant
|
||||
* to represent a single instantiation of a phase. The three phase models may be
|
||||
* in equilibrium with multiple phases of the fluid in equilibrium with each
|
||||
* other. This has yet to be resolved.
|
||||
*
|
||||
* This class is usually used for non-ideal gases.
|
||||
*/
|
||||
|
|
@ -75,82 +74,41 @@ public:
|
|||
//! Constructor.
|
||||
MixtureFugacityTP();
|
||||
|
||||
//! Copy Constructor.
|
||||
/*!
|
||||
* @param b Object to be copied
|
||||
*/
|
||||
MixtureFugacityTP(const MixtureFugacityTP& b);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* @param b Object to be copied
|
||||
*/
|
||||
MixtureFugacityTP& operator=(const MixtureFugacityTP& b);
|
||||
|
||||
//! Duplication routine
|
||||
/*!
|
||||
* @return Returns a duplication
|
||||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//! @}
|
||||
//! @name Utilities
|
||||
//! @{
|
||||
|
||||
//! This method returns the convention used in specification
|
||||
//! of the standard state, of which there are currently two,
|
||||
//! temperature based, and variable pressure based.
|
||||
/*!
|
||||
* Currently, there are two standard state conventions:
|
||||
* - Temperature-based activities,
|
||||
* `cSS_CONVENTION_TEMPERATURE 0` (default)
|
||||
* - Variable Pressure and Temperature based activities,
|
||||
* `cSS_CONVENTION_VPSS 1`
|
||||
*/
|
||||
virtual int standardStateConvention() const;
|
||||
|
||||
//! Set the solution branch to force the ThermoPhase to exist on one branch or another
|
||||
//! Set the solution branch to force the ThermoPhase to exist on one branch
|
||||
//! or another
|
||||
/*!
|
||||
* @param solnBranch Branch that the solution is restricted to.
|
||||
* the value -1 means gas. The value -2 means unrestricted.
|
||||
* Values of zero or greater refer to species dominated condensed phases.
|
||||
* @param solnBranch Branch that the solution is restricted to. the value
|
||||
* -1 means gas. The value -2 means unrestricted. Values of zero or
|
||||
* greater refer to species dominated condensed phases.
|
||||
*/
|
||||
virtual void setForcedSolutionBranch(int solnBranch);
|
||||
|
||||
//! Report the solution branch which the solution is restricted to
|
||||
/*!
|
||||
* @return Branch that the solution is restricted to.
|
||||
* the value -1 means gas. The value -2 means unrestricted.
|
||||
* Values of zero or greater refer to species dominated condensed phases.
|
||||
* @return Branch that the solution is restricted to. the value -1 means
|
||||
* gas. The value -2 means unrestricted. Values of zero or greater
|
||||
* refer to species dominated condensed phases.
|
||||
*/
|
||||
virtual int forcedSolutionBranch() const;
|
||||
|
||||
//! Report the solution branch which the solution is actually on
|
||||
/*!
|
||||
* @return Branch that the solution is restricted to.
|
||||
* the value -1 means gas. The value -2 means superfluid..
|
||||
* Values of zero or greater refer to species dominated condensed phases.
|
||||
* @return Branch that the solution is restricted to. the value -1 means
|
||||
* gas. The value -2 means superfluid.. Values of zero or greater refer
|
||||
* to species dominated condensed phases.
|
||||
*/
|
||||
virtual int reportSolnBranchActual() const;
|
||||
|
||||
//! Get the array of log concentration-like derivatives of the
|
||||
//! log activity coefficients
|
||||
/*!
|
||||
* For ideal mixtures (unity activity coefficients), this can return zero.
|
||||
* Implementations should take the derivative of the logarithm of the
|
||||
* activity coefficient with respect to the logarithm of the
|
||||
* concentration-like variable (i.e. moles) that represents the standard
|
||||
* state.
|
||||
*
|
||||
* This quantity is to be used in conjunction with derivatives of
|
||||
* that concentration-like variable when the derivative of the chemical
|
||||
* potential is taken.
|
||||
*
|
||||
* units = dimensionless
|
||||
*
|
||||
* @param dlnActCoeffdlnN_diag Output vector of derivatives of the
|
||||
* log Activity Coefficients. length = m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const {
|
||||
throw NotImplementedError("MixtureFugacityTP::getdlnActCoeffdlnN_diag");
|
||||
}
|
||||
|
|
@ -165,9 +123,8 @@ public:
|
|||
* \f$ \mu_k / \hat R T \f$.
|
||||
* Units: unitless
|
||||
*
|
||||
* We close the loop on this function, here, calling
|
||||
* getChemPotentials() and then dividing by RT. No need for child
|
||||
* classes to handle.
|
||||
* We close the loop on this function, here, calling getChemPotentials() and
|
||||
* then dividing by RT. No need for child classes to handle.
|
||||
*
|
||||
* @param mu Output vector of non-dimensional species chemical potentials
|
||||
* Length: m_kk.
|
||||
|
|
@ -178,15 +135,14 @@ public:
|
|||
/*!
|
||||
* @name Properties of the Standard State of the Species in the Solution
|
||||
*
|
||||
* Within MixtureFugacityTP, these properties are calculated via a common routine,
|
||||
* _updateStandardStateThermo(),
|
||||
* which must be overloaded in inherited objects.
|
||||
* The values are cached within this object, and are not recalculated unless
|
||||
* the temperature or pressure changes.
|
||||
* Within MixtureFugacityTP, these properties are calculated via a common
|
||||
* routine, _updateStandardStateThermo(), which must be overloaded in
|
||||
* inherited objects. The values are cached within this object, and are not
|
||||
* recalculated unless the temperature or pressure changes.
|
||||
*/
|
||||
//@{
|
||||
|
||||
//! Get the array of chemical potentials at unit activity.
|
||||
//! Get the array of chemical potentials at unit activity.
|
||||
/*!
|
||||
* These are the standard state chemical potentials \f$ \mu^0_k(T,P)
|
||||
* \f$. The values are evaluated at the current temperature and pressure.
|
||||
|
|
@ -200,8 +156,8 @@ public:
|
|||
*/
|
||||
virtual void getStandardChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Get the nondimensional Enthalpy functions for the species
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
//! Get the nondimensional Enthalpy functions for the species at their
|
||||
//! standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* For all objects with the Mixture Fugacity approximation, we define the
|
||||
* standard state as an ideal gas at the current temperature and pressure
|
||||
|
|
@ -212,39 +168,43 @@ public:
|
|||
*/
|
||||
virtual void getEnthalpy_RT(doublereal* hrt) const;
|
||||
|
||||
//! Get the array of nondimensional Enthalpy functions for the standard state species
|
||||
//! Get the array of nondimensional Enthalpy functions for the standard
|
||||
//! state species at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* at the current <I>T</I> and <I>P</I> of the solution.
|
||||
* For all objects with the Mixture Fugacity approximation, we define the
|
||||
* standard state as an ideal gas at the current temperature and pressure
|
||||
* of the solution.
|
||||
* standard state as an ideal gas at the current temperature and pressure of
|
||||
* the solution.
|
||||
*
|
||||
* @param sr Output vector of nondimensional standard state
|
||||
* entropies. length = m_kk.
|
||||
* @param sr Output vector of nondimensional standard state entropies.
|
||||
* length = m_kk.
|
||||
*/
|
||||
virtual void getEntropy_R(doublereal* sr) const;
|
||||
|
||||
//! Get the nondimensional Gibbs functions for the species
|
||||
//! at their standard states of solution at the current T and P of the solution.
|
||||
//! Get the nondimensional Gibbs functions for the species at their standard
|
||||
//! states of solution at the current T and P of the solution.
|
||||
/*!
|
||||
* For all objects with the Mixture Fugacity approximation, we define the
|
||||
* standard state as an ideal gas at the current temperature and pressure
|
||||
* of the solution.
|
||||
*
|
||||
* @param grt Output vector of nondimensional standard state
|
||||
* Gibbs free energies. length = m_kk.
|
||||
* @param grt Output vector of nondimensional standard state Gibbs free
|
||||
* energies. length = m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT(doublereal* grt) const;
|
||||
|
||||
//! Get the pure Gibbs free energies of each species.
|
||||
//! Species are assumed to be in their standard states. This is the same
|
||||
//! as getStandardChemPotentials().
|
||||
//! @param[out] gpure Array of standard state Gibbs free energies.
|
||||
//! length = m_kk. units are J/kmol.
|
||||
//! Get the pure Gibbs free energies of each species. Species are assumed to
|
||||
//! be in their standard states.
|
||||
/*!
|
||||
* This is the same as getStandardChemPotentials().
|
||||
*
|
||||
* @param[out] gpure Array of standard state Gibbs free energies. length =
|
||||
* m_kk. units are J/kmol.
|
||||
*/
|
||||
void getPureGibbs(doublereal* gpure) const;
|
||||
|
||||
//! Returns the vector of nondimensional internal Energies of the standard state at the current temperature
|
||||
//! and pressure of the solution for each species.
|
||||
//! Returns the vector of nondimensional internal Energies of the standard
|
||||
//! state at the current temperature and pressure of the solution for each
|
||||
//! species.
|
||||
/*!
|
||||
* For all objects with the Mixture Fugacity approximation, we define the
|
||||
* standard state as an ideal gas at the current temperature and pressure
|
||||
|
|
@ -254,29 +214,30 @@ public:
|
|||
* u^{ss}_k(T,P) = h^{ss}_k(T) - P * V^{ss}_k
|
||||
* \f]
|
||||
*
|
||||
* @param urt Output vector of nondimensional standard state
|
||||
* internal energies. length = m_kk.
|
||||
* @param urt Output vector of nondimensional standard state internal
|
||||
* energies. length = m_kk.
|
||||
*/
|
||||
virtual void getIntEnergy_RT(doublereal* urt) const;
|
||||
|
||||
//! Get the nondimensional Heat Capacities at constant
|
||||
//! pressure for the standard state of the species at the current T and P.
|
||||
//! Get the nondimensional Heat Capacities at constant pressure for the
|
||||
//! standard state of the species at the current T and P.
|
||||
/*!
|
||||
* For all objects with the Mixture Fugacity approximation, we define the
|
||||
* standard state as an ideal gas at the current temperature and pressure of the solution.
|
||||
* standard state as an ideal gas at the current temperature and pressure of
|
||||
* the solution.
|
||||
*
|
||||
* @param cpr Output vector containing the
|
||||
* the nondimensional Heat Capacities at constant
|
||||
* pressure for the standard state of the species.
|
||||
* Length: m_kk.
|
||||
* @param cpr Output vector containing the the nondimensional Heat
|
||||
* Capacities at constant pressure for the standard state of
|
||||
* the species. Length: m_kk.
|
||||
*/
|
||||
virtual void getCp_R(doublereal* cpr) const;
|
||||
|
||||
//! Get the molar volumes of each species in their standard
|
||||
//! states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
//! Get the molar volumes of each species in their standard states at the
|
||||
//! current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* For all objects with the Mixture Fugacity approximation, we define the
|
||||
* standard state as an ideal gas at the current temperature and pressure of the solution.
|
||||
* standard state as an ideal gas at the current temperature and pressure of
|
||||
* the solution.
|
||||
*
|
||||
* units = m^3 / kmol
|
||||
*
|
||||
|
|
@ -288,20 +249,18 @@ public:
|
|||
|
||||
//! Set the temperature of the phase
|
||||
/*!
|
||||
* Currently this passes down to setState_TP(). It does not
|
||||
* make sense to calculate the standard state without first
|
||||
* setting T and P.
|
||||
* Currently this passes down to setState_TP(). It does not make sense to
|
||||
* calculate the standard state without first setting T and P.
|
||||
*
|
||||
* @param temp Temperature (kelvin)
|
||||
*/
|
||||
virtual void setTemperature(const doublereal temp);
|
||||
|
||||
//! Set the internally stored pressure (Pa) at constant
|
||||
//! temperature and composition
|
||||
//! Set the internally stored pressure (Pa) at constant temperature and
|
||||
//! composition
|
||||
/*!
|
||||
* Currently this passes down to setState_TP(). It does not
|
||||
* make sense to calculate the standard state without first
|
||||
* setting T and P.
|
||||
* Currently this passes down to setState_TP(). It does not make sense to
|
||||
* calculate the standard state without first setting T and P.
|
||||
*
|
||||
* @param p input Pressure (Pa)
|
||||
*/
|
||||
|
|
@ -309,102 +268,34 @@ public:
|
|||
|
||||
protected:
|
||||
/**
|
||||
* Calculate the density of the mixture using the partial
|
||||
* molar volumes and mole fractions as input
|
||||
* Calculate the density of the mixture using the partial molar volumes and
|
||||
* mole fractions as input
|
||||
*
|
||||
* The formula for this is
|
||||
*
|
||||
* \f[
|
||||
* \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}}
|
||||
* \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}}
|
||||
* \f]
|
||||
*
|
||||
* where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are
|
||||
* the molecular weights, and \f$V_k\f$ are the pure species
|
||||
* molar volumes.
|
||||
* where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular
|
||||
* weights, and \f$V_k\f$ are the pure species molar volumes.
|
||||
*
|
||||
* Note, the basis behind this formula is that in an ideal
|
||||
* solution the partial molar volumes are equal to the pure
|
||||
* species molar volumes. We have additionally specified
|
||||
* in this class that the pure species molar volumes are
|
||||
* independent of temperature and pressure.
|
||||
* Note, the basis behind this formula is that in an ideal solution the
|
||||
* partial molar volumes are equal to the pure species molar volumes. We
|
||||
* have additionally specified in this class that the pure species molar
|
||||
* volumes are independent of temperature and pressure.
|
||||
*/
|
||||
virtual void calcDensity();
|
||||
|
||||
public:
|
||||
//! Set the temperature and pressure at the same time
|
||||
/*!
|
||||
* Note this function triggers a reevaluation of the standard
|
||||
* state quantities.
|
||||
*
|
||||
* @param T temperature (kelvin)
|
||||
* @param pres pressure (pascal)
|
||||
*/
|
||||
virtual void setState_TP(doublereal T, doublereal pres);
|
||||
|
||||
//! Set the internally stored temperature (K) and density (kg/m^3)
|
||||
/*!
|
||||
* @param T Temperature in kelvin
|
||||
* @param rho Density (kg/m^3)
|
||||
*/
|
||||
virtual void setState_TR(doublereal T, doublereal rho);
|
||||
|
||||
//! Set the temperature (K), pressure (Pa), and mole fractions.
|
||||
/*!
|
||||
* Note, the mole fractions are set first before the pressure is set.
|
||||
* Setting the pressure may involve the solution of a nonlinear equation.
|
||||
*
|
||||
* @param t Temperature (K)
|
||||
* @param p Pressure (Pa)
|
||||
* @param x Vector of mole fractions. Length is equal to m_kk.
|
||||
*/
|
||||
virtual void setState_TPX(doublereal t, doublereal p, const doublereal* x);
|
||||
|
||||
//! Set the mass fractions to the specified values, and then
|
||||
//! normalize them so that they sum to 1.0.
|
||||
/*!
|
||||
* @param y Array of unnormalized mass fraction values (input).
|
||||
* Must have a length greater than or equal to the number of species.
|
||||
*/
|
||||
virtual void setMassFractions(const doublereal* const y);
|
||||
|
||||
//!Set the mass fractions to the specified values without normalizing.
|
||||
/*!
|
||||
* This is useful when the normalization
|
||||
* condition is being handled by some other means, for example
|
||||
* by a constraint equation as part of a larger set of
|
||||
* equations.
|
||||
*
|
||||
* @param y Input vector of mass fractions. Length is m_kk.
|
||||
*/
|
||||
virtual void setMassFractions_NoNorm(const doublereal* const y);
|
||||
|
||||
//! Set the mole fractions to the specified values, and then
|
||||
//! normalize them so that they sum to 1.0.
|
||||
/*!
|
||||
* @param x Array of unnormalized mole fraction values (input).
|
||||
* Must have a length greater than or equal to the number of species.
|
||||
*/
|
||||
virtual void setMoleFractions(const doublereal* const x);
|
||||
|
||||
//! Set the mole fractions to the specified values without normalizing.
|
||||
/*!
|
||||
* This is useful when the normalization
|
||||
* condition is being handled by some other means, for example
|
||||
* by a constraint equation as part of a larger set of equations.
|
||||
*
|
||||
* @param x Input vector of mole fractions. Length is m_kk.
|
||||
*/
|
||||
virtual void setMoleFractions_NoNorm(const doublereal* const x);
|
||||
|
||||
//! Set the concentrations to the specified values within the phase.
|
||||
/*!
|
||||
* @param c The input vector to this routine is in dimensional
|
||||
* units. For volumetric phases c[k] is the
|
||||
* concentration of the kth species in kmol/m3.
|
||||
* For surface phases, c[k] is the concentration
|
||||
* in kmol/m2. The length of the vector is the number
|
||||
* of species in the phase.
|
||||
*/
|
||||
virtual void setConcentrations(const doublereal* const c);
|
||||
|
||||
protected:
|
||||
|
|
@ -413,8 +304,8 @@ protected:
|
|||
public:
|
||||
//! Returns the current pressure of the phase
|
||||
/*!
|
||||
* The pressure is an independent variable in this phase. Its current value
|
||||
* is stored in the object MixtureFugacityTP.
|
||||
* The pressure is an independent variable in this phase. Its current value
|
||||
* is stored in the object MixtureFugacityTP.
|
||||
*
|
||||
* @return return the pressure in pascals.
|
||||
*/
|
||||
|
|
@ -423,12 +314,12 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
//! Updates the reference state thermodynamic functions at the current T of the solution.
|
||||
//! Updates the reference state thermodynamic functions at the current T of
|
||||
//! the solution.
|
||||
/*!
|
||||
* This function must be called for every call to functions in this
|
||||
* class. It checks to see whether the temperature has changed and
|
||||
* thus the ss thermodynamics functions for all of the species
|
||||
* must be recalculated.
|
||||
* This function must be called for every call to functions in this class.
|
||||
* It checks to see whether the temperature has changed and thus the ss
|
||||
* thermodynamics functions for all of the species must be recalculated.
|
||||
*
|
||||
* This function is responsible for updating the following internal members:
|
||||
*
|
||||
|
|
@ -440,52 +331,24 @@ protected:
|
|||
virtual void _updateReferenceStateThermo() const;
|
||||
public:
|
||||
|
||||
/// @name Thermodynamic Values for the Species Reference States (MixtureFugacityTP)
|
||||
/// @name Thermodynamic Values for the Species Reference States
|
||||
/*!
|
||||
* There are also temporary
|
||||
* variables for holding the species reference-state values of Cp, H, S, and V at the
|
||||
* last temperature and reference pressure called. These functions are not recalculated
|
||||
* if a new call is made using the previous temperature.
|
||||
* All calculations are done within the routine _updateRefStateThermo().
|
||||
* There are also temporary variables for holding the species reference-
|
||||
* state values of Cp, H, S, and V at the last temperature and reference
|
||||
* pressure called. These functions are not recalculated if a new call is
|
||||
* made using the previous temperature. All calculations are done within the
|
||||
* routine _updateRefStateThermo().
|
||||
*/
|
||||
//@{
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! enthalpies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
/*!
|
||||
* @param hrt Output vector contains the nondimensional enthalpies
|
||||
* of the reference state of the species
|
||||
* length = m_kk, units = dimensionless.
|
||||
*/
|
||||
virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
|
||||
|
||||
//! Modify the value of the 298 K Heat of Formation of the standard state of
|
||||
//! one species in the phase (J kmol-1)
|
||||
/*!
|
||||
* The 298K heat of formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k Index of the species
|
||||
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar.
|
||||
* units = J/kmol.
|
||||
*/
|
||||
virtual void getGibbs_RT_ref(doublereal* grt) const;
|
||||
void modifyOneHf298SS(const size_t k, const doublereal Hf298New);
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! Gibbs free energies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
/*!
|
||||
* @param grt Output vector contains the nondimensional Gibbs free energies
|
||||
* of the reference state of the species
|
||||
* length = m_kk, units = dimensionless.
|
||||
*/
|
||||
virtual void getGibbs_RT_ref(doublereal* grt) const;
|
||||
|
||||
protected:
|
||||
//! Returns the vector of nondimensional
|
||||
//! Gibbs free energies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
//! Returns the vector of nondimensional Gibbs free energies of the
|
||||
//! reference state at the current temperature of the solution and the
|
||||
//! reference pressure for the species.
|
||||
/*!
|
||||
* @return Output vector contains the nondimensional Gibbs free energies
|
||||
* of the reference state of the species
|
||||
|
|
@ -494,49 +357,9 @@ protected:
|
|||
const vector_fp& gibbs_RT_ref() const;
|
||||
|
||||
public:
|
||||
/*!
|
||||
* Returns the vector of the
|
||||
* Gibbs function of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
* units = J/kmol
|
||||
*
|
||||
* @param g Output vector contain the Gibbs free energies
|
||||
* of the reference state of the species
|
||||
* length = m_kk, units = J/kmol.
|
||||
*/
|
||||
virtual void getGibbs_ref(doublereal* g) const;
|
||||
|
||||
/*!
|
||||
* Returns the vector of nondimensional
|
||||
* entropies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*
|
||||
* @param er Output vector contain the nondimensional entropies
|
||||
* of the species in their reference states
|
||||
* length: m_kk, units: dimensionless.
|
||||
*/
|
||||
virtual void getEntropy_R_ref(doublereal* er) const;
|
||||
|
||||
/*!
|
||||
* Returns the vector of nondimensional
|
||||
* constant pressure heat capacities of the reference state
|
||||
* at the current temperature of the solution
|
||||
* and reference pressure for the species.
|
||||
*
|
||||
* @param cprt Output vector contains the nondimensional heat capacities
|
||||
* of the species in their reference states
|
||||
* length: m_kk, units: dimensionless.
|
||||
*/
|
||||
virtual void getCp_R_ref(doublereal* cprt) const;
|
||||
|
||||
//! Get the molar volumes of the species reference states at the current
|
||||
//! <I>T</I> and reference pressure of the solution.
|
||||
/*!
|
||||
* units = m^3 / kmol
|
||||
*
|
||||
* @param vol Output vector containing the standard state volumes.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getStandardVolumes_ref(doublereal* vol) const;
|
||||
|
||||
//@}
|
||||
|
|
@ -549,58 +372,8 @@ public:
|
|||
*/
|
||||
//@{
|
||||
|
||||
//! Set the initial state of the phase to the conditions specified in the state XML element.
|
||||
/*!
|
||||
* This method sets the temperature, pressure, and mole fraction vector to a set default value.
|
||||
*
|
||||
* @param state An XML_Node object corresponding to
|
||||
* the "state" entry for this phase in the input file.
|
||||
*/
|
||||
virtual void setStateFromXML(const XML_Node& state);
|
||||
|
||||
//! @internal Initialize the object
|
||||
/*!
|
||||
* This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called after calling installSpecies()
|
||||
* for each species in the phase. It's called before calling
|
||||
* initThermoXML() for the phase. Therefore, it's the correct
|
||||
* place for initializing vectors which have lengths equal to the
|
||||
* number of species.
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
//! Initialize a ThermoPhase object, potentially reading activity
|
||||
//! coefficient information from an XML database.
|
||||
/*!
|
||||
* This routine initializes the lengths in the current object and
|
||||
* then calls the parent routine.
|
||||
* This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called just prior to returning
|
||||
* from function importPhase().
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a
|
||||
* complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
private:
|
||||
|
|
@ -622,70 +395,74 @@ protected:
|
|||
*/
|
||||
doublereal z() const;
|
||||
|
||||
//! Calculate the deviation terms for the total entropy of the mixture from the
|
||||
//! ideal gas mixture
|
||||
//! Calculate the deviation terms for the total entropy of the mixture from
|
||||
//! the ideal gas mixture
|
||||
/*
|
||||
* Here we use the current state conditions
|
||||
* Here we use the current state conditions
|
||||
*
|
||||
* @return Returns the change in entropy in units of J kmol-1 K-1.
|
||||
* @returns the change in entropy in units of J kmol-1 K-1.
|
||||
*/
|
||||
virtual doublereal sresid() const;
|
||||
|
||||
//! Calculate the deviation terms for the total enthalpy of the mixture from the ideal gas mixture
|
||||
//! Calculate the deviation terms for the total enthalpy of the mixture from
|
||||
//! the ideal gas mixture
|
||||
/*
|
||||
* Here we use the current state conditions
|
||||
* Here we use the current state conditions
|
||||
*
|
||||
* @return Returns the change in entropy in units of J kmol-1.
|
||||
* @returns the change in entropy in units of J kmol-1.
|
||||
*/
|
||||
virtual doublereal hresid() const;
|
||||
|
||||
//! Estimate for the saturation pressure
|
||||
/*!
|
||||
* Note: this is only used as a starting guess for later routines that actually calculate an
|
||||
* accurate value for the saturation pressure.
|
||||
* Note: this is only used as a starting guess for later routines that
|
||||
* actually calculate an accurate value for the saturation pressure.
|
||||
*
|
||||
* @param TKelvin temperature in kelvin
|
||||
* @return returns the estimated saturation pressure at the given temperature
|
||||
* @param TKelvin temperature in kelvin
|
||||
* @return the estimated saturation pressure at the given temperature
|
||||
*/
|
||||
virtual doublereal psatEst(doublereal TKelvin) const;
|
||||
|
||||
public:
|
||||
//! Estimate for the molar volume of the liquid
|
||||
/*!
|
||||
* Note: this is only used as a starting guess for later routines that actually calculate an
|
||||
* accurate value for the liquid molar volume.
|
||||
* This routine doesn't change the state of the system.
|
||||
* Note: this is only used as a starting guess for later routines that
|
||||
* actually calculate an accurate value for the liquid molar volume. This
|
||||
* routine doesn't change the state of the system.
|
||||
*
|
||||
* @param TKelvin temperature in kelvin
|
||||
* @param pres Pressure in Pa. This is used as an initial guess. If the routine
|
||||
* needs to change the pressure to find a stable liquid state, the
|
||||
* new pressure is returned in this variable.
|
||||
* @return Returns the estimate of the liquid volume. If the liquid can't be found, this
|
||||
* routine returns -1.
|
||||
* @param TKelvin temperature in kelvin
|
||||
* @param pres Pressure in Pa. This is used as an initial guess. If the
|
||||
* routine needs to change the pressure to find a stable
|
||||
* liquid state, the new pressure is returned in this
|
||||
* variable.
|
||||
* @returns the estimate of the liquid volume. If the liquid can't be
|
||||
* found, this routine returns -1.
|
||||
*/
|
||||
virtual doublereal liquidVolEst(doublereal TKelvin, doublereal& pres) const;
|
||||
|
||||
//! Calculates the density given the temperature and the pressure and a guess at the density.
|
||||
//! Calculates the density given the temperature and the pressure and a
|
||||
//! guess at the density.
|
||||
/*!
|
||||
* Note, below T_c, this is a multivalued function. We do not cross the vapor dome in this.
|
||||
* This is protected because it is called during setState_TP() routines. Infinite loops would result
|
||||
* if it were not protected.
|
||||
* Note, below T_c, this is a multivalued function. We do not cross the
|
||||
* vapor dome in this. This is protected because it is called during
|
||||
* setState_TP() routines. Infinite loops would result if it were not
|
||||
* protected.
|
||||
*
|
||||
* -> why is this not const?
|
||||
*
|
||||
* parameters:
|
||||
* @param TKelvin Temperature in Kelvin
|
||||
* @param pressure Pressure in Pascals (Newton/m**2)
|
||||
* @param phaseRequested int representing the phase whose density we are requesting. If we put
|
||||
* a gas or liquid phase here, we will attempt to find a volume in that
|
||||
* part of the volume space, only, in this routine. A value of FLUID_UNDEFINED
|
||||
* means that we will accept anything.
|
||||
*
|
||||
* @param rhoguess Guessed density of the fluid. A value of -1.0 indicates that there
|
||||
* is no guessed density
|
||||
* @return We return the density of the fluid at the requested phase. If we have not found any
|
||||
* acceptable density we return a -1. If we have found an acceptable density at a
|
||||
* different phase, we return a -2.
|
||||
* @param TKelvin Temperature in Kelvin
|
||||
* @param pressure Pressure in Pascals (Newton/m**2)
|
||||
* @param phaseRequested int representing the phase whose density we are
|
||||
* requesting. If we put a gas or liquid phase here, we will attempt to
|
||||
* find a volume in that part of the volume space, only, in this
|
||||
* routine. A value of FLUID_UNDEFINED means that we will accept
|
||||
* anything.
|
||||
* @param rhoguess Guessed density of the fluid. A value of -1.0 indicates
|
||||
* that there is no guessed density
|
||||
* @return We return the density of the fluid at the requested phase. If
|
||||
* we have not found any acceptable density we return a -1. If we
|
||||
* have found an acceptable density at a different phase, we
|
||||
* return a -2.
|
||||
*/
|
||||
virtual doublereal densityCalc(doublereal TKelvin, doublereal pressure, int phaseRequested,
|
||||
doublereal rhoguess);
|
||||
|
|
@ -706,8 +483,8 @@ protected:
|
|||
public:
|
||||
//! Returns the Phase State flag for the current state of the object
|
||||
/*!
|
||||
* @param checkState If true, this function does a complete check to see where
|
||||
* in parameters space we are
|
||||
* @param checkState If true, this function does a complete check to see
|
||||
* where in parameters space we are
|
||||
*
|
||||
* There are three values:
|
||||
* - WATER_GAS below the critical temperature but below the critical density
|
||||
|
|
@ -716,58 +493,59 @@ public:
|
|||
*/
|
||||
int phaseState(bool checkState = false) const;
|
||||
|
||||
//! Return the value of the density at the liquid spinodal point (on the liquid side)
|
||||
//! for the current temperature.
|
||||
//! Return the value of the density at the liquid spinodal point (on the
|
||||
//! liquid side) for the current temperature.
|
||||
/*!
|
||||
* @return returns the density with units of kg m-3
|
||||
* @returns the density with units of kg m-3
|
||||
*/
|
||||
virtual doublereal densSpinodalLiquid() const;
|
||||
|
||||
//! Return the value of the density at the gas spinodal point (on the gas side)
|
||||
//! for the current temperature.
|
||||
//! Return the value of the density at the gas spinodal point (on the gas
|
||||
//! side) for the current temperature.
|
||||
/*!
|
||||
* @return returns the density with units of kg m-3
|
||||
* @returns the density with units of kg m-3
|
||||
*/
|
||||
virtual doublereal densSpinodalGas() const;
|
||||
|
||||
public:
|
||||
//! Calculate the saturation pressure at the current mixture content for the given temperature
|
||||
//! Calculate the saturation pressure at the current mixture content for the
|
||||
//! given temperature
|
||||
/*!
|
||||
* @param TKelvin (input) Temperature (Kelvin)
|
||||
* @param molarVolGas (return) Molar volume of the gas
|
||||
* @param molarVolLiquid (return) Molar volume of the liquid
|
||||
* @return Returns the saturation pressure at the given temperature
|
||||
* @param TKelvin (input) Temperature (Kelvin)
|
||||
* @param molarVolGas (return) Molar volume of the gas
|
||||
* @param molarVolLiquid (return) Molar volume of the liquid
|
||||
* @returns the saturation pressure at the given temperature
|
||||
*/
|
||||
doublereal calculatePsat(doublereal TKelvin, doublereal& molarVolGas,
|
||||
doublereal& molarVolLiquid);
|
||||
|
||||
public:
|
||||
//! Calculate the saturation pressure at the current mixture content for the given temperature
|
||||
//! Calculate the saturation pressure at the current mixture content for the
|
||||
//! given temperature
|
||||
/*!
|
||||
* @param TKelvin Temperature (Kelvin)
|
||||
* @return The saturation pressure at the given temperature
|
||||
* @param TKelvin Temperature (Kelvin)
|
||||
* @return The saturation pressure at the given temperature
|
||||
*/
|
||||
virtual doublereal satPressure(doublereal TKelvin);
|
||||
|
||||
protected:
|
||||
//! Calculate the pressure given the temperature and the molar volume
|
||||
/*!
|
||||
* Calculate the pressure given the temperature and the molar volume
|
||||
*
|
||||
* @param TKelvin temperature in kelvin
|
||||
* @param molarVol molar volume ( m3/kmol)
|
||||
* @return Returns the pressure.
|
||||
* @returns the pressure.
|
||||
*/
|
||||
virtual doublereal pressureCalc(doublereal TKelvin, doublereal molarVol) const;
|
||||
|
||||
//! Calculate the pressure and the pressure derivative given the temperature and the molar volume
|
||||
//! Calculate the pressure and the pressure derivative given the temperature
|
||||
//! and the molar volume
|
||||
/*!
|
||||
* Temperature and mole number are held constant
|
||||
*
|
||||
* @param TKelvin temperature in kelvin
|
||||
* @param molarVol molar volume ( m3/kmol)
|
||||
* @param presCalc Returns the pressure.
|
||||
* @return Returns the derivative of the pressure wrt the molar volume
|
||||
* @returns the derivative of the pressure wrt the molar volume
|
||||
*/
|
||||
virtual doublereal dpdVCalc(doublereal TKelvin, doublereal molarVol, doublereal& presCalc) const;
|
||||
|
||||
|
|
@ -784,12 +562,12 @@ protected:
|
|||
};
|
||||
|
||||
protected:
|
||||
//! Current value of the pressures
|
||||
//! Current value of the pressure
|
||||
/*!
|
||||
* Because the pressure is now a calculation, we store the result of the calculation whenever
|
||||
* it is recalculated.
|
||||
* Because the pressure is now a calculation, we store the result of the
|
||||
* calculation whenever it is recalculated.
|
||||
*
|
||||
* units = Pascals
|
||||
* units = Pascals
|
||||
*/
|
||||
doublereal m_Pcurrent;
|
||||
|
||||
|
|
@ -811,7 +589,8 @@ protected:
|
|||
//! Force the system to be on a particular side of the spinodal curve
|
||||
int forcedState_;
|
||||
|
||||
//! The last temperature at which the reference state thermodynamic properties were calculated at.
|
||||
//! The last temperature at which the reference state thermodynamic
|
||||
//! properties were calculated at.
|
||||
mutable doublereal m_Tlast_ref;
|
||||
|
||||
//! Temporary storage for log of p/rt
|
||||
|
|
|
|||
|
|
@ -24,26 +24,20 @@
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
/**
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
|
||||
/*!
|
||||
* MolalityVPSSTP is a derived class of ThermoPhase that handles
|
||||
* variable pressure standard state methods for calculating
|
||||
* thermodynamic properties that are further based on
|
||||
* molality-scaled activities.
|
||||
* This category incorporates most of the methods
|
||||
* for calculating liquid electrolyte thermodynamics that have been
|
||||
* developed since the 1970's.
|
||||
* MolalityVPSSTP is a derived class of ThermoPhase that handles variable
|
||||
* pressure standard state methods for calculating thermodynamic properties that
|
||||
* are further based on molality-scaled activities. This category incorporates
|
||||
* most of the methods for calculating liquid electrolyte thermodynamics that
|
||||
* have been developed since the 1970's.
|
||||
*
|
||||
* This class adds additional functions onto the ThermoPhase interface
|
||||
* that handle molality based standard states. The ThermoPhase
|
||||
* class includes a member function, ThermoPhase::activityConvention()
|
||||
* that indicates which convention the activities are based on. The
|
||||
* default is to assume activities are based on the molar convention.
|
||||
* However, classes which derive from the MolalityVPSSTP class return
|
||||
* <b>cAC_CONVENTION_MOLALITY</b> from this member function.
|
||||
* This class adds additional functions onto the ThermoPhase interface that
|
||||
* handle molality based standard states. The ThermoPhase class includes a
|
||||
* member function, ThermoPhase::activityConvention() that indicates which
|
||||
* convention the activities are based on. The default is to assume activities
|
||||
* are based on the molar convention. However, classes which derive from the
|
||||
* MolalityVPSSTP class return <b>cAC_CONVENTION_MOLALITY</b> from this member
|
||||
* function.
|
||||
*
|
||||
* The molality of a solute, \f$ m_i \f$, is defined as
|
||||
*
|
||||
|
|
@ -55,34 +49,34 @@ namespace Cantera
|
|||
* \tilde{M}_o = \frac{M_o}{1000}
|
||||
* \f]
|
||||
*
|
||||
* where \f$ M_o \f$ is the molecular weight of the solvent. The molality
|
||||
* has units of gmol kg<SUP>-1</SUP>. For the solute, the molality may be
|
||||
* considered as the amount of gmol's of solute per kg of solvent, a natural
|
||||
* experimental quantity.
|
||||
*
|
||||
* The formulas for calculating mole fractions if given the molalities of
|
||||
* the solutes is stated below. First calculate \f$ L^{sum} \f$, an intermediate
|
||||
* where \f$ M_o \f$ is the molecular weight of the solvent. The molality has
|
||||
* units of gmol kg<SUP>-1</SUP>. For the solute, the molality may be considered
|
||||
* as the amount of gmol's of solute per kg of solvent, a natural experimental
|
||||
* quantity.
|
||||
*
|
||||
* \f[
|
||||
* L^{sum} = \frac{1}{\tilde{M}_o X_o} = \frac{1}{\tilde{M}_o} + \sum_{i\ne o} m_i
|
||||
* \f]
|
||||
* Then,
|
||||
* \f[
|
||||
* X_o = \frac{1}{\tilde{M}_o L^{sum}}
|
||||
* \f]
|
||||
* \f[
|
||||
* X_i = \frac{m_i}{L^{sum}}
|
||||
* \f]
|
||||
* where \f$ X_o \f$ is the mole fraction of solvent, and \f$ X_o \f$ is the
|
||||
* mole fraction of solute <I>i</I>. Thus, the molality scale and the mole fraction
|
||||
* scale offer a one-to-one mapping between each other, except in the limit
|
||||
* of a zero solvent mole fraction.
|
||||
* The formulas for calculating mole fractions if given the molalities of the
|
||||
* solutes is stated below. First calculate \f$ L^{sum} \f$, an intermediate
|
||||
* quantity.
|
||||
*
|
||||
* The standard states for thermodynamic objects that derive from <b>MolalityVPSSTP</b>
|
||||
* are on the unit molality basis. Chemical potentials
|
||||
* of the solutes, \f$ \mu_k \f$, and the solvent, \f$ \mu_o \f$, which are based
|
||||
* on the molality form, have the following general format:
|
||||
* \f[
|
||||
* L^{sum} = \frac{1}{\tilde{M}_o X_o} = \frac{1}{\tilde{M}_o} + \sum_{i\ne o} m_i
|
||||
* \f]
|
||||
* Then,
|
||||
* \f[
|
||||
* X_o = \frac{1}{\tilde{M}_o L^{sum}}
|
||||
* \f]
|
||||
* \f[
|
||||
* X_i = \frac{m_i}{L^{sum}}
|
||||
* \f]
|
||||
* where \f$ X_o \f$ is the mole fraction of solvent, and \f$ X_o \f$ is the
|
||||
* mole fraction of solute <I>i</I>. Thus, the molality scale and the mole
|
||||
* fraction scale offer a one-to-one mapping between each other, except in the
|
||||
* limit of a zero solvent mole fraction.
|
||||
*
|
||||
* The standard states for thermodynamic objects that derive from MolalityVPSSTP
|
||||
* are on the unit molality basis. Chemical potentials of the solutes, \f$ \mu_k
|
||||
* \f$, and the solvent, \f$ \mu_o \f$, which are based on the molality form,
|
||||
* have the following general format:
|
||||
*
|
||||
* \f[
|
||||
* \mu_k = \mu^{\triangle}_k(T,P) + R T ln(\gamma_k^{\triangle} \frac{m_k}{m^\triangle})
|
||||
|
|
@ -91,130 +85,115 @@ namespace Cantera
|
|||
* \mu_o = \mu^o_o(T,P) + RT ln(a_o)
|
||||
* \f]
|
||||
*
|
||||
* where \f$ \gamma_k^{\triangle} \f$ is the molality based activity coefficient for species
|
||||
* \f$k\f$.
|
||||
* where \f$ \gamma_k^{\triangle} \f$ is the molality based activity coefficient
|
||||
* for species \f$k\f$.
|
||||
*
|
||||
* The chemical potential of the solvent is thus expressed in a different format
|
||||
* than the chemical potential of the solutes. Additionally, the activity of the
|
||||
* solvent, \f$ a_o \f$, is further reexpressed in terms of an osmotic coefficient,
|
||||
* \f$ \phi \f$.
|
||||
* \f[
|
||||
* \phi = \frac{- ln(a_o)}{\tilde{M}_o \sum_{i \ne o} m_i}
|
||||
* \f]
|
||||
* solvent, \f$ a_o \f$, is further reexpressed in terms of an osmotic
|
||||
* coefficient, \f$ \phi \f$.
|
||||
* \f[
|
||||
* \phi = \frac{- ln(a_o)}{\tilde{M}_o \sum_{i \ne o} m_i}
|
||||
* \f]
|
||||
*
|
||||
* MolalityVPSSTP::osmoticCoefficient() returns the value of \f$ \phi \f$.
|
||||
* Note there are a few of definitions of the osmotic coefficient floating
|
||||
* around. We use the one defined in
|
||||
* (Activity Coefficients in Electrolyte Solutions, K. S. Pitzer
|
||||
* CRC Press, Boca Raton, 1991, p. 85, Eqn. 28). This definition is most clearly
|
||||
* related to theoretical calculation.
|
||||
* MolalityVPSSTP::osmoticCoefficient() returns the value of \f$ \phi \f$. Note
|
||||
* there are a few of definitions of the osmotic coefficient floating around. We
|
||||
* use the one defined in (Activity Coefficients in Electrolyte Solutions, K. S.
|
||||
* Pitzer CRC Press, Boca Raton, 1991, p. 85, Eqn. 28). This definition is most
|
||||
* clearly related to theoretical calculation.
|
||||
*
|
||||
* The molar-based activity coefficients \f$ \gamma_k \f$ may be calculated
|
||||
* from the molality-based
|
||||
* activity coefficients, \f$ \gamma_k^\triangle \f$ by the following
|
||||
* formula.
|
||||
* The molar-based activity coefficients \f$ \gamma_k \f$ may be calculated from
|
||||
* the molality-based activity coefficients, \f$ \gamma_k^\triangle \f$ by the
|
||||
* following formula.
|
||||
* \f[
|
||||
* \gamma_k = \frac{\gamma_k^\triangle}{X_o}
|
||||
* \f]
|
||||
* For purposes of establishing a convention, the molar activity coefficient of the
|
||||
* solvent is set equal to the molality-based activity coefficient of the
|
||||
* For purposes of establishing a convention, the molar activity coefficient of
|
||||
* the solvent is set equal to the molality-based activity coefficient of the
|
||||
* solvent:
|
||||
* \f[
|
||||
* \gamma_o = \gamma_o^\triangle
|
||||
* \f]
|
||||
*
|
||||
* The molality-based and molarity-based standard states may be related to one
|
||||
* another by the following formula.
|
||||
* The molality-based and molarity-based standard states may be related to one
|
||||
* another by the following formula.
|
||||
*
|
||||
* \f[
|
||||
* \mu_k^\triangle(T,P) = \mu_k^o(T,P) + R T \ln(\tilde{M}_o m^\triangle)
|
||||
* \f]
|
||||
*
|
||||
* An important convention is followed in all routines that derive from MolalityVPSSTP.
|
||||
* Standard state thermodynamic functions and reference state thermodynamic functions
|
||||
* return the molality-based quantities. Also all functions which return
|
||||
* activities return the molality-based activities. The reason for this convention
|
||||
* has been discussed in supporting memos. However, it's important because the
|
||||
* term in the equation above is non-trivial. For example it's equal
|
||||
* to 2.38 kcal gmol<SUP>-1</SUP> for water at 298 K.
|
||||
* An important convention is followed in all routines that derive from
|
||||
* MolalityVPSSTP. Standard state thermodynamic functions and reference state
|
||||
* thermodynamic functions return the molality-based quantities. Also all
|
||||
* functions which return activities return the molality-based activities. The
|
||||
* reason for this convention has been discussed in supporting memos. However,
|
||||
* it's important because the term in the equation above is non-trivial. For
|
||||
* example it's equal to 2.38 kcal gmol<SUP>-1</SUP> for water at 298 K.
|
||||
*
|
||||
* In order to prevent a singularity, this class includes the concept of a minimum
|
||||
* value for the solvent mole fraction. All calculations involving the formulation
|
||||
* of activity coefficients and other non-ideal solution behavior adhere to
|
||||
* this concept of a minimal value for the solvent mole fraction. This makes sense
|
||||
* because these solution behavior were all designed and measured far away from
|
||||
* the zero solvent singularity condition and are not applicable in that limit.
|
||||
* In order to prevent a singularity, this class includes the concept of a
|
||||
* minimum value for the solvent mole fraction. All calculations involving the
|
||||
* formulation of activity coefficients and other non-ideal solution behavior
|
||||
* adhere to this concept of a minimal value for the solvent mole fraction. This
|
||||
* makes sense because these solution behavior were all designed and measured
|
||||
* far away from the zero solvent singularity condition and are not applicable
|
||||
* in that limit.
|
||||
*
|
||||
* This objects add a layer that supports molality. It inherits from VPStandardStateTP.
|
||||
* This objects add a layer that supports molality. It inherits from
|
||||
* VPStandardStateTP.
|
||||
*
|
||||
* All objects that derive from this are assumed to have molality based standard states.
|
||||
* All objects that derive from this are assumed to have molality based standard
|
||||
* states.
|
||||
*
|
||||
* Molality based activity coefficients are scaled according to the current
|
||||
* pH scale. See the Eq3/6 manual for details.
|
||||
* Molality based activity coefficients are scaled according to the current pH
|
||||
* scale. See the Eq3/6 manual for details.
|
||||
*
|
||||
* Activity coefficients for species k may be altered between scales s1 to s2
|
||||
* using the following formula
|
||||
* Activity coefficients for species k may be altered between scales s1 to s2
|
||||
* using the following formula
|
||||
*
|
||||
* \f[
|
||||
* ln(\gamma_k^{s2}) = ln(\gamma_k^{s1})
|
||||
* + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* ln(\gamma_k^{s2}) = ln(\gamma_k^{s1})
|
||||
* + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right)
|
||||
* \f]
|
||||
*
|
||||
* where j is any one species. For the NBS scale, j is equal to the Cl- species
|
||||
* and
|
||||
* where j is any one species. For the NBS scale, j is equal to the Cl- species
|
||||
* and
|
||||
*
|
||||
* \f[
|
||||
* ln(\gamma_{Cl-}^{s2}) = \frac{-A_{\phi} \sqrt{I}}{1.0 + 1.5 \sqrt{I}}
|
||||
* \f]
|
||||
* \f[
|
||||
* ln(\gamma_{Cl-}^{s2}) = \frac{-A_{\phi} \sqrt{I}}{1.0 + 1.5 \sqrt{I}}
|
||||
* \f]
|
||||
*
|
||||
* The Pitzer scale doesn't actually change anything. The pitzer scale is defined
|
||||
* as the raw unscaled activity coefficients produced by the underlying objects.
|
||||
* The Pitzer scale doesn't actually change anything. The pitzer scale is
|
||||
* defined as the raw unscaled activity coefficients produced by the underlying
|
||||
* objects.
|
||||
*
|
||||
* <H3> SetState Strategy </H3>
|
||||
* <H3> SetState Strategy </H3>
|
||||
*
|
||||
* The MolalityVPSSTP object does not have a setState strategy concerning the
|
||||
* molalities. It does not keep track of whether the molalities have changed.
|
||||
* It's strictly an interfacial layer that writes the current mole fractions to the
|
||||
* State object. When molalities are needed it recalculates the molalities from
|
||||
* the State object's mole fraction vector.
|
||||
* The MolalityVPSSTP object does not have a setState strategy concerning the
|
||||
* molalities. It does not keep track of whether the molalities have changed.
|
||||
* It's strictly an interfacial layer that writes the current mole fractions to
|
||||
* the State object. When molalities are needed it recalculates the molalities
|
||||
* from the State object's mole fraction vector.
|
||||
*
|
||||
* @todo Make two solvent minimum fractions. One would be for calculation of the non-ideal
|
||||
* factors. The other one would be for purposes of stoichiometry evaluation. the
|
||||
* stoichiometry evaluation one would be a 1E-13 limit. Anything less would create
|
||||
* problems with roundoff error.
|
||||
* @todo Make two solvent minimum fractions. One would be for calculation of the
|
||||
* non-ideal factors. The other one would be for purposes of stoichiometry
|
||||
* evaluation. the stoichiometry evaluation one would be a 1E-13 limit.
|
||||
* Anything less would create problems with roundoff error.
|
||||
*/
|
||||
class MolalityVPSSTP : public VPStandardStateTP
|
||||
{
|
||||
public:
|
||||
/// Default Constructor
|
||||
/*!
|
||||
* This doesn't do much more than initialize constants with
|
||||
* default values for water at 25C. Water molecular weight
|
||||
* comes from the default elements.xml file. It actually
|
||||
* differs slightly from the IAPWS95 value of 18.015268. However,
|
||||
* density conservation and therefore element conservation
|
||||
* is the more important principle to follow.
|
||||
* This doesn't do much more than initialize constants with default values
|
||||
* for water at 25C. Water molecular weight comes from the default
|
||||
* elements.xml file. It actually differs slightly from the IAPWS95 value of
|
||||
* 18.015268. However, density conservation and therefore element
|
||||
* conservation is the more important principle to follow.
|
||||
*/
|
||||
MolalityVPSSTP();
|
||||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* @param b class to be copied
|
||||
*/
|
||||
MolalityVPSSTP(const MolalityVPSSTP& b);
|
||||
|
||||
/// Assignment operator
|
||||
/*!
|
||||
* @param b class to be copied.
|
||||
*/
|
||||
MolalityVPSSTP& operator=(const MolalityVPSSTP& b);
|
||||
|
||||
//! Duplication routine for objects which inherit from ThermoPhase.
|
||||
/*!
|
||||
* This virtual routine can be used to duplicate objects
|
||||
* inherited from ThermoPhase even if the application only has
|
||||
* a pointer to ThermoPhase to work with.
|
||||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//! @name Utilities
|
||||
|
|
@ -223,8 +202,8 @@ public:
|
|||
//! Set the pH scale, which determines the scale for single-ion activity
|
||||
//! coefficients.
|
||||
/*!
|
||||
* Single ion activity coefficients are not unique in terms of the
|
||||
* representing actual measurable quantities.
|
||||
* Single ion activity coefficients are not unique in terms of the
|
||||
* representing actual measurable quantities.
|
||||
*
|
||||
* @param pHscaleType Integer representing the pHscale
|
||||
*/
|
||||
|
|
@ -233,8 +212,8 @@ public:
|
|||
//! Reports the pH scale, which determines the scale for single-ion activity
|
||||
//! coefficients.
|
||||
/*!
|
||||
* Single ion activity coefficients are not unique in terms of the
|
||||
* representing actual measurable quantities.
|
||||
* Single ion activity coefficients are not unique in terms of the
|
||||
* representing actual measurable quantities.
|
||||
*
|
||||
* @return Return the pHscale type
|
||||
*/
|
||||
|
|
@ -247,8 +226,8 @@ public:
|
|||
/**
|
||||
* This routine sets the index number of the solvent for the phase.
|
||||
*
|
||||
* Note, having a solvent is a precursor to many things having to do
|
||||
* with molality.
|
||||
* Note, having a solvent is a precursor to many things having to do with
|
||||
* molality.
|
||||
*
|
||||
* @param k the solvent index number
|
||||
*/
|
||||
|
|
@ -258,11 +237,11 @@ public:
|
|||
size_t solventIndex() const;
|
||||
|
||||
/**
|
||||
* Sets the minimum mole fraction in the molality formulation.
|
||||
* Note the molality formulation is singular in the limit that
|
||||
* the solvent mole fraction goes to zero. Numerically, how
|
||||
* this limit is treated and resolved is an ongoing issue within
|
||||
* Cantera. The minimum mole fraction must be in the range 0 to 0.9.
|
||||
* Sets the minimum mole fraction in the molality formulation. Note the
|
||||
* molality formulation is singular in the limit that the solvent mole
|
||||
* fraction goes to zero. Numerically, how this limit is treated and
|
||||
* resolved is an ongoing issue within Cantera. The minimum mole fraction
|
||||
* must be in the range 0 to 0.9.
|
||||
*
|
||||
* @param xmolSolventMIN Input double containing the minimum mole fraction
|
||||
*/
|
||||
|
|
@ -273,12 +252,12 @@ public:
|
|||
|
||||
//! Calculates the molality of all species and stores the result internally.
|
||||
/*!
|
||||
* We calculate the vector of molalities of the species
|
||||
* in the phase and store the result internally:
|
||||
* \f[
|
||||
* We calculate the vector of molalities of the species in the phase and
|
||||
* store the result internally:
|
||||
* \f[
|
||||
* m_i = \frac{X_i}{1000 * M_o * X_{o,p}}
|
||||
* \f]
|
||||
* where
|
||||
* \f]
|
||||
* where
|
||||
* - \f$ M_o \f$ is the molecular weight of the solvent
|
||||
* - \f$ X_o \f$ is the mole fraction of the solvent
|
||||
* - \f$ X_i \f$ is the mole fraction of the solute.
|
||||
|
|
@ -288,14 +267,13 @@ public:
|
|||
*/
|
||||
void calcMolalities() const;
|
||||
|
||||
//! This function will return the molalities of the species.
|
||||
//! This function will return the molalities of the species.
|
||||
/*!
|
||||
* We calculate the vector of molalities of the species
|
||||
* in the phase
|
||||
* We calculate the vector of molalities of the species in the phase
|
||||
* \f[
|
||||
* m_i = \frac{X_i}{1000 * M_o * X_{o,p}}
|
||||
* \f]
|
||||
* where
|
||||
* where
|
||||
* - \f$ M_o \f$ is the molecular weight of the solvent
|
||||
* - \f$ X_o \f$ is the mole fraction of the solvent
|
||||
* - \f$ X_i \f$ is the mole fraction of the solute.
|
||||
|
|
@ -309,14 +287,13 @@ public:
|
|||
|
||||
//! Set the molalities of the solutes in a phase
|
||||
/*!
|
||||
* Note, the entry for the solvent is not used.
|
||||
* We are supplied with the molalities of all of the
|
||||
* solute species. We then calculate the mole fractions of all
|
||||
* species and update the ThermoPhase object.
|
||||
* \f[
|
||||
* Note, the entry for the solvent is not used. We are supplied with the
|
||||
* molalities of all of the solute species. We then calculate the mole
|
||||
* fractions of all species and update the ThermoPhase object.
|
||||
* \f[
|
||||
* m_i = \frac{X_i}{M_o/1000 * X_{o,p}}
|
||||
* \f]
|
||||
* where
|
||||
* \f]
|
||||
* where
|
||||
* - \f$M_o\f$ is the molecular weight of the solvent
|
||||
* - \f$X_o\f$ is the mole fraction of the solvent
|
||||
* - \f$X_i\f$ is the mole fraction of the solute.
|
||||
|
|
@ -325,18 +302,18 @@ public:
|
|||
* in the denominator.
|
||||
*
|
||||
* The formulas for calculating mole fractions are
|
||||
* \f[
|
||||
* L^{sum} = \frac{1}{\tilde{M}_o X_o} = \frac{1}{\tilde{M}_o} + \sum_{i\ne o} m_i
|
||||
* \f]
|
||||
* Then,
|
||||
* \f[
|
||||
* X_o = \frac{1}{\tilde{M}_o L^{sum}}
|
||||
* \f]
|
||||
* \f[
|
||||
* X_i = \frac{m_i}{L^{sum}}
|
||||
* \f]
|
||||
* It is currently an error if the solvent mole fraction is attempted to be set
|
||||
* to a value lower than \f$X_o^{min}\f$.
|
||||
* \f[
|
||||
* L^{sum} = \frac{1}{\tilde{M}_o X_o} = \frac{1}{\tilde{M}_o} + \sum_{i\ne o} m_i
|
||||
* \f]
|
||||
* Then,
|
||||
* \f[
|
||||
* X_o = \frac{1}{\tilde{M}_o L^{sum}}
|
||||
* \f]
|
||||
* \f[
|
||||
* X_i = \frac{m_i}{L^{sum}}
|
||||
* \f]
|
||||
* It is currently an error if the solvent mole fraction is attempted to be
|
||||
* set to a value lower than \f$ X_o^{min} \f$.
|
||||
*
|
||||
* @param molal Input vector of molalities. Length: m_kk.
|
||||
*/
|
||||
|
|
@ -364,70 +341,31 @@ public:
|
|||
* @}
|
||||
* @name Activities, Standard States, and Activity Concentrations
|
||||
*
|
||||
* The activity \f$a_k\f$ of a species in solution is
|
||||
* related to the chemical potential by \f[ \mu_k = \mu_k^0(T)
|
||||
* + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is
|
||||
* the chemical potential at unit activity, which depends only
|
||||
* on temperature and pressure.
|
||||
* The activity \f$a_k\f$ of a species in solution is related to the
|
||||
* chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The
|
||||
* quantity \f$\mu_k^0(T,P)\f$ is the chemical potential at unit activity,
|
||||
* which depends only on temperature and pressure.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* This method returns the activity convention.
|
||||
* Currently, there are two activity conventions:
|
||||
* - Molar-based activities: %Unit activity of species at either a
|
||||
* hypothetical pure solution of the species or at a hypothetical
|
||||
* pure ideal solution at infinite dilution.
|
||||
* `cAC_CONVENTION_MOLAR 0` (default)
|
||||
* - Molality based activities: unit activity of solutes at a hypothetical
|
||||
* 1 molal solution referenced to infinite dilution at all pressures and
|
||||
* temperatures. The solvent is still on molar basis.
|
||||
* `cAC_CONVENTION_MOLALITY 1`
|
||||
*
|
||||
* We set the convention to molality here.
|
||||
*/
|
||||
int activityConvention() const;
|
||||
|
||||
/**
|
||||
* This method returns an array of generalized concentrations
|
||||
* \f$ C_k\f$ that are defined such that
|
||||
* \f$ a_k = C_k / C^0_k, \f$ where \f$ C^0_k \f$
|
||||
* is a standard concentration
|
||||
* defined below. These generalized concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions.
|
||||
*
|
||||
* @param c Array of generalized concentrations. The
|
||||
* units depend upon the implementation of the
|
||||
* reaction rate expressions within the phase.
|
||||
*/
|
||||
virtual void getActivityConcentrations(doublereal* c) const;
|
||||
|
||||
/**
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize
|
||||
* the generalized concentration. In many cases, this quantity
|
||||
* will be the same for all species in a phase - for example,
|
||||
* for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this
|
||||
* reason, this method returns a single value, instead of an
|
||||
* array. However, for phases in which the standard
|
||||
* concentration is species-specific (e.g. surface species of
|
||||
* different sizes), this method may be called with an
|
||||
* optional parameter indicating the species.
|
||||
*
|
||||
* @param k species index. Defaults to zero.
|
||||
*/
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
//! Get the array of non-dimensional activities (molality
|
||||
//! based for this class and classes that derive from it) at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
//! Get the array of non-dimensional activities (molality based for this
|
||||
//! class and classes that derive from it) at the current solution
|
||||
//! temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* All standard state properties for molality-based phases are
|
||||
* evaluated consistent with the molality scale. Therefore, this function
|
||||
* must return molality-based activities.
|
||||
* All standard state properties for molality-based phases are evaluated
|
||||
* consistent with the molality scale. Therefore, this function must return
|
||||
* molality-based activities.
|
||||
*
|
||||
* \f[
|
||||
* a_i^\triangle = \gamma_k^{\triangle} \frac{m_k}{m^\triangle}
|
||||
* a_i^\triangle = \gamma_k^{\triangle} \frac{m_k}{m^\triangle}
|
||||
* \f]
|
||||
*
|
||||
* This function must be implemented in derived classes.
|
||||
|
|
@ -444,10 +382,9 @@ public:
|
|||
* of the molality-based activity coefficients.
|
||||
* See Denbigh p. 278 for a thorough discussion.
|
||||
*
|
||||
* The molar-based activity coefficients \f$ \gamma_k \f$ may be calculated from the
|
||||
* molality-based
|
||||
* activity coefficients, \f$ \gamma_k^\triangle \f$ by the following
|
||||
* formula.
|
||||
* The molar-based activity coefficients \f$ \gamma_k \f$ may be calculated
|
||||
* from the molality-based activity coefficients, \f$ \gamma_k^\triangle \f$
|
||||
* by the following formula.
|
||||
* \f[
|
||||
* \gamma_k = \frac{\gamma_k^\triangle}{X_o}
|
||||
* \f]
|
||||
|
|
@ -463,54 +400,52 @@ public:
|
|||
* Derived classes don't need to overload this function. This function is
|
||||
* handled at this level.
|
||||
*
|
||||
* @param ac Output vector containing the mole-fraction based activity coefficients.
|
||||
* length: m_kk.
|
||||
* @param ac Output vector containing the mole-fraction based activity
|
||||
* coefficients. length: m_kk.
|
||||
*/
|
||||
void getActivityCoefficients(doublereal* ac) const;
|
||||
|
||||
//! Get the array of non-dimensional molality based
|
||||
//! activity coefficients at the current solution temperature,
|
||||
//! pressure, and solution concentration.
|
||||
//! Get the array of non-dimensional molality based activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* See Denbigh p. 278 for a thorough discussion. This class must be overwritten in
|
||||
* classes which derive from MolalityVPSSTP. This function takes over from the
|
||||
* molar-based activity coefficient calculation, getActivityCoefficients(), in
|
||||
* derived classes.
|
||||
* See Denbigh p. 278 for a thorough discussion. This class must be
|
||||
* overwritten in classes which derive from MolalityVPSSTP. This function
|
||||
* takes over from the molar-based activity coefficient calculation,
|
||||
* getActivityCoefficients(), in derived classes.
|
||||
*
|
||||
* These molality based activity coefficients are scaled according to the current
|
||||
* pH scale. See the Eq3/6 manual for details.
|
||||
* These molality based activity coefficients are scaled according to the
|
||||
* current pH scale. See the Eq3/6 manual for details.
|
||||
*
|
||||
* Activity coefficients for species k may be altered between scales s1 to s2
|
||||
* using the following formula
|
||||
* Activity coefficients for species k may be altered between scales s1 to
|
||||
* s2 using the following formula
|
||||
*
|
||||
* \f[
|
||||
* ln(\gamma_k^{s2}) = ln(\gamma_k^{s1})
|
||||
* + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* ln(\gamma_k^{s2}) = ln(\gamma_k^{s1})
|
||||
* + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right)
|
||||
* \f]
|
||||
*
|
||||
* where j is any one species. For the NBS scale, j is equal to the Cl- species
|
||||
* and
|
||||
* where j is any one species. For the NBS scale, j is equal to the Cl-
|
||||
* species and
|
||||
*
|
||||
* \f[
|
||||
* ln(\gamma_{Cl-}^{s2}) = \frac{-A_{\phi} \sqrt{I}}{1.0 + 1.5 \sqrt{I}}
|
||||
* \f]
|
||||
* \f[
|
||||
* ln(\gamma_{Cl-}^{s2}) = \frac{-A_{\phi} \sqrt{I}}{1.0 + 1.5 \sqrt{I}}
|
||||
* \f]
|
||||
*
|
||||
* @param acMolality Output vector containing the molality based activity coefficients.
|
||||
* length: m_kk.
|
||||
* @param acMolality Output vector containing the molality based activity
|
||||
* coefficients. length: m_kk.
|
||||
*/
|
||||
virtual void getMolalityActivityCoefficients(doublereal* acMolality) const;
|
||||
|
||||
//! Calculate the osmotic coefficient
|
||||
/*!
|
||||
* \f[
|
||||
* \phi = \frac{- ln(a_o)}{\tilde{M}_o \sum_{i \ne o} m_i}
|
||||
* \f]
|
||||
* \f[
|
||||
* \phi = \frac{- ln(a_o)}{\tilde{M}_o \sum_{i \ne o} m_i}
|
||||
* \f]
|
||||
*
|
||||
* Note there are a few of definitions of the osmotic coefficient floating
|
||||
* around. We use the one defined in
|
||||
* (Activity Coefficients in Electrolyte Solutions, K. S. Pitzer
|
||||
* CRC Press, Boca Raton, 1991, p. 85, Eqn. 28). This definition is most clearly
|
||||
* related to theoretical calculation.
|
||||
* Note there are a few of definitions of the osmotic coefficient floating
|
||||
* around. We use the one defined in (Activity Coefficients in Electrolyte
|
||||
* Solutions, K. S. Pitzer CRC Press, Boca Raton, 1991, p. 85, Eqn. 28).
|
||||
* This definition is most clearly related to theoretical calculation.
|
||||
*
|
||||
* units = dimensionless
|
||||
*/
|
||||
|
|
@ -520,16 +455,6 @@ public:
|
|||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Get the species electrochemical potentials.
|
||||
* These are partial molar quantities. This method adds a term
|
||||
* \f$ Fz_k \phi_k \f$ to each chemical potential.
|
||||
*
|
||||
* Units: J/kmol
|
||||
*
|
||||
* @param mu output vector containing the species electrochemical potentials.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
void getElectrochemPotentials(doublereal* mu) const;
|
||||
|
||||
//@}
|
||||
|
|
@ -540,20 +465,6 @@ public:
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* This method is used by the ChemEquil element-potential
|
||||
* based equilibrium solver.
|
||||
* It sets the state such that the chemical potentials of the
|
||||
* species within the current phase satisfy
|
||||
* \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m}
|
||||
* \left(\frac{\lambda_m} {\hat R T}\right) \f] where
|
||||
* \f$ \lambda_m \f$ is the element potential of element m. The
|
||||
* temperature is unchanged. Any phase (ideal or not) that
|
||||
* implements this method can be equilibrated by ChemEquil.
|
||||
*
|
||||
* @param lambda_RT Input vector containing the dimensionless
|
||||
* element potentials.
|
||||
*/
|
||||
virtual void setToEquilState(const doublereal* lambda_RT);
|
||||
|
||||
//@}
|
||||
|
|
@ -564,50 +475,33 @@ public:
|
|||
* definition in an input file. It should be overloaded in subclasses to set
|
||||
* any parameters that are specific to that particular phase model.
|
||||
*
|
||||
* The MolalityVPSSTP object defines a new method for setting
|
||||
* the concentrations of a phase. The new method is defined by a
|
||||
* block called "soluteMolalities". If this block
|
||||
* is found, the concentrations within that phase are
|
||||
* set to the "name":"molalities pairs found within that
|
||||
* XML block. The solvent concentration is then set
|
||||
* to everything else.
|
||||
* The MolalityVPSSTP object defines a new method for setting the
|
||||
* concentrations of a phase. The new method is defined by a block called
|
||||
* "soluteMolalities". If this block is found, the concentrations within
|
||||
* that phase are set to the "name":"molalities pairs found within that XML
|
||||
* block. The solvent concentration is then set to everything else.
|
||||
*
|
||||
* The function first calls the overloaded function,
|
||||
* VPStandardStateTP::setStateFromXML(), to pick up the parent class
|
||||
* behavior.
|
||||
*
|
||||
* usage: Overloaded functions should call this function
|
||||
* before carrying out their own behavior.
|
||||
* usage: Overloaded functions should call this function before carrying out
|
||||
* their own behavior.
|
||||
*
|
||||
* @param state An XML_Node object corresponding to
|
||||
* the "state" entry for this phase in the input file.
|
||||
* @param state An XML_Node object corresponding to the "state" entry for
|
||||
* this phase in the input file.
|
||||
*/
|
||||
virtual void setStateFromXML(const XML_Node& state);
|
||||
|
||||
//@}
|
||||
//! @name Initialization
|
||||
/// The following methods are used in the process of constructing
|
||||
/// the phase and setting its parameters from a specification in an
|
||||
/// input file. They are not normally used in application programs.
|
||||
/// To see how they are used, see importPhase().
|
||||
/// The following methods are used in the process of constructing the phase
|
||||
/// and setting its parameters from a specification in an input file. They
|
||||
/// are not normally used in application programs. To see how they are used,
|
||||
/// see importPhase().
|
||||
//@{
|
||||
|
||||
virtual void initThermo();
|
||||
|
||||
/**
|
||||
* Import and initialize a ThermoPhase object
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a
|
||||
* complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
//@}
|
||||
|
|
@ -640,36 +534,10 @@ public:
|
|||
*/
|
||||
void setState_TPM(doublereal t, doublereal p, const std::string& m);
|
||||
|
||||
//! Get the array of derivatives of the log activity coefficients with respect to the log of the species mole numbers
|
||||
/*!
|
||||
* Implementations should take the derivative of the logarithm of the activity coefficient with respect to a
|
||||
* species log mole number (with all other species mole numbers held constant). The default treatment in the
|
||||
* ThermoPhase object is to set this vector to zero.
|
||||
*
|
||||
* units = 1 / kmol
|
||||
*
|
||||
* dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log act_coeff for the <I>m</I><SUP>th</SUP>
|
||||
* species with respect to the number of moles of the <I>k</I><SUP>th</SUP> species.
|
||||
*
|
||||
* \f[
|
||||
* \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i}
|
||||
* \f]
|
||||
*
|
||||
* @param ld Number of rows in the matrix
|
||||
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
||||
* log Activity Coefficients. length = m_kk * m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN) {
|
||||
getdlnActCoeffdlnN_numderiv(ld, dlnActCoeffdlnN);
|
||||
}
|
||||
|
||||
//! returns a summary of the state of the phase as a string
|
||||
/*!
|
||||
* @param show_thermo If true, extra information is printed out
|
||||
* about the thermodynamic state of the system.
|
||||
* @param threshold Show information about species with mole fractions
|
||||
* greater than *threshold*.
|
||||
*/
|
||||
virtual std::string report(bool show_thermo=true,
|
||||
doublereal threshold=1e-14) const;
|
||||
|
||||
|
|
@ -677,23 +545,24 @@ protected:
|
|||
virtual void getCsvReportData(std::vector<std::string>& names,
|
||||
std::vector<vector_fp>& data) const;
|
||||
|
||||
//! Get the array of unscaled non-dimensional molality based
|
||||
//! activity coefficients at the current solution temperature,
|
||||
//! pressure, and solution concentration.
|
||||
//! Get the array of unscaled non-dimensional molality based activity
|
||||
//! coefficients at the current solution temperature, pressure, and solution
|
||||
//! concentration.
|
||||
/*!
|
||||
* See Denbigh p. 278 for a thorough discussion. This class must be overwritten in
|
||||
* classes which derive from MolalityVPSSTP. This function takes over from the
|
||||
* molar-based activity coefficient calculation, getActivityCoefficients(), in
|
||||
* derived classes.
|
||||
* See Denbigh p. 278 for a thorough discussion. This class must be
|
||||
* overwritten in classes which derive from MolalityVPSSTP. This function
|
||||
* takes over from the molar-based activity coefficient calculation,
|
||||
* getActivityCoefficients(), in derived classes.
|
||||
*
|
||||
* @param acMolality Output vector containing the molality based activity coefficients.
|
||||
* length: m_kk.
|
||||
* @param acMolality Output vector containing the molality based activity
|
||||
* coefficients. length: m_kk.
|
||||
*/
|
||||
virtual void getUnscaledMolalityActivityCoefficients(doublereal* acMolality) const;
|
||||
|
||||
//! Apply the current phScale to a set of activity Coefficients or activities
|
||||
//! Apply the current phScale to a set of activity Coefficients or
|
||||
//! activities
|
||||
/*!
|
||||
* See the Eq3/6 Manual for a thorough discussion.
|
||||
* See the Eq3/6 Manual for a thorough discussion.
|
||||
*
|
||||
* @param acMolality input/Output vector containing the molality based
|
||||
* activity coefficients. length: m_kk.
|
||||
|
|
@ -703,46 +572,40 @@ protected:
|
|||
private:
|
||||
//! Returns the index of the Cl- species.
|
||||
/*!
|
||||
* The Cl- species is special in the sense that its single ion
|
||||
* molality-based activity coefficient is used in the specification
|
||||
* of the pH scale for single ions. Therefore, we need to know
|
||||
* what species index is Cl-. If the species isn't in the species
|
||||
* list then this routine returns -1, and we can't use the NBS
|
||||
* pH scale.
|
||||
* The Cl- species is special in the sense that its single ion molality-
|
||||
* based activity coefficient is used in the specification of the pH scale
|
||||
* for single ions. Therefore, we need to know what species index is Cl-. If
|
||||
* the species isn't in the species list then this routine returns -1, and
|
||||
* we can't use the NBS pH scale.
|
||||
*
|
||||
* Right now we use a restrictive interpretation. The species
|
||||
* must be named "Cl-". It must consist of exactly one Cl and one E
|
||||
* atom.
|
||||
* Right now we use a restrictive interpretation. The species must be named
|
||||
* "Cl-". It must consist of exactly one Cl and one E atom.
|
||||
*/
|
||||
virtual size_t findCLMIndex() const;
|
||||
|
||||
//! Initialize lengths of local variables after all species have
|
||||
//! been identified.
|
||||
//! Initialize lengths of local variables after all species have been
|
||||
//! identified.
|
||||
void initLengths();
|
||||
|
||||
protected:
|
||||
|
||||
//! Index of the solvent
|
||||
/*!
|
||||
* Currently the index of the solvent is hard-coded to the value 0
|
||||
*/
|
||||
//! Index of the solvent. Currently the index of the solvent is hard-coded
|
||||
//! to the value 0
|
||||
size_t m_indexSolvent;
|
||||
|
||||
//! Scaling to be used for output of single-ion species activity
|
||||
//! coefficients.
|
||||
/*!
|
||||
* Index of the species to be used in the single-ion scaling
|
||||
* law. This is the identity of the Cl- species for the PHSCALE_NBS
|
||||
* scaling.
|
||||
* Either PHSCALE_PITZER or PHSCALE_NBS
|
||||
* Index of the species to be used in the single-ion scaling law. This is
|
||||
* the identity of the Cl- species for the PHSCALE_NBS scaling. Either
|
||||
* PHSCALE_PITZER or PHSCALE_NBS
|
||||
*/
|
||||
int m_pHScalingType;
|
||||
|
||||
//! Index of the phScale species
|
||||
/*!
|
||||
* Index of the species to be used in the single-ion scaling
|
||||
* law. This is the identity of the Cl- species for the PHSCALE_NBS
|
||||
* scaling
|
||||
* Index of the species to be used in the single-ion scaling law. This is
|
||||
* the identity of the Cl- species for the PHSCALE_NBS scaling
|
||||
*/
|
||||
size_t m_indexCLM;
|
||||
|
||||
|
|
@ -750,74 +613,67 @@ protected:
|
|||
doublereal m_weightSolvent;
|
||||
|
||||
/*!
|
||||
* In any molality implementation, it makes sense to have
|
||||
* a minimum solvent mole fraction requirement, since the
|
||||
* implementation becomes singular in the xmolSolvent=0
|
||||
* limit. The default is to set it to 0.01.
|
||||
* We then modify the molality definition to ensure that
|
||||
* molal_solvent = 0 when xmol_solvent = 0.
|
||||
* In any molality implementation, it makes sense to have a minimum solvent
|
||||
* mole fraction requirement, since the implementation becomes singular in
|
||||
* the xmolSolvent=0 limit. The default is to set it to 0.01. We then modify
|
||||
* the molality definition to ensure that molal_solvent = 0 when
|
||||
* xmol_solvent = 0.
|
||||
*/
|
||||
doublereal m_xmolSolventMIN;
|
||||
|
||||
//! This is the multiplication factor that goes inside
|
||||
//! log expressions involving the molalities of species.
|
||||
/*!
|
||||
* It's equal to Wt_0 / 1000,
|
||||
* where Wt_0 = weight of solvent (kg/kmol)
|
||||
*/
|
||||
//! This is the multiplication factor that goes inside log expressions
|
||||
//! involving the molalities of species. It's equal to Wt_0 / 1000, where
|
||||
//! Wt_0 = weight of solvent (kg/kmol)
|
||||
doublereal m_Mnaught;
|
||||
|
||||
//! Current value of the molalities of the species in the phase.
|
||||
/*!
|
||||
* Note this vector is a mutable quantity.
|
||||
* units are (kg/kmol)
|
||||
*/
|
||||
//! Current value of the molalities of the species in the phase. Note this
|
||||
//! vector is a mutable quantity. units are (kg/kmol)
|
||||
mutable vector_fp m_molalities;
|
||||
};
|
||||
|
||||
|
||||
//! Scale to be used for the output of single-ion activity coefficients
|
||||
//! is that used by Pitzer.
|
||||
//! Scale to be used for the output of single-ion activity coefficients is that
|
||||
//! used by Pitzer.
|
||||
/*!
|
||||
* This is the internal scale used within the code. One property is that
|
||||
* the activity coefficients for the cation and anion of a single salt
|
||||
* will be equal. This scale is the one presumed by the formulation of the
|
||||
* single-ion activity coefficients described in this report.
|
||||
* This is the internal scale used within the code. One property is that the
|
||||
* activity coefficients for the cation and anion of a single salt will be
|
||||
* equal. This scale is the one presumed by the formulation of the single-ion
|
||||
* activity coefficients described in this report.
|
||||
*
|
||||
* Activity coefficients for species k may be altered between scales s1 to s2
|
||||
* using the following formula
|
||||
* Activity coefficients for species k may be altered between scales s1 to s2
|
||||
* using the following formula
|
||||
*
|
||||
* \f[
|
||||
* ln(\gamma_k^{s2}) = ln(\gamma_k^{s1})
|
||||
* + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* ln(\gamma_k^{s2}) = ln(\gamma_k^{s1})
|
||||
* + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right)
|
||||
* \f]
|
||||
*
|
||||
* where j is any one species.
|
||||
* where j is any one species.
|
||||
*/
|
||||
const int PHSCALE_PITZER = 0;
|
||||
|
||||
//! Scale to be used for evaluation of single-ion activity coefficients
|
||||
//! is that used by the NBS standard for evaluation of the pH variable.
|
||||
//! Scale to be used for evaluation of single-ion activity coefficients is that
|
||||
//! used by the NBS standard for evaluation of the pH variable.
|
||||
/*!
|
||||
* This is not the internal scale used within the code.
|
||||
* This is not the internal scale used within the code.
|
||||
*
|
||||
* Activity coefficients for species k may be altered between scales s1 to s2
|
||||
* using the following formula
|
||||
* Activity coefficients for species k may be altered between scales s1 to s2
|
||||
* using the following formula
|
||||
*
|
||||
* \f[
|
||||
* ln(\gamma_k^{s2}) = ln(\gamma_k^{s1})
|
||||
* + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* ln(\gamma_k^{s2}) = ln(\gamma_k^{s1})
|
||||
* + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right)
|
||||
* \f]
|
||||
*
|
||||
* where j is any one species. For the NBS scale, j is equal to the Cl- species
|
||||
* and
|
||||
* where j is any one species. For the NBS scale, j is equal to the Cl- species
|
||||
* and
|
||||
*
|
||||
* \f[
|
||||
* ln(\gamma_{Cl-}^{s2}) = \frac{-A_{\phi} \sqrt{I}}{1.0 + 1.5 \sqrt{I}}
|
||||
* \f]
|
||||
* \f[
|
||||
* ln(\gamma_{Cl-}^{s2}) = \frac{-A_{\phi} \sqrt{I}}{1.0 + 1.5 \sqrt{I}}
|
||||
* \f]
|
||||
*
|
||||
* This is the NBS pH scale, which is used in all conventional pH
|
||||
* measurements. and is based on the Bates-Guggenheim equations.
|
||||
* This is the NBS pH scale, which is used in all conventional pH measurements.
|
||||
* and is based on the Bates-Guggenheim equations.
|
||||
*/
|
||||
const int PHSCALE_NBS = 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
/**
|
||||
* @file MolarityIonicVPSSTP.h
|
||||
* Header for intermediate ThermoPhase object for phases which
|
||||
* employ Gibbs excess free energy based formulations
|
||||
* (see \ref thermoprops
|
||||
* and class \link Cantera::MolarityIonicVPSSTP MolarityIonicVPSSTP\endlink).
|
||||
* @file MolarityIonicVPSSTP.h (see \ref thermoprops and class \link
|
||||
* Cantera::MolarityIonicVPSSTP MolarityIonicVPSSTP\endlink).
|
||||
*
|
||||
* Header file for a derived class of ThermoPhase that handles
|
||||
* variable pressure standard state methods for calculating
|
||||
* thermodynamic properties that are further based upon activities
|
||||
* based on the molarity scale. In this class, we expect that there are
|
||||
* ions, but they are treated on the molarity scale.
|
||||
* Header file for a derived class of ThermoPhase that handles variable pressure
|
||||
* standard state methods for calculating thermodynamic properties that are
|
||||
* further based upon activities based on the molarity scale. In this class, we
|
||||
* expect that there are ions, but they are treated on the molarity scale.
|
||||
*/
|
||||
/*
|
||||
* Copyright (2006) Sandia Corporation. Under the terms of
|
||||
|
|
@ -25,47 +21,34 @@
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
/**
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
|
||||
/*!
|
||||
* MolarityIonicVPSSTP is a derived class of GibbsExcessVPSSTP that handles
|
||||
* variable pressure standard state methods for calculating
|
||||
* thermodynamic properties that are further based on
|
||||
* expressing the Excess Gibbs free energy as a function of
|
||||
* the mole fractions (or pseudo mole fractions) of the constituents.
|
||||
* This category is the workhorse for describing ionic systems which are not on the molality scale.
|
||||
* MolarityIonicVPSSTP is a derived class of GibbsExcessVPSSTP that handles
|
||||
* variable pressure standard state methods for calculating thermodynamic
|
||||
* properties that are further based on expressing the Excess Gibbs free energy
|
||||
* as a function of the mole fractions (or pseudo mole fractions) of the
|
||||
* constituents. This category is the workhorse for describing ionic systems
|
||||
* which are not on the molality scale.
|
||||
*
|
||||
* This class adds additional functions onto the ThermoPhase interface
|
||||
* that handles the calculation of the excess Gibbs free energy. The ThermoPhase
|
||||
* class includes a member function, ThermoPhase::activityConvention()
|
||||
* that indicates which convention the activities are based on. The
|
||||
* default is to assume activities are based on the molar convention.
|
||||
* That default is used here.
|
||||
* This class adds additional functions onto the ThermoPhase interface that
|
||||
* handles the calculation of the excess Gibbs free energy. The ThermoPhase
|
||||
* class includes a member function, ThermoPhase::activityConvention() that
|
||||
* indicates which convention the activities are based on. The default is to
|
||||
* assume activities are based on the molar convention. That default is used
|
||||
* here.
|
||||
*
|
||||
* All of the Excess Gibbs free energy formulations in this area employ
|
||||
* symmetrical formulations.
|
||||
* All of the Excess Gibbs free energy formulations in this area employ
|
||||
* symmetrical formulations.
|
||||
*
|
||||
* This layer will massage the mole fraction vector to implement
|
||||
* cation and anion based mole numbers in an optional manner, such that
|
||||
* it is expected that there exists a charge balance at all times.
|
||||
* One of the ions must be a "special ion" in the sense that its' thermodynamic
|
||||
* functions are set to zero, and the thermo functions of all other
|
||||
* ions are based on a valuation relative to that special ion.
|
||||
* This layer will massage the mole fraction vector to implement cation and
|
||||
* anion based mole numbers in an optional manner, such that it is expected that
|
||||
* there exists a charge balance at all times. One of the ions must be a
|
||||
* "special ion" in the sense that its' thermodynamic functions are set to zero,
|
||||
* and the thermo functions of all other ions are based on a valuation relative
|
||||
* to that special ion.
|
||||
*/
|
||||
class MolarityIonicVPSSTP : public GibbsExcessVPSSTP
|
||||
{
|
||||
public:
|
||||
/// Constructor
|
||||
/*!
|
||||
* This doesn't do much more than initialize constants with
|
||||
* default values for water at 25C. Water molecular weight
|
||||
* comes from the default elements.xml file. It actually
|
||||
* differs slightly from the IAPWS95 value of 18.015268. However,
|
||||
* density conservation and therefore element conservation
|
||||
* is the more important principle to follow.
|
||||
*/
|
||||
MolarityIonicVPSSTP();
|
||||
|
||||
//! Construct and initialize a MolarityIonicVPSSTP ThermoPhase object
|
||||
|
|
@ -87,24 +70,8 @@ public:
|
|||
*/
|
||||
MolarityIonicVPSSTP(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* @param b class to be copied
|
||||
*/
|
||||
MolarityIonicVPSSTP(const MolarityIonicVPSSTP& b);
|
||||
|
||||
/// Assignment operator
|
||||
/*!
|
||||
* @param b class to be copied.
|
||||
*/
|
||||
MolarityIonicVPSSTP& operator=(const MolarityIonicVPSSTP& b);
|
||||
|
||||
//! Duplication routine for objects which inherit from ThermoPhase.
|
||||
/*!
|
||||
* This virtual routine can be used to duplicate ThermoPhase objects
|
||||
* inherited from ThermoPhase even if the application only has
|
||||
* a pointer to ThermoPhase to work with.
|
||||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
/**
|
||||
|
|
@ -118,39 +85,13 @@ public:
|
|||
* @{
|
||||
*/
|
||||
|
||||
//! Get the array of non-dimensional molar-based ln activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* @param lnac Output vector of ln activity coefficients. Length: m_kk.
|
||||
*/
|
||||
virtual void getLnActivityCoefficients(doublereal* lnac) const;
|
||||
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
||||
//! Get the species chemical potentials. Units: J/kmol.
|
||||
/*!
|
||||
* This function returns a vector of chemical potentials of the
|
||||
* species in solution at the current temperature, pressure
|
||||
* and mole fraction of the solution.
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
/**
|
||||
* Get the species electrochemical potentials.
|
||||
* These are partial molar quantities.
|
||||
* This method adds a term \f$ Fz_k \phi_k \f$ to the
|
||||
* to each chemical potential.
|
||||
*
|
||||
* Units: J/kmol
|
||||
*
|
||||
* @param mu output vector containing the species electrochemical potentials.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
void getElectrochemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Returns an array of partial molar enthalpies for the species
|
||||
|
|
@ -158,33 +99,33 @@ public:
|
|||
/*!
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* standard state enthalpies modified by the derivative of the
|
||||
* molality-based activity coefficient wrt temperature
|
||||
* For this phase, the partial molar enthalpies are equal to the standard
|
||||
* state enthalpies modified by the derivative of the molality-based
|
||||
* activity coefficient wrt temperature
|
||||
*
|
||||
* \f[
|
||||
* \f[
|
||||
* \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
* \f]
|
||||
* \f]
|
||||
*
|
||||
* @param hbar Vector of returned partial molar enthalpies
|
||||
* (length m_kk, units = J/kmol)
|
||||
*/
|
||||
virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
|
||||
|
||||
//! Returns an array of partial molar entropies for the species
|
||||
//! in the mixture.
|
||||
//! Returns an array of partial molar entropies for the species in the
|
||||
//! mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* standard state enthalpies modified by the derivative of the
|
||||
* activity coefficient wrt temperature
|
||||
* For this phase, the partial molar enthalpies are equal to the standard
|
||||
* state enthalpies modified by the derivative of the activity coefficient
|
||||
* wrt temperature
|
||||
*
|
||||
* \f[
|
||||
* \f[
|
||||
* \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
* - R \ln( \gamma_k X_k)
|
||||
* - R T \frac{d \ln(\gamma_k) }{dT}
|
||||
* \f]
|
||||
* \f]
|
||||
*
|
||||
* @param sbar Vector of returned partial molar entropies
|
||||
* (length m_kk, units = J/kmol/K)
|
||||
|
|
@ -196,33 +137,23 @@ public:
|
|||
/*!
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* standard state enthalpies modified by the derivative of the
|
||||
* activity coefficient wrt temperature
|
||||
* For this phase, the partial molar enthalpies are equal to the standard
|
||||
* state enthalpies modified by the derivative of the activity coefficient
|
||||
* wrt temperature
|
||||
*
|
||||
* \f[
|
||||
* \f[
|
||||
* ???????????????
|
||||
* \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
* - R \ln( \gamma_k X_k)
|
||||
* - R T \frac{d \ln(\gamma_k) }{dT}
|
||||
* ???????????????
|
||||
* \f]
|
||||
* \f]
|
||||
*
|
||||
* @param cpbar Vector of returned partial molar heat capacities
|
||||
* (length m_kk, units = J/kmol/K)
|
||||
*/
|
||||
virtual void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
||||
//! Return an array of partial molar volumes for the
|
||||
//! species in the mixture. Units: m^3/kmol.
|
||||
/*!
|
||||
* Frequently, for this class of thermodynamics representations,
|
||||
* the excess Volume due to mixing is zero. Here, we set it as
|
||||
* a default. It may be overridden in derived classes.
|
||||
*
|
||||
* @param vbar Output vector of species partial molar volumes.
|
||||
* Length = m_kk. units are m^3/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarVolumes(doublereal* vbar) const;
|
||||
|
||||
//@}
|
||||
|
|
@ -237,85 +168,54 @@ public:
|
|||
/// To see how they are used, see importPhase().
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
* @internal Initialize. This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called just prior to returning
|
||||
* from function importPhase().
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
/**
|
||||
* Import and initialize a ThermoPhase object
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a
|
||||
* complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
//! @}
|
||||
|
||||
//! returns a summary of the state of the phase as a string
|
||||
/*!
|
||||
* @param show_thermo If true, extra information is printed out
|
||||
* about the thermodynamic state of the system.
|
||||
* @param threshold Show information about species with mole fractions
|
||||
* greater than *threshold*.
|
||||
*/
|
||||
virtual std::string report(bool show_thermo=true,
|
||||
doublereal threshold=1e-14) const;
|
||||
|
||||
private:
|
||||
//! Initialize lengths of local variables after all species have been identified.
|
||||
//! Initialize lengths of local variables after all species have been
|
||||
//! identified.
|
||||
void initLengths();
|
||||
|
||||
//! Process an XML node called "binaryNeutralSpeciesParameters"
|
||||
/*!
|
||||
* This node contains all of the parameters necessary to describe
|
||||
* the Redlich-Kister model for a particular binary interaction.
|
||||
* This function reads the XML file and writes the coefficients
|
||||
* it finds to an internal data structures.
|
||||
* This node contains all of the parameters necessary to describe the
|
||||
* Redlich-Kister model for a particular binary interaction. This function
|
||||
* reads the XML file and writes the coefficients it finds to an internal
|
||||
* data structures.
|
||||
*
|
||||
* @param xmlBinarySpecies Reference to the XML_Node named "binaryNeutralSpeciesParameters"
|
||||
* containing the binary interaction
|
||||
* @param xmlBinarySpecies Reference to the XML_Node named
|
||||
* "binaryNeutralSpeciesParameters" containing the binary interaction
|
||||
*/
|
||||
void readXMLBinarySpecies(XML_Node& xmlBinarySpecies);
|
||||
|
||||
//! Update the activity coefficients
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* natural logarithm of the activity coefficients
|
||||
* This function will be called to update the internally stored natural
|
||||
* logarithm of the activity coefficients
|
||||
*/
|
||||
void s_update_lnActCoeff() const;
|
||||
|
||||
//! Update the derivative of the log of the activity coefficients wrt T
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* derivative of the natural logarithm of the activity coefficients
|
||||
* wrt temperature.
|
||||
* This function will be called to update the internally stored derivative
|
||||
* of the natural logarithm of the activity coefficients wrt temperature.
|
||||
*/
|
||||
void s_update_dlnActCoeff_dT() const;
|
||||
|
||||
//! Internal routine that calculates the derivative of the activity coefficients wrt
|
||||
//! the mole fractions.
|
||||
//! Internal routine that calculates the derivative of the activity
|
||||
//! coefficients wrt the mole fractions.
|
||||
/*!
|
||||
* This routine calculates the the derivative of the activity coefficients wrt to mole fraction
|
||||
* with all other mole fractions held constant. This is strictly not permitted. However, if the
|
||||
* resulting matrix is multiplied by a permissible deltaX vector then everything is ok.
|
||||
* This routine calculates the the derivative of the activity coefficients
|
||||
* wrt to mole fraction with all other mole fractions held constant. This is
|
||||
* strictly not permitted. However, if the resulting matrix is multiplied by
|
||||
* a permissible deltaX vector then everything is ok.
|
||||
*
|
||||
* This is the natural way to handle concentration derivatives in this routine.
|
||||
* This is the natural way to handle concentration derivatives in this
|
||||
* routine.
|
||||
*/
|
||||
void s_update_dlnActCoeff_dX_() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,10 +27,11 @@ namespace Cantera
|
|||
* support thermodynamic calculations (see \ref thermoprops).
|
||||
*/
|
||||
|
||||
//! Class Phase is the base class for phases of matter, managing the species and elements in a phase, as well as the
|
||||
//! independent variables of temperature, mass density, species mass/mole fraction,
|
||||
//! and other generalized forces and intrinsic properties (such as electric potential)
|
||||
//! that define the thermodynamic state.
|
||||
//! Class Phase is the base class for phases of matter, managing the species and
|
||||
//! elements in a phase, as well as the independent variables of temperature,
|
||||
//! mass density, species mass/mole fraction, and other generalized forces and
|
||||
//! intrinsic properties (such as electric potential) that define the
|
||||
//! thermodynamic state.
|
||||
/*!
|
||||
*
|
||||
* Class Phase provides information about the elements and species in a
|
||||
|
|
@ -58,11 +59,10 @@ namespace Cantera
|
|||
* temperature and then the density. An example of this is the function
|
||||
* Phase::setState_TRY(double t, double dens, const double* y).
|
||||
*
|
||||
* Class Phase contains method for saving and restoring the full internal
|
||||
* states of each phase. These are saveState() and restoreState(). These
|
||||
* functions operate on a state vector, which is in general of length
|
||||
* (2 + nSpecies()). The first two entries of the state vector are temperature
|
||||
* and density.
|
||||
* Class Phase contains method for saving and restoring the full internal states
|
||||
* of each phase. These are saveState() and restoreState(). These functions
|
||||
* operate on a state vector, which is in general of length (2 + nSpecies()).
|
||||
* The first two entries of the state vector are temperature and density.
|
||||
*
|
||||
* A species name may be referred to via three methods:
|
||||
*
|
||||
|
|
@ -75,17 +75,19 @@ namespace Cantera
|
|||
* complicated assemblies of %Cantera Phases.
|
||||
*
|
||||
* @todo
|
||||
* Make the concept of saving state vectors more general, so that it can
|
||||
* handle other cases where there are additional internal state variables, such
|
||||
* as the voltage, a potential energy, or a strain field.
|
||||
*
|
||||
* Specify that the input mole, mass, and volume fraction vectors must sum to one on entry to the set state routines.
|
||||
* Non-conforming mole/mass fraction vectors are not thermodynamically consistent.
|
||||
* Moreover, unless we do this, the calculation of Jacobians will be altered whenever the treatment of non-conforming mole
|
||||
* fractions is changed. Add setState functions corresponding to specifying mole numbers, which is actually what
|
||||
* is being done (well one of the options, there are many) when non-conforming mole fractions are input.
|
||||
* Note, we realize that most numerical Jacobian and some analytical Jacobians use non-conforming calculations.
|
||||
* These can easily be changed to the set mole number setState functions.
|
||||
* - Make the concept of saving state vectors more general, so that it can
|
||||
* handle other cases where there are additional internal state variables,
|
||||
* such as the voltage, a potential energy, or a strain field.
|
||||
* - Specify that the input mole, mass, and volume fraction vectors must sum
|
||||
* to one on entry to the set state routines. Non-conforming mole/mass
|
||||
* fraction vectors are not thermodynamically consistent. Moreover, unless
|
||||
* we do this, the calculation of Jacobians will be altered whenever the
|
||||
* treatment of non- conforming mole fractions is changed. Add setState
|
||||
* functions corresponding to specifying mole numbers, which is actually
|
||||
* what is being done (well one of the options, there are many) when non-
|
||||
* conforming mole fractions are input. Note, we realize that most numerical
|
||||
* Jacobian and some analytical Jacobians use non-conforming calculations.
|
||||
* These can easily be changed to the set mole number setState functions.
|
||||
*
|
||||
* @ingroup phases
|
||||
*/
|
||||
|
|
@ -106,16 +108,16 @@ public:
|
|||
|
||||
//! Returns a const reference to the XML_Node that describes the phase.
|
||||
/*!
|
||||
* The XML_Node for the phase contains all of the input data used to set
|
||||
* up the model for the phase during its initialization.
|
||||
* The XML_Node for the phase contains all of the input data used to set up
|
||||
* the model for the phase during its initialization.
|
||||
*/
|
||||
XML_Node& xml() const;
|
||||
|
||||
//! Stores the XML tree information for the current phase
|
||||
/*!
|
||||
* This function now stores the complete XML_Node tree as read into the code
|
||||
* via a file. This is needed to move around within the XML tree during
|
||||
* construction of transport and kinetics mechanisms after copy
|
||||
* This function now stores the complete XML_Node tree as read into the
|
||||
* code via a file. This is needed to move around within the XML tree
|
||||
* during construction of transport and kinetics mechanisms after copy
|
||||
* construction operations.
|
||||
*
|
||||
* @param xmlPhase Reference to the XML node corresponding to the phase
|
||||
|
|
@ -191,25 +193,25 @@ public:
|
|||
//! Return the element constraint type
|
||||
//! Possible types include:
|
||||
//!
|
||||
//! CT_ELEM_TYPE_TURNEDOFF -1
|
||||
//! CT_ELEM_TYPE_ABSPOS 0
|
||||
//! CT_ELEM_TYPE_ELECTRONCHARGE 1
|
||||
//! CT_ELEM_TYPE_CHARGENEUTRALITY 2
|
||||
//! CT_ELEM_TYPE_LATTICERATIO 3
|
||||
//! CT_ELEM_TYPE_KINETICFROZEN 4
|
||||
//! CT_ELEM_TYPE_SURFACECONSTRAINT 5
|
||||
//! CT_ELEM_TYPE_OTHERCONSTRAINT 6
|
||||
//! - `CT_ELEM_TYPE_TURNEDOFF -1`
|
||||
//! - `CT_ELEM_TYPE_ABSPOS 0`
|
||||
//! - `CT_ELEM_TYPE_ELECTRONCHARGE 1`
|
||||
//! - `CT_ELEM_TYPE_CHARGENEUTRALITY 2`
|
||||
//! - `CT_ELEM_TYPE_LATTICERATIO 3`
|
||||
//! - `CT_ELEM_TYPE_KINETICFROZEN 4`
|
||||
//! - `CT_ELEM_TYPE_SURFACECONSTRAINT 5`
|
||||
//! - `CT_ELEM_TYPE_OTHERCONSTRAINT 6`
|
||||
//!
|
||||
//! The default is `CT_ELEM_TYPE_ABSPOS`.
|
||||
//! @param m Element index
|
||||
//! @return Returns the element type
|
||||
//! @returns the element type
|
||||
int elementType(size_t m) const;
|
||||
|
||||
//! Change the element type of the mth constraint
|
||||
//! Reassigns an element type.
|
||||
//! @param m Element index
|
||||
//! @param elem_type New elem type to be assigned
|
||||
//! @return Returns the old element type
|
||||
//! @returns the old element type
|
||||
int changeElementType(int m, int elem_type);
|
||||
|
||||
//! Return a read-only reference to the vector of atomic weights.
|
||||
|
|
@ -218,11 +220,11 @@ public:
|
|||
//! Number of elements.
|
||||
size_t nElements() const;
|
||||
|
||||
//! Check that the specified element index is in range
|
||||
//! Check that the specified element index is in range.
|
||||
//! Throws an exception if m is greater than nElements()-1
|
||||
void checkElementIndex(size_t m) const;
|
||||
|
||||
//! Check that an array size is at least nElements()
|
||||
//! Check that an array size is at least nElements().
|
||||
//! Throws an exception if mm is less than nElements(). Used before calls
|
||||
//! which take an array pointer.
|
||||
void checkElementArraySize(size_t mm) const;
|
||||
|
|
@ -265,18 +267,18 @@ public:
|
|||
return m_kk;
|
||||
}
|
||||
|
||||
//! Check that the specified species index is in range
|
||||
//! Check that the specified species index is in range.
|
||||
//! Throws an exception if k is greater than nSpecies()-1
|
||||
void checkSpeciesIndex(size_t k) const;
|
||||
|
||||
//! Check that an array size is at least nSpecies()
|
||||
//! Check that an array size is at least nSpecies().
|
||||
//! Throws an exception if kk is less than nSpecies(). Used before calls
|
||||
//! which take an array pointer.
|
||||
void checkSpeciesArraySize(size_t kk) const;
|
||||
|
||||
//!@} end group Element and Species Information
|
||||
|
||||
//! Save the current internal state of the phase
|
||||
//! Save the current internal state of the phase.
|
||||
//! Write to vector 'state' the current internal state.
|
||||
//! @param state output vector. Will be resized to nSpecies() + 2.
|
||||
void saveState(vector_fp& state) const;
|
||||
|
|
@ -353,7 +355,8 @@ public:
|
|||
//! a zero mass fraction.
|
||||
void setState_TRY(doublereal t, doublereal dens, const compositionMap& y);
|
||||
|
||||
//! Set the internally stored temperature (K), molar density (kmol/m^3), and mole fractions.
|
||||
//! Set the internally stored temperature (K), molar density (kmol/m^3), and
|
||||
//! mole fractions.
|
||||
//! @param t Temperature in kelvin
|
||||
//! @param n molar density (kmol/m^3)
|
||||
//! @param x vector of species mole fractions, length m_kk
|
||||
|
|
@ -388,7 +391,7 @@ public:
|
|||
|
||||
//! Molecular weight of species \c k.
|
||||
//! @param k index of species \c k
|
||||
//! @return Returns the molecular weight of species \c k.
|
||||
//! @returns the molecular weight of species \c k.
|
||||
doublereal molecularWeight(size_t k) const;
|
||||
|
||||
//! Copy the vector of molecular weights into vector weights.
|
||||
|
|
@ -450,7 +453,7 @@ public:
|
|||
//! length greater than or equal to the number of species.
|
||||
void getMoleFractions(doublereal* const x) const;
|
||||
|
||||
//! Set the mole fractions to the specified values
|
||||
//! Set the mole fractions to the specified values.
|
||||
//! There is no restriction on the sum of the mole fraction vector.
|
||||
//! Internally, the Phase object will normalize this vector before storing
|
||||
//! its contents.
|
||||
|
|
@ -490,8 +493,9 @@ public:
|
|||
|
||||
//! Get the species concentrations (kmol/m^3).
|
||||
/*!
|
||||
* @param[out] c The vector of species concentrations. Units are kmol/m^3. The length of
|
||||
* the vector must be greater than or equal to the number of species within the phase.
|
||||
* @param[out] c The vector of species concentrations. Units are
|
||||
* kmol/m^3. The length of the vector must be greater than
|
||||
* or equal to the number of species within the phase.
|
||||
*/
|
||||
void getConcentrations(doublereal* const c) const;
|
||||
|
||||
|
|
@ -500,7 +504,7 @@ public:
|
|||
/*!
|
||||
* @param[in] k Index of the species within the phase.
|
||||
*
|
||||
* @return Returns the concentration of species k (kmol m-3).
|
||||
* @returns the concentration of species k (kmol m-3).
|
||||
*/
|
||||
doublereal concentration(const size_t k) const;
|
||||
|
||||
|
|
@ -607,7 +611,7 @@ public:
|
|||
//! @return The molar volume of the phase
|
||||
doublereal molarVolume() const;
|
||||
|
||||
//! Set the internally stored density (kg/m^3) of the phase
|
||||
//! Set the internally stored density (kg/m^3) of the phase.
|
||||
//! Note the density of a phase is an independent variable.
|
||||
//! @param[in] density_ density (kg/m^3).
|
||||
virtual void setDensity(const doublereal density_) {
|
||||
|
|
@ -714,7 +718,7 @@ public:
|
|||
|
||||
//! Returns a bool indicating whether the object is ready for use
|
||||
/*!
|
||||
* @return returns true if the object is ready for calculation, false otherwise.
|
||||
* @returns true if the object is ready for calculation, false otherwise.
|
||||
*/
|
||||
virtual bool ready() const;
|
||||
|
||||
|
|
@ -726,8 +730,8 @@ public:
|
|||
protected:
|
||||
//! Cached for saved calculations within each ThermoPhase.
|
||||
/*!
|
||||
* For more information on how to use this, see examples within the source code and documentation
|
||||
* for this within ValueCache class itself.
|
||||
* For more information on how to use this, see examples within the source
|
||||
* code and documentation for this within ValueCache class itself.
|
||||
*/
|
||||
mutable ValueCache m_cache;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,245 +20,233 @@
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
/**
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
|
||||
//! PhaseCombo_Interaction is a derived class of GibbsExcessVPSSTP that employs
|
||||
//! the Margules approximation for the excess Gibbs free energy while eliminating
|
||||
//! the entropy of mixing term.
|
||||
//! PhaseCombo_Interaction is a derived class of GibbsExcessVPSSTP that employs
|
||||
//! the Margules approximation for the excess Gibbs free energy while
|
||||
//! eliminating the entropy of mixing term.
|
||||
/*!
|
||||
* PhaseCombo_Interaction derives from class GibbsExcessVPSSTP which is derived from VPStandardStateTP,
|
||||
* and overloads the virtual methods defined there with ones that
|
||||
* use expressions appropriate for the Margules Excess Gibbs free energy approximation.
|
||||
* The reader should refer to the MargulesVPSSTP class for information on that class.
|
||||
* This class in addition adds a term to the activity coefficient that eliminates the
|
||||
* ideal solution mixing term within the chemical potential. This is a very radical thing
|
||||
* to do, but it is supported by experimental evidence under some conditions.
|
||||
* PhaseCombo_Interaction derives from class GibbsExcessVPSSTP which is derived
|
||||
* from VPStandardStateTP, and overloads the virtual methods defined there with
|
||||
* ones that use expressions appropriate for the Margules Excess Gibbs free
|
||||
* energy approximation. The reader should refer to the MargulesVPSSTP class for
|
||||
* information on that class. This class in addition adds a term to the activity
|
||||
* coefficient that eliminates the ideal solution mixing term within the
|
||||
* chemical potential. This is a very radical thing to do, but it is supported
|
||||
* by experimental evidence under some conditions.
|
||||
*
|
||||
* The independent unknowns are pressure, temperature, and mass fraction.
|
||||
* The independent unknowns are pressure, temperature, and mass fraction.
|
||||
*
|
||||
* Several concepts are introduced. The first concept is that there are temporary
|
||||
* variables for holding the species standard state values of Cp, H, S, G, and V at the
|
||||
* last temperature and pressure called. These functions are not recalculated
|
||||
* if a new call is made using the previous temperature and pressure. Currently,
|
||||
* these variables and the calculation method are handled by the VPSSMgr class,
|
||||
* for which VPStandardStateTP owns a pointer to.
|
||||
* This class is introduced to represent specific conditions observed in thermal
|
||||
* batteries. HOwever, it may be physically motivated to represent conditions
|
||||
* where there may be a mixture of compounds that are not "mixed" at the
|
||||
* molecular level. Therefore, there is no mixing term.
|
||||
*
|
||||
* To support the above functionality, pressure and temperature variables,
|
||||
* m_plast_ss and m_tlast_ss, are kept which store the last pressure and temperature
|
||||
* used in the evaluation of standard state properties.
|
||||
*
|
||||
* This class is introduced to represent specific conditions observed in thermal batteries.
|
||||
* HOwever, it may be physically motivated to represent conditions where there may
|
||||
* be a mixture of compounds that are not "mixed" at the molecular level. Therefore, there
|
||||
* is no mixing term.
|
||||
*
|
||||
* The lack of a mixing term has profound effects. First, the mole fraction of a species
|
||||
* can now be identically zero due to thermodynamic considerations. The phase behaves more
|
||||
* like a series of phases. That's why we named it PhaseCombo.
|
||||
* The lack of a mixing term has profound effects. First, the mole fraction of a
|
||||
* species can now be identically zero due to thermodynamic considerations. The
|
||||
* phase behaves more like a series of phases. That's why we named it
|
||||
* PhaseCombo.
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Specification of Species Standard State Properties </H2>
|
||||
* <HR>
|
||||
*
|
||||
* All species are defined to have standard states that depend upon both
|
||||
* the temperature and the pressure. The Margules approximation assumes
|
||||
* symmetric standard states, where all of the standard state assume
|
||||
* that the species are in pure component states at the temperature
|
||||
* and pressure of the solution. I don't think it prevents, however,
|
||||
* some species from being dilute in the solution.
|
||||
* All species are defined to have standard states that depend upon both the
|
||||
* temperature and the pressure. The Margules approximation assumes symmetric
|
||||
* standard states, where all of the standard state assume that the species are
|
||||
* in pure component states at the temperature and pressure of the solution. I
|
||||
* don't think it prevents, however, some species from being dilute in the
|
||||
* solution.
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Specification of Solution Thermodynamic Properties </H2>
|
||||
* <HR>
|
||||
*
|
||||
* The molar excess Gibbs free energy is given by the following formula which is a sum over interactions <I>i</I>.
|
||||
* Each of the interactions are binary interactions involving two of the species in the phase, denoted, <I>Ai</I>
|
||||
* and <I>Bi</I>.
|
||||
* This is the generalization of the Margules formulation for a phase
|
||||
* that has more than 2 species. The second term in the excess Gibbs free energy is a negation of the
|
||||
* ideal solution's mixing term.
|
||||
* The molar excess Gibbs free energy is given by the following formula which is
|
||||
* a sum over interactions <I>i</I>. Each of the interactions are binary
|
||||
* interactions involving two of the species in the phase, denoted, <I>Ai</I>
|
||||
* and <I>Bi</I>. This is the generalization of the Margules formulation for a
|
||||
* phase that has more than 2 species. The second term in the excess Gibbs free
|
||||
* energy is a negation of the ideal solution's mixing term.
|
||||
*
|
||||
* \f[
|
||||
* G^E = \sum_i \left( H_{Ei} - T S_{Ei} \right) - \sum_i \left( n_i R T \ln{X_i} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* H^E_i = n X_{Ai} X_{Bi} \left( h_{o,i} + h_{1,i} X_{Bi} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* S^E_i = n X_{Ai} X_{Bi} \left( s_{o,i} + s_{1,i} X_{Bi} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* G^E = \sum_i \left( H_{Ei} - T S_{Ei} \right) - \sum_i \left( n_i R T \ln{X_i} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* H^E_i = n X_{Ai} X_{Bi} \left( h_{o,i} + h_{1,i} X_{Bi} \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* S^E_i = n X_{Ai} X_{Bi} \left( s_{o,i} + s_{1,i} X_{Bi} \right)
|
||||
* \f]
|
||||
*
|
||||
* where n is the total moles in the solution.
|
||||
* where n is the total moles in the solution. The activity of a species defined
|
||||
* in the phase is given by an excess Gibbs free energy formulation.
|
||||
*
|
||||
* The activity of a species defined in the phase is given by an excess Gibbs free energy formulation.
|
||||
* \f[
|
||||
* a_k = \gamma_k X_k
|
||||
* \f]
|
||||
*
|
||||
* \f[
|
||||
* a_k = \gamma_k X_k
|
||||
* \f]
|
||||
* where
|
||||
*
|
||||
* where
|
||||
* \f[
|
||||
* R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i}
|
||||
* \f]
|
||||
*
|
||||
* \f[
|
||||
* R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i}
|
||||
* \f]
|
||||
* Taking the derivatives results in the following expression
|
||||
*
|
||||
* Taking the derivatives results in the following expression
|
||||
* \f[
|
||||
* R T \ln( \gamma_k )= \sum_i \left( \left( \delta_{Ai,k} X_{Bi} + \delta_{Bi,k} X_{Ai} - X_{Ai} X_{Bi} \right)
|
||||
* \left( g^E_{o,i} + g^E_{1,i} X_{Bi} \right) +
|
||||
* \left( \delta_{Bi,k} - X_{Bi} \right) X_{Ai} X_{Bi} g^E_{1,i} \right) - RT \ln{X_k}
|
||||
* \f]
|
||||
*
|
||||
* \f[
|
||||
* R T \ln( \gamma_k )= \sum_i \left( \left( \delta_{Ai,k} X_{Bi} + \delta_{Bi,k} X_{Ai} - X_{Ai} X_{Bi} \right)
|
||||
* \left( g^E_{o,i} + g^E_{1,i} X_{Bi} \right) +
|
||||
* \left( \delta_{Bi,k} - X_{Bi} \right) X_{Ai} X_{Bi} g^E_{1,i} \right) - RT \ln{X_k}
|
||||
* \f]
|
||||
* where \f$ g^E_{o,i} = h_{o,i} - T s_{o,i} \f$ and
|
||||
* \f$ g^E_{1,i} = h_{1,i} - T s_{1,i} \f$ and where \f$ X_k \f$ is the mole
|
||||
* fraction of species <I>k</I>.
|
||||
*
|
||||
* where
|
||||
* \f$ g^E_{o,i} = h_{o,i} - T s_{o,i} \f$ and \f$ g^E_{1,i} = h_{1,i} - T s_{1,i} \f$
|
||||
* and where \f$ X_k \f$ is the mole fraction of species <I>k</I>.
|
||||
* This object inherits from the class VPStandardStateTP. Therefore, the
|
||||
* specification and calculation of all standard state and reference state
|
||||
* values are handled at that level. Various functional forms for the standard
|
||||
* state are permissible. The chemical potential for species <I>k</I> is equal
|
||||
* to
|
||||
*
|
||||
* This object inherits from the class VPStandardStateTP. Therefore, the specification and
|
||||
* calculation of all standard state and reference state values are handled at that level. Various functional
|
||||
* forms for the standard state are permissible.
|
||||
* The chemical potential for species <I>k</I> is equal to
|
||||
* \f[
|
||||
* \mu_k(T,P) = \mu^o_k(T, P) + R T \ln(\gamma_k X_k)
|
||||
* \f]
|
||||
*
|
||||
* \f[
|
||||
* \mu_k(T,P) = \mu^o_k(T, P) + R T \ln(\gamma_k X_k)
|
||||
* \f]
|
||||
* The partial molar entropy for species <I>k</I> is given by the following
|
||||
* relation,
|
||||
*
|
||||
* The partial molar entropy for species <I>k</I> is given by the following relation,
|
||||
* \f[
|
||||
* \tilde{s}_k(T,P) = s^o_k(T,P) - R \ln( \gamma_k X_k )
|
||||
* - R T \frac{d \ln(\gamma_k) }{dT}
|
||||
* \f]
|
||||
*
|
||||
* \f[
|
||||
* \tilde{s}_k(T,P) = s^o_k(T,P) - R \ln( \gamma_k X_k )
|
||||
* - R T \frac{d \ln(\gamma_k) }{dT}
|
||||
* \f]
|
||||
* The partial molar enthalpy for species <I>k</I> is given by
|
||||
*
|
||||
* The partial molar enthalpy for species <I>k</I> is given by
|
||||
* \f[
|
||||
* \tilde{h}_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
* \f]
|
||||
*
|
||||
* \f[
|
||||
* \tilde{h}_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
* \f]
|
||||
* The partial molar volume for species <I>k</I> is
|
||||
*
|
||||
* The partial molar volume for species <I>k</I> is
|
||||
* \f[
|
||||
* \tilde V_k(T,P) = V^o_k(T,P) + R T \frac{d \ln(\gamma_k) }{dP}
|
||||
* \f]
|
||||
*
|
||||
* \f[
|
||||
* \tilde V_k(T,P) = V^o_k(T,P) + R T \frac{d \ln(\gamma_k) }{dP}
|
||||
* \f]
|
||||
* The partial molar Heat Capacity for species <I>k</I> is
|
||||
*
|
||||
* The partial molar Heat Capacity for species <I>k</I> is
|
||||
*
|
||||
* \f[
|
||||
* \tilde{C}_{p,k}(T,P) = C^o_{p,k}(T,P) - 2 R T \frac{d \ln( \gamma_k )}{dT}
|
||||
* - R T^2 \frac{d^2 \ln(\gamma_k) }{{dT}^2}
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{C}_{p,k}(T,P) = C^o_{p,k}(T,P) - 2 R T \frac{d \ln( \gamma_k )}{dT}
|
||||
* - R T^2 \frac{d^2 \ln(\gamma_k) }{{dT}^2}
|
||||
* \f]
|
||||
*
|
||||
* <HR>
|
||||
* <H2> %Application within Kinetics Managers </H2>
|
||||
* <HR>
|
||||
*
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
|
||||
* C^s_k, \f$ where \f$ C^s_k \f$ is a standard concentration
|
||||
* defined below and \f$ a_k \f$ are activities used in the
|
||||
* thermodynamic functions. These activity (or generalized) concentrations are used
|
||||
* by kinetics manager classes to compute the forward and reverse rates of elementary reactions.
|
||||
* The activity concentration,\f$ C^a_k \f$,is given by the following expression.
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / C^s_k, \f$ where
|
||||
* \f$ C^s_k \f$ is a standard concentration defined below and \f$ a_k \f$ are
|
||||
* activities used in the thermodynamic functions. These activity (or
|
||||
* generalized) concentrations are used by kinetics manager classes to compute
|
||||
* the forward and reverse rates of elementary reactions. The activity
|
||||
* concentration,\f$ C^a_k \f$,is given by the following expression.
|
||||
*
|
||||
* \f[
|
||||
* C^a_k = C^s_k X_k = \frac{P}{R T} X_k
|
||||
* \f]
|
||||
* \f[
|
||||
* C^a_k = C^s_k X_k = \frac{P}{R T} X_k
|
||||
* \f]
|
||||
*
|
||||
* The standard concentration for species <I>k</I> is independent of <I>k</I> and equal to
|
||||
* The standard concentration for species <I>k</I> is independent of <I>k</I>
|
||||
* and equal to
|
||||
*
|
||||
* \f[
|
||||
* C^s_k = C^s = \frac{P}{R T}
|
||||
* \f]
|
||||
* \f[
|
||||
* C^s_k = C^s = \frac{P}{R T}
|
||||
* \f]
|
||||
*
|
||||
* For example, a bulk-phase binary gas reaction between species j and k, producing
|
||||
* a new gas species l would have the
|
||||
* following equation for its rate of progress variable, \f$ R^1 \f$, which has
|
||||
* units of kmol m-3 s-1.
|
||||
* For example, a bulk-phase binary gas reaction between species j and k,
|
||||
* producing a new gas species l would have the following equation for its rate
|
||||
* of progress variable, \f$ R^1 \f$, which has units of kmol m-3 s-1.
|
||||
*
|
||||
* \f[
|
||||
* \f[
|
||||
* R^1 = k^1 C_j^a C_k^a = k^1 (C^s a_j) (C^s a_k)
|
||||
* \f]
|
||||
* \f]
|
||||
*
|
||||
* where
|
||||
* where
|
||||
*
|
||||
* \f[
|
||||
* \f[
|
||||
* C_j^a = C^s a_j \mbox{\quad and \quad} C_k^a = C^s a_k
|
||||
* \f]
|
||||
* \f]
|
||||
*
|
||||
* \f$ C_j^a \f$ is the activity concentration of species j, and
|
||||
* \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^s \f$
|
||||
* is the standard concentration. \f$ a_j \f$ is
|
||||
* the activity of species j which is equal to the mole fraction of j.
|
||||
* \f$ C_j^a \f$ is the activity concentration of species j, and \f$ C_k^a \f$
|
||||
* is the activity concentration of species k. \f$ C^s \f$ is the standard
|
||||
* concentration. \f$ a_j \f$ is the activity of species j which is equal to the
|
||||
* mole fraction of j.
|
||||
*
|
||||
* The reverse rate constant can then be obtained from the law of microscopic reversibility
|
||||
* and the equilibrium expression for the system.
|
||||
* The reverse rate constant can then be obtained from the law of microscopic
|
||||
* reversibility and the equilibrium expression for the system.
|
||||
*
|
||||
* \f[
|
||||
* \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
|
||||
* \f]
|
||||
* \f[
|
||||
* \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
|
||||
* \f]
|
||||
*
|
||||
* \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, associated with
|
||||
* the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ and their associated activities,
|
||||
* \f$ a_l \f$, repeated here:
|
||||
* \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant,
|
||||
* associated with the pressure dependent standard states \f$ \mu^o_l(T,P) \f$
|
||||
* and their associated activities, \f$ a_l \f$, repeated here:
|
||||
*
|
||||
* \f[
|
||||
* \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l)
|
||||
* \f]
|
||||
* \f[
|
||||
* \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l)
|
||||
* \f]
|
||||
*
|
||||
* We can switch over to expressing the equilibrium constant in terms of the reference
|
||||
* state chemical potentials
|
||||
* We can switch over to expressing the equilibrium constant in terms of the
|
||||
* reference state chemical potentials
|
||||
*
|
||||
* \f[
|
||||
* K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P}
|
||||
* \f]
|
||||
* \f[
|
||||
* K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P}
|
||||
* \f]
|
||||
*
|
||||
* The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over
|
||||
* to activity concentrations. When this is done:
|
||||
* The concentration equilibrium constant, \f$ K_c \f$, may be obtained by
|
||||
* changing over to activity concentrations. When this is done:
|
||||
*
|
||||
* \f[
|
||||
* \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 =
|
||||
* \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT}
|
||||
* \f]
|
||||
* \f[
|
||||
* \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 =
|
||||
* \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT}
|
||||
* \f]
|
||||
*
|
||||
* Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$,
|
||||
* using the second and third part of the above expression as a definition for the concentration
|
||||
* equilibrium constant.
|
||||
* Kinetics managers will calculate the concentration equilibrium constant,
|
||||
* \f$ K_c \f$, using the second and third part of the above expression as a
|
||||
* definition for the concentration equilibrium constant.
|
||||
*
|
||||
* For completeness, the pressure equilibrium constant may be obtained as well
|
||||
* For completeness, the pressure equilibrium constant may be obtained as well
|
||||
*
|
||||
* \f[
|
||||
* \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} )
|
||||
* \f]
|
||||
* \f[
|
||||
* \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} )
|
||||
* \f]
|
||||
*
|
||||
* \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. However, it isn't
|
||||
* necessarily the simplest form of the equilibrium constant for other types of phases; \f$ K_c \f$ is
|
||||
* used instead because it is completely general.
|
||||
* \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases.
|
||||
* However, it isn't necessarily the simplest form of the equilibrium constant
|
||||
* for other types of phases; \f$ K_c \f$ is used instead because it is
|
||||
* completely general.
|
||||
*
|
||||
* The reverse rate of progress may be written down as
|
||||
* \f[
|
||||
* R^{-1} = k^{-1} C_l^a = k^{-1} (C^o a_l)
|
||||
* \f]
|
||||
* The reverse rate of progress may be written down as
|
||||
* \f[
|
||||
* R^{-1} = k^{-1} C_l^a = k^{-1} (C^o a_l)
|
||||
* \f]
|
||||
*
|
||||
* where we can use the concept of microscopic reversibility to
|
||||
* write the reverse rate constant in terms of the
|
||||
* forward reate constant and the concentration equilibrium
|
||||
* constant, \f$ K_c \f$.
|
||||
* where we can use the concept of microscopic reversibility to write the
|
||||
* reverse rate constant in terms of the forward reate constant and the
|
||||
* concentration equilibrium constant, \f$ K_c \f$.
|
||||
*
|
||||
* \f[
|
||||
* k^{-1} = k^1 K^1_c
|
||||
* \f]
|
||||
* \f[
|
||||
* k^{-1} = k^1 K^1_c
|
||||
* \f]
|
||||
*
|
||||
* \f$k^{-1} \f$ has units of s-1.
|
||||
* \f$k^{-1} \f$ has units of s-1.
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Instantiation of the Class </H2>
|
||||
* <HR>
|
||||
*
|
||||
* The constructor for this phase is located in the default ThermoFactory
|
||||
* for %Cantera. A new PhaseCombo_Interaction object may be created by the following code
|
||||
* snippet:
|
||||
* The constructor for this phase is located in the default ThermoFactory for
|
||||
* %Cantera. A new PhaseCombo_Interaction object may be created by the following
|
||||
* code snippet:
|
||||
*
|
||||
* @code
|
||||
* XML_Node *xc = get_XML_File("LiFeS_X_combo.xml");
|
||||
|
|
@ -286,8 +274,8 @@ namespace Cantera
|
|||
* <HR>
|
||||
* <H2> XML Example </H2>
|
||||
* <HR>
|
||||
* An example of an XML Element named phase setting up a PhaseCombo_Interaction
|
||||
* object named LiFeS_X is given below.
|
||||
* An example of an XML Element named phase setting up a PhaseCombo_Interaction
|
||||
* object named LiFeS_X is given below.
|
||||
*
|
||||
* @code
|
||||
* <phase dim="3" id="LiFeS_X">
|
||||
|
|
@ -320,8 +308,9 @@ namespace Cantera
|
|||
* </phase>
|
||||
* @endcode
|
||||
*
|
||||
* The model attribute "PhaseCombo_Interaction" of the thermo XML element identifies the phase as
|
||||
* being of the type handled by the PhaseCombo_Interaction object.
|
||||
* The model attribute "PhaseCombo_Interaction" of the thermo XML element
|
||||
* identifies the phase as being of the type handled by the
|
||||
* PhaseCombo_Interaction object.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
|
|
@ -329,14 +318,6 @@ class PhaseCombo_Interaction : public GibbsExcessVPSSTP
|
|||
{
|
||||
public:
|
||||
//! Constructor
|
||||
/*!
|
||||
* This doesn't do much more than initialize constants with
|
||||
* default values for water at 25C. Water molecular weight
|
||||
* comes from the default elements.xml file. It actually
|
||||
* differs slightly from the IAPWS95 value of 18.015268. However,
|
||||
* density conservation and therefore element conservation
|
||||
* is the more important principle to follow.
|
||||
*/
|
||||
PhaseCombo_Interaction();
|
||||
|
||||
//! Construct and initialize a PhaseCombo_Interaction ThermoPhase object
|
||||
|
|
@ -358,133 +339,89 @@ public:
|
|||
*/
|
||||
PhaseCombo_Interaction(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* @param b class to be copied
|
||||
*/
|
||||
PhaseCombo_Interaction(const PhaseCombo_Interaction& b);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* @param b class to be copied.
|
||||
*/
|
||||
PhaseCombo_Interaction& operator=(const PhaseCombo_Interaction& b);
|
||||
|
||||
//! Duplication routine for objects which inherit from ThermoPhase.
|
||||
/*!
|
||||
* This virtual routine can be used to duplicate ThermoPhase objects
|
||||
* inherited from ThermoPhase even if the application only has
|
||||
* a pointer to ThermoPhase to work with.
|
||||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//! @name Utilities
|
||||
//! @{
|
||||
|
||||
//! Equation of state type flag.
|
||||
/*!
|
||||
* The ThermoPhase base class returns zero. Subclasses should define this
|
||||
* to return a unique non-zero value. Known constants defined for this
|
||||
* purpose are listed in mix_defs.h.
|
||||
*/
|
||||
virtual int eosType() const;
|
||||
|
||||
//! @}
|
||||
//! @name Molar Thermodynamic Properties
|
||||
//! @{
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
|
||||
/// Molar entropy. Units: J/kmol.
|
||||
virtual doublereal entropy_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
virtual doublereal cp_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
virtual doublereal cv_mole() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Activities, Standard States, and Activity Concentrations
|
||||
*
|
||||
* The activity \f$a_k\f$ of a species in solution is
|
||||
* related to the chemical potential by \f[ \mu_k = \mu_k^0(T)
|
||||
* + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is
|
||||
* the chemical potential at unit activity, which depends only
|
||||
* on temperature and pressure.
|
||||
* The activity \f$a_k\f$ of a species in solution is related to the
|
||||
* chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The
|
||||
* quantity \f$\mu_k^0(T,P)\f$ is the chemical potential at unit activity,
|
||||
* which depends only on temperature and pressure.
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! Get the array of non-dimensional molar-based activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* @param ac Output vector of activity coefficients. Length: m_kk.
|
||||
*/
|
||||
virtual void getActivityCoefficients(doublereal* ac) const;
|
||||
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
||||
//! Get the species chemical potentials. Units: J/kmol.
|
||||
/*!
|
||||
* This function returns a vector of chemical potentials of the
|
||||
* species in solution at the current temperature, pressure
|
||||
* and mole fraction of the solution.
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Returns an array of partial molar enthalpies for the species
|
||||
//! in the mixture.
|
||||
//! Returns an array of partial molar enthalpies for the species in the
|
||||
//! mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* standard state enthalpies modified by the derivative of the
|
||||
* molality-based activity coefficient wrt temperature
|
||||
* For this phase, the partial molar enthalpies are equal to the standard
|
||||
* state enthalpies modified by the derivative of the molality-based
|
||||
* activity coefficient wrt temperature
|
||||
*
|
||||
* \f[
|
||||
* \f[
|
||||
* \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
* \f]
|
||||
* \f]
|
||||
*
|
||||
* @param hbar Vector of returned partial molar enthalpies
|
||||
* (length m_kk, units = J/kmol)
|
||||
*/
|
||||
virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
|
||||
|
||||
//! Returns an array of partial molar entropies for the species
|
||||
//! in the mixture.
|
||||
//! Returns an array of partial molar entropies for the species in the
|
||||
//! mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* standard state enthalpies modified by the derivative of the
|
||||
* activity coefficient wrt temperature
|
||||
* For this phase, the partial molar enthalpies are equal to the standard
|
||||
* state enthalpies modified by the derivative of the activity coefficient
|
||||
* wrt temperature
|
||||
*
|
||||
* \f[
|
||||
* \f[
|
||||
* \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
* - R \ln( \gamma_k X_k)
|
||||
* - R T \frac{d \ln(\gamma_k) }{dT}
|
||||
* \f]
|
||||
* \f]
|
||||
*
|
||||
* @param sbar Vector of returned partial molar entropies
|
||||
* (length m_kk, units = J/kmol/K)
|
||||
*/
|
||||
virtual void getPartialMolarEntropies(doublereal* sbar) const;
|
||||
|
||||
//! Returns an array of partial molar entropies for the species
|
||||
//! in the mixture.
|
||||
//! Returns an array of partial molar entropies for the species in the
|
||||
//! mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* standard state enthalpies modified by the derivative of the
|
||||
* activity coefficient wrt temperature
|
||||
* For this phase, the partial molar enthalpies are equal to the standard
|
||||
* state enthalpies modified by the derivative of the activity coefficient
|
||||
* wrt temperature
|
||||
*
|
||||
* \f[
|
||||
* ???????????????
|
||||
|
|
@ -499,53 +436,30 @@ public:
|
|||
*/
|
||||
virtual void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
||||
//! Return an array of partial molar volumes for the
|
||||
//! species in the mixture. Units: m^3/kmol.
|
||||
//! Return an array of partial molar volumes for the species in the mixture.
|
||||
//! Units: m^3/kmol.
|
||||
/*!
|
||||
* Frequently, for this class of thermodynamics representations,
|
||||
* the excess Volume due to mixing is zero. Here, we set it as
|
||||
* a default. It may be overridden in derived classes.
|
||||
* Frequently, for this class of thermodynamics representations, the excess
|
||||
* Volume due to mixing is zero. Here, we set it as a default. It may be
|
||||
* overridden in derived classes.
|
||||
*
|
||||
* @param vbar Output vector of species partial molar volumes.
|
||||
* Length = m_kk. units are m^3/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarVolumes(doublereal* vbar) const;
|
||||
|
||||
//! Get the species electrochemical potentials.
|
||||
/*!
|
||||
* These are partial molar quantities.
|
||||
* This method adds a term \f$ Fz_k \phi_k \f$ to the
|
||||
* to each chemical potential.
|
||||
*
|
||||
* Units: J/kmol
|
||||
*
|
||||
* @param mu output vector containing the species electrochemical potentials.
|
||||
* Length: m_kk., units = J/kmol
|
||||
*/
|
||||
void getElectrochemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Get the array of temperature second derivatives of the log activity coefficients
|
||||
//! Get the array of temperature second derivatives of the log activity
|
||||
//! coefficients
|
||||
/*!
|
||||
* This function is a virtual class, but it first appears in GibbsExcessVPSSTP
|
||||
* class and derived classes from GibbsExcessVPSSTP.
|
||||
*
|
||||
* units = 1/Kelvin
|
||||
*
|
||||
* @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of the
|
||||
* log Activity Coefficients. length = m_kk
|
||||
* @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of
|
||||
* the log Activity Coefficients. length = m_kk
|
||||
*/
|
||||
virtual void getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const;
|
||||
|
||||
//! Get the array of temperature derivatives of the log activity coefficients
|
||||
/*!
|
||||
* This function is a virtual class, but it first appears in GibbsExcessVPSSTP
|
||||
* class and derived classes from GibbsExcessVPSSTP.
|
||||
*
|
||||
* units = 1/Kelvin
|
||||
*
|
||||
* @param dlnActCoeffdT Output vector of temperature derivatives of the
|
||||
* log Activity Coefficients. length = m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdT(doublereal* dlnActCoeffdT) const;
|
||||
|
||||
/// @}
|
||||
|
|
@ -556,103 +470,16 @@ public:
|
|||
/// To see how they are used, see importPhase().
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
* @internal Initialize. This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called just prior to returning
|
||||
* from function importPhase().
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
/**
|
||||
* Import and initialize a ThermoPhase object
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a
|
||||
* complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
//! @}
|
||||
//! @name Derivatives of Thermodynamic Variables needed for Applications
|
||||
//! @{
|
||||
|
||||
//! Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along
|
||||
//! a line in parameter space or along a line in physical space
|
||||
/*!
|
||||
* @param dTds Input of temperature change along the path
|
||||
* @param dXds Input vector of changes in mole fraction along the path. length = m_kk
|
||||
* Along the path length it must be the case that the mole fractions sum to one.
|
||||
* @param dlnActCoeffds Output vector of the directional derivatives of the
|
||||
* log Activity Coefficients along the path. length = m_kk
|
||||
* units are 1/units(s). if s is a physical coordinate then the units are 1/m.
|
||||
*/
|
||||
virtual void getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const;
|
||||
|
||||
//! Get the array of log concentration-like derivatives of the
|
||||
//! log activity coefficients - diagonal component
|
||||
/*!
|
||||
* This function is a virtual method. For ideal mixtures
|
||||
* (unity activity coefficients), this can return zero.
|
||||
* Implementations should take the derivative of the
|
||||
* logarithm of the activity coefficient with respect to the
|
||||
* logarithm of the mole fraction.
|
||||
*
|
||||
* units = dimensionless
|
||||
*
|
||||
* @param dlnActCoeffdlnX_diag Output vector of the diagonal component of the log(mole fraction)
|
||||
* derivatives of the log Activity Coefficients.
|
||||
* length = m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const;
|
||||
|
||||
//! Get the array of derivatives of the log activity coefficients wrt mole numbers - diagonal only
|
||||
/*!
|
||||
* This function is a virtual method. For ideal mixtures
|
||||
* (unity activity coefficients), this can return zero.
|
||||
* Implementations should take the derivative of the
|
||||
* logarithm of the activity coefficient with respect to the
|
||||
* logarithm of the concentration-like variable (i.e. mole fraction,
|
||||
* molality, etc.) that represents the standard state.
|
||||
*
|
||||
* units = dimensionless
|
||||
*
|
||||
* @param dlnActCoeffdlnN_diag Output vector of the diagonal entries for the log(mole fraction)
|
||||
* derivatives of the log Activity Coefficients.
|
||||
* length = m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const;
|
||||
|
||||
//! Get the array of derivatives of the log activity coefficients with respect to the ln species mole numbers
|
||||
/*!
|
||||
* Implementations should take the derivative of the logarithm of the activity coefficient with respect to a
|
||||
* log of a species mole number (with all other species mole numbers held constant)
|
||||
*
|
||||
* units = 1 / kmol
|
||||
*
|
||||
* dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log act_coeff for the <I>m</I><SUP>th</SUP>
|
||||
* species with respect to the number of moles of the <I>k</I><SUP>th</SUP> species.
|
||||
*
|
||||
* \f[
|
||||
* \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i}
|
||||
* \f]
|
||||
*
|
||||
* @param ld Number of rows in the matrix
|
||||
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
||||
* log Activity Coefficients. length = m_kk * m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN);
|
||||
|
||||
//@}
|
||||
|
|
@ -660,65 +487,65 @@ public:
|
|||
private:
|
||||
//! Process an XML node called "binaryNeutralSpeciesParameters"
|
||||
/*!
|
||||
* This node contains all of the parameters necessary to describe
|
||||
* the Margules model for a particular binary interaction.
|
||||
* This function reads the XML file and writes the coefficients
|
||||
* it finds to an internal data structures.
|
||||
* This node contains all of the parameters necessary to describe the
|
||||
* Margules model for a particular binary interaction. This function reads
|
||||
* the XML file and writes the coefficients it finds to an internal data
|
||||
* structures.
|
||||
*
|
||||
* @param xmlBinarySpecies Reference to the XML_Node named "binaryNeutralSpeciesParameters"
|
||||
* containing the binary interaction
|
||||
* @param xmlBinarySpecies Reference to the XML_Node named
|
||||
* "binaryNeutralSpeciesParameters" containing the binary interaction
|
||||
*/
|
||||
void readXMLBinarySpecies(XML_Node& xmlBinarySpecies);
|
||||
|
||||
//! Resize internal arrays within the object that depend upon the number
|
||||
//! of binary Margules interaction terms
|
||||
//! Resize internal arrays within the object that depend upon the number of
|
||||
//! binary Margules interaction terms
|
||||
/*!
|
||||
* @param num Number of binary Margules interaction terms
|
||||
*/
|
||||
void resizeNumInteractions(const size_t num);
|
||||
|
||||
//! Initialize lengths of local variables after all species have
|
||||
//! been identified.
|
||||
//! Initialize lengths of local variables after all species have been
|
||||
//! identified.
|
||||
void initLengths();
|
||||
|
||||
//! Update the activity coefficients
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* natural logarithm of the activity coefficients
|
||||
* This function will be called to update the internally stored natural
|
||||
* logarithm of the activity coefficients
|
||||
*/
|
||||
void s_update_lnActCoeff() const;
|
||||
|
||||
//! Update the derivative of the log of the activity coefficients wrt T
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* derivative of the natural logarithm of the activity coefficients
|
||||
* wrt temperature.
|
||||
* This function will be called to update the internally stored derivative
|
||||
* of the natural logarithm of the activity coefficients wrt temperature.
|
||||
*/
|
||||
void s_update_dlnActCoeff_dT() const;
|
||||
|
||||
//! Update the derivative of the log of the activity coefficients
|
||||
//! wrt log(mole fraction)
|
||||
//! Update the derivative of the log of the activity coefficients wrt
|
||||
//! log(mole fraction)
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* derivative of the natural logarithm of the activity coefficients
|
||||
* wrt logarithm of the mole fractions.
|
||||
* This function will be called to update the internally stored derivative
|
||||
* of the natural logarithm of the activity coefficients wrt logarithm of
|
||||
* the mole fractions.
|
||||
*/
|
||||
void s_update_dlnActCoeff_dlnX_diag() const;
|
||||
|
||||
//! Update the derivative of the log of the activity coefficients
|
||||
//! wrt log(moles) - diagonal only
|
||||
//! Update the derivative of the log of the activity coefficients wrt
|
||||
//! log(moles) - diagonal only
|
||||
/*!
|
||||
* This function will be called to update the internally stored diagonal entries for the
|
||||
* derivative of the natural logarithm of the activity coefficients
|
||||
* wrt logarithm of the moles.
|
||||
* This function will be called to update the internally stored diagonal
|
||||
* entries for the derivative of the natural logarithm of the activity
|
||||
* coefficients wrt logarithm of the moles.
|
||||
*/
|
||||
void s_update_dlnActCoeff_dlnN_diag() const;
|
||||
|
||||
//! Update the derivative of the log of the activity coefficients wrt log(moles_m)
|
||||
//! Update the derivative of the log of the activity coefficients wrt
|
||||
//! log(moles_m)
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* derivative of the natural logarithm of the activity coefficients
|
||||
* wrt logarithm of the mole number of species
|
||||
* This function will be called to update the internally stored derivative
|
||||
* of the natural logarithm of the activity coefficients wrt logarithm of
|
||||
* the mole number of species
|
||||
*/
|
||||
void s_update_dlnActCoeff_dlnN() const;
|
||||
|
||||
|
|
@ -726,65 +553,65 @@ protected:
|
|||
//! number of binary interaction expressions
|
||||
size_t numBinaryInteractions_;
|
||||
|
||||
//! Enthalpy term for the binary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Enthalpy term for the binary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_HE_b_ij;
|
||||
|
||||
//! Enthalpy term for the ternary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Enthalpy term for the ternary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_HE_c_ij;
|
||||
|
||||
//! Enthalpy term for the quaternary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Enthalpy term for the quaternary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_HE_d_ij;
|
||||
|
||||
//! Entropy term for the binary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Entropy term for the binary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_SE_b_ij;
|
||||
|
||||
//! Entropy term for the ternary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Entropy term for the ternary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_SE_c_ij;
|
||||
|
||||
//! Entropy term for the quaternary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Entropy term for the quaternary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_SE_d_ij;
|
||||
|
||||
//! Enthalpy term for the binary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Enthalpy term for the binary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_VHE_b_ij;
|
||||
|
||||
//! Enthalpy term for the ternary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Enthalpy term for the ternary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_VHE_c_ij;
|
||||
|
||||
//! Enthalpy term for the quaternary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Enthalpy term for the quaternary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_VHE_d_ij;
|
||||
|
||||
//! Entropy term for the binary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Entropy term for the binary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_VSE_b_ij;
|
||||
|
||||
//! Entropy term for the ternary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Entropy term for the ternary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_VSE_c_ij;
|
||||
|
||||
//! Entropy term for the quaternary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Entropy term for the quaternary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable vector_fp m_VSE_d_ij;
|
||||
|
||||
//! vector of species indices representing species A in the interaction
|
||||
/*!
|
||||
* Each Margules excess Gibbs free energy term involves two species, A and B.
|
||||
* This vector identifies species A.
|
||||
* Each Margules excess Gibbs free energy term involves two species, A and
|
||||
* B. This vector identifies species A.
|
||||
*/
|
||||
std::vector<size_t> m_pSpecies_A_ij;
|
||||
|
||||
//! vector of species indices representing species B in the interaction
|
||||
/*!
|
||||
* Each Margules excess Gibbs free energy term involves two species, A and B.
|
||||
* This vector identifies species B.
|
||||
* Each Margules excess Gibbs free energy term involves two species, A and
|
||||
* B. This vector identifies species B.
|
||||
*/
|
||||
std::vector<size_t> m_pSpecies_B_ij;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,12 +19,11 @@
|
|||
|
||||
namespace Cantera
|
||||
{
|
||||
//! This phase object consists of a single component that can be a
|
||||
//! gas, a liquid, a mixed gas-liquid fluid, or a fluid beyond its
|
||||
//! critical point
|
||||
//! This phase object consists of a single component that can be a gas, a
|
||||
//! liquid, a mixed gas-liquid fluid, or a fluid beyond its critical point
|
||||
/*!
|
||||
* The object inherits from ThermoPhase. However, it's built on top
|
||||
* of the tpx package.
|
||||
* The object inherits from ThermoPhase. However, it's built on top of the tpx
|
||||
* package.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
|
|
@ -34,26 +33,8 @@ public:
|
|||
//! Empty Base Constructor
|
||||
PureFluidPhase();
|
||||
|
||||
//! Copy Constructor
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
PureFluidPhase(const PureFluidPhase& right);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
PureFluidPhase& operator=(const PureFluidPhase& right);
|
||||
|
||||
//! Duplication function
|
||||
/*!
|
||||
* This virtual function is used to create a duplicate of the
|
||||
* current phase. It's used to duplicate the phase when given
|
||||
* a ThermoPhase pointer to the phase.
|
||||
*
|
||||
* @return It returns a ThermoPhase pointer.
|
||||
*/
|
||||
ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//! Equation of state type
|
||||
|
|
@ -61,22 +42,11 @@ public:
|
|||
return cPureFluid;
|
||||
}
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
|
||||
/// Molar internal energy. Units: J/kmol.
|
||||
virtual doublereal intEnergy_mole() const;
|
||||
|
||||
/// Molar entropy. Units: J/kmol/K.
|
||||
virtual doublereal entropy_mole() const;
|
||||
|
||||
/// Molar Gibbs function. Units: J/kmol.
|
||||
virtual doublereal gibbs_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
virtual doublereal cp_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
virtual doublereal cv_mole() const;
|
||||
|
||||
//! Return the thermodynamic pressure (Pa).
|
||||
|
|
@ -95,130 +65,22 @@ public:
|
|||
*/
|
||||
virtual void setPressure(doublereal p);
|
||||
|
||||
//! Get the species chemical potentials. Units: J/kmol.
|
||||
/*!
|
||||
* This function returns a vector of chemical potentials of the
|
||||
* species in solution at the current temperature, pressure
|
||||
* and mole fraction of the solution.
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const {
|
||||
mu[0] = gibbs_mole();
|
||||
}
|
||||
|
||||
//! Returns an array of partial molar enthalpies for the species
|
||||
//! in the mixture. Units (J/kmol)
|
||||
/*!
|
||||
* @param hbar Output vector of species partial molar enthalpies.
|
||||
* Length: m_kk. units are J/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
|
||||
|
||||
//! Returns an array of partial molar entropies of the species in the
|
||||
//! solution. Units: J/kmol/K.
|
||||
/*!
|
||||
* @param sbar Output vector of species partial molar entropies.
|
||||
* Length = m_kk. units are J/kmol/K.
|
||||
*/
|
||||
virtual void getPartialMolarEntropies(doublereal* sbar) const;
|
||||
|
||||
//! Return an array of partial molar internal energies for the
|
||||
//! species in the mixture. Units: J/kmol.
|
||||
/*!
|
||||
* @param ubar Output vector of species partial molar internal energies.
|
||||
* Length = m_kk. units are J/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarIntEnergies(doublereal* ubar) const;
|
||||
|
||||
//! Return an array of partial molar heat capacities for the
|
||||
//! species in the mixture. Units: J/kmol/K
|
||||
/*!
|
||||
* @param cpbar Output vector of species partial molar heat
|
||||
* capacities at constant pressure.
|
||||
* Length = m_kk. units are J/kmol/K.
|
||||
*/
|
||||
virtual void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
||||
//! Return an array of partial molar volumes for the
|
||||
//! species in the mixture. Units: m^3/kmol.
|
||||
/*!
|
||||
* @param vbar Output vector of species partial molar volumes.
|
||||
* Length = m_kk. units are m^3/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarVolumes(doublereal* vbar) const;
|
||||
|
||||
//! This method returns an array of generalized concentrations
|
||||
/*!
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
|
||||
* C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration
|
||||
* defined below and \f$ a_k \f$ are activities used in the
|
||||
* thermodynamic functions. These activity (or generalized)
|
||||
* concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions. Note that they may
|
||||
* or may not have units of concentration --- they might be
|
||||
* partial pressures, mole fractions, or surface coverages,
|
||||
* for example.
|
||||
*
|
||||
* @param c Output array of generalized concentrations. The
|
||||
* units depend upon the implementation of the
|
||||
* reaction rate expressions within the phase.
|
||||
*/
|
||||
virtual void getActivityConcentrations(doublereal* c) const;
|
||||
|
||||
//! Return the standard concentration for the kth species
|
||||
/*!
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize
|
||||
* the activity (i.e., generalized) concentration. In many cases, this quantity
|
||||
* will be the same for all species in a phase - for example,
|
||||
* for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this
|
||||
* reason, this method returns a single value, instead of an
|
||||
* array. However, for phases in which the standard
|
||||
* concentration is species-specific (e.g. surface species of
|
||||
* different sizes), this method may be called with an
|
||||
* optional parameter indicating the species.
|
||||
*
|
||||
* @param k Optional parameter indicating the species. The default
|
||||
* is to assume this refers to species 0.
|
||||
* @return
|
||||
* Returns the standard concentration. The units are by definition
|
||||
* dependent on the ThermoPhase and kinetics manager representation.
|
||||
*/
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
//! Get the array of non-dimensional activities at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* Note, for molality based formulations, this returns the
|
||||
* molality based activities.
|
||||
*
|
||||
* We resolve this function at this level by calling
|
||||
* on the activityConcentration function. However,
|
||||
* derived classes may want to override this default
|
||||
* implementation.
|
||||
*
|
||||
* @param a Output vector of activities. Length: m_kk.
|
||||
*/
|
||||
virtual void getActivities(doublereal* a) const;
|
||||
|
||||
//! Returns the isothermal compressibility. Units: 1/Pa.
|
||||
/*!
|
||||
* The isothermal compressibility is defined as
|
||||
* \f[
|
||||
* \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal isothermalCompressibility() const;
|
||||
|
||||
//! Return the volumetric thermal expansion coefficient. Units: 1/K.
|
||||
/*!
|
||||
* The thermal expansion coefficient is defined as
|
||||
* \f[
|
||||
* \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal thermalExpansionCoeff() const;
|
||||
|
||||
//! Returns a reference to the substance object
|
||||
|
|
@ -234,83 +96,23 @@ public:
|
|||
*/
|
||||
//@{
|
||||
|
||||
//! Get the array of chemical potentials at unit activity for the species
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* These are the standard state chemical potentials \f$ \mu^0_k(T,P)
|
||||
* \f$. The values are evaluated at the current
|
||||
* temperature and pressure of the solution
|
||||
*
|
||||
* @param mu Output vector of chemical potentials.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getStandardChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Get the nondimensional Enthalpy functions for the species
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param hrt Output vector of nondimensional standard state enthalpies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEnthalpy_RT(doublereal* hrt) const;
|
||||
|
||||
//! Get the array of nondimensional Entropy functions for the
|
||||
//! standard state species at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param sr Output vector of nondimensional standard state entropies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEntropy_R(doublereal* sr) const;
|
||||
|
||||
//! Get the nondimensional Gibbs functions for the species
|
||||
//! in their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param grt Output vector of nondimensional standard state Gibbs free energies
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT(doublereal* grt) const;
|
||||
|
||||
//@}
|
||||
|
||||
/// @name Thermodynamic Values for the Species Reference States
|
||||
/*!
|
||||
* The species reference state for pure fluids is defined as an ideal gas at the
|
||||
* reference pressure and current temperature of the fluid.
|
||||
* The species reference state for pure fluids is defined as an ideal gas at
|
||||
* the reference pressure and current temperature of the fluid.
|
||||
*/
|
||||
//@{
|
||||
|
||||
//! Returns the vector of nondimensional enthalpies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
/*!
|
||||
* @param hrt Output vector containing the nondimensional reference state enthalpies
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
|
||||
|
||||
//! Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
/*!
|
||||
* @param grt Output vector containing the nondimensional reference state
|
||||
* Gibbs Free energies. Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT_ref(doublereal* grt) const;
|
||||
|
||||
//! Returns the vector of the Gibbs function of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
/*!
|
||||
* units = J/kmol
|
||||
*
|
||||
* @param g Output vector containing the reference state
|
||||
* Gibbs Free energies. Length: m_kk. Units: J/kmol.
|
||||
*/
|
||||
virtual void getGibbs_ref(doublereal* g) const;
|
||||
|
||||
//! Returns the vector of nondimensional entropies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for each species.
|
||||
/*!
|
||||
* @param er Output vector containing the nondimensional reference state
|
||||
* entropies. Length: m_kk.
|
||||
*/
|
||||
virtual void getEntropy_R_ref(doublereal* er) const;
|
||||
|
||||
/**
|
||||
|
|
@ -320,52 +122,15 @@ public:
|
|||
* @{
|
||||
*/
|
||||
|
||||
//! Set the internally stored specific enthalpy (J/kg) and pressure (Pa) of the phase.
|
||||
/*!
|
||||
* @param h Specific enthalpy (J/kg)
|
||||
* @param p Pressure (Pa)
|
||||
* @param tol Optional parameter setting the tolerance of the
|
||||
* calculation.
|
||||
*/
|
||||
virtual void setState_HP(doublereal h, doublereal p,
|
||||
doublereal tol = 1.e-8);
|
||||
|
||||
//! Set the specific internal energy (J/kg) and specific volume (m^3/kg).
|
||||
/*!
|
||||
* This function fixes the internal state of the phase so that
|
||||
* the specific internal energy and specific volume have the value of the input parameters.
|
||||
*
|
||||
* @param u specific internal energy (J/kg)
|
||||
* @param v specific volume (m^3/kg).
|
||||
* @param tol Optional parameter setting the tolerance of the
|
||||
* calculation.
|
||||
*/
|
||||
virtual void setState_UV(doublereal u, doublereal v,
|
||||
doublereal tol = 1.e-8);
|
||||
|
||||
//! Set the specific entropy (J/kg/K) and specific volume (m^3/kg).
|
||||
/*!
|
||||
* This function fixes the internal state of the phase so that
|
||||
* the specific entropy and specific volume have the value of the input parameters.
|
||||
*
|
||||
* @param s specific entropy (J/kg/K)
|
||||
* @param v specific volume (m^3/kg).
|
||||
* @param tol Optional parameter setting the tolerance of the
|
||||
* calculation.
|
||||
*/
|
||||
virtual void setState_SV(doublereal s, doublereal v,
|
||||
doublereal tol = 1.e-8);
|
||||
|
||||
//! Set the specific entropy (J/kg/K) and pressure (Pa).
|
||||
/*!
|
||||
* This function fixes the internal state of the phase so that
|
||||
* the specific entropy and the pressure have the value of the input parameters.
|
||||
*
|
||||
* @param s specific entropy (J/kg/K)
|
||||
* @param p specific pressure (Pa).
|
||||
* @param tol Optional parameter setting the tolerance of the
|
||||
* calculation.
|
||||
*/
|
||||
virtual void setState_SP(doublereal s, doublereal p,
|
||||
doublereal tol = 1.e-8);
|
||||
//@}
|
||||
|
|
@ -373,13 +138,8 @@ public:
|
|||
//! @name Critical State Properties
|
||||
//@{
|
||||
|
||||
//! critical temperature
|
||||
virtual doublereal critTemperature() const;
|
||||
|
||||
//! critical pressure
|
||||
virtual doublereal critPressure() const;
|
||||
|
||||
//! critical density
|
||||
virtual doublereal critDensity() const;
|
||||
|
||||
//@}
|
||||
|
|
@ -387,72 +147,17 @@ public:
|
|||
//! @name Saturation properties.
|
||||
//@{
|
||||
|
||||
//! saturation temperature
|
||||
/*!
|
||||
* @param p Pressure (Pa)
|
||||
*/
|
||||
virtual doublereal satTemperature(doublereal p) const;
|
||||
|
||||
//! Return the saturation pressure given the temperature
|
||||
/*!
|
||||
* @param t Temperature (Kelvin)
|
||||
*/
|
||||
virtual doublereal satPressure(doublereal t);
|
||||
|
||||
//! Return the fraction of vapor at the current conditions
|
||||
virtual doublereal vaporFraction() const;
|
||||
|
||||
//! Set the state to a saturated system at a particular temperature
|
||||
/*!
|
||||
* @param t Temperature (kelvin)
|
||||
* @param x Fraction of vapor
|
||||
*/
|
||||
virtual void setState_Tsat(doublereal t, doublereal x);
|
||||
|
||||
//! Set the state to a saturated system at a particular pressure
|
||||
/*!
|
||||
* @param p Pressure (Pa)
|
||||
* @param x Fraction of vapor
|
||||
*/
|
||||
virtual void setState_Psat(doublereal p, doublereal x);
|
||||
//@}
|
||||
|
||||
//! Initialize the ThermoPhase object after all species have been set up
|
||||
/*!
|
||||
* @internal Initialize.
|
||||
*
|
||||
* This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called from ThermoPhase::initThermoXML(),
|
||||
* which is called from importPhase(),
|
||||
* just prior to returning from function importPhase().
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
//! Set equation of state parameter values from XML entries.
|
||||
/*!
|
||||
* This method is called by function importPhase() when processing a phase
|
||||
* definition in an input file. It should be overloaded in subclasses to set
|
||||
* any parameters that are specific to that particular phase
|
||||
* model. Note, this method is called before the phase is
|
||||
* initialized with elements and/or species.
|
||||
*
|
||||
* @param eosdata An XML_Node object corresponding to
|
||||
* the "thermo" entry for this phase in the input file.
|
||||
*/
|
||||
virtual void setParametersFromXML(const XML_Node& eosdata);
|
||||
|
||||
//! returns a summary of the state of the phase as a string
|
||||
/*!
|
||||
* @param show_thermo If true, extra information is printed out
|
||||
* about the thermodynamic state of the system.
|
||||
* @param threshold Unused in this subclass
|
||||
*/
|
||||
virtual std::string report(bool show_thermo=true,
|
||||
doublereal threshold=1e-14) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
/**
|
||||
* @file RedlichKisterVPSSTP.h
|
||||
* Header for intermediate ThermoPhase object for phases which
|
||||
* employ Gibbs excess free energy based formulations
|
||||
* (see \ref thermoprops
|
||||
* and class \link Cantera::RedlichKisterVPSSTP RedlichKisterVPSSTP\endlink).
|
||||
*
|
||||
* Header file for a derived class of ThermoPhase that handles
|
||||
* variable pressure standard state methods for calculating
|
||||
* thermodynamic properties that are further based upon activities
|
||||
* based on the molality scale. These include most of the methods for
|
||||
* calculating liquid electrolyte thermodynamics.
|
||||
* @file RedlichKisterVPSSTP.h (see \ref thermoprops and class \link
|
||||
* Cantera::RedlichKisterVPSSTP RedlichKisterVPSSTP\endlink).
|
||||
*/
|
||||
/*
|
||||
* Copyright (2006) Sandia Corporation. Under the terms of
|
||||
|
|
@ -25,240 +16,220 @@
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
/**
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
|
||||
//! RedlichKisterVPSSTP is a derived class of GibbsExcessVPSSTP that employs
|
||||
//! the Redlich-Kister approximation for the excess Gibbs free energy
|
||||
//! RedlichKisterVPSSTP is a derived class of GibbsExcessVPSSTP that employs the
|
||||
//! Redlich-Kister approximation for the excess Gibbs free energy
|
||||
/*!
|
||||
* RedlichKisterVPSSTP derives from class GibbsExcessVPSSTP which is derived
|
||||
* from VPStandardStateTP, and overloads the virtual methods defined there with ones that
|
||||
* use expressions appropriate for the Redlich Kister Excess Gibbs free energy approximation.
|
||||
* RedlichKisterVPSSTP derives from class GibbsExcessVPSSTP which is derived
|
||||
* from VPStandardStateTP, and overloads the virtual methods defined there with
|
||||
* ones that use expressions appropriate for the Redlich Kister Excess Gibbs
|
||||
* free energy approximation.
|
||||
*
|
||||
* The independent unknowns are pressure, temperature, and mass fraction.
|
||||
*
|
||||
* Several concepts are introduced. The first concept is there are temporary
|
||||
* variables for holding the species standard state values of Cp, H, S, G, and V at the
|
||||
* last temperature and pressure called. These functions are not recalculated
|
||||
* if a new call is made using the previous temperature and pressure. Currently,
|
||||
* these variables and the calculation method are handled by the VPSSMgr class,
|
||||
* for which VPStandardStateTP owns a pointer to.
|
||||
*
|
||||
* To support the above functionality, pressure and temperature variables,
|
||||
* m_plast_ss and m_tlast_ss, are kept which store the last pressure and temperature
|
||||
* used in the evaluation of standard state properties.
|
||||
*
|
||||
* This class is usually used for nearly incompressible phases. For those phases, it
|
||||
* makes sense to change the equation of state independent variable from
|
||||
* density to pressure. The variable m_Pcurrent contains the current value of the
|
||||
* pressure within the phase.
|
||||
* The independent unknowns are pressure, temperature, and mass fraction.
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Specification of Species Standard State Properties </H2>
|
||||
* <HR>
|
||||
*
|
||||
* All species are defined to have standard states that depend upon both
|
||||
* the temperature and the pressure. The Redlich-Kister approximation assumes
|
||||
* symmetric standard states, where all of the standard state assume
|
||||
* that the species are in pure component states at the temperature
|
||||
* and pressure of the solution. I don't think it prevents, however,
|
||||
* some species from being dilute in the solution.
|
||||
* All species are defined to have standard states that depend upon both the
|
||||
* temperature and the pressure. The Redlich-Kister approximation assumes
|
||||
* symmetric standard states, where all of the standard state assume that the
|
||||
* species are in pure component states at the temperature and pressure of the
|
||||
* solution. I don't think it prevents, however, some species from being dilute
|
||||
* in the solution.
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Specification of Solution Thermodynamic Properties </H2>
|
||||
* <HR>
|
||||
*
|
||||
* The molar excess Gibbs free energy is given by the following formula which is a sum over interactions <I>i</I>.
|
||||
* Each of the interactions are binary interactions involving two of the species in the phase, denoted, <I>Ai</I>
|
||||
* and <I>Bi</I>.
|
||||
* This is the generalization of the Redlich-Kister formulation for a phase that has more than 2 species.
|
||||
* The molar excess Gibbs free energy is given by the following formula which is
|
||||
* a sum over interactions <I>i</I>. Each of the interactions are binary
|
||||
* interactions involving two of the species in the phase, denoted, <I>Ai</I>
|
||||
* and <I>Bi</I>. This is the generalization of the Redlich-Kister formulation
|
||||
* for a phase that has more than 2 species.
|
||||
*
|
||||
* \f[
|
||||
* G^E = \sum_{i} G^E_{i}
|
||||
* \f]
|
||||
* \f[
|
||||
* G^E = \sum_{i} G^E_{i}
|
||||
* \f]
|
||||
*
|
||||
* where
|
||||
* where
|
||||
*
|
||||
* \f[
|
||||
* G^E_{i} = n X_{Ai} X_{Bi} \sum_m \left( A^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* G^E_{i} = n X_{Ai} X_{Bi} \sum_m \left( A^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right)
|
||||
* \f]
|
||||
*
|
||||
* and where we can break down the Gibbs free energy contributions into enthalpy and entropy contributions
|
||||
* and where we can break down the Gibbs free energy contributions into enthalpy and entropy contributions
|
||||
*
|
||||
* \f[
|
||||
* H^E_i = n X_{Ai} X_{Bi} \sum_m \left( H^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* H^E_i = n X_{Ai} X_{Bi} \sum_m \left( H^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right)
|
||||
* \f]
|
||||
*
|
||||
* \f[
|
||||
* S^E_i = n X_{Ai} X_{Bi} \sum_m \left( S^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right)
|
||||
* \f]
|
||||
* \f[
|
||||
* S^E_i = n X_{Ai} X_{Bi} \sum_m \left( S^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right)
|
||||
* \f]
|
||||
*
|
||||
* where n is the total moles in the solution.
|
||||
* where n is the total moles in the solution. The activity of a species defined
|
||||
* in the phase is given by an excess Gibbs free energy formulation.
|
||||
*
|
||||
* The activity of a species defined in the phase is given by an excess Gibbs free energy formulation.
|
||||
* \f[
|
||||
* a_k = \gamma_k X_k
|
||||
* \f]
|
||||
*
|
||||
* \f[
|
||||
* a_k = \gamma_k X_k
|
||||
* \f]
|
||||
* where
|
||||
*
|
||||
* where
|
||||
* \f[
|
||||
* R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i}
|
||||
* \f]
|
||||
*
|
||||
* \f[
|
||||
* R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i}
|
||||
* \f]
|
||||
* Taking the derivatives results in the following expression
|
||||
* \f[
|
||||
* R T \ln( \gamma_k )= \sum_i \delta_{Ai,k} (1 - X_{Ai}) X_{Bi} \sum_m \left( A^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right)
|
||||
* + \sum_i \delta_{Ai,k} X_{Ai} X_{Bi} \sum_m \left( A^{i}_0 + A^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^{m-1} (1 - X_{Ai} + X_{Bi}) \right)
|
||||
* \f]
|
||||
*
|
||||
* Taking the derivatives results in the following expression
|
||||
* \f[
|
||||
* R T \ln( \gamma_k )= \sum_i \delta_{Ai,k} (1 - X_{Ai}) X_{Bi} \sum_m \left( A^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right)
|
||||
* + \sum_i \delta_{Ai,k} X_{Ai} X_{Bi} \sum_m \left( A^{i}_0 + A^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^{m-1} (1 - X_{Ai} + X_{Bi}) \right)
|
||||
* \f]
|
||||
* This object inherits from the class VPStandardStateTP. Therefore, the
|
||||
* specification and calculation of all standard state and reference state
|
||||
* values are handled at that level. Various functional forms for the standard
|
||||
* state are permissible. The chemical potential for species <I>k</I> is equal
|
||||
* to
|
||||
*
|
||||
* This object inherits from the class VPStandardStateTP. Therefore, the specification and
|
||||
* calculation of all standard state and reference state values are handled at that level. Various functional
|
||||
* forms for the standard state are permissible.
|
||||
* The chemical potential for species <I>k</I> is equal to
|
||||
* \f[
|
||||
* \mu_k(T,P) = \mu^o_k(T, P) + R T \ln(\gamma_k X_k)
|
||||
* \f]
|
||||
*
|
||||
* \f[
|
||||
* \mu_k(T,P) = \mu^o_k(T, P) + R T \ln(\gamma_k X_k)
|
||||
* \f]
|
||||
* The partial molar entropy for species <I>k</I> is given by the following
|
||||
* relation,
|
||||
*
|
||||
* The partial molar entropy for species <I>k</I> is given by the following relation,
|
||||
*
|
||||
* \f[
|
||||
* \tilde{s}_k(T,P) = s^o_k(T,P) - R \ln( \gamma_k X_k )
|
||||
* - R T \frac{d \ln(\gamma_k) }{dT}
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{s}_k(T,P) = s^o_k(T,P) - R \ln( \gamma_k X_k )
|
||||
* - R T \frac{d \ln(\gamma_k) }{dT}
|
||||
* \f]
|
||||
*
|
||||
* The partial molar enthalpy for species <I>k</I> is given by
|
||||
*
|
||||
* \f[
|
||||
* \tilde{h}_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{h}_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
* \f]
|
||||
*
|
||||
* The partial molar volume for species <I>k</I> is
|
||||
*
|
||||
* \f[
|
||||
* \tilde V_k(T,P) = V^o_k(T,P) + R T \frac{d \ln(\gamma_k) }{dP}
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde V_k(T,P) = V^o_k(T,P) + R T \frac{d \ln(\gamma_k) }{dP}
|
||||
* \f]
|
||||
*
|
||||
* The partial molar Heat Capacity for species <I>k</I> is
|
||||
*
|
||||
* \f[
|
||||
* \tilde{C}_{p,k}(T,P) = C^o_{p,k}(T,P) - 2 R T \frac{d \ln( \gamma_k )}{dT}
|
||||
* - R T^2 \frac{d^2 \ln(\gamma_k) }{{dT}^2}
|
||||
* \f]
|
||||
* \f[
|
||||
* \tilde{C}_{p,k}(T,P) = C^o_{p,k}(T,P) - 2 R T \frac{d \ln( \gamma_k )}{dT}
|
||||
* - R T^2 \frac{d^2 \ln(\gamma_k) }{{dT}^2}
|
||||
* \f]
|
||||
*
|
||||
* <HR>
|
||||
* <H2> %Application within Kinetics Managers </H2>
|
||||
* <HR>
|
||||
*
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
|
||||
* C^s_k, \f$ where \f$ C^s_k \f$ is a standard concentration
|
||||
* defined below and \f$ a_k \f$ are activities used in the
|
||||
* thermodynamic functions. These activity (or generalized)
|
||||
* concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions.
|
||||
* The activity concentration,\f$ C^a_k \f$,is given by the following expression.
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / C^s_k, \f$ where
|
||||
* \f$ C^s_k \f$ is a standard concentration defined below and \f$ a_k \f$ are
|
||||
* activities used in the thermodynamic functions. These activity (or
|
||||
* generalized) concentrations are used by kinetics manager classes to compute
|
||||
* the forward and reverse rates of elementary reactions. The activity
|
||||
* concentration,\f$ C^a_k \f$,is given by the following expression.
|
||||
*
|
||||
* \f[
|
||||
* C^a_k = C^s_k X_k = \frac{P}{R T} X_k
|
||||
* \f]
|
||||
* \f[
|
||||
* C^a_k = C^s_k X_k = \frac{P}{R T} X_k
|
||||
* \f]
|
||||
*
|
||||
* The standard concentration for species <I>k</I> is independent of <I>k</I> and equal to
|
||||
* The standard concentration for species <I>k</I> is independent of <I>k</I>
|
||||
* and equal to
|
||||
*
|
||||
* \f[
|
||||
* C^s_k = C^s = \frac{P}{R T}
|
||||
* \f]
|
||||
* \f[
|
||||
* C^s_k = C^s = \frac{P}{R T}
|
||||
* \f]
|
||||
*
|
||||
* For example, a bulk-phase binary gas reaction between species j and k, producing
|
||||
* a new gas species l would have the
|
||||
* following equation for its rate of progress variable, \f$ R^1 \f$, which has
|
||||
* units of kmol m-3 s-1.
|
||||
* For example, a bulk-phase binary gas reaction between species j and k,
|
||||
* producing a new gas species l would have the following equation for its rate
|
||||
* of progress variable, \f$ R^1 \f$, which has units of kmol m-3 s-1.
|
||||
*
|
||||
* \f[
|
||||
* \f[
|
||||
* R^1 = k^1 C_j^a C_k^a = k^1 (C^s a_j) (C^s a_k)
|
||||
* \f]
|
||||
* where
|
||||
* \f[
|
||||
* C_j^a = C^s a_j \mbox{\quad and \quad} C_k^a = C^s a_k
|
||||
* \f]
|
||||
* \f]
|
||||
* where
|
||||
* \f[
|
||||
* C_j^a = C^s a_j \mbox{\quad and \quad} C_k^a = C^s a_k
|
||||
* \f]
|
||||
*
|
||||
* \f$ C_j^a \f$ is the activity concentration of species j, and
|
||||
* \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^s \f$
|
||||
* is the standard concentration. \f$ a_j \f$ is
|
||||
* the activity of species j which is equal to the mole fraction of j.
|
||||
* \f$ C_j^a \f$ is the activity concentration of species j, and \f$ C_k^a \f$
|
||||
* is the activity concentration of species k. \f$ C^s \f$ is the standard
|
||||
* concentration. \f$ a_j \f$ is the activity of species j which is equal to the
|
||||
* mole fraction of j.
|
||||
*
|
||||
* The reverse rate constant can then be obtained from the law of microscopic reversibility
|
||||
* and the equilibrium expression for the system.
|
||||
* The reverse rate constant can then be obtained from the law of microscopic
|
||||
* reversibility and the equilibrium expression for the system.
|
||||
*
|
||||
* \f[
|
||||
* \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
|
||||
* \f]
|
||||
* \f[
|
||||
* \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
|
||||
* \f]
|
||||
*
|
||||
* \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, associated with
|
||||
* the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ and their associated activities,
|
||||
* \f$ a_l \f$, repeated here:
|
||||
* \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant,
|
||||
* associated with the pressure dependent standard states \f$ \mu^o_l(T,P) \f$
|
||||
* and their associated activities, \f$ a_l \f$, repeated here:
|
||||
*
|
||||
* \f[
|
||||
* \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l)
|
||||
* \f]
|
||||
* \f[
|
||||
* \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l)
|
||||
* \f]
|
||||
*
|
||||
* We can switch over to expressing the equilibrium constant in terms of the reference
|
||||
* state chemical potentials
|
||||
* We can switch over to expressing the equilibrium constant in terms of the
|
||||
* reference state chemical potentials
|
||||
*
|
||||
* \f[
|
||||
* K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P}
|
||||
* \f]
|
||||
* \f[
|
||||
* K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P}
|
||||
* \f]
|
||||
*
|
||||
* The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over
|
||||
* to activity concentrations. When this is done:
|
||||
* The concentration equilibrium constant, \f$ K_c \f$, may be obtained by
|
||||
* changing over to activity concentrations. When this is done:
|
||||
*
|
||||
* \f[
|
||||
* \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 =
|
||||
* \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT}
|
||||
* \f]
|
||||
* \f[
|
||||
* \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 =
|
||||
* \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT}
|
||||
* \f]
|
||||
*
|
||||
* %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$,
|
||||
* using the second and third part of the above expression as a definition for the concentration
|
||||
* equilibrium constant.
|
||||
* %Kinetics managers will calculate the concentration equilibrium constant, \f$
|
||||
* K_c \f$, using the second and third part of the above expression as a
|
||||
* definition for the concentration equilibrium constant.
|
||||
*
|
||||
* For completeness, the pressure equilibrium constant may be obtained as well
|
||||
* For completeness, the pressure equilibrium constant may be obtained as well
|
||||
*
|
||||
* \f[
|
||||
* \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} )
|
||||
* \f]
|
||||
* \f[
|
||||
* \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} )
|
||||
* \f]
|
||||
*
|
||||
* \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. However, it isn't
|
||||
* necessarily the simplest form of the equilibrium constant for other types of phases; \f$ K_c \f$ is
|
||||
* used instead because it is completely general.
|
||||
* \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases.
|
||||
* However, it isn't necessarily the simplest form of the equilibrium constant
|
||||
* for other types of phases; \f$ K_c \f$ is used instead because it is
|
||||
* completely general.
|
||||
*
|
||||
* The reverse rate of progress may be written down as
|
||||
* \f[
|
||||
* The reverse rate of progress may be written down as
|
||||
* \f[
|
||||
* R^{-1} = k^{-1} C_l^a = k^{-1} (C^o a_l)
|
||||
* \f]
|
||||
* \f]
|
||||
*
|
||||
* where we can use the concept of microscopic reversibility to
|
||||
* write the reverse rate constant in terms of the
|
||||
* forward reate constant and the concentration equilibrium
|
||||
* constant, \f$ K_c \f$.
|
||||
* where we can use the concept of microscopic reversibility to write the
|
||||
* reverse rate constant in terms of the forward reate constant and the
|
||||
* concentration equilibrium constant, \f$ K_c \f$.
|
||||
*
|
||||
* \f[
|
||||
* k^{-1} = k^1 K^1_c
|
||||
* \f]
|
||||
* \f[
|
||||
* k^{-1} = k^1 K^1_c
|
||||
* \f]
|
||||
*
|
||||
* \f$k^{-1} \f$ has units of s-1.
|
||||
* \f$k^{-1} \f$ has units of s-1.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
class RedlichKisterVPSSTP : public GibbsExcessVPSSTP
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
/*!
|
||||
* This doesn't do much more than initialize constants with
|
||||
* default values.
|
||||
* This doesn't do much more than initialize constants with default values.
|
||||
*/
|
||||
RedlichKisterVPSSTP();
|
||||
|
||||
|
|
@ -281,39 +252,16 @@ public:
|
|||
*/
|
||||
RedlichKisterVPSSTP(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* @param b class to be copied
|
||||
*/
|
||||
RedlichKisterVPSSTP(const RedlichKisterVPSSTP& b);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* @param b class to be copied.
|
||||
*/
|
||||
RedlichKisterVPSSTP& operator=(const RedlichKisterVPSSTP& b);
|
||||
|
||||
//! Duplication routine for objects which inherit from ThermoPhase.
|
||||
/*!
|
||||
* This virtual routine can be used to duplicate ThermoPhase objects
|
||||
* inherited from ThermoPhase even if the application only has
|
||||
* a pointer to ThermoPhase to work with.
|
||||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//! @name Molar Thermodynamic Properties
|
||||
//! @{
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
|
||||
/// Molar entropy. Units: J/kmol.
|
||||
virtual doublereal entropy_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
virtual doublereal cp_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
virtual doublereal cv_mole() const;
|
||||
|
||||
/**
|
||||
|
|
@ -328,36 +276,22 @@ public:
|
|||
* @{
|
||||
*/
|
||||
|
||||
//! Get the array of non-dimensional molar-based ln activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* @param lnac Output vector of ln activity coefficients. Length: m_kk.
|
||||
*/
|
||||
virtual void getLnActivityCoefficients(doublereal* lnac) const;
|
||||
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
||||
//! Get the species chemical potentials. Units: J/kmol.
|
||||
/*!
|
||||
* This function returns a vector of chemical potentials of the
|
||||
* species in solution at the current temperature, pressure
|
||||
* and mole fraction of the solution.
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Returns an array of partial molar enthalpies for the species
|
||||
//! in the mixture.
|
||||
//! Returns an array of partial molar enthalpies for the species in the
|
||||
//! mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* standard state enthalpies modified by the derivative of the
|
||||
* molality-based activity coefficient wrt temperature
|
||||
* For this phase, the partial molar enthalpies are equal to the standard
|
||||
* state enthalpies modified by the derivative of the molality-based
|
||||
* activity coefficient wrt temperature
|
||||
*
|
||||
* \f[
|
||||
* \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
|
|
@ -368,14 +302,14 @@ public:
|
|||
*/
|
||||
virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
|
||||
|
||||
//! Returns an array of partial molar entropies for the species
|
||||
//! in the mixture.
|
||||
//! Returns an array of partial molar entropies for the species in the
|
||||
//! mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* standard state enthalpies modified by the derivative of the
|
||||
* activity coefficient wrt temperature
|
||||
* For this phase, the partial molar enthalpies are equal to the standard
|
||||
* state enthalpies modified by the derivative of the activity coefficient
|
||||
* wrt temperature
|
||||
*
|
||||
* \f[
|
||||
* \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
|
||||
|
|
@ -388,14 +322,14 @@ public:
|
|||
*/
|
||||
virtual void getPartialMolarEntropies(doublereal* sbar) const;
|
||||
|
||||
//! Returns an array of partial molar entropies for the species
|
||||
//! in the mixture.
|
||||
//! Returns an array of partial molar entropies for the species in the
|
||||
//! mixture.
|
||||
/*!
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* For this phase, the partial molar enthalpies are equal to the
|
||||
* standard state enthalpies modified by the derivative of the
|
||||
* activity coefficient wrt temperature
|
||||
* For this phase, the partial molar enthalpies are equal to the standard
|
||||
* state enthalpies modified by the derivative of the activity coefficient
|
||||
* wrt temperature
|
||||
*
|
||||
* \f[
|
||||
* ???????????????
|
||||
|
|
@ -410,53 +344,20 @@ public:
|
|||
*/
|
||||
virtual void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
||||
//! Return an array of partial molar volumes for the
|
||||
//! species in the mixture. Units: m^3/kmol.
|
||||
/*!
|
||||
* Frequently, for this class of thermodynamics representations,
|
||||
* the excess Volume due to mixing is zero. Here, we set it as
|
||||
* a default. It may be overridden in derived classes.
|
||||
*
|
||||
* @param vbar Output vector of species partial molar volumes.
|
||||
* Length = m_kk. units are m^3/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarVolumes(doublereal* vbar) const;
|
||||
|
||||
//! Get the species electrochemical potentials.
|
||||
/*!
|
||||
* These are partial molar quantities.
|
||||
* This method adds a term \f$ Fz_k \phi_k \f$ to the
|
||||
* to each chemical potential.
|
||||
*
|
||||
* Units: J/kmol
|
||||
*
|
||||
* @param mu output vector containing the species electrochemical potentials.
|
||||
* Length: m_kk., units = J/kmol
|
||||
*/
|
||||
void getElectrochemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Get the array of temperature second derivatives of the log activity coefficients
|
||||
//! Get the array of temperature second derivatives of the log activity
|
||||
//! coefficients
|
||||
/*!
|
||||
* This function is a virtual class, but it first appears in GibbsExcessVPSSTP
|
||||
* class and derived classes from GibbsExcessVPSSTP.
|
||||
*
|
||||
* units = 1/Kelvin
|
||||
*
|
||||
* @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of the
|
||||
* log Activity Coefficients. length = m_kk
|
||||
* @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of
|
||||
* the log Activity Coefficients. length = m_kk
|
||||
*/
|
||||
virtual void getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const;
|
||||
|
||||
//! Get the array of temperature derivatives of the log activity coefficients
|
||||
/*!
|
||||
* This function is a virtual class, but it first appears in GibbsExcessVPSSTP
|
||||
* class and derived classes from GibbsExcessVPSSTP.
|
||||
*
|
||||
* units = 1/Kelvin
|
||||
*
|
||||
* @param dlnActCoeffdT Output vector of temperature derivatives of the
|
||||
* log Activity Coefficients. length = m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdT(doublereal* dlnActCoeffdT) const;
|
||||
|
||||
/// @}
|
||||
|
|
@ -466,103 +367,16 @@ public:
|
|||
/// input file. They are not normally used in application programs.
|
||||
/// To see how they are used, see importPhase().
|
||||
|
||||
/*!
|
||||
* @internal Initialize. This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called just prior to returning
|
||||
* from function importPhase().
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
/**
|
||||
* Import and initialize a ThermoPhase object
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a
|
||||
* complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
//! @}
|
||||
//! @name Derivatives of Thermodynamic Variables needed for Applications
|
||||
//! @{
|
||||
|
||||
//! Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along
|
||||
//! a line in parameter space or along a line in physical space
|
||||
/*!
|
||||
* @param dTds Input of temperature change along the path
|
||||
* @param dXds Input vector of changes in mole fraction along the path. length = m_kk
|
||||
* Along the path length it must be the case that the mole fractions sum to one.
|
||||
* @param dlnActCoeffds Output vector of the directional derivatives of the
|
||||
* log Activity Coefficients along the path. length = m_kk
|
||||
* units are 1/units(s). if s is a physical coordinate then the units are 1/m.
|
||||
*/
|
||||
virtual void getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const;
|
||||
|
||||
//! Get the array of log concentration-like derivatives of the
|
||||
//! log activity coefficients - diagonal component
|
||||
/*!
|
||||
* This function is a virtual method. For ideal mixtures
|
||||
* (unity activity coefficients), this can return zero.
|
||||
* Implementations should take the derivative of the
|
||||
* logarithm of the activity coefficient with respect to the
|
||||
* logarithm of the mole fraction.
|
||||
*
|
||||
* units = dimensionless
|
||||
*
|
||||
* @param dlnActCoeffdlnX_diag Output vector of the diagonal component of the log(mole fraction)
|
||||
* derivatives of the log Activity Coefficients.
|
||||
* length = m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const;
|
||||
|
||||
//! Get the array of derivatives of the log activity coefficients wrt mole numbers - diagonal only
|
||||
/*!
|
||||
* This function is a virtual method. For ideal mixtures
|
||||
* (unity activity coefficients), this can return zero.
|
||||
* Implementations should take the derivative of the
|
||||
* logarithm of the activity coefficient with respect to the
|
||||
* logarithm of the concentration-like variable (i.e. mole fraction,
|
||||
* molality, etc.) that represents the standard state.
|
||||
*
|
||||
* units = dimensionless
|
||||
*
|
||||
* @param dlnActCoeffdlnN_diag Output vector of the diagonal entries for the log(mole fraction)
|
||||
* derivatives of the log Activity Coefficients.
|
||||
* length = m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const;
|
||||
|
||||
//! Get the array of derivatives of the ln activity coefficients with respect to the ln species mole numbers
|
||||
/*!
|
||||
* Implementations should take the derivative of the logarithm of the activity coefficient with respect to a
|
||||
* log of a species mole number (with all other species mole numbers held constant)
|
||||
*
|
||||
* units = 1 / kmol
|
||||
*
|
||||
* dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log act_coeff for the <I>m</I><SUP>th</SUP>
|
||||
* species with respect to the number of moles of the <I>k</I><SUP>th</SUP> species.
|
||||
*
|
||||
* \f[
|
||||
* \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i}
|
||||
* \f]
|
||||
*
|
||||
* @param ld Number of rows in the matrix
|
||||
* @param dlnActCoeffdlnN Output vector of derivatives of the
|
||||
* log Activity Coefficients. length = m_kk * m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN);
|
||||
|
||||
//@}
|
||||
|
|
@ -570,13 +384,13 @@ public:
|
|||
private:
|
||||
//! Process an XML node called "binaryNeutralSpeciesParameters"
|
||||
/*!
|
||||
* This node contains all of the parameters necessary to describe
|
||||
* the Redlich-Kister model for a particular binary interaction.
|
||||
* This function reads the XML file and writes the coefficients
|
||||
* it finds to an internal data structures.
|
||||
* This node contains all of the parameters necessary to describe the
|
||||
* Redlich-Kister model for a particular binary interaction. This function
|
||||
* reads the XML file and writes the coefficients it finds to an internal
|
||||
* data structures.
|
||||
*
|
||||
* @param xmlBinarySpecies Reference to the XML_Node named "binaryNeutralSpeciesParameters"
|
||||
* containing the binary interaction
|
||||
* @param xmlBinarySpecies Reference to the XML_Node named
|
||||
* "binaryNeutralSpeciesParameters" containing the binary interaction
|
||||
*/
|
||||
void readXMLBinarySpecies(XML_Node& xmlBinarySpecies);
|
||||
|
||||
|
|
@ -587,33 +401,34 @@ private:
|
|||
*/
|
||||
void resizeNumInteractions(const size_t num);
|
||||
|
||||
//! Initialize lengths of local variables after all species have
|
||||
//! been identified.
|
||||
//! Initialize lengths of local variables after all species have been
|
||||
//! identified.
|
||||
void initLengths();
|
||||
|
||||
//! Update the activity coefficients
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* natural logarithm of the activity coefficients
|
||||
* This function will be called to update the internally stored natural
|
||||
* logarithm of the activity coefficients
|
||||
*/
|
||||
void s_update_lnActCoeff() const;
|
||||
|
||||
//! Update the derivative of the log of the activity coefficients wrt T
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
* derivative of the natural logarithm of the activity coefficients
|
||||
* wrt temperature.
|
||||
* This function will be called to update the internally stored derivative
|
||||
* of the natural logarithm of the activity coefficients wrt temperature.
|
||||
*/
|
||||
void s_update_dlnActCoeff_dT() const;
|
||||
|
||||
//! Internal routine that calculates the derivative of the activity coefficients wrt
|
||||
//! the mole fractions.
|
||||
//! Internal routine that calculates the derivative of the activity
|
||||
//! coefficients wrt the mole fractions.
|
||||
/*!
|
||||
* This routine calculates the the derivative of the activity coefficients wrt to mole fraction
|
||||
* with all other mole fractions held constant. This is strictly not permitted. However, if the
|
||||
* resulting matrix is multiplied by a permissible deltaX vector then everything is ok.
|
||||
* This routine calculates the the derivative of the activity coefficients
|
||||
* wrt to mole fraction with all other mole fractions held constant. This is
|
||||
* strictly not permitted. However, if the resulting matrix is multiplied by
|
||||
* a permissible deltaX vector then everything is ok.
|
||||
*
|
||||
* This is the natural way to handle concentration derivatives in this routine.
|
||||
* This is the natural way to handle concentration derivatives in this
|
||||
* routine.
|
||||
*/
|
||||
void s_update_dlnActCoeff_dX_() const;
|
||||
|
||||
|
|
@ -621,8 +436,10 @@ private:
|
|||
public:
|
||||
//! Utility routine that calculates a literature expression
|
||||
/*!
|
||||
* @param VintOut Output contribution to the voltage corresponding to nonideal term
|
||||
* @param voltsOut Output contribution to the voltage corresponding to nonideal term and mf term
|
||||
* @param VintOut Output contribution to the voltage corresponding to
|
||||
* nonideal term
|
||||
* @param voltsOut Output contribution to the voltage corresponding to
|
||||
* nonideal term and mf term
|
||||
*/
|
||||
void Vint(double& VintOut, double& voltsOut);
|
||||
#endif
|
||||
|
|
@ -633,42 +450,40 @@ protected:
|
|||
|
||||
//! vector of species indices representing species A in the interaction
|
||||
/*!
|
||||
* Each Redlich-Kister excess Gibbs free energy term involves two species, A and B.
|
||||
* This vector identifies species A.
|
||||
* Each Redlich-Kister excess Gibbs free energy term involves two species,
|
||||
* A and B. This vector identifies species A.
|
||||
*/
|
||||
std::vector<size_t> m_pSpecies_A_ij;
|
||||
|
||||
//! vector of species indices representing species B in the interaction
|
||||
/*!
|
||||
* Each Redlich-Kister excess Gibbs free energy term involves two species, A and B.
|
||||
* This vector identifies species B.
|
||||
* Each Redlich-Kister excess Gibbs free energy term involves two species,
|
||||
* A and B. This vector identifies species B.
|
||||
*/
|
||||
std::vector<size_t> m_pSpecies_B_ij;
|
||||
|
||||
//! Vector of the length of the polynomial for the interaction.
|
||||
std::vector<size_t> m_N_ij;
|
||||
|
||||
//! Enthalpy term for the binary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Enthalpy term for the binary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable std::vector< vector_fp> m_HE_m_ij;
|
||||
|
||||
//! Entropy term for the binary mole fraction interaction of the
|
||||
//! excess Gibbs free energy expression
|
||||
//! Entropy term for the binary mole fraction interaction of the excess
|
||||
//! Gibbs free energy expression
|
||||
mutable std::vector< vector_fp> m_SE_m_ij;
|
||||
|
||||
//! form of the RedlichKister interaction expression
|
||||
/*!
|
||||
* Currently there is only one form.
|
||||
*/
|
||||
//! form of the RedlichKister interaction expression. Currently there is
|
||||
//! only one form.
|
||||
int formRedlichKister_;
|
||||
|
||||
//! form of the temperature dependence of the Redlich-Kister interaction expression
|
||||
/*!
|
||||
* Currently there is only one form -> constant wrt temperature.
|
||||
*/
|
||||
//! form of the temperature dependence of the Redlich-Kister interaction
|
||||
//! expression. Currently there is only one form -> constant wrt
|
||||
//! temperature.
|
||||
int formTempModel_;
|
||||
|
||||
//! Two dimensional array of derivatives of activity coefficients wrt mole fractions
|
||||
//! Two dimensional array of derivatives of activity coefficients wrt mole
|
||||
//! fractions
|
||||
mutable Array2D dlnActCoeff_dX_;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ public:
|
|||
/*!
|
||||
* @param infile Name of the input file containing the phase XML data
|
||||
* to set up the object
|
||||
* @param id ID of the phase in the input file. Defaults to the empty string.
|
||||
* @param id ID of the phase in the input file. Defaults to the empty
|
||||
* string.
|
||||
*/
|
||||
RedlichKwongMFTP(const std::string& infile, const std::string& id="");
|
||||
|
||||
|
|
@ -48,59 +49,23 @@ public:
|
|||
//! XML database
|
||||
/*!
|
||||
* @param phaseRef XML phase node containing the description of the phase
|
||||
* @param id id attribute containing the name of the phase. (default is the empty string)
|
||||
* @param id id attribute containing the name of the phase. (default
|
||||
* is the empty string)
|
||||
*/
|
||||
RedlichKwongMFTP(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
//! Copy Constructor
|
||||
/*!
|
||||
* Copy constructor for the object. Constructed object will be a clone of this object, but will
|
||||
* also own all of its data. This is a wrapper around the assignment operator
|
||||
*
|
||||
* @param right Object to be copied.
|
||||
*/
|
||||
RedlichKwongMFTP(const RedlichKwongMFTP& right);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* Assignment operator for the object. Constructed object will be a clone of this object, but will
|
||||
* also own all of its data.
|
||||
*
|
||||
* @param right Object to be copied.
|
||||
*/
|
||||
RedlichKwongMFTP& operator=(const RedlichKwongMFTP& right);
|
||||
|
||||
//! Duplicator from the ThermoPhase parent class
|
||||
/*!
|
||||
* Given a pointer to a ThermoPhase object, this function will
|
||||
* duplicate the ThermoPhase object and all underlying structures.
|
||||
* This is basically a wrapper around the copy constructor.
|
||||
*
|
||||
* @return returns a pointer to a ThermoPhase
|
||||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
/**
|
||||
* Equation of state type flag. The base class returns
|
||||
* zero. Subclasses should define this to return a unique
|
||||
* non-zero value. Constants defined for this purpose are
|
||||
* listed in mix_defs.h.
|
||||
*/
|
||||
virtual int eosType() const;
|
||||
|
||||
//! @name Molar Thermodynamic properties
|
||||
//! @{
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
|
||||
/// Molar entropy. Units: J/kmol/K.
|
||||
virtual doublereal entropy_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
virtual doublereal cp_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
virtual doublereal cv_mole() const;
|
||||
|
||||
//! @}
|
||||
|
|
@ -123,8 +88,8 @@ public:
|
|||
|
||||
protected:
|
||||
/**
|
||||
* Calculate the density of the mixture using the partial
|
||||
* molar volumes and mole fractions as input
|
||||
* Calculate the density of the mixture using the partial molar volumes and
|
||||
* mole fractions as input
|
||||
*
|
||||
* The formula for this is
|
||||
*
|
||||
|
|
@ -132,117 +97,49 @@ protected:
|
|||
* \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}}
|
||||
* \f]
|
||||
*
|
||||
* where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are
|
||||
* the molecular weights, and \f$V_k\f$ are the pure species
|
||||
* molar volumes.
|
||||
* where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular
|
||||
* weights, and \f$V_k\f$ are the pure species molar volumes.
|
||||
*
|
||||
* Note, the basis behind this formula is that in an ideal
|
||||
* solution the partial molar volumes are equal to the
|
||||
* species standard state molar volumes.
|
||||
* The species molar volumes may be functions
|
||||
* of temperature and pressure.
|
||||
* Note, the basis behind this formula is that in an ideal solution the
|
||||
* partial molar volumes are equal to the species standard state molar
|
||||
* volumes. The species molar volumes may be functions of temperature and
|
||||
* pressure.
|
||||
*/
|
||||
virtual void calcDensity();
|
||||
|
||||
//! Set the temperature (K)
|
||||
/*!
|
||||
* This function sets the temperature, and makes sure that
|
||||
* the value propagates to underlying objects
|
||||
*
|
||||
* @param temp Temperature in kelvin
|
||||
*/
|
||||
virtual void setTemperature(const doublereal temp);
|
||||
|
||||
//! Set the mass fractions to the specified values, and then
|
||||
//! normalize them so that they sum to 1.0.
|
||||
/*!
|
||||
* @param y Array of unnormalized mass fraction values (input).
|
||||
* Must have a length greater than or equal to the number of species.
|
||||
*/
|
||||
virtual void setMassFractions(const doublereal* const y);
|
||||
|
||||
//!Set the mass fractions to the specified values without normalizing.
|
||||
/*!
|
||||
* This is useful when the normalization
|
||||
* condition is being handled by some other means, for example
|
||||
* by a constraint equation as part of a larger set of
|
||||
* equations.
|
||||
*
|
||||
* @param y Input vector of mass fractions. Length is m_kk.
|
||||
*/
|
||||
virtual void setMassFractions_NoNorm(const doublereal* const y);
|
||||
|
||||
//! Set the mole fractions to the specified values, and then
|
||||
//! normalize them so that they sum to 1.0.
|
||||
/*!
|
||||
* @param x Array of unnormalized mole fraction values (input).
|
||||
* Must have a length greater than or equal to the number of species.
|
||||
*/
|
||||
virtual void setMoleFractions(const doublereal* const x);
|
||||
|
||||
//! Set the mole fractions to the specified values without normalizing.
|
||||
/*!
|
||||
* This is useful when the normalization
|
||||
* condition is being handled by some other means, for example
|
||||
* by a constraint equation as part of a larger set of equations.
|
||||
*
|
||||
* @param x Input vector of mole fractions. Length is m_kk.
|
||||
*/
|
||||
virtual void setMoleFractions_NoNorm(const doublereal* const x);
|
||||
|
||||
//! Set the concentrations to the specified values within the phase.
|
||||
/*!
|
||||
* @param c The input vector to this routine is in dimensional
|
||||
* units. For volumetric phases c[k] is the
|
||||
* concentration of the kth species in kmol/m3.
|
||||
* For surface phases, c[k] is the concentration
|
||||
* in kmol/m2. The length of the vector is the number
|
||||
* of species in the phase.
|
||||
*/
|
||||
virtual void setConcentrations(const doublereal* const c);
|
||||
|
||||
public:
|
||||
//! This method returns an array of generalized concentrations
|
||||
/*!
|
||||
* \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
|
||||
* C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration
|
||||
* defined below and \f$ a_k \f$ are activities used in the
|
||||
* thermodynamic functions. These activity (or generalized)
|
||||
* concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions. Note that they may
|
||||
* or may not have units of concentration --- they might be
|
||||
* partial pressures, mole fractions, or surface coverages,
|
||||
* for example.
|
||||
*
|
||||
* @param c Output array of generalized concentrations. The
|
||||
* units depend upon the implementation of the
|
||||
* reaction rate expressions within the phase.
|
||||
*/
|
||||
virtual void getActivityConcentrations(doublereal* c) const;
|
||||
|
||||
//! Returns the standard concentration \f$ C^0_k \f$, which is used to normalize
|
||||
//! the generalized concentration.
|
||||
//! Returns the standard concentration \f$ C^0_k \f$, which is used to
|
||||
//! normalize the generalized concentration.
|
||||
/*!
|
||||
* This is defined as the concentration by which the generalized
|
||||
* concentration is normalized to produce the activity.
|
||||
* In many cases, this quantity will be the same for all species in a phase.
|
||||
* Since the activity for an ideal gas mixture is
|
||||
* simply the mole fraction, for an ideal gas \f$ C^0_k = P/\hat R T \f$.
|
||||
* concentration is normalized to produce the activity. In many cases, this
|
||||
* quantity will be the same for all species in a phase. Since the activity
|
||||
* for an ideal gas mixture is simply the mole fraction, for an ideal gas
|
||||
* \f$ C^0_k = P/\hat R T \f$.
|
||||
*
|
||||
* @param k Optional parameter indicating the species. The default
|
||||
* is to assume this refers to species 0.
|
||||
* @param k Optional parameter indicating the species. The default is to
|
||||
* assume this refers to species 0.
|
||||
* @return
|
||||
* Returns the standard Concentration in units of m3 kmol-1.
|
||||
*/
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
//! Get the array of non-dimensional activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
//! Get the array of non-dimensional activity coefficients at the current
|
||||
//! solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* For all objects with the Mixture Fugacity approximation, we define the
|
||||
* standard state as an ideal gas at the current temperature and pressure
|
||||
* of the solution. The activities are based on this standard state.
|
||||
* standard state as an ideal gas at the current temperature and pressure of
|
||||
* the solution. The activities are based on this standard state.
|
||||
*
|
||||
* @param ac Output vector of activity coefficients. Length: m_kk.
|
||||
*/
|
||||
|
|
@ -257,79 +154,29 @@ public:
|
|||
* \f$ \mu_k / \hat R T \f$.
|
||||
* Units: unitless
|
||||
*
|
||||
* We close the loop on this function, here, calling
|
||||
* getChemPotentials() and then dividing by RT. No need for child
|
||||
* classes to handle.
|
||||
* We close the loop on this function, here, calling getChemPotentials() and
|
||||
* then dividing by RT. No need for child classes to handle.
|
||||
*
|
||||
* @param mu Output vector of non-dimensional species chemical potentials
|
||||
* Length: m_kk.
|
||||
*/
|
||||
void getChemPotentials_RT(doublereal* mu) const;
|
||||
|
||||
//! Get the species chemical potentials. Units: J/kmol.
|
||||
/*!
|
||||
* This function returns a vector of chemical potentials of the
|
||||
* species in solution at the current temperature, pressure
|
||||
* and mole fraction of the solution.
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Get the species partial molar enthalpies. Units: J/kmol.
|
||||
/*!
|
||||
* @param hbar Output vector of species partial molar enthalpies.
|
||||
* Length: m_kk. units are J/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
|
||||
|
||||
//! Get the species partial molar entropies. Units: J/kmol/K.
|
||||
/*!
|
||||
* @param sbar Output vector of species partial molar entropies.
|
||||
* Length = m_kk. units are J/kmol/K.
|
||||
*/
|
||||
virtual void getPartialMolarEntropies(doublereal* sbar) const;
|
||||
|
||||
//! Get the species partial molar enthalpies. Units: J/kmol.
|
||||
/*!
|
||||
* @param ubar Output vector of species partial molar internal energies.
|
||||
* Length = m_kk. units are J/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarIntEnergies(doublereal* ubar) const;
|
||||
|
||||
//! Get the partial molar heat capacities Units: J/kmol/K
|
||||
/*!
|
||||
* @param cpbar Output vector of species partial molar heat capacities
|
||||
* at constant pressure.
|
||||
* Length = m_kk. units are J/kmol/K.
|
||||
*/
|
||||
virtual void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
||||
//! Get the species partial molar volumes. Units: m^3/kmol.
|
||||
/*!
|
||||
* @param vbar Output vector of species partial molar volumes.
|
||||
* Length = m_kk. units are m^3/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarVolumes(doublereal* vbar) const;
|
||||
|
||||
//@}
|
||||
/// @name Critical State Properties.
|
||||
//@{
|
||||
|
||||
/// Critical temperature (K).
|
||||
virtual doublereal critTemperature() const;
|
||||
|
||||
/// Critical pressure (Pa).
|
||||
virtual doublereal critPressure() const;
|
||||
|
||||
/// Critical volume (m3/kmol)
|
||||
virtual doublereal critVolume() const;
|
||||
|
||||
// Critical compressibility (unitless)
|
||||
virtual doublereal critCompressibility() const;
|
||||
|
||||
/// Critical density (kg/m3).
|
||||
virtual doublereal critDensity() const;
|
||||
|
||||
public:
|
||||
|
|
@ -343,71 +190,9 @@ public:
|
|||
*/
|
||||
//@{
|
||||
|
||||
//! Set equation of state parameter values from XML entries.
|
||||
/*!
|
||||
* This method is called by function importPhase() when processing a phase
|
||||
* definition in an input file. It should be overloaded in subclasses to set
|
||||
* any parameters that are specific to that particular phase model.
|
||||
*
|
||||
* @param thermoNode An XML_Node object corresponding to
|
||||
* the "thermo" entry for this phase in the input file.
|
||||
*/
|
||||
virtual void setParametersFromXML(const XML_Node& thermoNode);
|
||||
|
||||
//! @internal Initialize the object
|
||||
/*!
|
||||
* This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called just prior to returning
|
||||
* from function importPhase().
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
//!This method is used by the ChemEquil equilibrium solver.
|
||||
/*!
|
||||
* It sets the state such that the chemical potentials satisfy
|
||||
* \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m}
|
||||
* \left(\frac{\lambda_m} {\hat R T}\right) \f] where
|
||||
* \f$ \lambda_m \f$ is the element potential of element m. The
|
||||
* temperature is unchanged. Any phase (ideal or not) that
|
||||
* implements this method can be equilibrated by ChemEquil.
|
||||
*
|
||||
* @param lambda_RT Input vector of dimensionless element potentials
|
||||
* The length is equal to nElements().
|
||||
*/
|
||||
void setToEquilState(const doublereal* lambda_RT);
|
||||
|
||||
//! Initialize a ThermoPhase object, potentially reading activity
|
||||
//! coefficient information from an XML database.
|
||||
/*!
|
||||
* This routine initializes the lengths in the current object and
|
||||
* then calls the parent routine.
|
||||
* This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called just prior to returning
|
||||
* from function importPhase().
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a
|
||||
* complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
private:
|
||||
|
|
@ -435,95 +220,16 @@ private:
|
|||
|
||||
protected:
|
||||
// Special functions inherited from MixtureFugacityTP
|
||||
|
||||
//! Calculate the deviation terms for the total entropy of the mixture from the
|
||||
//! ideal gas mixture
|
||||
/*!
|
||||
* Here we use the current state conditions
|
||||
*
|
||||
* @return Returns the change in entropy in units of J kmol-1 K-1.
|
||||
*/
|
||||
virtual doublereal sresid() const;
|
||||
|
||||
// Calculate the deviation terms for the total enthalpy of the mixture from the
|
||||
// ideal gas mixture
|
||||
/*
|
||||
* Here we use the current state conditions
|
||||
*
|
||||
* @return Returns the change in enthalpy in units of J kmol-1.
|
||||
*/
|
||||
virtual doublereal hresid() const;
|
||||
public:
|
||||
//! Estimate for the molar volume of the liquid
|
||||
/*!
|
||||
* Note: this is only used as a starting guess for later routines that actually calculate an
|
||||
* accurate value for the liquid molar volume.
|
||||
* This routine doesn't change the state of the system.
|
||||
*
|
||||
* @param TKelvin temperature in kelvin
|
||||
* @param pres Pressure in Pa. This is used as an initial guess. If the routine
|
||||
* needs to change the pressure to find a stable liquid state, the
|
||||
* new pressure is returned in this variable.
|
||||
* @return Returns the estimate of the liquid volume.
|
||||
*/
|
||||
virtual doublereal liquidVolEst(doublereal TKelvin, doublereal& pres) const;
|
||||
|
||||
//! Calculates the density given the temperature and the pressure and a guess at the density.
|
||||
/*!
|
||||
* Note, below T_c, this is a multivalued function. We do not cross the vapor dome in this.
|
||||
* This is protected because it is called during setState_TP() routines. Infinite loops would result
|
||||
* if it were not protected.
|
||||
*
|
||||
* -> why is this not const?
|
||||
*
|
||||
* parameters:
|
||||
* @param TKelvin Temperature in Kelvin
|
||||
* @param pressure Pressure in Pascals (Newton/m**2)
|
||||
* @param phase int representing the phase whose density we are requesting. If we put
|
||||
* a gas or liquid phase here, we will attempt to find a volume in that
|
||||
* part of the volume space, only, in this routine. A value of FLUID_UNDEFINED
|
||||
* means that we will accept anything.
|
||||
* @param rhoguess Guessed density of the fluid. A value of -1.0 indicates that there
|
||||
* is no guessed density
|
||||
* @return We return the density of the fluid at the requested phase. If we have not found any
|
||||
* acceptable density we return a -1. If we have found an acceptable density at a
|
||||
* different phase, we return a -2.
|
||||
*/
|
||||
public:
|
||||
virtual doublereal liquidVolEst(doublereal TKelvin, doublereal& pres) const;
|
||||
virtual doublereal densityCalc(doublereal TKelvin, doublereal pressure, int phase, doublereal rhoguess);
|
||||
|
||||
//! Return the value of the density at the liquid spinodal point (on the liquid side)
|
||||
//! for the current temperature.
|
||||
/*!
|
||||
* @return returns the density with units of kg m-3
|
||||
*/
|
||||
virtual doublereal densSpinodalLiquid() const;
|
||||
|
||||
//! Return the value of the density at the gas spinodal point (on the gas side)
|
||||
//! for the current temperature.
|
||||
/*!
|
||||
* @return returns the density with units of kg m-3
|
||||
*/
|
||||
virtual doublereal densSpinodalGas() const;
|
||||
|
||||
//! Calculate the pressure given the temperature and the molar volume
|
||||
/*!
|
||||
* Calculate the pressure given the temperature and the molar volume
|
||||
*
|
||||
* @param TKelvin temperature in kelvin
|
||||
* @param molarVol molar volume ( m3/kmol)
|
||||
* @return Returns the pressure.
|
||||
*/
|
||||
virtual doublereal pressureCalc(doublereal TKelvin, doublereal molarVol) const;
|
||||
|
||||
//! Calculate the pressure and the pressure derivative given the temperature and the molar volume
|
||||
/*!
|
||||
* Temperature and mole number are held constant
|
||||
*
|
||||
* @param TKelvin temperature in kelvin
|
||||
* @param molarVol molar volume ( m3/kmol)
|
||||
* @param presCalc Returns the pressure.
|
||||
* @return Returns the derivative of the pressure wrt the molar volume
|
||||
*/
|
||||
virtual doublereal dpdVCalc(doublereal TKelvin, doublereal molarVol, doublereal& presCalc) const;
|
||||
|
||||
//! Calculate dpdV and dpdT at the current conditions
|
||||
|
|
@ -536,19 +242,20 @@ public:
|
|||
|
||||
//! Update the a and b parameters
|
||||
/*!
|
||||
* The a and the b parameters depend on the mole fraction and the temperature.
|
||||
* This function updates the internal numbers based on the state of the object.
|
||||
* The a and the b parameters depend on the mole fraction and the
|
||||
* temperature. This function updates the internal numbers based on the
|
||||
* state of the object.
|
||||
*/
|
||||
void updateAB();
|
||||
|
||||
//! Calculate the a and the b parameters given the temperature
|
||||
//! Calculate the a and the b parameters given the temperature
|
||||
/*!
|
||||
* This function doesn't change the internal state of the object, so it is a const
|
||||
* function. It does use the stored mole fractions in the object.
|
||||
* This function doesn't change the internal state of the object, so it is a
|
||||
* const function. It does use the stored mole fractions in the object.
|
||||
*
|
||||
* @param temp Temperature (TKelvin)
|
||||
* @param aCalc (output) Returns the a value
|
||||
* @param bCalc (output) Returns the b value.
|
||||
* @param temp Temperature (TKelvin)
|
||||
* @param aCalc (output) Returns the a value
|
||||
* @param bCalc (output) Returns the b value.
|
||||
*/
|
||||
void calculateAB(doublereal temp, doublereal& aCalc, doublereal& bCalc) const;
|
||||
|
||||
|
|
@ -623,22 +330,22 @@ protected:
|
|||
|
||||
//! The derivative of the pressure wrt the volume
|
||||
/*!
|
||||
* Calculated at the current conditions
|
||||
* temperature and mole number kept constant
|
||||
* Calculated at the current conditions. temperature and mole number kept
|
||||
* constant
|
||||
*/
|
||||
mutable doublereal dpdV_;
|
||||
|
||||
//! The derivative of the pressure wrt the temperature
|
||||
/*!
|
||||
* Calculated at the current conditions
|
||||
* Total volume and mole number kept constant
|
||||
* Calculated at the current conditions. Total volume and mole number kept
|
||||
* constant
|
||||
*/
|
||||
mutable doublereal dpdT_;
|
||||
|
||||
//! Vector of derivatives of pressure wrt mole number
|
||||
/*!
|
||||
* Calculated at the current conditions
|
||||
* Total volume, temperature and other mole number kept constant
|
||||
* Calculated at the current conditions. Total volume, temperature and
|
||||
* other mole number kept constant
|
||||
*/
|
||||
mutable vector_fp dpdni_;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,7 @@ const int cHole = 1;
|
|||
/**
|
||||
* @ingroup thermoprops
|
||||
*
|
||||
* Class SemiconductorPhase represents electrons and holes
|
||||
* in a semiconductor.
|
||||
* Class SemiconductorPhase represents electrons and holes in a semiconductor.
|
||||
*
|
||||
*/
|
||||
class SemiconductorPhase : public ThermoPhase
|
||||
|
|
@ -42,7 +41,6 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
//! Duplicator
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const {
|
||||
SemiconductorPhase* idg = new SemiconductorPhase(*this);
|
||||
return (ThermoPhase*) idg;
|
||||
|
|
|
|||
|
|
@ -20,47 +20,39 @@ namespace Cantera
|
|||
/**
|
||||
* @ingroup thermoprops
|
||||
*
|
||||
* The SingleSpeciesTP class is a filter class for ThermoPhase.
|
||||
* What it does is to simplify the construction of ThermoPhase
|
||||
* objects by assuming that the phase consists of one and
|
||||
* only one type of species. In other words, it's a stoichiometric
|
||||
* phase. However, no assumptions are made concerning the
|
||||
* thermodynamic functions or the equation of state of the
|
||||
* phase. Therefore it's an incomplete description of
|
||||
* the thermodynamics. The complete description must be
|
||||
* made in a derived class of SingleSpeciesTP.
|
||||
* The SingleSpeciesTP class is a filter class for ThermoPhase. What it does is
|
||||
* to simplify the construction of ThermoPhase objects by assuming that the
|
||||
* phase consists of one and only one type of species. In other words, it's a
|
||||
* stoichiometric phase. However, no assumptions are made concerning the
|
||||
* thermodynamic functions or the equation of state of the phase. Therefore it's
|
||||
* an incomplete description of the thermodynamics. The complete description
|
||||
* must be made in a derived class of SingleSpeciesTP.
|
||||
*
|
||||
* Several different groups of thermodynamic functions are resolved
|
||||
* at this level by this class. For example, All partial molar property
|
||||
* routines call their single species standard state equivalents.
|
||||
* All molar solution thermodynamic routines call the single species
|
||||
* standard state equivalents.
|
||||
* Activities routines are resolved at this level, as there is only
|
||||
* one species.
|
||||
* Several different groups of thermodynamic functions are resolved at this
|
||||
* level by this class. For example, All partial molar property routines call
|
||||
* their single species standard state equivalents. All molar solution
|
||||
* thermodynamic routines call the single species standard state equivalents.
|
||||
* Activities routines are resolved at this level, as there is only one species.
|
||||
*
|
||||
* It is assumed that the reference state thermodynamics may be
|
||||
* obtained by a pointer to a populated species thermodynamic property
|
||||
* manager class (see ThermoPhase::m_spthermo). How to relate pressure
|
||||
* changes to the reference state thermodynamics is again left open
|
||||
* to implementation.
|
||||
* It is assumed that the reference state thermodynamics may be obtained by a
|
||||
* pointer to a populated species thermodynamic property manager class (see
|
||||
* ThermoPhase::m_spthermo). How to relate pressure changes to the reference
|
||||
* state thermodynamics is again left open to implementation.
|
||||
*
|
||||
* Mole fraction and Mass fraction vectors are assumed to be equal
|
||||
* to x[0] = 1 y[0] = 1, respectively. Simplifications to the interface
|
||||
* of setState_TPY() and setState_TPX() functions result and are made
|
||||
* within the class.
|
||||
* Mole fraction and Mass fraction vectors are assumed to be equal to x[0] = 1
|
||||
* y[0] = 1, respectively. Simplifications to the interface of setState_TPY()
|
||||
* and setState_TPX() functions result and are made within the class.
|
||||
*
|
||||
* Note, this class can handle the thermodynamic description of one
|
||||
* phase of one species. It can not handle the description of phase
|
||||
* equilibrium between two phases of a stoichiometric compound
|
||||
* (e.g. water liquid and water vapor, below the critical point).
|
||||
* However, it may be used to describe the thermodynamics of one phase
|
||||
* of such a compound even past the phase equilibrium point, up to the
|
||||
* point where the phase itself ceases to be a stable phase.
|
||||
* Note, this class can handle the thermodynamic description of one phase of one
|
||||
* species. It can not handle the description of phase equilibrium between two
|
||||
* phases of a stoichiometric compound (e.g. water liquid and water vapor, below
|
||||
* the critical point). However, it may be used to describe the thermodynamics
|
||||
* of one phase of such a compound even past the phase equilibrium point, up to
|
||||
* the point where the phase itself ceases to be a stable phase.
|
||||
*
|
||||
* This class doesn't do much at the initialization level.
|
||||
* Its SingleSpeciesTP::initThermo()
|
||||
* member does check that one and only one species has been defined
|
||||
* to occupy the phase.
|
||||
* This class doesn't do much at the initialization level. Its
|
||||
* SingleSpeciesTP::initThermo() member does check that one and only one species
|
||||
* has been defined to occupy the phase.
|
||||
*/
|
||||
class SingleSpeciesTP : public ThermoPhase
|
||||
{
|
||||
|
|
@ -68,104 +60,47 @@ public:
|
|||
//! Base empty constructor.
|
||||
SingleSpeciesTP();
|
||||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
SingleSpeciesTP(const SingleSpeciesTP& right);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
SingleSpeciesTP& operator=(const SingleSpeciesTP& right);
|
||||
|
||||
//! Duplication function
|
||||
/*!
|
||||
* This virtual function is used to create a duplicate of the
|
||||
* current phase. It's used to duplicate the phase when given
|
||||
* a ThermoPhase pointer to the phase.
|
||||
*
|
||||
* @return It returns a ThermoPhase pointer.
|
||||
*/
|
||||
ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
/**
|
||||
* Returns the equation of state type flag.
|
||||
* This is a modified base class.
|
||||
* Therefore, if not overridden in derived classes,
|
||||
* this call will throw an exception.
|
||||
* Returns the equation of state type flag. This is a modified base class.
|
||||
* Therefore, if not overridden in derived classes, this call will throw an
|
||||
* exception.
|
||||
*/
|
||||
virtual int eosType() const;
|
||||
|
||||
/**
|
||||
* @name Molar Thermodynamic Properties of the Solution
|
||||
* @name Molar Thermodynamic Properties of the Solution
|
||||
*
|
||||
* These functions are resolved at this level, by reference
|
||||
* to the partial molar functions and standard state
|
||||
* functions for species 0. Derived classes don't need
|
||||
* to supply entries for these functions.
|
||||
* These functions are resolved at this level, by reference to the partial
|
||||
* molar functions and standard state functions for species 0. Derived
|
||||
* classes don't need to supply entries for these functions.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
/*!
|
||||
* This function is resolved here by calling the standard state
|
||||
* thermo function.
|
||||
*/
|
||||
doublereal enthalpy_mole() const;
|
||||
|
||||
/// Molar internal energy. Units: J/kmol.
|
||||
/*!
|
||||
* This function is resolved here by calling the standard state
|
||||
* thermo function.
|
||||
*/
|
||||
doublereal intEnergy_mole() const;
|
||||
|
||||
/// Molar entropy. Units: J/kmol/K.
|
||||
/*!
|
||||
* This function is resolved here by calling the standard state
|
||||
* thermo function.
|
||||
*/
|
||||
doublereal entropy_mole() const;
|
||||
|
||||
/// Molar Gibbs function. Units: J/kmol.
|
||||
/*!
|
||||
* This function is resolved here by calling the standard state
|
||||
* thermo function.
|
||||
*/
|
||||
doublereal gibbs_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
/*!
|
||||
* This function is resolved here by calling the standard state
|
||||
* thermo function.
|
||||
*/
|
||||
doublereal cp_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
/*!
|
||||
* This function is resolved here by calling the standard state
|
||||
* thermo function.
|
||||
*/
|
||||
doublereal cv_mole() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Activities, Standard State, and Activity Concentrations
|
||||
*
|
||||
* The activity \f$a_k\f$ of a species in solution is
|
||||
* related to the chemical potential by \f[ \mu_k = \mu_k^0(T)
|
||||
* + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T)\f$ is
|
||||
* the chemical potential at unit activity, which depends only
|
||||
* on temperature.
|
||||
* The activity \f$a_k\f$ of a species in solution is related to the
|
||||
* chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f]
|
||||
* The quantity \f$\mu_k^0(T)\f$ is the chemical potential at unit activity,
|
||||
* which depends only on temperature.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the array of non-dimensional activities at
|
||||
* the current solution temperature, pressure, and
|
||||
* solution concentration.
|
||||
* Get the array of non-dimensional activities at the current solution
|
||||
* temperature, pressure, and solution concentration.
|
||||
*
|
||||
* We redefine this function to just return 1.0 here.
|
||||
*
|
||||
|
|
@ -175,13 +110,6 @@ public:
|
|||
a[0] = 1.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array of non-dimensional activity coefficients at
|
||||
* the current solution temperature, pressure, and
|
||||
* solution concentration.
|
||||
*
|
||||
* @param ac Output vector of activity coefficients. Length: 1.
|
||||
*/
|
||||
virtual void getActivityCoefficients(doublereal* ac) const {
|
||||
ac[0] = 1.0;
|
||||
}
|
||||
|
|
@ -189,50 +117,49 @@ public:
|
|||
//@}
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
///
|
||||
/// These functions are resolved at this level, by reference
|
||||
/// to the partial molar functions and standard state
|
||||
/// functions for species 0. Derived classes don't need
|
||||
/// to supply entries for these functions.
|
||||
/// These functions are resolved at this level, by reference to the partial
|
||||
/// molar functions and standard state functions for species 0. Derived
|
||||
/// classes don't need to supply entries for these functions.
|
||||
//@{
|
||||
|
||||
//! Get the array of non-dimensional species chemical potentials
|
||||
//! These are partial molar Gibbs free energies.
|
||||
//! Get the array of non-dimensional species chemical potentials. These are
|
||||
//! partial molar Gibbs free energies.
|
||||
/*!
|
||||
* These are the phase, partial molar, and the standard state
|
||||
* dimensionless chemical potentials.
|
||||
* These are the phase, partial molar, and the standard state dimensionless
|
||||
* chemical potentials.
|
||||
* \f$ \mu_k / \hat R T \f$.
|
||||
*
|
||||
* Units: unitless
|
||||
*
|
||||
* @param murt On return, Contains the chemical potential / RT of the single species
|
||||
* and the phase. Units are unitless. Length = 1
|
||||
* @param murt On return, Contains the chemical potential / RT of the
|
||||
* single species and the phase. Units are unitless. Length = 1
|
||||
*/
|
||||
void getChemPotentials_RT(doublereal* murt) const;
|
||||
|
||||
//! Get the array of chemical potentials
|
||||
/*!
|
||||
* These are the phase, partial molar, and the standard state chemical potentials.
|
||||
* These are the phase, partial molar, and the standard state chemical
|
||||
* potentials.
|
||||
* \f$ \mu(T,P) = \mu^0_k(T,P) \f$.
|
||||
*
|
||||
* @param mu On return, Contains the chemical potential of the single species
|
||||
* and the phase. Units are J / kmol . Length = 1
|
||||
* @param mu On return, Contains the chemical potential of the single
|
||||
* species and the phase. Units are J / kmol . Length = 1
|
||||
*/
|
||||
void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Get the species electrochemical potentials. Units: J/kmol.
|
||||
/*!
|
||||
* This method adds a term \f$ Fz_k \phi_k \f$ to
|
||||
* each chemical potential.
|
||||
* This method adds a term \f$ Fz_k \phi_k \f$ to each chemical potential.
|
||||
*
|
||||
* This is resolved here. A single species phase
|
||||
* is not allowed to have anything other than a zero charge.
|
||||
* This is resolved here. A single species phase is not allowed to have
|
||||
* anything other than a zero charge.
|
||||
*
|
||||
* @param mu On return, Contains the electrochemical potential of the single species
|
||||
* and the phase. Units J/kmol . Length = 1
|
||||
* @param mu On return, Contains the electrochemical potential of the
|
||||
* single species and the phase. Units J/kmol . Length = 1
|
||||
*/
|
||||
void getElectrochemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Get the species partial molar enthalpies. Units: J/kmol.
|
||||
//! Get the species partial molar enthalpies. Units: J/kmol.
|
||||
/*!
|
||||
* These are the phase enthalpies. \f$ h_k \f$.
|
||||
*
|
||||
|
|
@ -245,8 +172,8 @@ public:
|
|||
/*!
|
||||
* These are the phase internal energies. \f$ u_k \f$.
|
||||
*
|
||||
* @param ubar On return, Contains the internal energy of the single species
|
||||
* and the phase. Units are J / kmol . Length = 1
|
||||
* @param ubar On return, Contains the internal energy of the single species
|
||||
* and the phase. Units are J / kmol . Length = 1
|
||||
*/
|
||||
virtual void getPartialMolarIntEnergies(doublereal* ubar) const;
|
||||
|
||||
|
|
@ -254,8 +181,8 @@ public:
|
|||
/*!
|
||||
* This is the phase entropy. \f$ s(T,P) = s_o(T,P) \f$.
|
||||
*
|
||||
* @param sbar On return, Contains the entropy of the single species
|
||||
* and the phase. Units are J / kmol / K . Length = 1
|
||||
* @param sbar On return, Contains the entropy of the single species and the
|
||||
* phase. Units are J / kmol / K . Length = 1
|
||||
*/
|
||||
void getPartialMolarEntropies(doublereal* sbar) const;
|
||||
|
||||
|
|
@ -263,7 +190,7 @@ public:
|
|||
/*!
|
||||
* This is the phase heat capacity. \f$ Cp(T,P) = Cp_o(T,P) \f$.
|
||||
*
|
||||
* @param cpbar On return, Contains the heat capacity of the single species
|
||||
* @param cpbar On return, Contains the heat capacity of the single species
|
||||
* and the phase. Units are J / kmol / K . Length = 1
|
||||
*/
|
||||
void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
|
@ -272,8 +199,8 @@ public:
|
|||
/*!
|
||||
* This is the phase molar volume. \f$ V(T,P) = V_o(T,P) \f$.
|
||||
*
|
||||
* @param vbar On return, Contains the molar volume of the single species
|
||||
* and the phase. Units are m^3 / kmol. Length = 1
|
||||
* @param vbar On return, Contains the molar volume of the single species
|
||||
* and the phase. Units are m^3 / kmol. Length = 1
|
||||
*/
|
||||
void getPartialMolarVolumes(doublereal* vbar) const;
|
||||
|
||||
|
|
@ -285,22 +212,15 @@ public:
|
|||
/// are not resolved at the SingleSpeciesTP level.
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Get the dimensional Gibbs functions for the standard
|
||||
* state of the species at the current T and P.
|
||||
*
|
||||
* @param gpure returns a vector of size 1, containing the Gibbs function
|
||||
* Units: J/kmol.
|
||||
*/
|
||||
void getPureGibbs(doublereal* gpure) const;
|
||||
|
||||
//! Get the molar volumes of each species in their standard
|
||||
//! states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
//! Get the molar volumes of each species in their standard states at the
|
||||
//! current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* units = m^3 / kmol
|
||||
*
|
||||
* We resolve this function at this level, by assigning
|
||||
* the molecular weight divided by the phase density
|
||||
* We resolve this function at this level, by assigning the molecular weight
|
||||
* divided by the phase density
|
||||
*
|
||||
* @param vbar On output this contains the standard volume of the species
|
||||
* and phase (m^3/kmol). Vector of length 1
|
||||
|
|
@ -310,80 +230,15 @@ public:
|
|||
//@}
|
||||
/// @name Thermodynamic Values for the Species Reference State
|
||||
///
|
||||
/// Almost all functions in this group are resolved by this
|
||||
/// class. It is assumed that the m_spthermo species thermo
|
||||
/// pointer is populated and yields the reference state thermodynamics
|
||||
/// The internal energy function is not given by this
|
||||
/// class, since it would involve a specification of the
|
||||
/// equation of state.
|
||||
/// Almost all functions in this group are resolved by this class. The
|
||||
/// internal energy function is not given by this class, since it would
|
||||
/// involve a specification of the equation of state.
|
||||
//@{
|
||||
|
||||
/*!
|
||||
* Returns the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*
|
||||
* This function is resolved in this class. It is assumed that the m_spthermo species thermo
|
||||
* pointer is populated and yields the reference state.
|
||||
*
|
||||
* @param hrt Output vector containing the nondimensional reference state enthalpies
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
|
||||
|
||||
/*!
|
||||
* Returns the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*
|
||||
* This function is resolved in this class. It is assumed that the m_spthermo species thermo
|
||||
* pointer is populated and yields the reference state.
|
||||
*
|
||||
* @param grt Output vector containing the nondimensional reference state
|
||||
* Gibbs Free energies. Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT_ref(doublereal* grt) const;
|
||||
|
||||
/*!
|
||||
* Returns the vector of the
|
||||
* Gibbs function of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
* units = J/kmol
|
||||
*
|
||||
* This function is resolved in this class. It is assumed that the m_spthermo species thermo
|
||||
* pointer is populated and yields the reference state.
|
||||
*
|
||||
* @param g Output vector containing the reference state
|
||||
* Gibbs Free energies. Length: m_kk. Units: J/kmol.
|
||||
*/
|
||||
virtual void getGibbs_ref(doublereal* g) const;
|
||||
|
||||
/*!
|
||||
* Returns the vector of nondimensional
|
||||
* entropies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for each species.
|
||||
*
|
||||
* This function is resolved in this class. It is assumed that the m_spthermo species thermo
|
||||
* pointer is populated and yields the reference state.
|
||||
*
|
||||
* @param er Output vector containing the nondimensional reference state
|
||||
* entropies. Length: m_kk.
|
||||
*/
|
||||
virtual void getEntropy_R_ref(doublereal* er) const;
|
||||
|
||||
/*!
|
||||
* Returns the vector of nondimensional
|
||||
* constant pressure heat capacities of the reference state
|
||||
* at the current temperature of the solution
|
||||
* and reference pressure for each species.
|
||||
*
|
||||
* This function is resolved in this class. It is assumed that the m_spthermo species thermo
|
||||
* pointer is populated and yields the reference state.
|
||||
*
|
||||
* @param cprt Output vector of nondimensional reference state
|
||||
* heat capacities at constant pressure for the species.
|
||||
* Length: m_kk
|
||||
*/
|
||||
virtual void getCp_R_ref(doublereal* cprt) const;
|
||||
|
||||
/**
|
||||
|
|
@ -399,68 +254,18 @@ public:
|
|||
//! Mole fractions are fixed, with x[0] = 1.0.
|
||||
void setMoleFractions(const doublereal* const x) {};
|
||||
|
||||
//! Set the internally stored specific enthalpy (J/kg) and pressure (Pa) of the phase.
|
||||
/*!
|
||||
* @param h Specific enthalpy (J/kg)
|
||||
* @param p Pressure (Pa)
|
||||
* @param tol Optional parameter setting the tolerance of the
|
||||
* calculation.
|
||||
*/
|
||||
virtual void setState_HP(doublereal h, doublereal p,
|
||||
doublereal tol = 1.e-8);
|
||||
|
||||
//! Set the specific internal energy (J/kg) and specific volume (m^3/kg).
|
||||
/*!
|
||||
* This function fixes the internal state of the phase so that
|
||||
* the specific internal energy and specific volume have the value of the input parameters.
|
||||
*
|
||||
* @param u specific internal energy (J/kg)
|
||||
* @param v specific volume (m^3/kg).
|
||||
* @param tol Optional parameter setting the tolerance of the
|
||||
* calculation.
|
||||
*/
|
||||
virtual void setState_UV(doublereal u, doublereal v,
|
||||
doublereal tol = 1.e-8);
|
||||
|
||||
//! Set the specific entropy (J/kg/K) and pressure (Pa).
|
||||
/*!
|
||||
* This function fixes the internal state of the phase so that
|
||||
* the specific entropy and the pressure have the value of the input parameters.
|
||||
*
|
||||
* @param s specific entropy (J/kg/K)
|
||||
* @param p specific pressure (Pa).
|
||||
* @param tol Optional parameter setting the tolerance of the
|
||||
* calculation.
|
||||
*/
|
||||
virtual void setState_SP(doublereal s, doublereal p,
|
||||
doublereal tol = 1.e-8);
|
||||
|
||||
//! Set the specific entropy (J/kg/K) and specific volume (m^3/kg).
|
||||
/*!
|
||||
* This function fixes the internal state of the phase so that
|
||||
* the specific entropy and specific volume have the value of the input parameters.
|
||||
*
|
||||
* @param s specific entropy (J/kg/K)
|
||||
* @param v specific volume (m^3/kg).
|
||||
* @param tol Optional parameter setting the tolerance of the
|
||||
* calculation.
|
||||
*/
|
||||
virtual void setState_SV(doublereal s, doublereal v,
|
||||
doublereal tol = 1.e-8);
|
||||
//@}
|
||||
|
||||
/**
|
||||
* @internal Initialize.
|
||||
*
|
||||
* This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. When importing a CTML phase
|
||||
* description, this method is called just prior to returning
|
||||
* from function importPhase().
|
||||
*
|
||||
* Inheriting objects should call this function
|
||||
* @copydoc ThermoPhase::initThermo
|
||||
*
|
||||
* This version sets the mole fraction vector to x[0] = 1.0, and then
|
||||
* calls the ThermoPhase::initThermo() function.
|
||||
|
|
@ -468,16 +273,11 @@ public:
|
|||
virtual void initThermo();
|
||||
|
||||
protected:
|
||||
//! The current pressure of the solution (Pa)
|
||||
/*!
|
||||
* It gets initialized to 1 atm.
|
||||
*/
|
||||
//! The current pressure of the solution (Pa). It gets initialized to 1 atm.
|
||||
doublereal m_press;
|
||||
|
||||
/*!
|
||||
* Reference pressure (Pa) must be the same for all species
|
||||
* - defaults to 1 atm.
|
||||
*/
|
||||
// Reference pressure (Pa). Must be the same for all species. Defaults to
|
||||
// 1 atm.
|
||||
doublereal m_p0;
|
||||
|
||||
//! Dimensionless enthalpy at the (mtlast, m_p0)
|
||||
|
|
@ -488,10 +288,9 @@ protected:
|
|||
mutable vector_fp m_s0_R;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* This crucial internal routine calls the species thermo
|
||||
* update program to calculate new species Cp0, H0, and
|
||||
* S0 whenever the temperature has changed.
|
||||
* @internal This crucial internal routine calls the species thermo update
|
||||
* program to calculate new species Cp0, H0, and S0 whenever the
|
||||
* temperature has changed.
|
||||
*/
|
||||
void _updateThermo() const;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
//! Class StoichSubstance represents a stoichiometric (fixed
|
||||
//! composition) incompressible substance.
|
||||
//! Class StoichSubstance represents a stoichiometric (fixed composition)
|
||||
//! incompressible substance.
|
||||
/*!
|
||||
* This class internally changes the independent degree of freedom from density
|
||||
* to pressure. This is necessary because the phase is incompressible. It uses
|
||||
* a constant volume approximation.
|
||||
* to pressure. This is necessary because the phase is incompressible. It uses a
|
||||
* constant volume approximation.
|
||||
*
|
||||
* <b> Specification of Species Standard State Properties </b>
|
||||
*
|
||||
|
|
@ -171,26 +171,8 @@ public:
|
|||
*/
|
||||
StoichSubstance(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
StoichSubstance(const StoichSubstance& right);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* @param right Object to be copied
|
||||
*/
|
||||
StoichSubstance& operator=(const StoichSubstance& right);
|
||||
|
||||
//! Duplication function
|
||||
/*!
|
||||
* This virtual function is used to create a duplicate of the current phase.
|
||||
* It's used to duplicate the phase when given a ThermoPhase pointer to the
|
||||
* phase.
|
||||
*
|
||||
* @return It returns a ThermoPhase pointer.
|
||||
*/
|
||||
ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
/**
|
||||
|
|
@ -220,22 +202,7 @@ public:
|
|||
*/
|
||||
virtual void setPressure(doublereal p);
|
||||
|
||||
//! Returns the isothermal compressibility. Units: 1/Pa.
|
||||
/*!
|
||||
* The isothermal compressibility is defined as
|
||||
* \f[
|
||||
* \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal isothermalCompressibility() const;
|
||||
|
||||
//! Return the volumetric thermal expansion coefficient. Units: 1/K.
|
||||
/*!
|
||||
* The thermal expansion coefficient is defined as
|
||||
* \f[
|
||||
* \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal thermalExpansionCoeff() const;
|
||||
|
||||
/**
|
||||
|
|
@ -277,11 +244,6 @@ public:
|
|||
* Returns The standard Concentration as 1.0
|
||||
*/
|
||||
virtual doublereal standardConcentration(size_t k=0) const;
|
||||
|
||||
//! Natural logarithm of the standard concentration of the kth species.
|
||||
/*!
|
||||
* @param k index of the species (defaults to zero)
|
||||
*/
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
//! Get the array of chemical potentials at unit activity for the species
|
||||
|
|
@ -305,36 +267,9 @@ public:
|
|||
/// @name Properties of the Standard State of the Species in the Solution
|
||||
//@{
|
||||
|
||||
//! Get the nondimensional Enthalpy functions for the species
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param hrt Output vector of nondimensional standard state enthalpies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEnthalpy_RT(doublereal* hrt) const;
|
||||
|
||||
//! Get the array of nondimensional Entropy functions for the
|
||||
//! standard state species at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param sr Output vector of nondimensional standard state entropies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEntropy_R(doublereal* sr) const;
|
||||
|
||||
//! Get the nondimensional Gibbs functions for the species
|
||||
//! in their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param grt Output vector of nondimensional standard state Gibbs free energies
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT(doublereal* grt) const;
|
||||
|
||||
//! Get the nondimensional Heat Capacities at constant pressure for the
|
||||
//! species standard states at the current <I>T</I> and <I>P</I> of the solution
|
||||
/*!
|
||||
* @param cpr Output vector of nondimensional standard state heat capacities
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getCp_R(doublereal* cpr) const;
|
||||
|
||||
//! Returns the vector of nondimensional Internal Energies of the standard
|
||||
|
|
@ -359,30 +294,18 @@ public:
|
|||
//! state at the current temperature of the solution and the reference
|
||||
//! pressure for each species.
|
||||
/*!
|
||||
* @param urt Output vector of nondimensional reference state
|
||||
* internal energies of the species.
|
||||
* Length: m_kk
|
||||
* @param urt Output vector of nondimensional reference state internal
|
||||
* energies of the species. Length: m_kk
|
||||
*/
|
||||
virtual void getIntEnergy_RT_ref(doublereal* urt) const;
|
||||
// @}
|
||||
|
||||
/*
|
||||
* @internal Initialize. This method is provided to allow subclasses to
|
||||
* perform any initialization required after all species have been added.
|
||||
* For example, it might be used to resize internal work arrays that must
|
||||
* have an entry for each species. The base class implementation does
|
||||
* nothing, and subclasses that do not require initialization do not need to
|
||||
* overload this method. When importing a CTML phase description, this
|
||||
* method is called just prior to returning from function importPhase().
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
//! Set the equation of state parameters
|
||||
/*!
|
||||
* @internal
|
||||
* The number and meaning of these depends on the subclass.
|
||||
*
|
||||
* @param n number of parameters
|
||||
* @param c array of \a n coefficients
|
||||
|
|
@ -405,12 +328,6 @@ public:
|
|||
|
||||
//! Set equation of state parameter values from XML entries.
|
||||
/*!
|
||||
* This method is called by function importPhase() when processing a phase
|
||||
* definition in an input file. It should be overloaded in subclasses to set
|
||||
* any parameters that are specific to that particular phase model. Note,
|
||||
* this method is called before the phase is initialized with elements
|
||||
* and/or species.
|
||||
*
|
||||
* For this phase, the density of the phase is specified in this block.
|
||||
*
|
||||
* @param eosdata An XML_Node object corresponding to
|
||||
|
|
|
|||
|
|
@ -17,12 +17,11 @@
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
//! A simple thermodynamic model for a surface phase,
|
||||
//! assuming an ideal solution model.
|
||||
//! A simple thermodynamic model for a surface phase, assuming an ideal solution
|
||||
//! model.
|
||||
/*!
|
||||
* The surface consists of a grid of equivalent sites.
|
||||
* Surface species may be defined to
|
||||
* occupy one or more sites. The surface species are assumed to be
|
||||
* The surface consists of a grid of equivalent sites. Surface species may be
|
||||
* defined to occupy one or more sites. The surface species are assumed to be
|
||||
* independent, and thus the species form an ideal solution.
|
||||
*
|
||||
* The density of surface sites is given by the variable \f$ n_0 \f$,
|
||||
|
|
@ -30,13 +29,13 @@ namespace Cantera
|
|||
*
|
||||
* <b> Specification of Species Standard State Properties </b>
|
||||
*
|
||||
* It is assumed that the reference state thermodynamics may be
|
||||
* obtained by a pointer to a populated species thermodynamic property
|
||||
* manager class (see ThermoPhase::m_spthermo). How to relate pressure
|
||||
* changes to the reference state thermodynamics is resolved at this level.
|
||||
* It is assumed that the reference state thermodynamics may be obtained by a
|
||||
* pointer to a populated species thermodynamic property manager class (see
|
||||
* ThermoPhase::m_spthermo). How to relate pressure changes to the reference
|
||||
* state thermodynamics is resolved at this level.
|
||||
*
|
||||
* Pressure is defined as an independent variable in this phase. However, it has
|
||||
* no effect on any quantities, as the molar concentration is a constant.
|
||||
* Pressure is defined as an independent variable in this phase. However, it has
|
||||
* no effect on any quantities, as the molar concentration is a constant.
|
||||
*
|
||||
* Therefore, The standard state internal energy for species <I>k</I> is
|
||||
* equal to the enthalpy for species <I>k</I>.
|
||||
|
|
@ -45,8 +44,8 @@ namespace Cantera
|
|||
* u^o_k = h^o_k
|
||||
* \f]
|
||||
*
|
||||
* Also, the standard state chemical potentials, entropy, and heat capacities
|
||||
* are independent of pressure. The standard state Gibbs free energy is obtained
|
||||
* Also, the standard state chemical potentials, entropy, and heat capacities
|
||||
* are independent of pressure. The standard state Gibbs free energy is obtained
|
||||
* from the enthalpy and entropy functions.
|
||||
*
|
||||
* <b> Specification of Solution Thermodynamic Properties </b>
|
||||
|
|
@ -112,8 +111,8 @@ namespace Cantera
|
|||
*
|
||||
* <b> XML Example </b>
|
||||
*
|
||||
* An example of an XML Element named phase setting up a SurfPhase object named diamond_100
|
||||
* is given below.
|
||||
* An example of an XML Element named phase setting up a SurfPhase object named
|
||||
* diamond_100 is given below.
|
||||
*
|
||||
* @code
|
||||
* <phase dim="2" id="diamond_100">
|
||||
|
|
@ -150,8 +149,8 @@ public:
|
|||
*/
|
||||
SurfPhase(doublereal n0 = 1.0);
|
||||
|
||||
//! Construct and initialize a SurfPhase ThermoPhase object
|
||||
//! directly from an ASCII input file
|
||||
//! Construct and initialize a SurfPhase ThermoPhase object directly from an
|
||||
//! ASCII input file
|
||||
/*!
|
||||
* @param infile name of the input file
|
||||
* @param id name of the phase id in the file.
|
||||
|
|
@ -159,42 +158,15 @@ public:
|
|||
*/
|
||||
SurfPhase(const std::string& infile, const std::string& id);
|
||||
|
||||
//! Construct and initialize a SurfPhase ThermoPhase object
|
||||
//! directly from an XML database
|
||||
//! Construct and initialize a SurfPhase ThermoPhase object directly from an
|
||||
//! XML database
|
||||
/*!
|
||||
* @param xmlphase XML node pointing to a SurfPhase description
|
||||
*/
|
||||
SurfPhase(XML_Node& xmlphase);
|
||||
|
||||
//! Copy Constructor
|
||||
/*!
|
||||
* Copy constructor for the object. Constructed
|
||||
* object will be a clone of this object, but will
|
||||
* also own all of its data.
|
||||
* This is a wrapper around the assignment operator
|
||||
*
|
||||
* @param right Object to be copied.
|
||||
*/
|
||||
SurfPhase(const SurfPhase& right);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* Assignment operator for the object. Constructed
|
||||
* object will be a clone of this object, but will
|
||||
* also own all of its data.
|
||||
*
|
||||
* @param right Object to be copied.
|
||||
*/
|
||||
SurfPhase& operator=(const SurfPhase& right);
|
||||
|
||||
//! Duplicator from the ThermoPhase parent class
|
||||
/*
|
||||
* Given a pointer to a ThermoPhase object, this function will
|
||||
* duplicate the ThermoPhase object and all underlying structures.
|
||||
* This is basically a wrapper around the copy constructor.
|
||||
*
|
||||
* @return returns a pointer to a ThermoPhase
|
||||
*/
|
||||
ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//! Equation of state type flag.
|
||||
|
|
@ -211,10 +183,9 @@ public:
|
|||
* \f[
|
||||
* \hat h(T,P) = \sum_k X_k \hat h^0_k(T),
|
||||
* \f]
|
||||
* and is a function only of temperature.
|
||||
* The standard-state pure-species Enthalpies
|
||||
* \f$ \hat h^0_k(T) \f$ are computed by the species thermodynamic
|
||||
* property manager.
|
||||
* and is a function only of temperature. The standard-state pure-species
|
||||
* Enthalpies \f$ \hat h^0_k(T) \f$ are computed by the species
|
||||
* thermodynamic property manager.
|
||||
*
|
||||
* \see SpeciesThermo
|
||||
*/
|
||||
|
|
@ -222,9 +193,8 @@ public:
|
|||
|
||||
//! Return the Molar Internal Energy. Units: J/kmol
|
||||
/**
|
||||
* For a surface phase, the pressure is not a relevant
|
||||
* thermodynamic variable, and so the Enthalpy is equal to the
|
||||
* Internal Energy.
|
||||
* For a surface phase, the pressure is not a relevant thermodynamic
|
||||
* variable, and so the Enthalpy is equal to the Internal Energy.
|
||||
*/
|
||||
virtual doublereal intEnergy_mole() const;
|
||||
|
||||
|
|
@ -237,87 +207,36 @@ public:
|
|||
virtual doublereal entropy_mole() const;
|
||||
|
||||
virtual doublereal cp_mole() const;
|
||||
|
||||
virtual doublereal cv_mole() const;
|
||||
|
||||
//! Get the species chemical potentials. Units: J/kmol.
|
||||
/*!
|
||||
* This function returns a vector of chemical potentials of the
|
||||
* species in solution at the current temperature, pressure
|
||||
* and mole fraction of the solution.
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
//! Returns an array of partial molar enthalpies for the species
|
||||
//! in the mixture. Units (J/kmol)
|
||||
/*!
|
||||
* @param hbar Output vector of species partial molar enthalpies.
|
||||
* Length: m_kk. units are J/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
|
||||
|
||||
//! Returns an array of partial molar entropies of the species in the
|
||||
//! solution. Units: J/kmol/K.
|
||||
/*!
|
||||
* @param sbar Output vector of species partial molar entropies.
|
||||
* Length = m_kk. units are J/kmol/K.
|
||||
*/
|
||||
virtual void getPartialMolarEntropies(doublereal* sbar) const;
|
||||
|
||||
//! Return an array of partial molar heat capacities for the
|
||||
//! species in the mixture. Units: J/kmol/K
|
||||
/*!
|
||||
* @param cpbar Output vector of species partial molar heat
|
||||
* capacities at constant pressure.
|
||||
* Length = m_kk. units are J/kmol/K.
|
||||
*/
|
||||
virtual void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
||||
//! Return an array of partial molar volumes for the
|
||||
//! species in the mixture. Units: m^3/kmol.
|
||||
/*!
|
||||
* @param vbar Output vector of species partial molar volumes.
|
||||
* Length = m_kk. units are m^3/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarVolumes(doublereal* vbar) const;
|
||||
|
||||
//! Get the array of chemical potentials at unit activity for the
|
||||
//! standard state species at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* These are the standard state chemical potentials \f$ \mu^0_k(T,P)
|
||||
* \f$. The values are evaluated at the current
|
||||
* temperature and pressure of the solution
|
||||
*
|
||||
* @param mu0 Output vector of chemical potentials.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getStandardChemPotentials(doublereal* mu0) const;
|
||||
|
||||
//! Return a vector of activity concentrations for each species
|
||||
/*!
|
||||
* For this phase the activity concentrations,\f$ C^a_k \f$, are defined to be
|
||||
* equal to the actual concentrations, \f$ C^s_k \f$.
|
||||
* Activity concentrations are
|
||||
* For this phase the activity concentrations,\f$ C^a_k \f$, are defined to
|
||||
* be equal to the actual concentrations, \f$ C^s_k \f$. Activity
|
||||
* concentrations are
|
||||
*
|
||||
* \f[
|
||||
* C^a_k = C^s_k = \frac{\theta_k n_0}{s_k}
|
||||
* \f]
|
||||
*
|
||||
* where \f$ \theta_k \f$ is the surface site fraction for species k,
|
||||
* \f$ n_0 \f$ is the surface site density for the phase, and
|
||||
* \f$ s_k \f$ is the surface size of species k.
|
||||
* where \f$ \theta_k \f$ is the surface site fraction for species k,
|
||||
* \f$ n_0 \f$ is the surface site density for the phase, and
|
||||
* \f$ s_k \f$ is the surface size of species k.
|
||||
*
|
||||
* \f$ C^a_k\f$ that are defined such that \f$ a_k = C^a_k /
|
||||
* C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration
|
||||
* defined below and \f$ a_k \f$ are activities used in
|
||||
* the thermodynamic functions. These activity concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions. Note that they may
|
||||
* or may not have units of concentration --- they might be
|
||||
* partial pressures, mole fractions, or surface coverages,
|
||||
* \f$ C^a_k\f$ that are defined such that \f$ a_k = C^a_k / C^0_k, \f$
|
||||
* where \f$ C^0_k \f$ is a standard concentration defined below and \f$ a_k
|
||||
* \f$ are activities used in the thermodynamic functions. These activity
|
||||
* concentrations are used by kinetics manager classes to compute the
|
||||
* forward and reverse rates of elementary reactions. Note that they may or
|
||||
* may not have units of concentration --- they might be partial pressures,
|
||||
* mole fractions, or surface coverages,
|
||||
*
|
||||
* @param c vector of activity concentration (kmol m-2).
|
||||
*/
|
||||
|
|
@ -325,16 +244,15 @@ public:
|
|||
|
||||
//! Return the standard concentration for the kth species
|
||||
/*!
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize
|
||||
* the activity (i.e., generalized) concentration.
|
||||
* For this phase, the standard concentration is species-
|
||||
* specific
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize the activity
|
||||
* (i.e., generalized) concentration. For this phase, the standard
|
||||
* concentration is species- specific
|
||||
*
|
||||
* \f[
|
||||
* C^0_k = \frac{n_0}{s_k}
|
||||
* \f]
|
||||
*
|
||||
* This definition implies that the activity is equal to \f$ \theta_k \f$.
|
||||
* This definition implies that the activity is equal to \f$ \theta_k \f$.
|
||||
*
|
||||
* @param k Optional parameter indicating the species. The default
|
||||
* is to assume this refers to species 0.
|
||||
|
|
@ -342,11 +260,6 @@ public:
|
|||
* Returns the standard Concentration in units of m3 kmol-1.
|
||||
*/
|
||||
virtual doublereal standardConcentration(size_t k = 0) const;
|
||||
|
||||
//! Return the log of the standard concentration for the kth species
|
||||
/*!
|
||||
* @param k species index (default 0)
|
||||
*/
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
//! Set the equation of state parameters from the argument list
|
||||
|
|
@ -364,15 +277,13 @@ public:
|
|||
/*!
|
||||
* The Equation-of-State data consists of one item, the site density.
|
||||
*
|
||||
* @param thermoData Reference to an XML_Node named thermo
|
||||
* containing the equation-of-state data. The
|
||||
* XML_Node is within the phase XML_Node describing
|
||||
* the SurfPhase object.
|
||||
* @param thermoData Reference to an XML_Node named thermo containing the
|
||||
* equation-of-state data. The XML_Node is within the
|
||||
* phase XML_Node describing the SurfPhase object.
|
||||
*
|
||||
* An example of the contents of the thermoData XML_Node is provided
|
||||
* below. The units attribute is used to supply the units of the
|
||||
* site density in any convenient form. Internally it is changed
|
||||
* into MKS form.
|
||||
* An example of the contents of the thermoData XML_Node is provided below.
|
||||
* The units attribute is used to supply the units of the site density in
|
||||
* any convenient form. Internally it is changed into MKS form.
|
||||
*
|
||||
* @code
|
||||
* <thermo model="Surface">
|
||||
|
|
@ -387,8 +298,8 @@ public:
|
|||
|
||||
//! Set the initial state of the Surface Phase from an XML_Node
|
||||
/*!
|
||||
* State variables that can be set by this routine are
|
||||
* the temperature and the surface site coverages.
|
||||
* State variables that can be set by this routine are the temperature and
|
||||
* the surface site coverages.
|
||||
*
|
||||
* @param state XML_Node containing the state information
|
||||
*
|
||||
|
|
@ -417,47 +328,10 @@ public:
|
|||
*/
|
||||
void setSiteDensity(doublereal n0);
|
||||
|
||||
//! Get the nondimensional Gibbs functions for the species
|
||||
//! in their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param grt Output vector of nondimensional standard state Gibbs free energies
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT(doublereal* grt) const;
|
||||
|
||||
//! Get the nondimensional Enthalpy functions for the species standard states
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param hrt Output vector of nondimensional standard state enthalpies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEnthalpy_RT(doublereal* hrt) const;
|
||||
|
||||
//! Get the array of nondimensional Entropy functions for the
|
||||
//! species standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param sr Output vector of nondimensional standard state entropies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEntropy_R(doublereal* sr) const;
|
||||
|
||||
//! Get the nondimensional Heat Capacities at constant
|
||||
//! pressure for the species standard states
|
||||
//! at the current <I>T</I> and <I>P</I> of the solution
|
||||
/*!
|
||||
* @param cpr Output vector of nondimensional standard state heat capacities
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getCp_R(doublereal* cpr) const;
|
||||
|
||||
//! Get the molar volumes of the species standard states at the current
|
||||
//! <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* units = m^3 / kmol
|
||||
*
|
||||
* @param vol Output vector containing the standard state volumes.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getStandardVolumes(doublereal* vol) const;
|
||||
|
||||
//! Return the thermodynamic pressure (Pa).
|
||||
|
|
@ -465,8 +339,8 @@ public:
|
|||
return m_press;
|
||||
}
|
||||
|
||||
//! Set the internally stored pressure (Pa) at constant
|
||||
//! temperature and composition
|
||||
//! Set the internally stored pressure (Pa) at constant temperature and
|
||||
//! composition
|
||||
/*!
|
||||
* @param p input Pressure (Pa)
|
||||
*/
|
||||
|
|
@ -475,56 +349,20 @@ public:
|
|||
}
|
||||
|
||||
virtual void getPureGibbs(doublereal* g) const;
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! Gibbs Free Energies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
/*!
|
||||
* @param grt Output vector containing the nondimensional reference state
|
||||
* Gibbs Free energies. Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT_ref(doublereal* grt) const;
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! enthalpies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
/*!
|
||||
* @param hrt Output vector of nondimensional standard state enthalpies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! entropies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for each species.
|
||||
/*!
|
||||
* @param er Output vector containing the nondimensional reference state
|
||||
* entropies. Length: m_kk.
|
||||
*/
|
||||
virtual void getEntropy_R_ref(doublereal* er) const;
|
||||
|
||||
//! Returns the vector of nondimensional constant pressure heat capacities
|
||||
//! of the reference state at the current temperature of the solution and
|
||||
//! reference pressure for each species.
|
||||
/*!
|
||||
* @param cprt Output vector of nondimensional reference state
|
||||
* heat capacities at constant pressure for the species.
|
||||
* Length: m_kk
|
||||
*/
|
||||
virtual void getCp_R_ref(doublereal* cprt) const;
|
||||
|
||||
//! Set the surface site fractions to a specified state.
|
||||
/*!
|
||||
* This routine converts to concentrations
|
||||
* in kmol/m2, using m_n0, the surface site density,
|
||||
* and size(k), which is defined to be the number of
|
||||
* surface sites occupied by the kth molecule.
|
||||
* It then calls Phase::setConcentrations to set the
|
||||
* internal concentration in the object.
|
||||
* This routine converts to concentrations in kmol/m2, using m_n0, the
|
||||
* surface site density, and size(k), which is defined to be the number of
|
||||
* surface sites occupied by the kth molecule. It then calls
|
||||
* Phase::setConcentrations to set the internal concentration in the object.
|
||||
*
|
||||
* @param theta This is the surface site fraction
|
||||
* for the kth species in the surface phase.
|
||||
* This is a dimensionless quantity.
|
||||
* @param theta This is the surface site fraction for the kth species in
|
||||
* the surface phase. This is a dimensionless quantity.
|
||||
*
|
||||
* This routine normalizes the theta's to 1, before application
|
||||
*/
|
||||
|
|
@ -532,16 +370,13 @@ public:
|
|||
|
||||
//! Set the surface site fractions to a specified state.
|
||||
/*!
|
||||
* This routine converts to concentrations
|
||||
* in kmol/m2, using m_n0, the surface site density,
|
||||
* and size(k), which is defined to be the number of
|
||||
* surface sites occupied by the kth molecule.
|
||||
* It then calls Phase::setConcentrations to set the
|
||||
* internal concentration in the object.
|
||||
* This routine converts to concentrations in kmol/m2, using m_n0, the
|
||||
* surface site density, and size(k), which is defined to be the number of
|
||||
* surface sites occupied by the kth molecule. It then calls
|
||||
* Phase::setConcentrations to set the internal concentration in the object.
|
||||
*
|
||||
* @param theta This is the surface site fraction
|
||||
* for the kth species in the surface phase.
|
||||
* This is a dimensionless quantity.
|
||||
* @param theta This is the surface site fraction for the kth species in
|
||||
* the surface phase. This is a dimensionless quantity.
|
||||
*/
|
||||
void setCoveragesNoNorm(const doublereal* theta);
|
||||
|
||||
|
|
@ -558,8 +393,8 @@ public:
|
|||
/*!
|
||||
* Get the coverages.
|
||||
*
|
||||
* @param theta Array theta must be at least as long as
|
||||
* the number of species.
|
||||
* @param theta Array theta must be at least as long as the number of
|
||||
* species.
|
||||
*/
|
||||
void getCoverages(doublereal* theta) const;
|
||||
|
||||
|
|
@ -590,20 +425,19 @@ protected:
|
|||
|
||||
//! vector storing the log of the size of each species.
|
||||
/*!
|
||||
* The size of each species is defined as the number of surface
|
||||
* sites each species occupies.
|
||||
* The size of each species is defined as the number of surface sites each
|
||||
* species occupies.
|
||||
*/
|
||||
mutable vector_fp m_logsize;
|
||||
|
||||
private:
|
||||
//! Update the species reference state thermodynamic functions
|
||||
/*!
|
||||
* The polynomials for the standard state functions are only
|
||||
* reevaluated if the temperature has changed.
|
||||
* The polynomials for the standard state functions are only reevaluated if
|
||||
* the temperature has changed.
|
||||
*
|
||||
* @param force Boolean, which if true, forces a reevaluation
|
||||
* of the thermo polynomials.
|
||||
* default = false.
|
||||
* @param force Boolean, which if true, forces a reevaluation of the thermo
|
||||
* polynomials. default = false.
|
||||
*/
|
||||
void _updateThermo(bool force=false) const;
|
||||
};
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -4,9 +4,6 @@
|
|||
* variable pressure standard state methods for calculating
|
||||
* thermodynamic properties (see \ref thermoprops and
|
||||
* class \link Cantera::VPStandardStateTP VPStandardStateTP\endlink).
|
||||
*
|
||||
* These include most of the
|
||||
* methods for calculating liquid electrolyte thermodynamics.
|
||||
*/
|
||||
/*
|
||||
* Copyright (2005) Sandia Corporation. Under the terms of
|
||||
|
|
@ -24,31 +21,29 @@ namespace Cantera
|
|||
/**
|
||||
* @ingroup thermoprops
|
||||
*
|
||||
* This is a filter class for ThermoPhase that implements some prepatory
|
||||
* steps for efficiently handling
|
||||
* a variable pressure standard state for species.
|
||||
* This is a filter class for ThermoPhase that implements some prepatory steps
|
||||
* for efficiently handling a variable pressure standard state for species.
|
||||
*
|
||||
* Several concepts are introduced. The first concept is there are temporary
|
||||
* variables for holding the species standard state values
|
||||
* of Cp, H, S, G, and V at the
|
||||
* last temperature and pressure called. These functions are not recalculated
|
||||
* if a new call is made using the previous temperature and pressure. Currently,
|
||||
* these variables and the calculation method are handled by the VPSSMgr class,
|
||||
* for which VPStandardStateTP owns a pointer to.
|
||||
* Several concepts are introduced. The first concept is there are temporary
|
||||
* variables for holding the species standard state values of Cp, H, S, G, and V
|
||||
* at the last temperature and pressure called. These functions are not
|
||||
* recalculated if a new call is made using the previous temperature and
|
||||
* pressure. Currently, these variables and the calculation method are handled
|
||||
* by the VPSSMgr class, for which VPStandardStateTP owns a pointer to.
|
||||
*
|
||||
* To support the above functionality, pressure and temperature variables,
|
||||
* m_Plast_ss and m_Tlast_ss, are kept which store the last pressure and temperature
|
||||
* used in the evaluation of standard state properties.
|
||||
* To support the above functionality, pressure and temperature variables,
|
||||
* m_Plast_ss and m_Tlast_ss, are kept which store the last pressure and
|
||||
* temperature used in the evaluation of standard state properties.
|
||||
*
|
||||
* This class is usually used for nearly incompressible phases. For those phases, it
|
||||
* makes sense to change the equation of state independent variable from
|
||||
* density to pressure. The variable m_Pcurrent contains the current value of the
|
||||
* pressure within the phase.
|
||||
* This class is usually used for nearly incompressible phases. For those
|
||||
* phases, it makes sense to change the equation of state independent variable
|
||||
* from density to pressure. The variable m_Pcurrent contains the current value
|
||||
* of the pressure within the phase.
|
||||
*
|
||||
* @todo
|
||||
* Put some teeth into this level by overloading the setDensity() function. It should
|
||||
* now throw an exception. Instead, setPressure routines should calculate the
|
||||
* solution density and then call State:setDensity() directly.
|
||||
* @todo Put some teeth into this level by overloading the setDensity()
|
||||
* function. It should now throw an exception. Instead, setPressure routines
|
||||
* should calculate the solution density and then call State:setDensity()
|
||||
* directly.
|
||||
*/
|
||||
class VPStandardStateTP : public ThermoPhase
|
||||
{
|
||||
|
|
@ -58,58 +53,17 @@ public:
|
|||
/// Constructor.
|
||||
VPStandardStateTP();
|
||||
|
||||
//! Copy Constructor.
|
||||
/*!
|
||||
* @param b Object to be copied
|
||||
*/
|
||||
VPStandardStateTP(const VPStandardStateTP& b);
|
||||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
* @param b Object to be copied
|
||||
*/
|
||||
VPStandardStateTP& operator=(const VPStandardStateTP& b);
|
||||
|
||||
//! Destructor.
|
||||
virtual ~VPStandardStateTP();
|
||||
|
||||
//! Duplication routine
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//@}
|
||||
//! @name Utilities (VPStandardStateTP)
|
||||
//@{
|
||||
|
||||
//! This method returns the convention used in specification
|
||||
//! of the standard state, of which there are currently two,
|
||||
//! temperature based, and variable pressure based.
|
||||
/*!
|
||||
* Currently, there are two standard state conventions:
|
||||
* - Temperature-based activities,
|
||||
* `cSS_CONVENTION_TEMPERATURE 0` (default)
|
||||
* - Variable Pressure and Temperature-based activities,
|
||||
* `cSS_CONVENTION_VPSS 1`
|
||||
*/
|
||||
virtual int standardStateConvention() const;
|
||||
|
||||
//! Get the array of log concentration-like derivatives of the
|
||||
//! log activity coefficients
|
||||
/*!
|
||||
* This function is a virtual method. For ideal mixtures
|
||||
* (unity activity coefficients), this can return zero.
|
||||
* Implementations should take the derivative of the
|
||||
* logarithm of the activity coefficient with respect to the
|
||||
* logarithm of the concentration-like variable (i.e. moles)
|
||||
* that represents the standard state.
|
||||
* This quantity is to be used in conjunction with derivatives of
|
||||
* that concentration-like variable when the derivative of the chemical
|
||||
* potential is taken.
|
||||
*
|
||||
* units = dimensionless
|
||||
*
|
||||
* @param dlnActCoeffdlnN_diag Output vector of derivatives of the
|
||||
* log Activity Coefficients. length = m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const {
|
||||
throw NotImplementedError("VPStandardStateTP::getdlnActCoeffdlnN_diag");
|
||||
}
|
||||
|
|
@ -120,12 +74,10 @@ public:
|
|||
|
||||
//! Get the array of non-dimensional species chemical potentials.
|
||||
/*!
|
||||
* These are partial molar Gibbs free energies,
|
||||
* \f$ \mu_k / \hat R T \f$.
|
||||
* These are partial molar Gibbs free energies, \f$ \mu_k / \hat R T \f$.
|
||||
*
|
||||
* We close the loop on this function, here, calling
|
||||
* getChemPotentials() and then dividing by RT. No need for child
|
||||
* classes to handle.
|
||||
* We close the loop on this function, here, calling getChemPotentials() and
|
||||
* then dividing by RT. No need for child classes to handle.
|
||||
*
|
||||
* @param mu Output vector of non-dimensional species chemical potentials
|
||||
* Length: m_kk.
|
||||
|
|
@ -135,125 +87,39 @@ public:
|
|||
//@}
|
||||
|
||||
/*!
|
||||
* @name Properties of the Standard State of the Species in the Solution (VPStandardStateTP)
|
||||
* @name Properties of the Standard State of the Species in the Solution
|
||||
*
|
||||
* Within VPStandardStateTP, these properties are calculated via a common routine,
|
||||
* _updateStandardStateThermo(), which must be overloaded in inherited
|
||||
* objects. The values are cached within this object, and are not
|
||||
* Within VPStandardStateTP, these properties are calculated via a common
|
||||
* routine, _updateStandardStateThermo(), which must be overloaded in
|
||||
* inherited objects. The values are cached within this object, and are not
|
||||
* recalculated unless the temperature or pressure changes.
|
||||
*/
|
||||
//@{
|
||||
|
||||
//!Get the array of chemical potentials at unit activity.
|
||||
/*!
|
||||
* These are the standard state chemical potentials \f$ \mu^0_k(T,P)
|
||||
* \f$. The values are evaluated at the current temperature and pressure.
|
||||
*
|
||||
* @param mu Output vector of standard state chemical potentials.
|
||||
* length = m_kk. units are J / kmol.
|
||||
*/
|
||||
virtual void getStandardChemPotentials(doublereal* mu) const;
|
||||
|
||||
/**
|
||||
* Get the nondimensional Enthalpy functions for the species
|
||||
* at their standard states at the current
|
||||
* <I>T</I> and <I>P</I> of the solution.
|
||||
*
|
||||
* @param hrt Output vector of standard state enthalpies.
|
||||
* length = m_kk. units are unitless.
|
||||
*/
|
||||
virtual void getEnthalpy_RT(doublereal* hrt) const;
|
||||
|
||||
/**
|
||||
* Get the array of nondimensional Enthalpy functions for the
|
||||
* standard state species
|
||||
* at the current <I>T</I> and <I>P</I> of the solution.
|
||||
*
|
||||
* @param sr Output vector of nondimensional standard state
|
||||
* entropies. length = m_kk.
|
||||
*/
|
||||
virtual void getEntropy_R(doublereal* sr) const;
|
||||
|
||||
/**
|
||||
* Get the nondimensional Gibbs functions for the species
|
||||
* at their standard states of solution at the current T and P
|
||||
* of the solution.
|
||||
*
|
||||
* @param grt Output vector of nondimensional standard state
|
||||
* Gibbs free energies. length = m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT(doublereal* grt) const;
|
||||
|
||||
//! Get the standard state Gibbs functions for each species
|
||||
//! at the current T and P.
|
||||
/*!
|
||||
* (Note resolved at this level)
|
||||
*
|
||||
* @param gpure Output vector of standard state
|
||||
* Gibbs free energies. length = m_kk.
|
||||
* units are J/kmol.
|
||||
*/
|
||||
void getPureGibbs(doublereal* gpure) const;
|
||||
|
||||
/**
|
||||
* Returns the vector of nondimensional
|
||||
* internal Energies of the standard state at the current temperature
|
||||
* and pressure of the solution for each species.
|
||||
* \f[
|
||||
* u^{ss}_k(T,P) = h^{ss}_k(T) - P * V^{ss}_k
|
||||
* \f]
|
||||
*
|
||||
* @param urt Output vector of nondimensional standard state
|
||||
* internal energies. length = m_kk.
|
||||
*/
|
||||
virtual void getIntEnergy_RT(doublereal* urt) const;
|
||||
|
||||
/**
|
||||
* Get the nondimensional Heat Capacities at constant
|
||||
* pressure for the standard state of the species
|
||||
* at the current T and P.
|
||||
*
|
||||
* This is redefined here to call the internal function, _updateStandardStateThermo(),
|
||||
* which calculates all standard state properties at the same time.
|
||||
*
|
||||
* @param cpr Output vector containing the
|
||||
* the nondimensional Heat Capacities at constant
|
||||
* pressure for the standard state of the species.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getCp_R(doublereal* cpr) const;
|
||||
|
||||
//! Get the molar volumes of each species in their standard
|
||||
//! states at the current
|
||||
//! <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* units = m^3 / kmol
|
||||
*
|
||||
* This is redefined here to call the internal function, _updateStandardStateThermo(),
|
||||
* which calculates all standard state properties at the same time.
|
||||
*
|
||||
* @param vol Output vector of species volumes. length = m_kk.
|
||||
* units = m^3 / kmol
|
||||
*/
|
||||
virtual void getStandardVolumes(doublereal* vol) const;
|
||||
virtual const vector_fp& getStandardVolumes() const;
|
||||
|
||||
//! Set the temperature of the phase
|
||||
/*!
|
||||
* Currently this passes down to setState_TP(). It does not
|
||||
* make sense to calculate the standard state without first
|
||||
* setting T and P.
|
||||
* Currently this passes down to setState_TP(). It does not make sense to
|
||||
* calculate the standard state without first setting T and P.
|
||||
*
|
||||
* @param temp Temperature (kelvin)
|
||||
*/
|
||||
virtual void setTemperature(const doublereal temp);
|
||||
|
||||
//! Set the internally stored pressure (Pa) at constant
|
||||
//! temperature and composition
|
||||
//! Set the internally stored pressure (Pa) at constant temperature and
|
||||
//! composition
|
||||
/*!
|
||||
* Currently this passes down to setState_TP(). It does not
|
||||
* make sense to calculate the standard state without first
|
||||
* setting T and P.
|
||||
* Currently this passes down to setState_TP(). It does not make sense to
|
||||
* calculate the standard state without first setting T and P.
|
||||
*
|
||||
* @param p input Pressure (Pa)
|
||||
*/
|
||||
|
|
@ -261,8 +127,8 @@ public:
|
|||
|
||||
//! Set the temperature and pressure at the same time
|
||||
/*!
|
||||
* Note this function triggers a reevaluation of the standard
|
||||
* state quantities.
|
||||
* Note this function triggers a reevaluation of the standard state
|
||||
* quantities.
|
||||
*
|
||||
* @param T temperature (kelvin)
|
||||
* @param pres pressure (pascal)
|
||||
|
|
@ -282,11 +148,10 @@ public:
|
|||
|
||||
//! Updates the standard state thermodynamic functions at the current T and P of the solution.
|
||||
/*!
|
||||
* If m_useTmpStandardStateStorage is true,
|
||||
* this function must be called for every call to functions in this
|
||||
* class. It checks to see whether the temperature or pressure has changed and
|
||||
* thus the ss thermodynamics functions for all of the species
|
||||
* must be recalculated.
|
||||
* If m_useTmpStandardStateStorage is true, this function must be called for
|
||||
* every call to functions in this class. It checks to see whether the
|
||||
* temperature or pressure has changed and thus the ss thermodynamics
|
||||
* functions for all of the species must be recalculated.
|
||||
*
|
||||
* This function is responsible for updating the following internal members,
|
||||
* when m_useTmpStandardStateStorage is true.
|
||||
|
|
@ -306,8 +171,8 @@ public:
|
|||
|
||||
protected:
|
||||
/**
|
||||
* Calculate the density of the mixture using the partial
|
||||
* molar volumes and mole fractions as input
|
||||
* Calculate the density of the mixture using the partial molar volumes and
|
||||
* mole fractions as input.
|
||||
*
|
||||
* The formula for this is
|
||||
*
|
||||
|
|
@ -315,22 +180,20 @@ protected:
|
|||
* \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}}
|
||||
* \f]
|
||||
*
|
||||
* where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are
|
||||
* the molecular weights, and \f$V_k\f$ are the pure species
|
||||
* molar volumes.
|
||||
* where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular
|
||||
* weights, and \f$V_k\f$ are the pure species molar volumes.
|
||||
*
|
||||
* Note, the basis behind this formula is that in an ideal
|
||||
* solution the partial molar volumes are equal to the pure
|
||||
* species molar volumes. We have additionally specified
|
||||
* in this class that the pure species molar volumes are
|
||||
* independent of temperature and pressure.
|
||||
* Note, the basis behind this formula is that in an ideal solution the
|
||||
* partial molar volumes are equal to the pure species molar volumes. We
|
||||
* have additionally specified in this class that the pure species molar
|
||||
* volumes are independent of temperature and pressure.
|
||||
*
|
||||
* NOTE: This is a non-virtual function, which is not a
|
||||
* member of the ThermoPhase base class.
|
||||
* NOTE: This function is not a member of the ThermoPhase base class.
|
||||
*/
|
||||
virtual void calcDensity();
|
||||
|
||||
//! Updates the standard state thermodynamic functions at the current T and P of the solution.
|
||||
//! Updates the standard state thermodynamic functions at the current T and
|
||||
//! P of the solution.
|
||||
/*!
|
||||
* @internal
|
||||
*
|
||||
|
|
@ -354,98 +217,31 @@ protected:
|
|||
virtual void _updateStandardStateThermo() const;
|
||||
|
||||
public:
|
||||
/// @name Thermodynamic Values for the Species Reference States (VPStandardStateTP)
|
||||
/// @name Thermodynamic Values for the Species Reference States
|
||||
/*!
|
||||
* There are also temporary
|
||||
* variables for holding the species reference-state values of Cp, H, S, and V at the
|
||||
* last temperature and reference pressure called. These functions are not recalculated
|
||||
* if a new call is made using the previous temperature.
|
||||
* All calculations are done within the routine _updateRefStateThermo().
|
||||
* There are also temporary variables for holding the species reference-
|
||||
* state values of Cp, H, S, and V at the last temperature and reference
|
||||
* pressure called. These functions are not recalculated if a new call is
|
||||
* made using the previous temperature. All calculations are done within the
|
||||
* routine _updateRefStateThermo().
|
||||
*/
|
||||
//@{
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! enthalpies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
/*!
|
||||
* @param hrt Output vector contains the nondimensional enthalpies
|
||||
* of the reference state of the species
|
||||
* length = m_kk, units = dimensionless.
|
||||
*/
|
||||
virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
|
||||
|
||||
//! Modify the value of the 298 K Heat of Formation of the standard state of
|
||||
//! one species in the phase (J kmol-1)
|
||||
/*!
|
||||
* The 298K heat of formation is defined as the enthalpy change to create the standard state
|
||||
* of the species from its constituent elements in their standard states at 298 K and 1 bar.
|
||||
*
|
||||
* @param k Index of the species
|
||||
* @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar.
|
||||
* units = J/kmol.
|
||||
*/
|
||||
void modifyOneHf298SS(const size_t k, const doublereal Hf298New);
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! Gibbs free energies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
/*!
|
||||
* @param grt Output vector contains the nondimensional Gibbs free energies
|
||||
* of the reference state of the species
|
||||
* length = m_kk, units = dimensionless.
|
||||
*/
|
||||
virtual void getGibbs_RT_ref(doublereal* grt) const;
|
||||
|
||||
protected:
|
||||
const vector_fp& Gibbs_RT_ref() const;
|
||||
|
||||
public:
|
||||
/*!
|
||||
* Returns the vector of the
|
||||
* Gibbs function of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
* units = J/kmol
|
||||
*
|
||||
* @param g Output vector contain the Gibbs free energies
|
||||
* of the reference state of the species
|
||||
* length = m_kk, units = J/kmol.
|
||||
*/
|
||||
virtual void getGibbs_ref(doublereal* g) const;
|
||||
|
||||
/*!
|
||||
* Returns the vector of nondimensional
|
||||
* entropies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*
|
||||
* @param er Output vector contain the nondimensional entropies
|
||||
* of the species in their reference states
|
||||
* length: m_kk, units: dimensionless.
|
||||
*/
|
||||
virtual void getEntropy_R_ref(doublereal* er) const;
|
||||
|
||||
/*!
|
||||
* Returns the vector of nondimensional
|
||||
* constant pressure heat capacities of the reference state
|
||||
* at the current temperature of the solution
|
||||
* and reference pressure for the species.
|
||||
*
|
||||
* @param cprt Output vector contains the nondimensional heat capacities
|
||||
* of the species in their reference states
|
||||
* length: m_kk, units: dimensionless.
|
||||
*/
|
||||
virtual void getCp_R_ref(doublereal* cprt) const;
|
||||
|
||||
//! Get the molar volumes of the species reference states at the current
|
||||
//! <I>T</I> and <I>P_ref</I> of the solution.
|
||||
/*!
|
||||
* units = m^3 / kmol
|
||||
*
|
||||
* @param vol Output vector containing the standard state volumes.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getStandardVolumes_ref(doublereal* vol) const;
|
||||
//@}
|
||||
|
||||
//! @name Initialization Methods - For Internal use (VPStandardState)
|
||||
//! @name Initialization Methods - For Internal use
|
||||
/*!
|
||||
* The following methods are used in the process of constructing
|
||||
* the phase and setting its parameters from a specification in an
|
||||
|
|
@ -455,33 +251,6 @@ public:
|
|||
//@{
|
||||
|
||||
virtual void initThermo();
|
||||
|
||||
//! Initialize a ThermoPhase object, potentially reading activity
|
||||
//! coefficient information from an XML database.
|
||||
/*!
|
||||
* This routine initializes the lengths in the current object and
|
||||
* then calls the parent routine.
|
||||
* This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
* species have been added. For example, it might be used to
|
||||
* resize internal work arrays that must have an entry for
|
||||
* each species. The base class implementation does nothing,
|
||||
* and subclasses that do not require initialization do not
|
||||
* need to overload this method. When importing a CTML phase
|
||||
* description, this method is called just prior to returning
|
||||
* from function importPhase().
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a
|
||||
* complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
using Phase::addSpecies;
|
||||
|
|
@ -495,7 +264,7 @@ public:
|
|||
|
||||
//! Return a pointer to the VPSSMgr for this phase
|
||||
/*!
|
||||
* @return Returns a pointer to the VPSSMgr for this phase
|
||||
* @returns a pointer to the VPSSMgr for this phase
|
||||
*/
|
||||
VPSSMgr* provideVPSSMgr();
|
||||
|
||||
|
|
@ -507,18 +276,19 @@ public:
|
|||
protected:
|
||||
//! Current value of the pressure - state variable
|
||||
/*!
|
||||
* Because we are now using the pressure as a state variable, we need to carry it
|
||||
* along within this object
|
||||
* Because we are now using the pressure as a state variable, we need to
|
||||
* carry it along within this object
|
||||
*
|
||||
* units = Pascals
|
||||
*/
|
||||
doublereal m_Pcurrent;
|
||||
|
||||
//! The last temperature at which the standard statethermodynamic properties were calculated at.
|
||||
//! The last temperature at which the standard statethermodynamic properties
|
||||
//! were calculated at.
|
||||
mutable doublereal m_Tlast_ss;
|
||||
|
||||
//! The last pressure at which the Standard State thermodynamic
|
||||
//! properties were calculated at.
|
||||
//! The last pressure at which the Standard State thermodynamic properties
|
||||
//! were calculated at.
|
||||
mutable doublereal m_Plast_ss;
|
||||
|
||||
/*!
|
||||
|
|
@ -534,9 +304,8 @@ protected:
|
|||
|
||||
//! Storage for the PDSS objects for the species
|
||||
/*!
|
||||
* Storage is in species index order.
|
||||
* VPStandardStateTp owns each of the objects.
|
||||
* Copy operations are deep.
|
||||
* Storage is in species index order. VPStandardStateTp owns each of the
|
||||
* objects. Copy operations are deep.
|
||||
*/
|
||||
std::vector<PDSS*> m_PDSS_storage;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -20,64 +20,61 @@ namespace Cantera
|
|||
|
||||
class WaterPropsIAPWS;
|
||||
class WaterProps;
|
||||
//! Class for single-component water. This is designed to cover just the
|
||||
//! liquid part of water.
|
||||
//! Class for single-component water. This is designed to cover just the liquid
|
||||
//! part of water.
|
||||
/*!
|
||||
* The reference is W. Wagner, A. Prub, "The IAPWS Formulation 1995 for the Thermodynamic
|
||||
* Properties of Ordinary Water Substance for General and Scientific Use,"
|
||||
* J. Phys. Chem. Ref. Dat, 31, 387, 2002.
|
||||
* The reference is W. Wagner, A. Prub, "The IAPWS Formulation 1995 for the
|
||||
* Thermodynamic Properties of Ordinary Water Substance for General and
|
||||
* Scientific Use," J. Phys. Chem. Ref. Dat, 31, 387, 2002.
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Specification of Species Standard State Properties </H2>
|
||||
* <HR>
|
||||
*
|
||||
* The offsets used in the steam tables are different than NIST's.
|
||||
* They assume u_liq(TP) = 0.0, s_liq(TP) = 0.0, where TP is the
|
||||
* triple point conditions:
|
||||
* The offsets used in the steam tables are different than NIST's. They assume
|
||||
* u_liq(TP) = 0.0, s_liq(TP) = 0.0, where TP is the triple point conditions:
|
||||
*
|
||||
* - u(273.16, rho) = 0.0
|
||||
* - s(273.16, rho) = 0.0
|
||||
* - psat(273.16) = 611.655 Pascal
|
||||
* - rho(273.16, psat) = 999.793 kg m-3
|
||||
*
|
||||
* These "steam table" assumptions are used by the WaterPropsIAPWS class.
|
||||
* Therefore, offsets must be calculated to make the thermodynamic
|
||||
* properties calculated within this class to be consistent with
|
||||
* thermo properties within Cantera.
|
||||
* These "steam table" assumptions are used by the WaterPropsIAPWS class.
|
||||
* Therefore, offsets must be calculated to make the thermodynamic properties
|
||||
* calculated within this class to be consistent with thermo properties within
|
||||
* Cantera.
|
||||
*
|
||||
* The thermodynamic base state for water is set to the NIST basis here
|
||||
* by specifying constants, #EW_Offset and #SW_Offset, one for energy
|
||||
* quantities and one for entropy quantities. The offsets are
|
||||
* specified so that the following properties hold:
|
||||
* The thermodynamic base state for water is set to the NIST basis here by
|
||||
* specifying constants, #EW_Offset and #SW_Offset, one for energy quantities
|
||||
* and one for entropy quantities. The offsets are specified so that the
|
||||
* following properties hold:
|
||||
*
|
||||
* - Delta_Hfo_idealgas(298.15) = -241.826 kJ/gmol
|
||||
* - So_idealgas(298.15, 1bar) = 188.835 J/gmolK
|
||||
* - Delta_Hfo_idealgas(298.15) = -241.826 kJ/gmol
|
||||
* - So_idealgas(298.15, 1bar) = 188.835 J/gmolK
|
||||
*
|
||||
* (From http://webbook.nist.gov)
|
||||
* (From http://webbook.nist.gov)
|
||||
*
|
||||
* The "o" here refers to a hypothetical ideal gas state. The way
|
||||
* we achieve this in practice is to evaluate at a very low pressure
|
||||
* and then use the theoretical ideal gas results to scale up to
|
||||
* higher pressures:
|
||||
* The "o" here refers to a hypothetical ideal gas state. The way we achieve
|
||||
* this in practice is to evaluate at a very low pressure and then use the
|
||||
* theoretical ideal gas results to scale up to higher pressures:
|
||||
*
|
||||
* Ho(1bar) = H(P0)
|
||||
* Ho(1bar) = H(P0)
|
||||
*
|
||||
* So(1bar) = S(P0) + RT ln(1bar/P0)
|
||||
* So(1bar) = S(P0) + RT ln(1bar/P0)
|
||||
*
|
||||
* <HR>
|
||||
* <H2> %Application within Kinetics Managers </H2>
|
||||
* <HR>
|
||||
*
|
||||
* This is unimplemented.
|
||||
* This is unimplemented.
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Instantiation of the Class </H2>
|
||||
* <HR>
|
||||
*
|
||||
* The constructor for this phase is NOT located in the default ThermoFactory
|
||||
* for %Cantera. However, a new WaterSSTP object may be created by
|
||||
* the following code snippets, combined with an XML file given in the
|
||||
* XML example section.
|
||||
* for %Cantera. However, a new WaterSSTP object may be created by the following
|
||||
* code snippets, combined with an XML file given in the XML example section.
|
||||
*
|
||||
* @code
|
||||
* WaterSSTP *w = new WaterSSTP("waterSSTPphase.xml","");
|
||||
|
|
@ -102,8 +99,8 @@ class WaterProps;
|
|||
* <H2> XML Example </H2>
|
||||
* <HR>
|
||||
*
|
||||
* An example of an XML Element named phase setting up a WaterSSTP object with
|
||||
* id "water" is given below.
|
||||
* An example of an XML Element named phase setting up a WaterSSTP object with
|
||||
* id "water" is given below.
|
||||
*
|
||||
* @code
|
||||
* <!-- phase water -->
|
||||
|
|
@ -129,11 +126,9 @@ public:
|
|||
//! Base constructor
|
||||
WaterSSTP();
|
||||
|
||||
//! Copy constructor
|
||||
WaterSSTP(const WaterSSTP&);
|
||||
|
||||
//! Assignment operator
|
||||
WaterSSTP& operator=(const WaterSSTP&);
|
||||
ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//! Full constructor for a water phase
|
||||
/*!
|
||||
|
|
@ -149,9 +144,6 @@ public:
|
|||
*/
|
||||
explicit WaterSSTP(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
//! Duplicator from a ThermoPhase object
|
||||
ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
virtual int eosType() const {
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -167,187 +159,52 @@ public:
|
|||
|
||||
virtual doublereal pressure() const;
|
||||
virtual void setPressure(doublereal p);
|
||||
|
||||
//! Returns the isothermal compressibility. Units: 1/Pa.
|
||||
/*!
|
||||
* The isothermal compressibility is defined as
|
||||
* \f[
|
||||
* \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
|
||||
* \f]
|
||||
* or
|
||||
* \f[
|
||||
* \kappa_T = \frac{1}{\rho}\left(\frac{\partial \rho}{\partial P}\right)_T
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal isothermalCompressibility() const;
|
||||
|
||||
//! Return the volumetric thermal expansion coefficient. Units: 1/K.
|
||||
/*!
|
||||
* The thermal expansion coefficient is defined as
|
||||
* \f[
|
||||
* \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal thermalExpansionCoeff() const;
|
||||
|
||||
//! Return the derivative of the volumetric thermal expansion coefficient. Units: 1/K2.
|
||||
/*!
|
||||
* The thermal expansion coefficient is defined as
|
||||
* \f[
|
||||
* \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
|
||||
* \f]
|
||||
*/
|
||||
//! Return the derivative of the volumetric thermal expansion coefficient.
|
||||
//! Units: 1/K2.
|
||||
virtual doublereal dthermalExpansionCoeffdT() const;
|
||||
|
||||
//! @}
|
||||
//! @name Properties of the Standard State of the Species in the Solution
|
||||
//! @{
|
||||
|
||||
//! Get the Gibbs function for the species
|
||||
//! standard states at the current T and P of the solution.
|
||||
/*!
|
||||
* @param gss Vector of length m_kk, which on return
|
||||
* will contain the
|
||||
* standard state Gibbs function for species <I>k</I>.
|
||||
*/
|
||||
virtual void getStandardChemPotentials(doublereal* gss) const;
|
||||
|
||||
//!Get the nondimensional Gibbs function for the species
|
||||
//! standard states at the current T and P of the solution.
|
||||
/*!
|
||||
* @param grt Vector of length m_kk, which on return
|
||||
* will contain the nondimensional
|
||||
* standard state Gibbs function for species <I>k</I>
|
||||
*/
|
||||
virtual void getGibbs_RT(doublereal* grt) const;
|
||||
|
||||
//! Get the array of nondimensional Enthalpy functions for the standard state species
|
||||
//! at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* @param hrt Vector of length m_kk, which on return
|
||||
* will contain the nondimensional
|
||||
* standard state enthalpy of species <I>k</I>
|
||||
*/
|
||||
void getEnthalpy_RT(doublereal* hrt) const;
|
||||
|
||||
//! Get the nondimensional Entropies for the species
|
||||
//! standard states at the current T and P of the solution.
|
||||
/*!
|
||||
* @param sr Vector of length m_kk, which on return
|
||||
* will contain the nondimensional
|
||||
* standard state entropy for species<I>k</I>
|
||||
*/
|
||||
void getEntropy_R(doublereal* sr) const;
|
||||
|
||||
//! Get the nondimensional heat capacity at constant pressure
|
||||
//! function for the species standard states at the current T and P of the solution.
|
||||
/*!
|
||||
* @param cpr Vector of length m_kk, which on return
|
||||
* will contain the nondimensional
|
||||
* constant pressure heat capacity for species <I>k</I>
|
||||
*/
|
||||
virtual void getCp_R(doublereal* cpr) const;
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! internal Energies of the standard state at the current
|
||||
//! temperature and pressure of the solution for each species.
|
||||
/*!
|
||||
* @param urt Output vector of standard state nondimensional internal energies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getIntEnergy_RT(doublereal* urt) const;
|
||||
|
||||
//@}
|
||||
//! @name Thermodynamic Values for the Species Reference State
|
||||
/*!
|
||||
* All functions in this group need to be overrided, because
|
||||
* the m_spthermo SpeciesThermo function is not adequate for
|
||||
* the real equation of state.
|
||||
* All functions in this group need to be overrided, because the
|
||||
* m_spthermo SpeciesThermo function is not adequate for the real equation
|
||||
* of state.
|
||||
*/
|
||||
//@{
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! enthalpies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
/*!
|
||||
* @param hrt Output vector containing the nondimensional reference state enthalpies
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
|
||||
|
||||
/*!
|
||||
* Returns the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*
|
||||
* @param grt Output vector containing the nondimensional reference state
|
||||
* Gibbs Free energies. Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT_ref(doublereal* grt) const;
|
||||
|
||||
/*!
|
||||
* Returns the vector of the Gibbs function of the reference state at the
|
||||
* current temperature of the solution and the reference pressure for the
|
||||
* species. units = J/kmol
|
||||
*
|
||||
* @param g Output vector containing the reference state
|
||||
* Gibbs Free energies. Length: m_kk. Units: J/kmol.
|
||||
*/
|
||||
virtual void getGibbs_ref(doublereal* g) const;
|
||||
|
||||
/*!
|
||||
* Returns the vector of nondimensional
|
||||
* entropies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for each species.
|
||||
*
|
||||
* @param er Output vector containing the nondimensional reference state
|
||||
* entropies. Length: m_kk.
|
||||
*/
|
||||
virtual void getEntropy_R_ref(doublereal* er) const;
|
||||
|
||||
/*!
|
||||
* Returns the vector of nondimensional
|
||||
* constant pressure heat capacities of the reference state
|
||||
* at the current temperature of the solution
|
||||
* and reference pressure for each species.
|
||||
*
|
||||
* @param cprt Output vector of nondimensional reference state
|
||||
* heat capacities at constant pressure for the species.
|
||||
* Length: m_kk
|
||||
*/
|
||||
virtual void getCp_R_ref(doublereal* cprt) const;
|
||||
|
||||
//! Get the molar volumes of the species reference states at the current
|
||||
//! <I>T</I> and <I>P_ref</I> of the solution.
|
||||
/*!
|
||||
* units = m^3 / kmol
|
||||
*
|
||||
* @param vol Output vector containing the standard state volumes.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getStandardVolumes_ref(doublereal* vol) const;
|
||||
//! @}
|
||||
|
||||
/// critical temperature
|
||||
virtual doublereal critTemperature() const;
|
||||
|
||||
/// critical pressure
|
||||
virtual doublereal critPressure() const;
|
||||
|
||||
/// critical density
|
||||
virtual doublereal critDensity() const;
|
||||
|
||||
/// saturation pressure
|
||||
/*!
|
||||
* @param t Temperature (kelvin)
|
||||
*/
|
||||
virtual doublereal satPressure(doublereal t);
|
||||
|
||||
//! Return the fraction of vapor at the current conditions
|
||||
/*!
|
||||
* Below Tcrit, this routine will always return 0, by definition
|
||||
* of the functionality of the routine. Above Tcrit, we query
|
||||
* the density to toggle between 0 and 1.
|
||||
* Below Tcrit, this routine will always return 0, by definition of the
|
||||
* functionality of the routine. Above Tcrit, we query the density to toggle
|
||||
* between 0 and 1.
|
||||
*/
|
||||
virtual doublereal vaporFraction() const;
|
||||
|
||||
|
|
@ -369,49 +226,7 @@ public:
|
|||
*/
|
||||
virtual void setDensity(const doublereal dens);
|
||||
|
||||
//!Import and initialize a ThermoPhase object using an XML tree.
|
||||
/*!
|
||||
* @internal
|
||||
*
|
||||
* Here we read extra information about the XML description
|
||||
* of a phase. Regular information about elements and species
|
||||
* and their reference state thermodynamic information
|
||||
* have already been read at this point.
|
||||
* For example, we do not need to call this function for
|
||||
* ideal gas equations of state. This function is called from importPhase()
|
||||
* after the elements and the species are initialized with
|
||||
* default ideal solution level data.
|
||||
*
|
||||
* The default implementation in ThermoPhase calls the
|
||||
* virtual function initThermo() and then sets the "state" of the
|
||||
* phase by looking for an XML element named "state", and then
|
||||
* interpreting its contents by calling the virtual function
|
||||
* setStateFromXML().
|
||||
*
|
||||
* @param phaseNode This object must be the phase node of a
|
||||
* complete XML tree
|
||||
* description of the phase, including all of the
|
||||
* species data. In other words while "phase" must
|
||||
* point to an XML phase object, it must have
|
||||
* sibling nodes "speciesData" that describe
|
||||
* the species in the phase.
|
||||
* @param id ID of the phase. If nonnull, a check is done
|
||||
* to see if phaseNode is pointing to the phase
|
||||
* with the correct id.
|
||||
*/
|
||||
virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
//! Set equation of state parameter values from XML entries.
|
||||
/*!
|
||||
* This method is called by function importPhase() when processing a phase
|
||||
* definition in an input file. It should be overloaded in subclasses to set
|
||||
* any parameters that are specific to that particular phase
|
||||
* model. Note, this method is called before the phase is
|
||||
* initialized with elements and/or species.
|
||||
*
|
||||
* @param eosdata An XML_Node object corresponding to
|
||||
* the "thermo" entry for this phase in the input file.
|
||||
*/
|
||||
virtual void setParametersFromXML(const XML_Node& eosdata);
|
||||
|
||||
//! Get a pointer to a changeable WaterPropsIAPWS object
|
||||
|
|
@ -426,9 +241,8 @@ public:
|
|||
|
||||
protected:
|
||||
/**
|
||||
* @internal
|
||||
* This internal routine must be overwritten because
|
||||
* it is not applicable.
|
||||
* @internal This internal routine must be overwritten because it is not
|
||||
* applicable.
|
||||
*/
|
||||
void _updateThermo() const;
|
||||
|
||||
|
|
@ -438,11 +252,9 @@ private:
|
|||
|
||||
//! Pointer to the WaterProps object
|
||||
/*!
|
||||
* This class is used to house several approximation
|
||||
* routines for properties of water.
|
||||
*
|
||||
* This object owns m_waterProps, and the WaterPropsIAPWS object used by
|
||||
* WaterProps is m_sub, which is defined above.
|
||||
* This class is used to house several approximation routines for properties
|
||||
* of water. This object owns m_waterProps, and the WaterPropsIAPWS object
|
||||
* used by WaterProps is m_sub, which is defined above.
|
||||
*/
|
||||
std::unique_ptr<WaterProps> m_waterProps;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
/**
|
||||
* @file MixedSolventElectrolyte.cpp
|
||||
* Definitions for ThermoPhase object for phases which
|
||||
* employ excess Gibbs free energy formulations related to Margules
|
||||
* expansions (see \ref thermoprops
|
||||
* and class \link Cantera::MargulesVPSSTP MargulesVPSSTP\endlink).
|
||||
* @file MixedSolventElectrolyte.cpp see \ref thermoprops and class \link
|
||||
* Cantera::MixedSolventElectrolyte MixedSolventElectrolyte \endlink).
|
||||
*/
|
||||
/*
|
||||
* Copyright (2009) Sandia Corporation. Under the terms of
|
||||
|
|
|
|||
|
|
@ -4,11 +4,6 @@
|
|||
* employ molality based activity coefficient formulations
|
||||
* (see \ref thermoprops
|
||||
* and class \link Cantera::MolalityVPSSTP MolalityVPSSTP\endlink).
|
||||
*
|
||||
* Header file for a derived class of ThermoPhase that handles variable pressure
|
||||
* standard state methods for calculating thermodynamic properties that are
|
||||
* further based upon activities based on the molality scale. These include
|
||||
* most of the methods for calculating liquid electrolyte thermodynamics.
|
||||
*/
|
||||
/*
|
||||
* Copyright (2005) Sandia Corporation. Under the terms of
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue