Cleaned up Doxygen docs for class VPStandardStateTP and descendants
This commit is contained in:
parent
05abe9d361
commit
da33cc66c3
29 changed files with 922 additions and 6367 deletions
|
|
@ -81,7 +81,7 @@ class PDSS_Water;
|
|||
* The enthalpy function is given by the following relation.
|
||||
*
|
||||
* \f[
|
||||
* \raggedright h^\triangle_k(T,P) = h^{\triangle,ref}_k(T)
|
||||
* h^\triangle_k(T,P) = h^{\triangle,ref}_k(T)
|
||||
* + \tilde v \left( P - P_{ref} \right)
|
||||
* \f]
|
||||
*
|
||||
|
|
@ -201,7 +201,7 @@ class PDSS_Water;
|
|||
* \f$ I_s \f$ we need to
|
||||
* catalog all species in the phase. This is done using the following categories:
|
||||
*
|
||||
* - <B>cEST_solvent</B> : Solvent species (neutral)
|
||||
* - <B>cEST_solvent</B> Solvent species (neutral)
|
||||
* - <B>cEST_chargedSpecies</B> Charged species (charged)
|
||||
* - <B>cEST_weakAcidAssociated</B> Species which can break apart into charged species.
|
||||
* It may or may not be charged. These may or
|
||||
|
|
@ -249,8 +249,7 @@ class PDSS_Water;
|
|||
*
|
||||
* DHFORM_DILUTE_LIMIT = 0
|
||||
*
|
||||
* This form assumes a dilute limit to DH, and is mainly
|
||||
* for informational purposes:
|
||||
* This form assumes a dilute limit to DH, and is mainly for informational purposes:
|
||||
* \f[
|
||||
* \ln(\gamma_k^\triangle) = - z_k^2 A_{Debye} \sqrt{I}
|
||||
* \f]
|
||||
|
|
@ -278,10 +277,9 @@ class PDSS_Water;
|
|||
* + \log(10) B^{dot}_k I
|
||||
* \f]
|
||||
*
|
||||
* Note, this particular form where \f$ a_k \f$ can differ in
|
||||
* multielectrolyte
|
||||
* solutions has problems with respect to a Gibbs-Duhem analysis. However,
|
||||
* we include it here because there is a lot of data fit to it.
|
||||
* Note, this particular form where \f$ a_k \f$ can differ in multielectrolyte
|
||||
* solutions has problems with respect to a Gibbs-Duhem analysis. However,
|
||||
* we include it here because there is a lot of data fit to it.
|
||||
*
|
||||
* The activity for the solvent water,\f$ a_o \f$, is not independent and must be
|
||||
* determined from the Gibbs-Duhem relation. Here, we use:
|
||||
|
|
@ -305,15 +303,14 @@ class PDSS_Water;
|
|||
*
|
||||
* DHFORM_BDOT_AUNIFORM = 2
|
||||
*
|
||||
* This form assumes Bethke's format for the Debye-Huckel activity coefficient
|
||||
* This form assumes Bethke's format for the Debye-Huckel activity coefficient
|
||||
*
|
||||
* \f[
|
||||
* \ln(\gamma_k^\triangle) = -z_k^2 \frac{A_{Debye} \sqrt{I}}{ 1 + B_{Debye} a \sqrt{I}}
|
||||
* + \log(10) B^{dot}_k I
|
||||
* \f]
|
||||
*
|
||||
* The value of a is determined at the beginning of the
|
||||
* calculation, and not changed.
|
||||
* The value of a is determined at the beginning of the calculation, and not changed.
|
||||
*
|
||||
* \f[
|
||||
* \ln(a_o) = \frac{X_o - 1.0}{X_o}
|
||||
|
|
@ -326,19 +323,18 @@ class PDSS_Water;
|
|||
*
|
||||
* DHFORM_BETAIJ = 3
|
||||
*
|
||||
* This form assumes a linear expansion in a virial coefficient form
|
||||
* It is used extensively in the book by Newmann, "Electrochemistry Systems",
|
||||
* and is the beginning of
|
||||
* more complex treatments for stronger electrolytes, fom Pitzer
|
||||
* and from Harvey, Moller, and Weire.
|
||||
* This form assumes a linear expansion in a virial coefficient form.
|
||||
* It is used extensively in the book by Newmann, "Electrochemistry Systems",
|
||||
* and is the beginning of more complex treatments for stronger electrolytes,
|
||||
* fom Pitzer and from Harvey, Moller, and Weire.
|
||||
*
|
||||
* \f[
|
||||
* \ln(\gamma_k^\triangle) = -z_k^2 \frac{A_{Debye} \sqrt{I}}{ 1 + B_{Debye} a \sqrt{I}}
|
||||
* + 2 \sum_j \beta_{j,k} m_j
|
||||
* \f]
|
||||
*
|
||||
* In the current treatment the binary interaction coefficients, \f$ \beta_{j,k}\f$, are
|
||||
* independent of temperature and pressure.
|
||||
* In the current treatment the binary interaction coefficients, \f$ \beta_{j,k}\f$, are
|
||||
* independent of temperature and pressure.
|
||||
*
|
||||
* \f[
|
||||
* \ln(a_o) = \frac{X_o - 1.0}{X_o}
|
||||
|
|
@ -384,9 +380,9 @@ class PDSS_Water;
|
|||
*
|
||||
* DHFORM_PITZER_BETAIJ = 4
|
||||
*
|
||||
* This form assumes an activity coefficient formulation consistent
|
||||
* with a truncated form of Pitzer's formulation. Pitzer's formulation is equivalent
|
||||
* to the formulations above in the dilute limit, where rigorous theory may be applied.
|
||||
* This form assumes an activity coefficient formulation consistent
|
||||
* with a truncated form of Pitzer's formulation. Pitzer's formulation is equivalent
|
||||
* to the formulations above in the dilute limit, where rigorous theory may be applied.
|
||||
*
|
||||
* \f[
|
||||
* \ln(\gamma_k^\triangle) = -z_k^2 \frac{A_{Debye}}{3} \frac{\sqrt{I}}{ 1 + B_{Debye} a \sqrt{I}}
|
||||
|
|
@ -425,23 +421,19 @@ class PDSS_Water;
|
|||
* {\left(\frac{N_a e^2}{\epsilon R T }\right)}^{3/2}
|
||||
* \f]
|
||||
*
|
||||
* Units = sqrt(kg/gmol)
|
||||
* where
|
||||
* - \f$ N_a \f$ is Avogadro's number
|
||||
* - \f$ \rho_w \f$ is the density of water
|
||||
* - \f$ e \f$ is the electronic charge
|
||||
* - \f$ \epsilon = K \epsilon_o \f$ is the permittivity of water
|
||||
* - \f$ K \f$ is the dielectric constant of water
|
||||
* - \f$ \epsilon_o \f$ is the permittivity of free space
|
||||
* - \f$ \rho_o \f$ is the density of the solvent in its standard state.
|
||||
*
|
||||
* where
|
||||
* - \f$ N_a \f$ is Avogadro's number
|
||||
* - \f$ \rho_w \f$ is the density of water
|
||||
* - \f$ e \f$ is the electronic charge
|
||||
* - \f$ \epsilon = K \epsilon_o \f$ is the permittivity of water
|
||||
* where \f$ K \f$ is the dielectric constant of water,
|
||||
* and \f$ \epsilon_o \f$ is the permittivity of free space.
|
||||
* - \f$ \rho_o \f$ is the density of the solvent in its standard state.
|
||||
*
|
||||
* Nominal value at 298 K and 1 atm = 1.172576 (kg/gmol)<SUP>1/2</SUP>
|
||||
* based on:
|
||||
* - \f$ \epsilon / \epsilon_0 \f$ = 78.54
|
||||
* (water at 25C)
|
||||
* - T = 298.15 K
|
||||
* - B_Debye = 3.28640E9 (kg/gmol)<SUP>1/2</SUP> m<SUP>-1</SUP>
|
||||
* Nominal value at 298 K and 1 atm = 1.172576 (kg/gmol)<SUP>1/2</SUP> based on:
|
||||
* - \f$ \epsilon / \epsilon_0 \f$ = 78.54 (water at 25C)
|
||||
* - T = 298.15 K
|
||||
* - B_Debye = 3.28640E9 (kg/gmol)<SUP>1/2</SUP> m<SUP>-1</SUP>
|
||||
*
|
||||
* An example of a fixed value implementation is given below.
|
||||
* @code
|
||||
|
|
@ -607,10 +599,8 @@ class PDSS_Water;
|
|||
*/
|
||||
class DebyeHuckel : public MolalityVPSSTP
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Empty Constructor
|
||||
//! Default Constructor
|
||||
DebyeHuckel();
|
||||
|
||||
//! Copy constructor
|
||||
|
|
@ -622,16 +612,14 @@ public:
|
|||
//! Full constructor for creating the phase.
|
||||
/*!
|
||||
* @param inputFile File name containing the XML 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.
|
||||
*/
|
||||
DebyeHuckel(const std::string& inputFile, const std::string& id = "");
|
||||
|
||||
//! Full constructor for creating the phase.
|
||||
/*!
|
||||
* @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.
|
||||
*/
|
||||
DebyeHuckel(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
|
|
@ -648,11 +636,8 @@ public:
|
|||
*/
|
||||
ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
/**
|
||||
*
|
||||
* @name Utilities
|
||||
* @{
|
||||
*/
|
||||
//! @name Utilities
|
||||
//! @{
|
||||
|
||||
/**
|
||||
* Equation of state type flag. The base class returns
|
||||
|
|
@ -662,29 +647,18 @@ public:
|
|||
*/
|
||||
virtual int eosType() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Molar Thermodynamic Properties of the Solution --------------
|
||||
* @{
|
||||
*/
|
||||
//! @}
|
||||
//! @name Molar Thermodynamic Properties of the Solution
|
||||
//! @{
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
/**
|
||||
* Molar enthalpy of the solution. Units: J/kmol.
|
||||
* (HKM -> Bump up to Parent object)
|
||||
*/
|
||||
/// Molar enthalpy of the solution. Units: J/kmol.
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
|
||||
/// Molar internal energy. Units: J/kmol.
|
||||
/**
|
||||
* Molar internal energy of the solution. Units: J/kmol.
|
||||
* (HKM -> Bump up to Parent object)
|
||||
*/
|
||||
/// Molar internal energy of the solution. Units: J/kmol.
|
||||
virtual doublereal intEnergy_mole() const;
|
||||
|
||||
/// Molar entropy. Units: J/kmol/K.
|
||||
/**
|
||||
* 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[
|
||||
|
|
@ -697,15 +671,10 @@ public:
|
|||
* property manager. The pure species entropies are independent of
|
||||
* temperature since the volume expansivities are equal to zero.
|
||||
* @see SpeciesThermo
|
||||
*
|
||||
* (HKM -> Bump up to Parent object)
|
||||
*/
|
||||
virtual doublereal entropy_mole() const;
|
||||
|
||||
/// Molar Gibbs function. Units: J/kmol.
|
||||
/*
|
||||
* (HKM -> Bump up to Parent object)
|
||||
*/
|
||||
virtual doublereal gibbs_mole() const;
|
||||
|
||||
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
|
|
@ -718,7 +687,7 @@ public:
|
|||
virtual doublereal cv_mole() const;
|
||||
|
||||
//@}
|
||||
/** @name Mechanical Equation of State Properties -------------------------
|
||||
/** @name Mechanical Equation of State Properties
|
||||
//@{
|
||||
*
|
||||
* In this equation of state implementation, the density is a
|
||||
|
|
@ -787,14 +756,10 @@ public:
|
|||
* This function will now throw an error condition if the
|
||||
* input isn't exactly equal to the current density.
|
||||
*
|
||||
*
|
||||
* @todo Now have a compressible ss equation for liquid water.
|
||||
* Therefore, this phase is compressible. May still
|
||||
* want to change the independent variable however.
|
||||
*
|
||||
* NOTE: This is an overwritten function from the State.h
|
||||
* class
|
||||
*
|
||||
* @param rho Input density (kg/m^3).
|
||||
*/
|
||||
void setDensity(const doublereal rho);
|
||||
|
|
@ -807,22 +772,16 @@ public:
|
|||
* This function will now throw an error condition if the input
|
||||
* isn't exactly equal to the current molar density.
|
||||
*
|
||||
* NOTE: This is a virtual function overwritten from the State.h
|
||||
* class
|
||||
*
|
||||
* @param conc Input molar density (kmol/m^3).
|
||||
*/
|
||||
virtual void setMolarDensity(const doublereal conc);
|
||||
|
||||
//! Set the temperature (K)
|
||||
/*!
|
||||
* Overwritten setTemperature(double) from State.h. This
|
||||
* function sets the temperature, and makes sure that
|
||||
* This function sets the temperature, and makes sure that
|
||||
* the value propagates to underlying objects, such as
|
||||
* the water standard state model.
|
||||
*
|
||||
* @todo Make Phase::setTemperature a virtual function
|
||||
*
|
||||
* @param temp Temperature in kelvin
|
||||
*/
|
||||
virtual void setTemperature(const doublereal temp);
|
||||
|
|
@ -842,6 +801,9 @@ public:
|
|||
* \f[
|
||||
* \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.
|
||||
*/
|
||||
virtual doublereal isothermalCompressibility() const;
|
||||
|
||||
|
|
@ -852,20 +814,12 @@ public:
|
|||
* \f[
|
||||
* \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.
|
||||
*/
|
||||
virtual doublereal thermalExpansionCoeff() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Potential Energy
|
||||
*
|
||||
* Species may have an additional potential energy due to the
|
||||
* presence of external gravitation or electric fields. These
|
||||
* methods allow specifying a potential energy for individual
|
||||
* species.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Activities, Standard States, and Activity Concentrations
|
||||
|
|
@ -935,6 +889,10 @@ public:
|
|||
* Inherited classes are responsible for overriding the default
|
||||
* values if necessary.
|
||||
*
|
||||
* On return uA contains the powers of the units (MKS assumed)
|
||||
* of the standard concentrations and generalized concentrations
|
||||
* for the kth species.
|
||||
*
|
||||
* @param uA Output vector containing the units
|
||||
* uA[0] = kmol units - default = 1
|
||||
* uA[1] = m units - default = -nDim(), the number of spatial
|
||||
|
|
@ -959,7 +917,7 @@ public:
|
|||
* derived classes may want to override this default
|
||||
* implementation.
|
||||
*
|
||||
* (note solvent is on molar scale).
|
||||
* (note solvent activity coefficient is on molar scale).
|
||||
*
|
||||
* @param ac Output vector of activities. Length: m_kk.
|
||||
*/
|
||||
|
|
@ -972,6 +930,8 @@ public:
|
|||
* note solvent is on molar scale. The solvent molar
|
||||
* based activity coefficient is returned.
|
||||
*
|
||||
* Note, most of the work is done in an internal private routine
|
||||
*
|
||||
* @param acMolality Vector of Molality-based activity coefficients
|
||||
* Length: m_kk
|
||||
*/
|
||||
|
|
@ -979,7 +939,7 @@ public:
|
|||
getMolalityActivityCoefficients(doublereal* acMolality) const;
|
||||
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution -----------------
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
||||
|
||||
|
|
@ -992,9 +952,6 @@ public:
|
|||
* \f[
|
||||
* \mu_k = \mu^{\triangle}_k(T,P) + R T ln(\gamma_k^{\triangle} m_k)
|
||||
* \f]
|
||||
* or another way to phrase this is
|
||||
*
|
||||
* where
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
|
|
@ -1029,8 +986,9 @@ public:
|
|||
/**
|
||||
* Maxwell's equations provide an insight in how to calculate this
|
||||
* (p.215 Smith and Van Ness)
|
||||
*
|
||||
* d(chemPot_i)/dT = -sbar_i
|
||||
* \f[
|
||||
* \frac{d\mu_i}{dT} = -\bar{s}_i
|
||||
* \f]
|
||||
*
|
||||
* For this phase, the partial molar entropies are equal to the
|
||||
* SS species entropies plus the ideal solution contribution.following
|
||||
|
|
@ -1039,7 +997,7 @@ public:
|
|||
* \bar s_k(T,P) = \hat s^0_k(T) - R log(M0 * molality[k])
|
||||
* \f]
|
||||
* \f[
|
||||
* \bar s_solvent(T,P) = \hat s^0_solvent(T)
|
||||
* \bar s_{solvent}(T,P) = \hat s^0_{solvent}(T)
|
||||
* - R ((xmolSolvent - 1.0) / xmolSolvent)
|
||||
* \f]
|
||||
*
|
||||
|
|
@ -1066,8 +1024,15 @@ public:
|
|||
//! Return an array of partial molar volumes for the
|
||||
//! species in the mixture. Units: m^3/kmol.
|
||||
/*!
|
||||
* For this solution, the partial molar volumes are equal to the
|
||||
* constant species molar volumes.
|
||||
* For this solution, the partial molar volumes are normally
|
||||
* equal to theconstant species molar volumes, except
|
||||
* when the activity coefficients depend on pressure.
|
||||
*
|
||||
* The general relation is
|
||||
*
|
||||
* vbar_i = d(chemPot_i)/dP at const T, n
|
||||
* = V0_i + d(Gex)/dP)_T,M
|
||||
* = V0_i + RT d(lnActCoeffi)dP _T,M
|
||||
*
|
||||
* @param vbar Output vector of species partial molar volumes.
|
||||
* Length = m_kk. units are m^3/kmol.
|
||||
|
|
@ -1076,53 +1041,9 @@ public:
|
|||
|
||||
//@}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
//! Updates the standard state thermodynamic functions at the current T and P of the solution.
|
||||
/*!
|
||||
* @internal
|
||||
*
|
||||
* This function gets called for every call to a public function in this
|
||||
* class. It checks to see whether the temperature or pressure has changed and
|
||||
* thus whether the ss thermodynamics functions must be recalculated.
|
||||
*
|
||||
* @param pres Pressure at which to evaluate the standard states.
|
||||
* The default, indicated by a -1.0, is to use the current pressure
|
||||
*/
|
||||
//virtual void _updateStandardStateThermo() const;
|
||||
|
||||
//@}
|
||||
/// @name Thermodynamic Values for the Species Reference States ---
|
||||
//@{
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// The methods below are not virtual, and should not
|
||||
// be overloaded.
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @name Specific Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @name Setting the State
|
||||
*
|
||||
* These methods set all or part of the thermodynamic
|
||||
* state.
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@}
|
||||
|
||||
/**
|
||||
* @name Chemical Equilibrium
|
||||
* Chemical equilibrium.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
@ -1143,10 +1064,8 @@ public:
|
|||
err("setToEquilState");
|
||||
}
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
//! Set the equation of state parameters
|
||||
/*!
|
||||
* @internal
|
||||
|
|
@ -1177,21 +1096,14 @@ public:
|
|||
* model. Note, this method is called before the phase is
|
||||
* initialized with elements and/or species.
|
||||
*
|
||||
* HKM -> Right now, the parameters are set elsewhere (initThermoXML)
|
||||
* It just didn't seem to fit.
|
||||
*
|
||||
* @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);
|
||||
|
||||
//---------------------------------------------------------
|
||||
/// @name Critical state properties.
|
||||
/// These methods are only implemented by some subclasses.
|
||||
|
||||
//@{
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
/// @name Saturation properties.
|
||||
/// These methods are only implemented by subclasses that
|
||||
/// implement full liquid-vapor equations of state.
|
||||
|
|
@ -1236,12 +1148,10 @@ public:
|
|||
|
||||
//@}
|
||||
|
||||
|
||||
/*
|
||||
* -------------- Utilities -------------------------------
|
||||
*/
|
||||
|
||||
|
||||
//! Initialize the object's internal lengths after species are set
|
||||
/**
|
||||
* @internal Initialize. This method is provided to allow
|
||||
|
|
@ -1292,35 +1202,32 @@ public:
|
|||
* \f[
|
||||
* A_{Debye} = \frac{F e B_{Debye}}{8 \pi \epsilon R T} {\left( C_o \tilde{M}_o \right)}^{1/2}
|
||||
* \f]
|
||||
* where
|
||||
*
|
||||
* where
|
||||
* \f[
|
||||
* B_{Debye} = \frac{F} {{(\frac{\epsilon R T}{2})}^{1/2}}
|
||||
* \f]
|
||||
* Therefore:
|
||||
* \f[
|
||||
* \f[
|
||||
* A_{Debye} = \frac{1}{8 \pi}
|
||||
* {\left(\frac{2 N_a \rho_o}{1000}\right)}^{1/2}
|
||||
* {\left(\frac{N_a e^2}{\epsilon R T }\right)}^{3/2}
|
||||
* \f]
|
||||
* \f]
|
||||
*
|
||||
* Units = sqrt(kg/gmol)
|
||||
* where
|
||||
* - Units = sqrt(kg/gmol)
|
||||
* - \f$ N_a \f$ is Avogadro's number
|
||||
* - \f$ \rho_w \f$ is the density of water
|
||||
* - \f$ e \f$ is the electronic charge
|
||||
* - \f$ \epsilon = K \epsilon_o \f$ is the permittivity of water
|
||||
* - \f$ K \f$ is the dielectric constant of water,
|
||||
* - \f$ \epsilon_o \f$ is the permittivity of free space.
|
||||
* - \f$ \rho_o \f$ is the density of the solvent in its standard state.
|
||||
*
|
||||
* where
|
||||
* - \f$ N_a \f$ is Avogadro's number
|
||||
* - \f$ \rho_w \f$ is the density of water
|
||||
* - \f$ e \f$ is the electronic charge
|
||||
* - \f$ \epsilon = K \epsilon_o \f$ is the permittivity of water
|
||||
* where \f$ K \f$ is the dielectric constant of water,
|
||||
* and \f$ \epsilon_o \f$ is the permittivity of free space.
|
||||
* = \f$ \rho_o \f$ is the density of the solvent in its standard state.
|
||||
*
|
||||
* Nominal value at 298 K and 1 atm = 1.172576 (kg/gmol)<SUP>1/2</SUP>
|
||||
* based on:
|
||||
* - \f$ \epsilon / \epsilon_0 \f$ = 78.54
|
||||
* (water at 25C)
|
||||
* - T = 298.15 K
|
||||
* - B_Debye = 3.28640E9 (kg/gmol)<SUP>1/2</SUP> m<SUP>-1</SUP>
|
||||
* Nominal value at 298 K and 1 atm = 1.172576 (kg/gmol)<SUP>1/2</SUP>
|
||||
* based on:
|
||||
* - \f$ \epsilon / \epsilon_0 \f$ = 78.54 (water at 25C)
|
||||
* - T = 298.15 K
|
||||
* - B_Debye = 3.28640E9 (kg/gmol)<SUP>1/2</SUP> m<SUP>-1</SUP>
|
||||
*
|
||||
* @param temperature Temperature in kelvin. Defaults to -1, in which
|
||||
* case the temperature of the phase is assumed.
|
||||
|
|
@ -1331,14 +1238,13 @@ public:
|
|||
virtual double A_Debye_TP(double temperature = -1.0,
|
||||
double pressure = -1.0) const;
|
||||
|
||||
|
||||
//! Value of the derivative of the Debye Huckel constant with
|
||||
//! respect to temperature.
|
||||
/*!
|
||||
* This is a function of temperature and pressure. See A_Debye_TP() for
|
||||
* a definition of \f$ A_{Debye} \f$.
|
||||
*
|
||||
* Units = sqrt(kg/gmol) K-1
|
||||
* Units = sqrt(kg/gmol) K-1
|
||||
*
|
||||
* @param temperature Temperature in kelvin. Defaults to -1, in which
|
||||
* case the temperature of the phase is assumed.
|
||||
|
|
@ -1355,7 +1261,7 @@ public:
|
|||
* This is a function of temperature and pressure. See A_Debye_TP() for
|
||||
* a definition of \f$ A_{Debye} \f$.
|
||||
*
|
||||
* Units = sqrt(kg/gmol) K-2
|
||||
* Units = sqrt(kg/gmol) K-2
|
||||
*
|
||||
* @param temperature Temperature in kelvin. Defaults to -1, in which
|
||||
* case the temperature of the phase is assumed.
|
||||
|
|
@ -1372,7 +1278,7 @@ public:
|
|||
* This is a function of temperature and pressure. See A_Debye_TP() for
|
||||
* a definition of \f$ A_{Debye} \f$.
|
||||
*
|
||||
* Units = sqrt(kg/gmol) Pa-1
|
||||
* Units = sqrt(kg/gmol) Pa-1
|
||||
*
|
||||
* @param temperature Temperature in kelvin. Defaults to -1, in which
|
||||
* case the temperature of the phase is assumed.
|
||||
|
|
@ -1400,8 +1306,6 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Static function that implements the non-polar species
|
||||
//! salt-out modifications.
|
||||
/*!
|
||||
|
|
@ -1411,7 +1315,6 @@ private:
|
|||
*/
|
||||
double _nonpolarActCoeff(double IionicMolality) const;
|
||||
|
||||
|
||||
//! Formula for the osmotic coefficient that occurs in the GWB.
|
||||
/*!
|
||||
* It is originally from Helgeson for a variable
|
||||
|
|
@ -1425,11 +1328,8 @@ private:
|
|||
* NaCl brine. It's to be used with extreme caution.
|
||||
*/
|
||||
double _lnactivityWaterHelgesonFixedForm() const;
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
|
@ -1497,9 +1397,7 @@ protected:
|
|||
*/
|
||||
vector_fp m_Aionic;
|
||||
|
||||
/**
|
||||
* Current value of the ionic strength on the molality scale
|
||||
*/
|
||||
//! Current value of the ionic strength on the molality scale
|
||||
mutable double m_IionicMolality;
|
||||
|
||||
/**
|
||||
|
|
@ -1588,18 +1486,16 @@ protected:
|
|||
|
||||
//! Array of B_Dot values
|
||||
/**
|
||||
* B_Dot -> This expression is an extension of the
|
||||
* Debye-Huckel expression used in some formulations
|
||||
* to extend DH to higher molalities.
|
||||
* B_dot is specific to the major ionic pair.
|
||||
* This expression is an extension of the Debye-Huckel expression used
|
||||
* in some formulations to extend DH to higher molalities. B_dot is
|
||||
* specific to the major ionic pair.
|
||||
*/
|
||||
vector_fp m_B_Dot;
|
||||
|
||||
/**
|
||||
* m_npActCoeff -> These are coefficients to describe
|
||||
* the increase in activity coeff for non-polar molecules
|
||||
* due to the electrolyte becoming stronger (the so-called
|
||||
* salt-out effect)
|
||||
* These are coefficients to describe the increase in activity coeff for
|
||||
* non-polar molecules due to the electrolyte becoming stronger (the
|
||||
* so-called salt-out effect)
|
||||
*/
|
||||
vector_fp m_npActCoeff;
|
||||
|
||||
|
|
@ -1616,19 +1512,13 @@ protected:
|
|||
*/
|
||||
double m_densWaterSS;
|
||||
|
||||
/**
|
||||
* Pointer to the water property calculator
|
||||
*/
|
||||
//! Pointer to the water property calculator
|
||||
WaterProps* m_waterProps;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
|
|
@ -1670,6 +1560,8 @@ protected:
|
|||
mutable vector_fp m_dlnActCoeffMolaldP;
|
||||
|
||||
private:
|
||||
|
||||
//! Bail out of functions with an error exit if they are not implemented.
|
||||
doublereal err(const std::string& msg) const;
|
||||
|
||||
//! Initialize the internal lengths.
|
||||
|
|
@ -1682,8 +1574,9 @@ private:
|
|||
private:
|
||||
//! Calculate the log activity coefficients
|
||||
/*!
|
||||
* This function updates the internally stored
|
||||
* natural logarithm of the molality activity coefficients
|
||||
* This function updates the internally stored natural logarithm of the
|
||||
* molality activity coefficients. This is the main routine for
|
||||
* implementing the activity coefficient formulation.
|
||||
*/
|
||||
void s_update_lnMolalityActCoeff() const;
|
||||
|
||||
|
|
@ -1695,8 +1588,6 @@ private:
|
|||
*
|
||||
* We assume that the activity coefficients are current in this routine
|
||||
*
|
||||
*
|
||||
*
|
||||
* The solvent activity coefficient is on the molality scale. Its derivative is too.
|
||||
*/
|
||||
void s_update_dlnMolalityActCoeff_dT() const;
|
||||
|
|
@ -1711,8 +1602,6 @@ private:
|
|||
*
|
||||
* solvent activity coefficient is on the molality
|
||||
* scale. Its derivatives are too.
|
||||
*
|
||||
* note: private routine
|
||||
*/
|
||||
void s_update_d2lnMolalityActCoeff_dT2() const;
|
||||
|
||||
|
|
@ -1734,8 +1623,3 @@ private:
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -39,14 +39,14 @@ namespace Cantera
|
|||
* and semi-miscible compounds.
|
||||
*
|
||||
* It includes
|
||||
* . regular solutions
|
||||
* . Margules expansions
|
||||
* . NTRL equation
|
||||
* . Wilson's equation
|
||||
* . UNIQUAC equation of state.
|
||||
* - regular solutions
|
||||
* - Margules expansions
|
||||
* - NTRL equation
|
||||
* - 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
|
||||
* 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.
|
||||
|
|
@ -55,15 +55,13 @@ namespace Cantera
|
|||
* All of the Excess Gibbs free energy formulations in this area employ
|
||||
* symmetrical formulations.
|
||||
*
|
||||
*
|
||||
* Chemical potentials
|
||||
* 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$.
|
||||
*
|
||||
|
|
@ -71,7 +69,6 @@ namespace Cantera
|
|||
* 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>
|
||||
|
|
@ -96,15 +93,12 @@ namespace Cantera
|
|||
* 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:
|
||||
|
||||
/// Constructors
|
||||
//! @name Constructors
|
||||
//! @{
|
||||
/*!
|
||||
* This doesn't do much more than initialize constants with
|
||||
* default values for water at 25C. Water molecular weight
|
||||
|
|
@ -117,16 +111,12 @@ public:
|
|||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working 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);
|
||||
|
|
@ -141,13 +131,7 @@ public:
|
|||
* a pointer to ThermoPhase to work with.
|
||||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
/**
|
||||
*
|
||||
* @name Utilities
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! @}
|
||||
|
||||
//! Equation of state type flag.
|
||||
/*!
|
||||
|
|
@ -159,23 +143,9 @@ public:
|
|||
*/
|
||||
virtual int eosType() const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Molar Thermodynamic Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Mechanical Properties
|
||||
* @{
|
||||
*/
|
||||
//! @}
|
||||
//! @name Mechanical Properties
|
||||
//! @{
|
||||
|
||||
//! Set the internally stored pressure (Pa) at constant
|
||||
//! temperature and composition
|
||||
|
|
@ -191,7 +161,6 @@ public:
|
|||
virtual void setPressure(doublereal p);
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Calculate the density of the mixture using the partial
|
||||
* molar volumes and mole fractions as input
|
||||
|
|
@ -218,17 +187,6 @@ protected:
|
|||
void calcDensity();
|
||||
|
||||
public:
|
||||
/**
|
||||
* @}
|
||||
* @name Potential Energy
|
||||
*
|
||||
* Species may have an additional potential energy due to the
|
||||
* presence of external gravitation or electric fields. These
|
||||
* methods allow specifying a potential energy for individual
|
||||
* species.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Activities, Standard States, and Activity Concentrations
|
||||
|
|
@ -259,8 +217,6 @@ public:
|
|||
*/
|
||||
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
|
||||
|
|
@ -393,12 +349,10 @@ public:
|
|||
err("getdlnActCoeffdlnX");
|
||||
}
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
||||
|
||||
/**
|
||||
* Get the species electrochemical potentials.
|
||||
* These are partial molar quantities.
|
||||
|
|
@ -425,39 +379,13 @@ public:
|
|||
virtual void getPartialMolarVolumes(doublereal* vbar) const;
|
||||
virtual const vector_fp& getPartialMolarVolumes() const;
|
||||
|
||||
//@}
|
||||
/// @name Properties of the Standard State of the Species in the Solution
|
||||
//@{
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Thermodynamic Values for the Species Reference States
|
||||
//@{
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// The methods below are not virtual, and should not
|
||||
// be overloaded.
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @name Specific Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Setting the State
|
||||
*
|
||||
* These methods set all or part of the thermodynamic
|
||||
* state.
|
||||
* These methods set all or part of the thermodynamic state.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
//! Set the temperature (K) and pressure (Pa)
|
||||
/*!
|
||||
* Set the temperature and pressure.
|
||||
|
|
@ -467,15 +395,6 @@ public:
|
|||
*/
|
||||
virtual void setState_TP(doublereal t, doublereal p);
|
||||
|
||||
//@}
|
||||
|
||||
/**
|
||||
* @name Chemical Equilibrium
|
||||
* Routines that implement the Chemical equilibrium capability
|
||||
* for a single phase, based on the element-potential method.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Set the mass fractions to the specified values, and then
|
||||
* normalize them so that they sum to 1.0.
|
||||
|
|
@ -500,7 +419,6 @@ public:
|
|||
*/
|
||||
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.
|
||||
|
|
@ -537,18 +455,8 @@ public:
|
|||
* of species in the phase.
|
||||
*/
|
||||
virtual void setConcentrations(const doublereal* const c);
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
/// 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 files importCTML.cpp and
|
||||
/// ThermoFactory.cpp.
|
||||
|
||||
|
||||
/*!
|
||||
* @internal Initialize. This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
|
|
@ -564,9 +472,7 @@ public:
|
|||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
//! Initialize lengths of local variables after all species have
|
||||
//! been identified.
|
||||
void initLengths();
|
||||
|
|
@ -580,17 +486,14 @@ private:
|
|||
doublereal err(const std::string& msg) const;
|
||||
|
||||
protected:
|
||||
|
||||
//! utility routine to check mole fraction sum
|
||||
/*!
|
||||
* @param x vector of mole fractions.
|
||||
* @deprecated
|
||||
*/
|
||||
double checkMFSum(const doublereal* const x) const;
|
||||
|
||||
protected:
|
||||
|
||||
// HKM get rid of _Scaled_ prefix
|
||||
|
||||
//! Storage for the current values of the mole fractions of the species
|
||||
/*!
|
||||
* This vector is kept up-to-date when the setState functions are called.
|
||||
|
|
@ -634,15 +537,8 @@ protected:
|
|||
|
||||
//! Temporary storage space that is fair game
|
||||
mutable std::vector<doublereal> m_pp;
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -30,7 +30,6 @@ namespace Cantera
|
|||
/* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* This phase is based upon the mixing-rule assumption that
|
||||
* all molality-based activity coefficients are equal
|
||||
|
|
@ -65,12 +64,12 @@ namespace Cantera
|
|||
* 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>
|
||||
* <TR><TD> 0 </TD><TD> \f$ {m_k}/ { m^{\Delta}}\f$ </TD><TD> \f$ 1.0 \f$ </TD></TR>
|
||||
* <TR><TD> 1 </TD><TD> \f$ m_k / (m^{\Delta} V_k)\f$ </TD><TD> \f$ 1.0 / V_k \f$ </TD></TR>
|
||||
* <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>
|
||||
* <TABLE>
|
||||
* <TR><TD> m_formGC </TD><TD> ActivityConc </TD><TD> StandardConc </TD></TR>
|
||||
* <TR><TD> 0 </TD><TD> \f$ {m_k}/ { m^{\Delta}}\f$ </TD><TD> \f$ 1.0 \f$ </TD></TR>
|
||||
* <TR><TD> 1 </TD><TD> \f$ m_k / (m^{\Delta} V_k)\f$ </TD><TD> \f$ 1.0 / V_k \f$ </TD></TR>
|
||||
* <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$.
|
||||
|
|
@ -80,37 +79,26 @@ namespace Cantera
|
|||
* The value and form of the activity concentration will affect
|
||||
* reaction rate constants involving species in this phase.
|
||||
*
|
||||
* @verbatim
|
||||
<thermo model="IdealMolalSoln">
|
||||
<standardConc model="solvent_volume" />
|
||||
<solvent> H2O(l) </solvent>
|
||||
|
||||
<activityCoefficients model="IdealMolalSoln" >
|
||||
<idealMolalSolnCutoff model="polyExp">
|
||||
<gamma_O_limit> 1.0E-5 <gammaOlimit>
|
||||
<gamma_k_limit> 1.0E-5 <gammaklimit>
|
||||
<X_o_cutoff> 0.20 </X_o_cutoff>
|
||||
<C_0_param> 0.05 </C_0_param>
|
||||
<slope_f_limit> 0.6 </slopefLimit>
|
||||
<slope_g_limit> 0.0 </slopegLimit>
|
||||
</idealMolalSolnCutoff>
|
||||
</activityCoefficients>
|
||||
|
||||
|
||||
|
||||
</thermo>
|
||||
|
||||
|
||||
|
||||
@endverbatim
|
||||
*
|
||||
* <thermo model="IdealMolalSoln">
|
||||
* <standardConc model="solvent_volume" />
|
||||
* <solvent> H2O(l) </solvent>
|
||||
* <activityCoefficients model="IdealMolalSoln" >
|
||||
* <idealMolalSolnCutoff model="polyExp">
|
||||
* <gamma_O_limit> 1.0E-5 </gamma_O_limit>
|
||||
* <gamma_k_limit> 1.0E-5 <gamma_k_limit>
|
||||
* <X_o_cutoff> 0.20 </X_o_cutoff>
|
||||
* <C_0_param> 0.05 </C_0_param>
|
||||
* <slope_f_limit> 0.6 </slope_f_limit>
|
||||
* <slope_g_limit> 0.0 </slope_g_limit>
|
||||
* </idealMolalSolnCutoff>
|
||||
* </activityCoefficients>
|
||||
* </thermo>
|
||||
*/
|
||||
class IdealMolalSoln : public MolalityVPSSTP
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/// Constructors
|
||||
/// Constructor
|
||||
IdealMolalSoln();
|
||||
|
||||
//! Copy Constructor
|
||||
|
|
@ -153,11 +141,8 @@ public:
|
|||
*/
|
||||
ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
/**
|
||||
*
|
||||
* @name Utilities
|
||||
* @{
|
||||
*/
|
||||
//! @name Utilities
|
||||
//! @{
|
||||
|
||||
/**
|
||||
* Equation of state type flag. The base class returns
|
||||
|
|
@ -169,15 +154,12 @@ public:
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Molar Thermodynamic Properties of the Solution ---------------
|
||||
* @{
|
||||
*/
|
||||
//! @}
|
||||
//! @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,
|
||||
* \f[
|
||||
|
|
@ -194,7 +176,6 @@ 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,
|
||||
* \f[
|
||||
|
|
@ -223,9 +204,7 @@ public:
|
|||
|
||||
//! Molar Gibbs function for the solution: Units J/kmol.
|
||||
/*!
|
||||
*
|
||||
* Returns the gibbs free energy of the solution per mole
|
||||
* of the solution.
|
||||
* Returns the gibbs free energy of the solution per mole of the solution.
|
||||
*
|
||||
* \f[
|
||||
* \bar{g}(T, P, X_k) = \sum_k X_k \mu_k(T)
|
||||
|
|
@ -237,7 +216,7 @@ public:
|
|||
|
||||
//! Molar heat capacity of the solution at constant pressure. Units: J/kmol/K.
|
||||
/*!
|
||||
* \f[
|
||||
* \f[
|
||||
* \bar{c}_p(T, P, X_k) = \sum_k X_k \bar{c}_{p,k}(T)
|
||||
* \f]
|
||||
*
|
||||
|
|
@ -247,15 +226,12 @@ public:
|
|||
|
||||
//! Molar heat capacity of the solution at constant volume. Units: J/kmol/K.
|
||||
/*!
|
||||
* Molar heat capacity at constant volume: Units: J/kmol/K.
|
||||
* NOT IMPLEMENTED.
|
||||
* Units: J/kmol/K
|
||||
*/
|
||||
virtual doublereal cv_mole() const;
|
||||
|
||||
//@}
|
||||
/** @name Mechanical Equation of State Properties -------------------------
|
||||
//@{
|
||||
/** @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
|
||||
|
|
@ -264,8 +240,7 @@ public:
|
|||
* state by calling setDensity() may cause an exception to be
|
||||
* thrown.
|
||||
*/
|
||||
|
||||
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Set the pressure at constant temperature. Units: Pa.
|
||||
|
|
@ -296,9 +271,6 @@ protected:
|
|||
* 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.
|
||||
*/
|
||||
void calcDensity();
|
||||
|
||||
|
|
@ -316,9 +288,6 @@ public:
|
|||
*
|
||||
* This function will now throw an error condition.
|
||||
*
|
||||
* NOTE: This is an overwritten function from the State.h
|
||||
* class
|
||||
*
|
||||
* @param rho Input Density
|
||||
*/
|
||||
void setDensity(const doublereal rho);
|
||||
|
|
@ -329,9 +298,6 @@ public:
|
|||
*
|
||||
* This function will now throw an error condition.
|
||||
*
|
||||
* NOTE: This is an overwritten function from the State.h
|
||||
* class
|
||||
*
|
||||
* @param rho Input Density
|
||||
*/
|
||||
void setMolarDensity(const doublereal rho);
|
||||
|
|
@ -381,12 +347,9 @@ public:
|
|||
* @{
|
||||
*/
|
||||
|
||||
|
||||
//!Set the potential energy of species k to pe.
|
||||
/*!
|
||||
* Units: J/kmol.
|
||||
* This function must be reimplemented in inherited classes
|
||||
* of ThermoPhase.
|
||||
*
|
||||
* @param k Species index
|
||||
* @param pe Input potential energy.
|
||||
|
|
@ -395,11 +358,9 @@ public:
|
|||
err("setPotentialEnergy");
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Get the potential energy of species k.
|
||||
* Units: J/kmol.
|
||||
* This function must be reimplemented in inherited classes
|
||||
* of ThermoPhase.
|
||||
*
|
||||
* @param k Species index
|
||||
*/
|
||||
|
|
@ -468,13 +429,13 @@ public:
|
|||
* the program and in the XML input files.
|
||||
*
|
||||
* @param uA Output vector containing the units
|
||||
* uA[0] = kmol units - default = 1
|
||||
* uA[1] = m units - default = -nDim(), the number of spatial
|
||||
* dimensions in the Phase class.
|
||||
* uA[2] = kg units - default = 0;
|
||||
* uA[3] = Pa(pressure) units - default = 0;
|
||||
* uA[4] = Temperature units - default = 0;
|
||||
* uA[5] = time units - default = 0
|
||||
* uA[0] = kmol units - default = 1
|
||||
* uA[1] = m units - default = -nDim(), the number of spatial
|
||||
* dimensions in the Phase class.
|
||||
* uA[2] = kg units - default = 0;
|
||||
* uA[3] = Pa(pressure) units - default = 0;
|
||||
* uA[4] = Temperature units - default = 0;
|
||||
* uA[5] = time units - default = 0
|
||||
* @param k species index. Defaults to 0.
|
||||
* @param sizeUA output int containing the size of the vector.
|
||||
* Currently, this is equal to 6.
|
||||
|
|
@ -510,13 +471,12 @@ public:
|
|||
getMolalityActivityCoefficients(doublereal* acMolality) const;
|
||||
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution -----------------
|
||||
/// @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.
|
||||
*
|
||||
|
|
@ -531,7 +491,7 @@ public:
|
|||
* \f$ w \f$ refers to the solvent species.
|
||||
* \f$ X_w \f$ is the mole fraction of the solvent.
|
||||
* \f$ m_k \f$ is the molality of the kth solute.
|
||||
* \f$ m^\Delta is 1 gmol solute per kg solvent. \f$
|
||||
* \f$ m^\Delta \f$ is 1 gmol solute per kg solvent.
|
||||
*
|
||||
* Units: J/kmol.
|
||||
*
|
||||
|
|
@ -622,47 +582,9 @@ public:
|
|||
*/
|
||||
virtual void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
||||
//@}
|
||||
/// @name Properties of the Standard State of the Species
|
||||
// in the Solution --
|
||||
//@{
|
||||
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Thermodynamic Values for the Species Reference States ---
|
||||
//@{
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// The methods below are not virtual, and should not
|
||||
// be overloaded.
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @name Specific Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @name Setting the State
|
||||
*
|
||||
* These methods set all or part of the thermodynamic
|
||||
* state.
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@}
|
||||
|
||||
/**
|
||||
* @name Chemical Equilibrium
|
||||
* Chemical equilibrium.
|
||||
* @{
|
||||
*/
|
||||
//!@}
|
||||
//! @name Chemical Equilibrium
|
||||
//! @{
|
||||
|
||||
/**
|
||||
* This method is used by the ChemEquil equilibrium solver.
|
||||
|
|
@ -710,12 +632,15 @@ public:
|
|||
* any parameters that are specific to that particular phase
|
||||
* model.
|
||||
*
|
||||
* HKM -> Right now, the parameters are set elsewhere (initThermo)
|
||||
* It just didn't seem to fit.
|
||||
*
|
||||
*
|
||||
* @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);
|
||||
|
||||
//---------------------------------------------------------
|
||||
/// @name Critical state properties.
|
||||
/// These methods are only implemented by some subclasses.
|
||||
|
||||
|
|
@ -751,14 +676,6 @@ public:
|
|||
|
||||
//@}
|
||||
|
||||
/// @name Saturation properties.
|
||||
/// These methods are only implemented by subclasses that
|
||||
/// implement full liquid-vapor equations of state.
|
||||
///
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
/*
|
||||
* -------------- Utilities -------------------------------
|
||||
*/
|
||||
|
|
@ -793,8 +710,7 @@ public:
|
|||
|
||||
//! Report the molar volume of species k
|
||||
/*!
|
||||
*
|
||||
* units - \f$ m^3 kmol^-1 \f$
|
||||
* units - \f$ m^3 kmol^{-1} \f$
|
||||
*
|
||||
* @param k Species index.
|
||||
*/
|
||||
|
|
@ -802,7 +718,7 @@ public:
|
|||
|
||||
/*!
|
||||
* Fill in a return vector containing the species molar volumes
|
||||
* units - \f$ m^3 kmol^-1 \f$
|
||||
* units - \f$ m^3 kmol^{-1} \f$
|
||||
*
|
||||
* @param smv Output vector of species molar volumes.
|
||||
*/
|
||||
|
|
@ -811,7 +727,7 @@ public:
|
|||
|
||||
protected:
|
||||
/**
|
||||
* Species molar volume \f$ m^3 kmol^-1 \f$
|
||||
* Species molar volume \f$ m^3 kmol^{-1} \f$
|
||||
*/
|
||||
vector_fp m_speciesMolarVolume;
|
||||
|
||||
|
|
@ -820,12 +736,12 @@ protected:
|
|||
* depending on the value of the member attribute m_formGC, which
|
||||
* is supplied in the XML file.
|
||||
*
|
||||
* <TABLE>
|
||||
* <TABLE>
|
||||
* <TR><TD> m_formGC </TD><TD> ActivityConc </TD><TD> StandardConc </TD></TR>
|
||||
* <TR><TD> 0 </TD><TD> \f$ {m_k}/ { m^{\Delta}}\f$ </TD><TD> \f$ 1.0 \f$ </TD></TR>
|
||||
* <TR><TD> 1 </TD><TD> \f$ m_k / (m^{\Delta} V_k)\f$ </TD><TD> \f$ 1.0 / V_k \f$ </TD></TR>
|
||||
* <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>
|
||||
* </TABLE>
|
||||
*/
|
||||
int m_formGC;
|
||||
|
||||
|
|
@ -834,7 +750,6 @@ public:
|
|||
int IMS_typeCutoff_;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Temporary array used in equilibrium calculations
|
||||
*/
|
||||
|
|
@ -861,9 +776,6 @@ public:
|
|||
//! gamma_k minimum for the cutoff process at the zero solvent point
|
||||
doublereal IMS_gamma_k_min_;
|
||||
|
||||
//! Parameter in the polyExp cutoff treatment having to do with rate of exp decay
|
||||
doublereal IMS_cCut_;
|
||||
|
||||
//! Parameter in the polyExp cutoff treatment
|
||||
/*!
|
||||
* This is the slope of the f function at the zero solvent point
|
||||
|
|
@ -871,18 +783,6 @@ public:
|
|||
*/
|
||||
doublereal IMS_slopefCut_;
|
||||
|
||||
//! Parameter in the polyExp cutoff treatment having to do with rate of exp decay
|
||||
doublereal IMS_dfCut_;
|
||||
|
||||
//! Parameter in the polyExp cutoff treatment having to do with rate of exp decay
|
||||
doublereal IMS_efCut_;
|
||||
|
||||
//! Parameter in the polyExp cutoff treatment having to do with rate of exp decay
|
||||
doublereal IMS_afCut_;
|
||||
|
||||
//! Parameter in the polyExp cutoff treatment having to do with rate of exp decay
|
||||
doublereal IMS_bfCut_;
|
||||
|
||||
//! Parameter in the polyExp cutoff treatment
|
||||
/*!
|
||||
* This is the slope of the g function at the zero solvent point
|
||||
|
|
@ -890,17 +790,18 @@ public:
|
|||
*/
|
||||
doublereal IMS_slopegCut_;
|
||||
|
||||
//! Parameter 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_;
|
||||
doublereal IMS_efCut_;
|
||||
doublereal IMS_afCut_;
|
||||
doublereal IMS_bfCut_;
|
||||
doublereal IMS_dgCut_;
|
||||
|
||||
//! Parameter in the polyExp cutoff treatment having to do with rate of exp decay
|
||||
doublereal IMS_egCut_;
|
||||
|
||||
//! Parameter in the polyExp cutoff treatment having to do with rate of exp decay
|
||||
doublereal IMS_agCut_;
|
||||
|
||||
//! Parameter in the polyExp cutoff treatment having to do with rate of exp decay
|
||||
doublereal IMS_bgCut_;
|
||||
//! @}
|
||||
|
||||
private:
|
||||
|
||||
|
|
@ -914,7 +815,11 @@ private:
|
|||
//! natural logarithm of the molality activity coefficients
|
||||
/*!
|
||||
* Normally the solutes are all zero. However, sometimes they are not,
|
||||
* due to stability schemes
|
||||
* due to stability schemes.
|
||||
*
|
||||
* gamma_k_molar = gamma_k_molal / Xmol_solvent
|
||||
*
|
||||
* gamma_o_molar = gamma_o_molal
|
||||
*/
|
||||
void s_updateIMS_lnMolalityActCoeff() const;
|
||||
|
||||
|
|
@ -938,8 +843,3 @@ private:
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@
|
|||
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
class XML_Node;
|
||||
class PDSS;
|
||||
|
||||
/*!
|
||||
* @name CONSTANTS - Models for the Standard State of IdealSolnPhase's
|
||||
* @name CONSTANTS
|
||||
* Models for the Standard State of an IdealSolnPhase
|
||||
*/
|
||||
//@{
|
||||
const int cIdealSolnGasPhaseG = 6009;
|
||||
|
|
@ -32,29 +32,26 @@ const int cIdealSolnGasPhase0 = 6010;
|
|||
const int cIdealSolnGasPhase1 = 6011;
|
||||
const int cIdealSolnGasPhase2 = 6012;
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup thermoprops
|
||||
*
|
||||
* This class can handle either an ideal solution or an ideal gas approximation
|
||||
* of a phase.
|
||||
*
|
||||
* An ideal solution or an ideal gas approximation of a phase. Uses variable
|
||||
* pressure standard state methods for calculating thermodynamic properties.
|
||||
*
|
||||
* @nosubgrouping
|
||||
*/
|
||||
class IdealSolnGasVPSS : public VPStandardStateTP
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
*
|
||||
* @name Constructors and Duplicators for %IdealSolnGasVPSS
|
||||
*
|
||||
*/
|
||||
//! @{
|
||||
|
||||
/// Constructor.
|
||||
IdealSolnGasVPSS();
|
||||
|
||||
/// Create an object from an XML input file
|
||||
IdealSolnGasVPSS(const std::string& infile, std::string id="");
|
||||
|
||||
/// Copy Constructor.
|
||||
|
|
@ -66,16 +63,11 @@ public:
|
|||
/// Destructor.
|
||||
virtual ~IdealSolnGasVPSS();
|
||||
|
||||
/*
|
||||
* Duplication routine
|
||||
*/
|
||||
//! Duplication routine
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//@}
|
||||
|
||||
/**
|
||||
* @name Utilities (IdealSolnGasVPSS)
|
||||
*/
|
||||
//! @name Utilities (IdealSolnGasVPSS)
|
||||
//@{
|
||||
/**
|
||||
* Equation of state type flag. The base class returns
|
||||
|
|
@ -85,7 +77,9 @@ public:
|
|||
*/
|
||||
virtual int eosType() const;
|
||||
|
||||
//@}
|
||||
//! @}
|
||||
//! @name Molar Thermodynamic Properties
|
||||
//! @{
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
doublereal enthalpy_mole() const;
|
||||
|
|
@ -105,11 +99,9 @@ public:
|
|||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
doublereal cv_mole() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Mechanical Properties
|
||||
* @{
|
||||
*/
|
||||
//! @}
|
||||
//! @name Mechanical Properties
|
||||
//! @{
|
||||
|
||||
//! Set the pressure in the fluid
|
||||
/*!
|
||||
|
|
@ -146,14 +138,11 @@ protected:
|
|||
* species standard state molar volumes.
|
||||
* The species molar volumes may be functions
|
||||
* of temperature and pressure.
|
||||
*
|
||||
* NOTE: This is a non-virtual function, which is not a
|
||||
* member of the ThermoPhase base class.
|
||||
*/
|
||||
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 /
|
||||
|
|
@ -236,7 +225,7 @@ public:
|
|||
virtual void getActivityCoefficients(doublereal* ac) const;
|
||||
|
||||
|
||||
/// @name Partial Molar Properties of the Solution (IdealSolnGasVPSS)
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
||||
//! Get the array of non-dimensional species chemical potentials
|
||||
|
|
@ -300,34 +289,10 @@ public:
|
|||
* 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
|
||||
*
|
||||
* Properties of the standard states are delegated to the VPSSMgr object.
|
||||
* The values are cached within this object, and are not recalculated unless
|
||||
* the temperature or pressure changes.
|
||||
*/
|
||||
//@{
|
||||
|
||||
//@}
|
||||
|
||||
/// @name Thermodynamic Values for the Species Reference States (IdealSolnGasVPSS)
|
||||
/*!
|
||||
* Properties of the reference states are delegated to the VPSSMgr object.
|
||||
* The values are cached within this object, and are not recalculated unless
|
||||
* the temperature or pressure changes.
|
||||
*/
|
||||
//@{
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//! @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
|
||||
|
|
@ -337,9 +302,7 @@ public:
|
|||
*/
|
||||
//@{
|
||||
|
||||
|
||||
//! Set equation of state parameter values from XML
|
||||
//! entries.
|
||||
//! Set equation of state parameter values from XML entries.
|
||||
/*!
|
||||
* This method is called by function importPhase in
|
||||
* file importCTML.cpp when processing a phase definition in
|
||||
|
|
@ -368,7 +331,6 @@ public:
|
|||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
|
||||
//!This method is used by the ChemEquil equilibrium solver.
|
||||
/*!
|
||||
* It sets the state such that the chemical potentials satisfy
|
||||
|
|
@ -386,7 +348,6 @@ public:
|
|||
//! 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
|
||||
|
|
@ -415,15 +376,13 @@ public:
|
|||
private:
|
||||
//! @internal Initialize the internal lengths in this object.
|
||||
/*!
|
||||
* Note this is not a virtual function and only handles
|
||||
* this object
|
||||
* Note this is not a virtual function and only handles this object
|
||||
*/
|
||||
void initLengths();
|
||||
|
||||
//@}
|
||||
|
||||
protected:
|
||||
|
||||
//! boolean indicating what ideal solution this is
|
||||
/*!
|
||||
* - 1 = ideal gas
|
||||
|
|
@ -441,7 +400,6 @@ protected:
|
|||
|
||||
//! Temporary storage - length = m_kk.
|
||||
vector_fp m_pp;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* (see \ref thermoprops
|
||||
* and class \link Cantera::IonsFromNeutralVPSSTP IonsFromNeutralVPSSTP\endlink).
|
||||
*
|
||||
* Header file for a derived class of %ThermoPhase that handles
|
||||
* 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
|
||||
|
|
@ -53,30 +53,29 @@ enum IonSolnType_enumType {
|
|||
*
|
||||
* This object actually employs 4 different mole fraction types.
|
||||
*
|
||||
* 1) There is a mole fraction associated the the cations and
|
||||
* 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
|
||||
* 2. There is a mole fraction vector associated with the
|
||||
* neutral molecule ThermoPhase object.
|
||||
* 3) There is a mole fraction vector associated with the
|
||||
* 3. There is a mole fraction vector associated with the
|
||||
* cation lattice.
|
||||
* 4) There is a mole fraction vector associated with the
|
||||
* 4. There is a mole fraction vector associated with the
|
||||
* anion lattice
|
||||
*
|
||||
* This object can translate between any of the four mole
|
||||
* fraction representations.
|
||||
*
|
||||
*
|
||||
*/
|
||||
class IonsFromNeutralVPSSTP : public GibbsExcessVPSSTP
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/// Constructors
|
||||
//! @name Constructors
|
||||
//! @{
|
||||
|
||||
/*!
|
||||
* Default constructor
|
||||
*/
|
||||
|
|
@ -85,12 +84,8 @@ public:
|
|||
//! Construct and initialize an IonsFromNeutralVPSSTP object
|
||||
//! directly from an ASCII 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.
|
||||
* 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
|
||||
|
|
@ -134,16 +129,12 @@ public:
|
|||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working 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);
|
||||
|
|
@ -159,6 +150,8 @@ public:
|
|||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
// @}
|
||||
|
||||
/// The following methods are used in the process of constructing
|
||||
/// the phase and setting its parameters from a specification in an
|
||||
/// input file.
|
||||
|
|
@ -202,13 +195,8 @@ public:
|
|||
*/
|
||||
void constructPhaseXML(XML_Node& phaseNode, std::string id);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @name Utilities
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! @name Utilities
|
||||
//! @{
|
||||
|
||||
//! Equation of state type flag.
|
||||
/*!
|
||||
|
|
@ -220,81 +208,36 @@ public:
|
|||
*/
|
||||
virtual int eosType() const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Molar Thermodynamic Properties
|
||||
* @{
|
||||
*/
|
||||
//! @}
|
||||
//! @name Molar Thermodynamic Properties
|
||||
//! @{
|
||||
|
||||
//! Return the Molar enthalpy. Units: J/kmol.
|
||||
/*!
|
||||
* This is calculated from the partial molar enthalpies of the species
|
||||
* This is calculated from the partial molar enthalpies of the species.
|
||||
*/
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
|
||||
/**
|
||||
* Molar internal energy. J/kmol.
|
||||
* *
|
||||
*
|
||||
* This is calculated from the soln enthalpy and then
|
||||
* subtracting pV.
|
||||
*/
|
||||
virtual doublereal intEnergy_mole() const;
|
||||
|
||||
/**
|
||||
* Molar entropy. Units: J/kmol/K.
|
||||
*
|
||||
*
|
||||
*/
|
||||
//! Molar entropy. Units: J/kmol/K.
|
||||
virtual doublereal entropy_mole() const;
|
||||
|
||||
/**
|
||||
* Molar Gibbs free Energy for an ideal gas.
|
||||
* Units = J/kmol.
|
||||
*/
|
||||
//! 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.
|
||||
* For an ideal gas mixture,
|
||||
*
|
||||
*/
|
||||
//! 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.
|
||||
*
|
||||
*/
|
||||
//! Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
virtual doublereal cv_mole() const;
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Utilities
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Mechanical Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Potential Energy
|
||||
*
|
||||
* Species may have an additional potential energy due to the
|
||||
* presence of external gravitation or electric fields. These
|
||||
* methods allow specifying a potential energy for individual
|
||||
* species.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Activities, Standard States, and Activity Concentrations
|
||||
|
|
@ -314,7 +257,6 @@ public:
|
|||
*/
|
||||
virtual void getActivityCoefficients(doublereal* ac) const;
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
|
@ -330,7 +272,6 @@ public:
|
|||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
|
||||
//! Returns an array of partial molar enthalpies for the species
|
||||
//! in the mixture.
|
||||
/*!
|
||||
|
|
@ -387,13 +328,14 @@ public:
|
|||
//! 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.
|
||||
* 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
|
||||
* units = dimensionless
|
||||
*
|
||||
* @param dlnActCoeffdlnX_diag Output vector of log(mole fraction)
|
||||
* derivatives of the log Activity Coefficients.
|
||||
|
|
@ -404,11 +346,10 @@ public:
|
|||
//! Get the array of log concentration-like derivatives of the
|
||||
//! log activity coefficients - diagonal components
|
||||
/*!
|
||||
* 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 species mole numbe. This routine just does the diagonal entries.
|
||||
* 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
|
||||
*
|
||||
|
|
@ -437,7 +378,7 @@ public:
|
|||
* log Activity Coefficients. length = m_kk * m_kk
|
||||
*/
|
||||
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN) ;
|
||||
|
||||
//! @}
|
||||
|
||||
//! Get the Salt Dissociation Coefficients
|
||||
//! Returns the vector of dissociation coefficients and vector of charges
|
||||
|
|
@ -450,7 +391,6 @@ public:
|
|||
*/
|
||||
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.
|
||||
|
|
@ -494,36 +434,9 @@ public:
|
|||
anion=anionList_;
|
||||
}
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Properties of the Standard State of the Species in the Solution
|
||||
//@{
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Thermodynamic Values for the Species Reference States
|
||||
//@{
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// The methods below are not virtual, and should not
|
||||
// be overloaded.
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @name Specific Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @name Setting the State
|
||||
*
|
||||
* These methods set all or part of the thermodynamic
|
||||
* state.
|
||||
* These methods set all or part of the thermodynamic state.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
|
@ -540,8 +453,7 @@ public:
|
|||
virtual void setState_TP(doublereal t, doublereal p);
|
||||
|
||||
|
||||
//! Calculate ion mole fractions from neutral molecule
|
||||
//! mole fractions.
|
||||
//! Calculate ion mole fractions from neutral molecule mole fractions.
|
||||
/*!
|
||||
* @param mf Dump the mole fractions into this vector.
|
||||
*/
|
||||
|
|
@ -612,8 +524,7 @@ public:
|
|||
virtual void setMoleFractions_NoNorm(const doublereal* const x);
|
||||
|
||||
/**
|
||||
* Set the concentrations to the specified values within the
|
||||
* phase.
|
||||
* 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
|
||||
|
|
@ -641,7 +552,6 @@ public:
|
|||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
|
||||
/**
|
||||
* Import and initialize a ThermoPhase object
|
||||
*
|
||||
|
|
@ -660,8 +570,6 @@ public:
|
|||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Initialize lengths of local variables after all species have
|
||||
//! been identified.
|
||||
void initLengths();
|
||||
|
|
@ -752,16 +660,15 @@ protected:
|
|||
//! Formula Matrix for composition of neutral molecules
|
||||
//! in terms of the molecules in this ThermoPhase
|
||||
/*!
|
||||
* fm_neutralMolec_ions[ i + jNeut * m_kk ]
|
||||
* 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.
|
||||
*/
|
||||
std::vector<double> 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
|
||||
|
|
@ -774,11 +681,11 @@ protected:
|
|||
* 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;
|
||||
*
|
||||
* 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
|
||||
|
|
@ -791,7 +698,6 @@ protected:
|
|||
//! Mole fractions using the Neutral Molecule Mole fraction basis
|
||||
mutable std::vector<doublereal> NeutralMolecMoleFractions_;
|
||||
|
||||
|
||||
//! List of the species in this ThermoPhase which are cation species
|
||||
std::vector<size_t> cationList_;
|
||||
|
||||
|
|
@ -845,8 +751,8 @@ private:
|
|||
* This vector is used as a temporary storage area when calculating the ion chemical
|
||||
* potentials.
|
||||
*
|
||||
* Units = Joules/kmol
|
||||
* Length = numNeutralMoleculeSpecies_
|
||||
* - Units = Joules/kmol
|
||||
* - Length = numNeutralMoleculeSpecies_
|
||||
*/
|
||||
mutable std::vector<doublereal> muNeutralMolecule_;
|
||||
|
||||
|
|
@ -855,18 +761,17 @@ private:
|
|||
* This vector is used as a temporary storage area when calculating the ion chemical
|
||||
* potentials and activity coefficients
|
||||
*
|
||||
* Units = none
|
||||
* Length = numNeutralMoleculeSpecies_
|
||||
* - Units = none
|
||||
* - Length = numNeutralMoleculeSpecies_
|
||||
*/
|
||||
mutable std::vector<doublereal> lnActCoeff_NeutralMolecule_;
|
||||
|
||||
//! 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
|
||||
|
||||
*
|
||||
* Units = 1/Kelvin
|
||||
* Length = numNeutralMoleculeSpecies_
|
||||
* - Units = 1/Kelvin
|
||||
* - Length = numNeutralMoleculeSpecies_
|
||||
*/
|
||||
mutable std::vector<doublereal> dlnActCoeffdT_NeutralMolecule_;
|
||||
|
||||
|
|
@ -874,8 +779,8 @@ private:
|
|||
/*!
|
||||
* This vector is used as a temporary storage area when calculating the ion derivatives
|
||||
*
|
||||
* Units = none
|
||||
* Length = numNeutralMoleculeSpecies_
|
||||
* - Units = none
|
||||
* - Length = numNeutralMoleculeSpecies_
|
||||
*/
|
||||
mutable std::vector<doublereal> dlnActCoeffdlnX_diag_NeutralMolecule_;
|
||||
|
||||
|
|
@ -883,8 +788,8 @@ private:
|
|||
/*!
|
||||
* This vector is used as a temporary storage area when calculating the ion derivatives
|
||||
*
|
||||
* Units = none
|
||||
* Length = numNeutralMoleculeSpecies_
|
||||
* - Units = none
|
||||
* - Length = numNeutralMoleculeSpecies_
|
||||
*/
|
||||
mutable std::vector<doublereal> dlnActCoeffdlnN_diag_NeutralMolecule_;
|
||||
|
||||
|
|
@ -892,17 +797,12 @@ private:
|
|||
/*!
|
||||
* This vector is used as a temporary storage area when calculating the ion derivatives
|
||||
*
|
||||
* Units = none
|
||||
* Length = numNeutralMoleculeSpecies_
|
||||
* - Units = none
|
||||
* - Length = numNeutralMoleculeSpecies_
|
||||
*/
|
||||
mutable Array2D dlnActCoeffdlnN_NeutralMolecule_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ namespace Cantera
|
|||
* @ingroup thermoprops
|
||||
*/
|
||||
|
||||
|
||||
//! MargulesVPSSTP is a derived class of GibbsExcessVPSSTP that employs
|
||||
//! the Margules approximation for the excess gibbs free energy
|
||||
/*!
|
||||
|
|
@ -91,7 +90,7 @@ namespace Cantera
|
|||
* 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.
|
||||
|
|
@ -100,7 +99,7 @@ namespace Cantera
|
|||
* 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}
|
||||
|
|
@ -188,7 +187,6 @@ namespace Cantera
|
|||
* 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
|
||||
|
|
@ -224,11 +222,11 @@ namespace Cantera
|
|||
* \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} )
|
||||
|
|
@ -254,65 +252,12 @@ namespace Cantera
|
|||
*
|
||||
* \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:
|
||||
*
|
||||
* @code
|
||||
* XML_Node *xc = get_XML_File("silane.xml");
|
||||
* XML_Node * const xs = xc->findNameID("phase", "silane");
|
||||
* ThermoPhase *silane_tp = newPhase(*xs);
|
||||
* IdealGasPhase *silaneGas = dynamic_cast <IdealGasPhase *>(silane_tp);
|
||||
* @endcode
|
||||
*
|
||||
* or by the following constructor:
|
||||
*
|
||||
* @code
|
||||
* XML_Node *xc = get_XML_File("silane.xml");
|
||||
* XML_Node * const xs = xc->findNameID("phase", "silane");
|
||||
* IdealGasPhase *silaneGas = new IdealGasPhase(*xs);
|
||||
* @endcode
|
||||
*
|
||||
* <HR>
|
||||
* <H2> XML Example </H2>
|
||||
* <HR>
|
||||
* An example of an XML Element named phase setting up a IdealGasPhase
|
||||
* object named silane is given below.
|
||||
*
|
||||
*
|
||||
* @verbatim
|
||||
<!-- phase silane -->
|
||||
<phase dim="3" id="silane">
|
||||
<elementArray datasrc="elements.xml"> Si H He </elementArray>
|
||||
<speciesArray datasrc="#species_data">
|
||||
H2 H HE SIH4 SI SIH SIH2 SIH3 H3SISIH SI2H6
|
||||
H2SISIH2 SI3H8 SI2 SI3
|
||||
</speciesArray>
|
||||
<reactionArray datasrc="#reaction_data"/>
|
||||
<thermo model="IdealGas"/>
|
||||
<kinetics model="GasKinetics"/>
|
||||
<transport model="None"/>
|
||||
</phase>
|
||||
@endverbatim
|
||||
*
|
||||
* The model attribute "IdealGas" of the thermo XML element identifies the phase as
|
||||
* being of the type handled by the IdealGasPhase object.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
*
|
||||
|
||||
*/
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
class MargulesVPSSTP : public GibbsExcessVPSSTP
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
/*!
|
||||
* This doesn't do much more than initialize constants with
|
||||
|
|
@ -350,14 +295,11 @@ public:
|
|||
*/
|
||||
MargulesVPSSTP(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
|
||||
//! Special constructor for a hard-coded problem
|
||||
/*!
|
||||
*
|
||||
* @param testProb Hard-coded value. Only the value of 1 is
|
||||
* used. It's for
|
||||
* a LiKCl system
|
||||
* -> test to predict the eutectic and liquidus correctly.
|
||||
* @param testProb Hard-coded value. Only the value of 1 is used. It's
|
||||
* for a LiKCl system test to predict the eutectic and
|
||||
* liquidus correctly.
|
||||
*/
|
||||
MargulesVPSSTP(int testProb);
|
||||
|
||||
|
|
@ -372,7 +314,6 @@ public:
|
|||
|
||||
//! Assignment operator
|
||||
/*!
|
||||
*
|
||||
* @param b class to be copied.
|
||||
*/
|
||||
MargulesVPSSTP& operator=(const MargulesVPSSTP& b);
|
||||
|
|
@ -388,12 +329,8 @@ public:
|
|||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
/**
|
||||
*
|
||||
* @name Utilities
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! @name Utilities
|
||||
//! @{
|
||||
|
||||
//! Equation of state type flag.
|
||||
/*!
|
||||
|
|
@ -405,38 +342,21 @@ public:
|
|||
*/
|
||||
virtual int eosType() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Molar Thermodynamic Properties
|
||||
* @{
|
||||
*/
|
||||
//! @}
|
||||
//! @name Molar Thermodynamic Properties
|
||||
//! @{
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Utilities for Solvent ID and Molality
|
||||
* @{
|
||||
*/
|
||||
/// 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;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Mechanical Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Potential Energy
|
||||
*
|
||||
* Species may have an additional potential energy due to the
|
||||
* presence of external gravitation or electric fields. These
|
||||
* methods allow specifying a potential energy for individual
|
||||
* species.
|
||||
* @{
|
||||
*/
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
virtual doublereal cv_mole() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
@ -450,7 +370,6 @@ public:
|
|||
* @{
|
||||
*/
|
||||
|
||||
|
||||
//! Get the array of non-dimensional molar-based ln activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
|
|
@ -458,7 +377,6 @@ public:
|
|||
*/
|
||||
virtual void getLnActivityCoefficients(doublereal* lnac) const;
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
|
@ -474,18 +392,6 @@ public:
|
|||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
/// 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;
|
||||
|
||||
//! Returns an array of partial molar enthalpies for the species
|
||||
//! in the mixture.
|
||||
/*!
|
||||
|
|
@ -598,63 +504,14 @@ public:
|
|||
*/
|
||||
virtual void getdlnActCoeffdT(doublereal* dlnActCoeffdT) const;
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Properties of the Standard State of the Species in the Solution
|
||||
//@{
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Thermodynamic Values for the Species Reference States
|
||||
//@{
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// The methods below are not virtual, and should not
|
||||
// be overloaded.
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @name Specific Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @name Setting the State
|
||||
*
|
||||
* These methods set all or part of the thermodynamic
|
||||
* state.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
/**
|
||||
* @name Chemical Equilibrium
|
||||
* Routines that implement the Chemical equilibrium capability
|
||||
* for a single phase, based on the element-potential method.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
/// @}
|
||||
/// @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 files importCTML.cpp and
|
||||
/// ThermoFactory.cpp.
|
||||
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
* @internal Initialize. This method is provided to allow
|
||||
|
|
@ -671,7 +528,6 @@ public:
|
|||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
|
||||
/**
|
||||
* Import and initialize a ThermoPhase object
|
||||
*
|
||||
|
|
@ -688,11 +544,9 @@ public:
|
|||
*/
|
||||
void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Derivatives of Thermodynamic Variables needed for Applications
|
||||
* @{
|
||||
*/
|
||||
//! @}
|
||||
//! @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
|
||||
|
|
@ -741,7 +595,6 @@ public:
|
|||
*/
|
||||
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
|
||||
|
|
@ -765,7 +618,6 @@ public:
|
|||
//@}
|
||||
|
||||
private:
|
||||
|
||||
//! Process an XML node called "binaryNeutralSpeciesParameters"
|
||||
/*!
|
||||
* This node contains all of the parameters necessary to describe
|
||||
|
|
@ -785,7 +637,6 @@ private:
|
|||
*/
|
||||
void resizeNumInteractions(const size_t num);
|
||||
|
||||
|
||||
//! Initialize lengths of local variables after all species have
|
||||
//! been identified.
|
||||
void initLengths();
|
||||
|
|
@ -831,7 +682,6 @@ private:
|
|||
*/
|
||||
void s_update_dlnActCoeff_dlnN() const;
|
||||
|
||||
|
||||
private:
|
||||
//! Error function
|
||||
/*!
|
||||
|
|
@ -842,8 +692,6 @@ private:
|
|||
doublereal err(const std::string& msg) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
//! number of binary interaction expressions
|
||||
size_t numBinaryInteractions_;
|
||||
|
||||
|
|
@ -895,8 +743,6 @@ protected:
|
|||
//! 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.
|
||||
|
|
@ -922,17 +768,8 @@ protected:
|
|||
* Currently there is only one form -> constant wrt temperature.
|
||||
*/
|
||||
int formTempModel_;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,17 +24,15 @@
|
|||
|
||||
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
|
||||
/*!
|
||||
*
|
||||
* %MargulesVPSSTP derives from class GibbsExcessVPSSTP which is derived
|
||||
* 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
|
||||
|
|
@ -92,7 +90,7 @@ namespace Cantera
|
|||
* 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.
|
||||
|
|
@ -101,7 +99,7 @@ namespace Cantera
|
|||
* 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}
|
||||
|
|
@ -255,65 +253,12 @@ namespace Cantera
|
|||
*
|
||||
* \f$k^{-1} \f$ has units of s-1.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
*
|
||||
* <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:
|
||||
*
|
||||
* @code
|
||||
* XML_Node *xc = get_XML_File("silane.xml");
|
||||
* XML_Node * const xs = xc->findNameID("phase", "silane");
|
||||
* ThermoPhase *silane_tp = newPhase(*xs);
|
||||
* IdealGasPhase *silaneGas = dynamic_cast <IdealGasPhase *>(silane_tp);
|
||||
* @endcode
|
||||
*
|
||||
* or by the following constructor:
|
||||
*
|
||||
* @code
|
||||
* XML_Node *xc = get_XML_File("silane.xml");
|
||||
* XML_Node * const xs = xc->findNameID("phase", "silane");
|
||||
* IdealGasPhase *silaneGas = new IdealGasPhase(*xs);
|
||||
* @endcode
|
||||
*
|
||||
* <HR>
|
||||
* <H2> XML Example </H2>
|
||||
* <HR>
|
||||
* An example of an XML Element named phase setting up a IdealGasPhase
|
||||
* object named silane is given below.
|
||||
*
|
||||
*
|
||||
* @verbatim
|
||||
<!-- phase silane -->
|
||||
<phase dim="3" id="silane">
|
||||
<elementArray datasrc="elements.xml"> Si H He </elementArray>
|
||||
<speciesArray datasrc="#species_data">
|
||||
H2 H HE SIH4 SI SIH SIH2 SIH3 H3SISIH SI2H6
|
||||
H2SISIH2 SI3H8 SI2 SI3
|
||||
</speciesArray>
|
||||
<reactionArray datasrc="#reaction_data"/>
|
||||
<thermo model="IdealGas"/>
|
||||
<kinetics model="GasKinetics"/>
|
||||
<transport model="None"/>
|
||||
</phase>
|
||||
@endverbatim
|
||||
*
|
||||
* The model attribute "IdealGas" of the thermo XML element identifies the phase as
|
||||
* being of the type handled by the IdealGasPhase object.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
*
|
||||
|
||||
*/
|
||||
*/
|
||||
class MixedSolventElectrolyte : public MolarityIonicVPSSTP
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
/*!
|
||||
* This doesn't do much more than initialize constants with
|
||||
|
|
@ -328,13 +273,6 @@ public:
|
|||
//! Construct and initialize a MixedSolventElectrolyte 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.
|
||||
*
|
||||
* @param inputFile 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
|
||||
|
|
@ -352,29 +290,22 @@ public:
|
|||
*/
|
||||
MixedSolventElectrolyte(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
|
||||
//! Special constructor for a hard-coded problem
|
||||
/*!
|
||||
*
|
||||
* @param testProb Hard-coded value. Only the value of 1 is
|
||||
* used. It's for
|
||||
* a LiKCl system
|
||||
* -> test to predict the eutectic and liquidus correctly.
|
||||
* @param testProb Hard-coded value. Only the value of 1 is used. It's
|
||||
* for a LiKCl system -> test to predict the eutectic and
|
||||
* liquidus correctly.
|
||||
*/
|
||||
MixedSolventElectrolyte(int testProb);
|
||||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working 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);
|
||||
|
|
@ -390,12 +321,8 @@ public:
|
|||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
/**
|
||||
*
|
||||
* @name Utilities
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! @name Utilities
|
||||
//! @{
|
||||
|
||||
//! Equation of state type flag.
|
||||
/*!
|
||||
|
|
@ -407,38 +334,21 @@ public:
|
|||
*/
|
||||
virtual int eosType() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Molar Thermodynamic Properties
|
||||
* @{
|
||||
*/
|
||||
//! @}
|
||||
//! @name Molar Thermodynamic Properties
|
||||
//! @{
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Utilities for Solvent ID and Molality
|
||||
* @{
|
||||
*/
|
||||
/// 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;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Mechanical Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Potential Energy
|
||||
*
|
||||
* Species may have an additional potential energy due to the
|
||||
* presence of external gravitation or electric fields. These
|
||||
* methods allow specifying a potential energy for individual
|
||||
* species.
|
||||
* @{
|
||||
*/
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
virtual doublereal cv_mole() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
@ -459,9 +369,6 @@ public:
|
|||
*/
|
||||
virtual void getActivityCoefficients(doublereal* ac) const;
|
||||
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
|
@ -477,18 +384,6 @@ public:
|
|||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
/// 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;
|
||||
|
||||
//! Returns an array of partial molar enthalpies for the species
|
||||
//! in the mixture.
|
||||
/*!
|
||||
|
|
@ -549,7 +444,6 @@ public:
|
|||
*/
|
||||
virtual void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
||||
|
||||
//! Return an array of partial molar volumes for the
|
||||
//! species in the mixture. Units: m^3/kmol.
|
||||
/*!
|
||||
|
|
@ -597,67 +491,17 @@ public:
|
|||
*
|
||||
* @param dlnActCoeffdT Output vector of temperature derivatives of the
|
||||
* log Activity Coefficients. length = m_kk
|
||||
*
|
||||
*/
|
||||
virtual void getdlnActCoeffdT(doublereal* dlnActCoeffdT) const;
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Properties of the Standard State of the Species in the Solution
|
||||
//@{
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Thermodynamic Values for the Species Reference States
|
||||
//@{
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// The methods below are not virtual, and should not
|
||||
// be overloaded.
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @name Specific Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @name Setting the State
|
||||
*
|
||||
* These methods set all or part of the thermodynamic
|
||||
* state.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
/**
|
||||
* @name Chemical Equilibrium
|
||||
* Routines that implement the Chemical equilibrium capability
|
||||
* for a single phase, based on the element-potential method.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
//! @}
|
||||
//! @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 files importCTML.cpp and
|
||||
/// ThermoFactory.cpp.
|
||||
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
* @internal Initialize. This method is provided to allow
|
||||
|
|
@ -674,7 +518,6 @@ public:
|
|||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
|
||||
/**
|
||||
* Import and initialize a ThermoPhase object
|
||||
*
|
||||
|
|
@ -744,7 +587,6 @@ public:
|
|||
*/
|
||||
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
|
||||
|
|
@ -764,11 +606,9 @@ public:
|
|||
* 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
|
||||
|
|
@ -788,7 +628,6 @@ private:
|
|||
*/
|
||||
void resizeNumInteractions(const size_t num);
|
||||
|
||||
|
||||
//! Initialize lengths of local variables after all species have
|
||||
//! been identified.
|
||||
void initLengths();
|
||||
|
|
@ -834,8 +673,6 @@ private:
|
|||
*/
|
||||
void s_update_dlnActCoeff_dlnN() const;
|
||||
|
||||
|
||||
private:
|
||||
//! Error function
|
||||
/*!
|
||||
* Print an error string and exit
|
||||
|
|
@ -845,8 +682,6 @@ private:
|
|||
doublereal err(const std::string& msg) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
//! number of binary interaction expressions
|
||||
size_t numBinaryInteractions_;
|
||||
|
||||
|
|
@ -898,8 +733,6 @@ protected:
|
|||
//! 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.
|
||||
|
|
@ -925,17 +758,8 @@ protected:
|
|||
* Currently there is only one form -> constant wrt temperature.
|
||||
*/
|
||||
int formTempModel_;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -185,14 +185,11 @@ namespace Cantera
|
|||
* 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:
|
||||
|
||||
/// Constructors
|
||||
/// Default Constructor
|
||||
/*!
|
||||
* This doesn't do much more than initialize constants with
|
||||
* default values for water at 25C. Water molecular weight
|
||||
|
|
@ -205,18 +202,12 @@ public:
|
|||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working copy constructor
|
||||
*
|
||||
* @param b class to be copied
|
||||
*/
|
||||
MolalityVPSSTP(const MolalityVPSSTP& b);
|
||||
|
||||
/// Assignment operator
|
||||
/*!
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working assignment operator
|
||||
*
|
||||
* @param b class to be copied.
|
||||
*/
|
||||
MolalityVPSSTP& operator=(const MolalityVPSSTP& b);
|
||||
|
|
@ -224,20 +215,16 @@ public:
|
|||
/// Destructor.
|
||||
virtual ~MolalityVPSSTP();
|
||||
|
||||
//! Duplication routine for objects which inherit from ThermoPhase.
|
||||
//! Duplication routine for objects which inherit from ThermoPhase.
|
||||
/*!
|
||||
* This virtual routine can be used to duplicate thermophase objects
|
||||
* 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
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! @name Utilities
|
||||
//! @{
|
||||
|
||||
//! Equation of state type flag.
|
||||
/*!
|
||||
|
|
@ -269,48 +256,35 @@ public:
|
|||
*/
|
||||
int pHScale() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Molar Thermodynamic Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! @}
|
||||
//! @name Utilities for Solvent ID and Molality
|
||||
//! @{
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Utilities for Solvent ID and Molality
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* This routine sets the index number of the solvent for
|
||||
* the phase.
|
||||
* 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
|
||||
*/
|
||||
void setSolvent(size_t k);
|
||||
|
||||
//! Returns the solvent index.
|
||||
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.
|
||||
* Cantera. The minimum mole fraction must be in the range 0 to 0.9.
|
||||
*
|
||||
* @param xmolSolventMIN Input double containing the minimum mole fraction
|
||||
*/
|
||||
void setMoleFSolventMin(doublereal xmolSolventMIN);
|
||||
|
||||
//! Returns the solvent index.
|
||||
size_t solventIndex() const;
|
||||
|
||||
/**
|
||||
* Returns the minimum mole fraction in the molality
|
||||
* formulation.
|
||||
*/
|
||||
//! Returns the minimum mole fraction in the molality formulation.
|
||||
doublereal moleFSolventMin() const;
|
||||
|
||||
//! Calculates the molality of all species and stores the result internally.
|
||||
|
|
@ -324,7 +298,7 @@ public:
|
|||
* - \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.
|
||||
* - \f$ X_{o,p} = max (X_{o}^{min}, X_o) \f$
|
||||
* - \f$ X_{o,p} = \max (X_{o}^{min}, X_o) \f$
|
||||
* - \f$ X_{o}^{min} \f$ = minimum mole fraction of solvent allowed
|
||||
* in the denominator.
|
||||
*/
|
||||
|
|
@ -402,23 +376,6 @@ public:
|
|||
*/
|
||||
void setMolalitiesByName(const std::string& name);
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Mechanical Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Potential Energy
|
||||
*
|
||||
* Species may have an additional potential energy due to the
|
||||
* presence of external gravitation or electric fields. These
|
||||
* methods allow specifying a potential energy for individual
|
||||
* species.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Activities, Standard States, and Activity Concentrations
|
||||
|
|
@ -433,19 +390,15 @@ public:
|
|||
|
||||
/**
|
||||
* 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).
|
||||
* cAC_CONVENTION_MOLALITY 1
|
||||
* 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.
|
||||
*/
|
||||
|
|
@ -514,7 +467,6 @@ public:
|
|||
virtual void getUnitsStandardConc(double* uA, int k = 0,
|
||||
int sizeUA = 6) 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.
|
||||
|
|
@ -597,8 +549,6 @@ public:
|
|||
*/
|
||||
virtual void getMolalityActivityCoefficients(doublereal* acMolality) const;
|
||||
|
||||
|
||||
|
||||
//! Calculate the osmotic coefficient
|
||||
/*!
|
||||
* \f[
|
||||
|
|
@ -619,12 +569,10 @@ 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.
|
||||
* These are partial molar quantities. This method adds a term
|
||||
* \f$ Fz_k \phi_k \f$ to each chemical potential.
|
||||
*
|
||||
* Units: J/kmol
|
||||
*
|
||||
|
|
@ -633,41 +581,7 @@ public:
|
|||
*/
|
||||
void getElectrochemPotentials(doublereal* mu) const;
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Properties of the Standard State of the Species in the Solution
|
||||
//@{
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Thermodynamic Values for the Species Reference States
|
||||
//@{
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// The methods below are not virtual, and should not
|
||||
// be overloaded.
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @name Specific Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @name Setting the State
|
||||
*
|
||||
* These methods set all or part of the thermodynamic
|
||||
* state.
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@}
|
||||
|
||||
/**
|
||||
* @name Chemical Equilibrium
|
||||
* Routines that implement the Chemical equilibrium capability
|
||||
|
|
@ -691,10 +605,8 @@ public:
|
|||
*/
|
||||
virtual void setToEquilState(const doublereal* lambda_RT);
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
//! Set equation of state parameter values from XML entries.
|
||||
/*!
|
||||
* This method is called by function importPhase() in
|
||||
|
|
@ -711,7 +623,7 @@ public:
|
|||
* XML block. The solvent concentration is then set
|
||||
* to everything else.
|
||||
*
|
||||
* The function first calls the overloaded function ,
|
||||
* The function first calls the overloaded function,
|
||||
* VPStandardStateTP::setStateFromXML(), to pick up the parent class
|
||||
* behavior.
|
||||
*
|
||||
|
|
@ -723,29 +635,17 @@ public:
|
|||
*/
|
||||
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 files importCTML.cpp and
|
||||
/// ThermoFactory.cpp.
|
||||
//@{
|
||||
|
||||
|
||||
/*!
|
||||
* @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.
|
||||
*
|
||||
* @see importCTML.cpp
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
|
||||
/**
|
||||
* Import and initialize a ThermoPhase object
|
||||
*
|
||||
|
|
@ -762,6 +662,7 @@ public:
|
|||
*/
|
||||
void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
//@}
|
||||
|
||||
//! Set the temperature (K), pressure (Pa), and molalities
|
||||
//!(gmol kg-1) of the solutes
|
||||
|
|
@ -821,7 +722,6 @@ public:
|
|||
*/
|
||||
virtual std::string report(bool show_thermo = true) const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
virtual void getCsvReportData(std::vector<std::string>& names,
|
||||
|
|
@ -953,8 +853,6 @@ private:
|
|||
* \f]
|
||||
*
|
||||
* where j is any one species.
|
||||
*
|
||||
*
|
||||
*/
|
||||
const int PHSCALE_PITZER = 0;
|
||||
|
||||
|
|
@ -980,15 +878,9 @@ const int PHSCALE_PITZER = 0;
|
|||
*
|
||||
* 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;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -30,16 +30,15 @@ namespace Cantera
|
|||
*/
|
||||
|
||||
/*!
|
||||
* MolarityIonicVPSSTP is a derived class of ThermoPhase
|
||||
* GibbsExcessVPSSTP that handles
|
||||
* 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
|
||||
* 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.
|
||||
|
|
@ -60,8 +59,7 @@ class MolarityIonicVPSSTP : public GibbsExcessVPSSTP
|
|||
{
|
||||
|
||||
public:
|
||||
|
||||
/// Constructors
|
||||
/// Constructor
|
||||
/*!
|
||||
* This doesn't do much more than initialize constants with
|
||||
* default values for water at 25C. Water molecular weight
|
||||
|
|
@ -73,13 +71,8 @@ public:
|
|||
MolarityIonicVPSSTP();
|
||||
|
||||
//! Construct and initialize a MolarityIonicVPSSTP ThermoPhase object
|
||||
//! directly from an xml input file
|
||||
//! 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.
|
||||
*
|
||||
* @param inputFile 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
|
||||
|
|
@ -96,19 +89,14 @@ public:
|
|||
*/
|
||||
MolarityIonicVPSSTP(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
|
||||
*/
|
||||
MolarityIonicVPSSTP(const MolarityIonicVPSSTP& b);
|
||||
|
||||
/// Assignment operator
|
||||
/*!
|
||||
*
|
||||
* @param b class to be copied.
|
||||
*/
|
||||
MolarityIonicVPSSTP& operator=(const MolarityIonicVPSSTP& b);
|
||||
|
|
@ -124,12 +112,8 @@ public:
|
|||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
/**
|
||||
*
|
||||
* @name Utilities
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! @name Utilities
|
||||
//! @{
|
||||
|
||||
//! Equation of state type flag.
|
||||
/*!
|
||||
|
|
@ -141,39 +125,6 @@ public:
|
|||
*/
|
||||
virtual int eosType() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Molar Thermodynamic Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Utilities for Solvent ID and Molality
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Mechanical Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Potential Energy
|
||||
*
|
||||
* Species may have an additional potential energy due to the
|
||||
* presence of external gravitation or electric fields. These
|
||||
* methods allow specifying a potential energy for individual
|
||||
* species.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Activities, Standard States, and Activity Concentrations
|
||||
|
|
@ -293,67 +244,18 @@ public:
|
|||
*/
|
||||
virtual void getPartialMolarVolumes(doublereal* vbar) const;
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Properties of the Standard State of the Species in the Solution
|
||||
//@{
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Thermodynamic Values for the Species Reference States
|
||||
//@{
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// The methods below are not virtual, and should not
|
||||
// be overloaded.
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @name Specific Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @name Setting the State
|
||||
*
|
||||
* These methods set all or part of the thermodynamic
|
||||
* state.
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! Calculate pseudo binary mole fractions
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
virtual void calcPseudoBinaryMoleFractions() const;
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
/**
|
||||
* @name Chemical Equilibrium
|
||||
* Routines that implement the Chemical equilibrium capability
|
||||
* for a single phase, based on the element-potential method.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
/// @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 files importCTML.cpp and
|
||||
/// ThermoFactory.cpp.
|
||||
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
* @internal Initialize. This method is provided to allow
|
||||
|
|
@ -370,7 +272,6 @@ public:
|
|||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
|
||||
/**
|
||||
* Import and initialize a ThermoPhase object
|
||||
*
|
||||
|
|
@ -386,7 +287,7 @@ public:
|
|||
* 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
|
||||
/*!
|
||||
|
|
@ -395,10 +296,7 @@ public:
|
|||
*/
|
||||
virtual std::string report(bool show_thermo = true) const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Initialize lengths of local variables after all species have been identified.
|
||||
void initLengths();
|
||||
|
||||
|
|
@ -414,7 +312,6 @@ private:
|
|||
*/
|
||||
void readXMLBinarySpecies(XML_Node& xmlBinarySpecies);
|
||||
|
||||
|
||||
//! Update the activity coefficients
|
||||
/*!
|
||||
* This function will be called to update the internally stored
|
||||
|
|
@ -441,7 +338,6 @@ private:
|
|||
*/
|
||||
void s_update_dlnActCoeff_dX_() const;
|
||||
|
||||
|
||||
private:
|
||||
//! Error function
|
||||
/*!
|
||||
|
|
@ -452,13 +348,12 @@ private:
|
|||
doublereal err(const std::string& msg) const;
|
||||
|
||||
protected:
|
||||
|
||||
// Pseudobinary type
|
||||
/*!
|
||||
* PBTYPE_PASSTHROUGH All species are passthrough species
|
||||
* PBTYPE_SINGLEANION there is only one anion in the mixture
|
||||
* PBTYPE_SINGLECATION there is only one cation in the mixture
|
||||
* PBTYPE_MULTICATIONANION Complex mixture
|
||||
* - `PBTYPE_PASSTHROUGH` - All species are passthrough species
|
||||
* - `PBTYPE_SINGLEANION` - there is only one anion in the mixture
|
||||
* - `PBTYPE_SINGLECATION` - there is only one cation in the mixture
|
||||
* - `PBTYPE_MULTICATIONANION` - Complex mixture
|
||||
*/
|
||||
int PBType_;
|
||||
|
||||
|
|
@ -484,10 +379,6 @@ protected:
|
|||
size_t neutralPBindexStart;
|
||||
|
||||
mutable std::vector<doublereal> moleFractionsTmp_;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
};
|
||||
|
||||
#define PBTYPE_PASSTHROUGH 0
|
||||
|
|
@ -495,13 +386,6 @@ private:
|
|||
#define PBTYPE_SINGLECATION 2
|
||||
#define PBTYPE_MULTICATIONANION 3
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@ namespace Cantera
|
|||
//! 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,
|
||||
* 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.
|
||||
|
|
@ -60,7 +59,6 @@ namespace Cantera
|
|||
* like a series of phases. That's why we named it PhaseCombo.
|
||||
*
|
||||
*
|
||||
*
|
||||
* <HR>
|
||||
* <H2> Specification of Species Standard %State Properties </H2>
|
||||
* <HR>
|
||||
|
|
@ -72,7 +70,6 @@ namespace Cantera
|
|||
* 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>
|
||||
|
|
@ -102,7 +99,7 @@ namespace Cantera
|
|||
* 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}
|
||||
|
|
@ -227,29 +224,29 @@ namespace Cantera
|
|||
* \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[
|
||||
* \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]
|
||||
*
|
||||
* \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$.
|
||||
* constant, \f$ K_c \f$.
|
||||
*
|
||||
* \f[
|
||||
* k^{-1} = k^1 K^1_c
|
||||
|
|
@ -262,7 +259,6 @@ namespace Cantera
|
|||
* <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:
|
||||
|
|
@ -276,13 +272,12 @@ namespace Cantera
|
|||
*
|
||||
* or by the following code
|
||||
*
|
||||
* @code
|
||||
* std::string id = "LiFeS_X";
|
||||
* @code
|
||||
* std::string id = "LiFeS_X";
|
||||
* Cantera::ThermoPhase *LiFeS_X_Phase = Cantera::newPhase("LiFeS_X_combo.xml", id);
|
||||
* PhaseCombo_Interaction *LiFeS_X_solid = dynamic_cast <PhaseCombo_Interaction *>(l_tp);
|
||||
* @endcode
|
||||
*
|
||||
*
|
||||
* or by the following constructor:
|
||||
*
|
||||
* @code
|
||||
|
|
@ -298,51 +293,46 @@ namespace Cantera
|
|||
* 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">
|
||||
* <elementArray datasrc="elements.xml">
|
||||
* Li Fe S
|
||||
* </elementArray>
|
||||
* <speciesArray datasrc="#species_LiFeS">
|
||||
* LiTFe1S2(S) Li2Fe1S2(S)
|
||||
* </speciesArray>
|
||||
* <thermo model="PhaseCombo_Interaction">
|
||||
* <activityCoefficients model="Margules" TempModel="constant">
|
||||
* <binaryNeutralSpeciesParameters speciesA="LiTFe1S2(S)" speciesB="Li2Fe1S2(S)">
|
||||
* <excessEnthalpy model="poly_Xb" terms="2" units="kJ/mol">
|
||||
* 84.67069219, -269.1959421
|
||||
* </excessEnthalpy>
|
||||
* <excessEntropy model="poly_Xb" terms="2" units="J/mol/K">
|
||||
* 100.7511565, -361.4222659
|
||||
* </excessEntropy>
|
||||
* <excessVolume_Enthalpy model="poly_Xb" terms="2" units="ml/mol">
|
||||
* 0, 0
|
||||
* </excessVolume_Enthalpy>
|
||||
* <excessVolume_Entropy model="poly_Xb" terms="2" units="ml/mol/K">
|
||||
* 0, 0
|
||||
* </excessVolume_Entropy>
|
||||
* </binaryNeutralSpeciesParameters>
|
||||
* </activityCoefficients>
|
||||
* </thermo>
|
||||
* <transport model="none"/>
|
||||
* <kinetics model="none"/>
|
||||
* </phase>
|
||||
* @endcode
|
||||
*
|
||||
* @verbatim
|
||||
|
||||
<phase dim="3" id="LiFeS_X">
|
||||
<elementArray datasrc="elements.xml">
|
||||
Li Fe S
|
||||
</elementArray>
|
||||
<speciesArray datasrc="#species_LiFeS">
|
||||
LiTFe1S2(S) Li2Fe1S2(S)
|
||||
</speciesArray>
|
||||
<thermo model="PhaseCombo_Interaction">
|
||||
<activityCoefficients model="Margules" TempModel="constant">
|
||||
<binaryNeutralSpeciesParameters speciesA="LiTFe1S2(S)" speciesB="Li2Fe1S2(S)">
|
||||
<excessEnthalpy model="poly_Xb" terms="2" units="kJ/mol">
|
||||
84.67069219, -269.1959421
|
||||
</excessEnthalpy>
|
||||
<excessEntropy model="poly_Xb" terms="2" units="J/mol/K">
|
||||
100.7511565, -361.4222659
|
||||
</excessEntropy>
|
||||
<excessVolume_Enthalpy model="poly_Xb" terms="2" units="ml/mol">
|
||||
0, 0
|
||||
</excessVolume_Enthalpy>
|
||||
<excessVolume_Entropy model="poly_Xb" terms="2" units="ml/mol/K">
|
||||
0, 0
|
||||
</excessVolume_Entropy>
|
||||
</binaryNeutralSpeciesParameters>
|
||||
</activityCoefficients>
|
||||
</thermo>
|
||||
<transport model="none"/>
|
||||
<kinetics model="none"/>
|
||||
</phase>
|
||||
|
||||
@endverbatim
|
||||
* 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
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
*
|
||||
*/
|
||||
*/
|
||||
class PhaseCombo_Interaction : public GibbsExcessVPSSTP
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
/*!
|
||||
* This doesn't do much more than initialize constants with
|
||||
|
|
@ -357,13 +347,6 @@ public:
|
|||
//! Construct and initialize a PhaseCombo_Interaction 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.
|
||||
*
|
||||
* @param inputFile 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
|
||||
|
|
@ -380,29 +363,22 @@ public:
|
|||
*/
|
||||
PhaseCombo_Interaction(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
|
||||
//! Special constructor for a hard-coded problem
|
||||
/*!
|
||||
*
|
||||
* @param testProb Hard-coded value. Only the value of 1 is
|
||||
* used. It's for
|
||||
* a LiKCl system
|
||||
* -> test to predict the eutectic and liquidus correctly.
|
||||
* @param testProb Hard-coded value. Only the value of 1 is used. It's
|
||||
* for a LiKCl system -> test to predict the eutectic and
|
||||
* liquidus correctly.
|
||||
*/
|
||||
PhaseCombo_Interaction(int testProb);
|
||||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working 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);
|
||||
|
|
@ -418,55 +394,32 @@ public:
|
|||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
/**
|
||||
*
|
||||
* @name Utilities
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! @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.
|
||||
* 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
|
||||
* @{
|
||||
*/
|
||||
//! @}
|
||||
//! @name Molar Thermodynamic Properties
|
||||
//! @{
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Utilities for Solvent ID and Molality
|
||||
* @{
|
||||
*/
|
||||
/// 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;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Mechanical Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Potential Energy
|
||||
*
|
||||
* Species may have an additional potential energy due to the
|
||||
* presence of external gravitation or electric fields. These
|
||||
* methods allow specifying a potential energy for individual
|
||||
* species.
|
||||
* @{
|
||||
*/
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
virtual doublereal cv_mole() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
@ -502,18 +455,6 @@ public:
|
|||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
/// 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;
|
||||
|
||||
//! Returns an array of partial molar enthalpies for the species
|
||||
//! in the mixture.
|
||||
/*!
|
||||
|
|
@ -574,7 +515,6 @@ public:
|
|||
*/
|
||||
virtual void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
||||
|
||||
//! Return an array of partial molar volumes for the
|
||||
//! species in the mixture. Units: m^3/kmol.
|
||||
/*!
|
||||
|
|
@ -626,28 +566,14 @@ public:
|
|||
*/
|
||||
virtual void getdlnActCoeffdT(doublereal* dlnActCoeffdT) const;
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Properties of the Standard State of the Species in the Solution
|
||||
//@{
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Thermodynamic Values for the Species Reference States
|
||||
//@{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// @}
|
||||
/// @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 files importCTML.cpp and
|
||||
/// ThermoFactory.cpp.
|
||||
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
* @internal Initialize. This method is provided to allow
|
||||
|
|
@ -664,7 +590,6 @@ public:
|
|||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
|
||||
/**
|
||||
* Import and initialize a ThermoPhase object
|
||||
*
|
||||
|
|
@ -681,11 +606,9 @@ public:
|
|||
*/
|
||||
void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Derivatives of Thermodynamic Variables needed for Applications
|
||||
* @{
|
||||
*/
|
||||
//! @}
|
||||
//! @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
|
||||
|
|
@ -734,7 +657,6 @@ public:
|
|||
*/
|
||||
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
|
||||
|
|
@ -758,7 +680,6 @@ public:
|
|||
//@}
|
||||
|
||||
private:
|
||||
|
||||
//! Process an XML node called "binaryNeutralSpeciesParameters"
|
||||
/*!
|
||||
* This node contains all of the parameters necessary to describe
|
||||
|
|
@ -778,7 +699,6 @@ private:
|
|||
*/
|
||||
void resizeNumInteractions(const size_t num);
|
||||
|
||||
|
||||
//! Initialize lengths of local variables after all species have
|
||||
//! been identified.
|
||||
void initLengths();
|
||||
|
|
@ -824,7 +744,6 @@ private:
|
|||
*/
|
||||
void s_update_dlnActCoeff_dlnN() const;
|
||||
|
||||
|
||||
private:
|
||||
//! Error function
|
||||
/*!
|
||||
|
|
@ -835,8 +754,6 @@ private:
|
|||
doublereal err(const std::string& msg) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
//! number of binary interaction expressions
|
||||
size_t numBinaryInteractions_;
|
||||
|
||||
|
|
@ -888,8 +805,6 @@ protected:
|
|||
//! 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.
|
||||
|
|
@ -915,17 +830,8 @@ protected:
|
|||
* Currently there is only one form -> constant wrt temperature.
|
||||
*/
|
||||
int formTempModel_;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Header for intermediate ThermoPhase object for phases which
|
||||
* employ gibbs excess free energy based formulations
|
||||
* (see \ref thermoprops
|
||||
* and class \link Cantera::gibbsExcessVPSSTP gibbsExcessVPSSTP\endlink).
|
||||
* and class \link Cantera::PseudoBinaryVPSSTP PseudoBinaryVPSSTP\endlink).
|
||||
*
|
||||
* Header file for a derived class of ThermoPhase that handles
|
||||
* variable pressure standard state methods for calculating
|
||||
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
/**
|
||||
* @ingroup thermoprops
|
||||
*/
|
||||
|
|
@ -40,14 +39,14 @@ namespace Cantera
|
|||
* and semi-miscible compounds.
|
||||
*
|
||||
* It includes
|
||||
* . regular solutions
|
||||
* . Margules expansions
|
||||
* . NTRL equation
|
||||
* . Wilson's equation
|
||||
* . UNIQUAC equation of state.
|
||||
* - regular solutions
|
||||
* - Margules expansions
|
||||
* - NTRL equation
|
||||
* - 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
|
||||
* 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.
|
||||
|
|
@ -62,15 +61,11 @@ namespace Cantera
|
|||
* The way that it collects the cation and anion based mole numbers
|
||||
* is via holding two extra ThermoPhase objects. These
|
||||
* can include standard states for salts.
|
||||
*
|
||||
*
|
||||
*/
|
||||
class PseudoBinaryVPSSTP : public GibbsExcessVPSSTP
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/// Constructors
|
||||
/// Constructor
|
||||
/*!
|
||||
* This doesn't do much more than initialize constants with
|
||||
* default values for water at 25C. Water molecular weight
|
||||
|
|
@ -83,16 +78,12 @@ public:
|
|||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working copy constructor
|
||||
*
|
||||
* @param b class to be copied
|
||||
*/
|
||||
PseudoBinaryVPSSTP(const PseudoBinaryVPSSTP& b);
|
||||
|
||||
/// Assignment operator
|
||||
/*!
|
||||
*
|
||||
* @param b class to be copied.
|
||||
*/
|
||||
PseudoBinaryVPSSTP& operator=(const PseudoBinaryVPSSTP& b);
|
||||
|
|
@ -108,58 +99,18 @@ public:
|
|||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
/**
|
||||
*
|
||||
* @name Utilities
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! @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.
|
||||
* listed in mix_defs.h.
|
||||
*/
|
||||
virtual int eosType() const;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Molar Thermodynamic Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Utilities for Solvent ID and Molality
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Mechanical Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Potential Energy
|
||||
*
|
||||
* Species may have an additional potential energy due to the
|
||||
* presence of external gravitation or electric fields. These
|
||||
* methods allow specifying a potential energy for individual
|
||||
* species.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Activities, Standard States, and Activity Concentrations
|
||||
|
|
@ -172,9 +123,6 @@ public:
|
|||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize
|
||||
* the generalized concentration. In many cases, this quantity
|
||||
|
|
@ -197,15 +145,10 @@ public:
|
|||
* @param k species index
|
||||
*/
|
||||
virtual doublereal logStandardConc(size_t k=0) const;
|
||||
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
||||
|
||||
/**
|
||||
* Get the species electrochemical potentials.
|
||||
* These are partial molar quantities.
|
||||
|
|
@ -218,69 +161,19 @@ public:
|
|||
* Length: m_kk.
|
||||
*/
|
||||
void getElectrochemPotentials(doublereal* mu) const;
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Properties of the Standard State of the Species in the Solution
|
||||
//@{
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Thermodynamic Values for the Species Reference States
|
||||
//@{
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// The methods below are not virtual, and should not
|
||||
// be overloaded.
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @name Specific Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @name Setting the State
|
||||
*
|
||||
* These methods set all or part of the thermodynamic
|
||||
* state.
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! Calculate pseudo binary mole fractions
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
virtual void calcPseudoBinaryMoleFractions() const;
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
/**
|
||||
* @name Chemical Equilibrium
|
||||
* Routines that implement the Chemical equilibrium capability
|
||||
* for a single phase, based on the element-potential method.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
/// @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 files importCTML.cpp and
|
||||
/// ThermoFactory.cpp.
|
||||
|
||||
|
||||
/*!
|
||||
* @internal Initialize. This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
|
|
@ -296,7 +189,6 @@ public:
|
|||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
|
||||
/**
|
||||
* Import and initialize a ThermoPhase object
|
||||
*
|
||||
|
|
@ -313,7 +205,6 @@ public:
|
|||
*/
|
||||
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
|
||||
|
|
@ -321,17 +212,11 @@ public:
|
|||
*/
|
||||
virtual std::string report(bool show_thermo = true) const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Initialize lengths of local variables after all species have
|
||||
//! been identified.
|
||||
void initLengths();
|
||||
|
||||
|
||||
|
||||
private:
|
||||
//! Error function
|
||||
/*!
|
||||
* Print an error string and exit
|
||||
|
|
@ -341,7 +226,6 @@ private:
|
|||
doublereal err(const std::string& msg) const;
|
||||
|
||||
protected:
|
||||
|
||||
int PBType_;
|
||||
|
||||
//! Number of pseudo binary species
|
||||
|
|
@ -367,10 +251,6 @@ protected:
|
|||
ThermoPhase* anionPhase_;
|
||||
|
||||
mutable std::vector<doublereal> moleFractionsTmp_;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
};
|
||||
|
||||
#define PBTYPE_PASSTHROUGH 0
|
||||
|
|
@ -383,8 +263,3 @@ private:
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ namespace Cantera
|
|||
//! 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.
|
||||
|
|
@ -82,13 +81,13 @@ namespace Cantera
|
|||
* 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]
|
||||
*
|
||||
* 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)
|
||||
|
|
@ -117,8 +116,6 @@ namespace Cantera
|
|||
* 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]
|
||||
* where
|
||||
*
|
||||
*
|
||||
* 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
|
||||
|
|
@ -215,41 +212,41 @@ namespace Cantera
|
|||
* 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[
|
||||
* \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]
|
||||
*
|
||||
* %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[
|
||||
* \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]
|
||||
*
|
||||
* \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$.
|
||||
* constant, \f$ K_c \f$.
|
||||
*
|
||||
* \f[
|
||||
* k^{-1} = k^1 K^1_c
|
||||
|
|
@ -257,65 +254,12 @@ namespace Cantera
|
|||
*
|
||||
* \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:
|
||||
*
|
||||
* @code
|
||||
* XML_Node *xc = get_XML_File("silane.xml");
|
||||
* XML_Node * const xs = xc->findNameID("phase", "silane");
|
||||
* ThermoPhase *silane_tp = newPhase(*xs);
|
||||
* IdealGasPhase *silaneGas = dynamic_cast <IdealGasPhase *>(silane_tp);
|
||||
* @endcode
|
||||
*
|
||||
* or by the following constructor:
|
||||
*
|
||||
* @code
|
||||
* XML_Node *xc = get_XML_File("silane.xml");
|
||||
* XML_Node * const xs = xc->findNameID("phase", "silane");
|
||||
* IdealGasPhase *silaneGas = new IdealGasPhase(*xs);
|
||||
* @endcode
|
||||
*
|
||||
* <HR>
|
||||
* <H2> XML Example </H2>
|
||||
* <HR>
|
||||
* An example of an XML Element named phase setting up a IdealGasPhase
|
||||
* object named silane is given below.
|
||||
*
|
||||
*
|
||||
* @verbatim
|
||||
<!-- phase silane -->
|
||||
<phase dim="3" id="silane">
|
||||
<elementArray datasrc="elements.xml"> Si H He </elementArray>
|
||||
<speciesArray datasrc="#species_data">
|
||||
H2 H HE SIH4 SI SIH SIH2 SIH3 H3SISIH SI2H6
|
||||
H2SISIH2 SI3H8 SI2 SI3
|
||||
</speciesArray>
|
||||
<reactionArray datasrc="#reaction_data"/>
|
||||
<thermo model="IdealGas"/>
|
||||
<kinetics model="GasKinetics"/>
|
||||
<transport model="None"/>
|
||||
</phase>
|
||||
@endverbatim
|
||||
*
|
||||
* The model attribute "IdealGas" of the thermo XML element identifies the phase as
|
||||
* being of the type handled by the IdealGasPhase object.
|
||||
*
|
||||
* @ingroup thermoprops
|
||||
*
|
||||
|
||||
*/
|
||||
*/
|
||||
class RedlichKisterVPSSTP : public GibbsExcessVPSSTP
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
/*!
|
||||
* This doesn't do much more than initialize constants with
|
||||
|
|
@ -326,10 +270,6 @@ public:
|
|||
//! Construct and initialize a RedlichKisterVPSSTP 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.
|
||||
*
|
||||
* @param inputFile Name of the input file containing the phase XML data
|
||||
* to set up the object
|
||||
|
|
@ -347,29 +287,22 @@ public:
|
|||
*/
|
||||
RedlichKisterVPSSTP(XML_Node& phaseRef, const std::string& id = "");
|
||||
|
||||
|
||||
//! Special constructor for a hard-coded problem
|
||||
/*!
|
||||
*
|
||||
* @param testProb Hard-coded value. Only the value of 1 is
|
||||
* used. It's for
|
||||
* a LiKCl system
|
||||
* -> test to predict the eutectic and liquidus correctly.
|
||||
* @param testProb Hard-coded value. Only the value of 1 is used. It's
|
||||
* for a LiKCl system -> test to predict the eutectic and
|
||||
* liquidus correctly.
|
||||
*/
|
||||
RedlichKisterVPSSTP(int testProb);
|
||||
|
||||
//! Copy constructor
|
||||
/*!
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working 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);
|
||||
|
|
@ -385,55 +318,33 @@ public:
|
|||
*/
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
/**
|
||||
*
|
||||
* @name Utilities
|
||||
* @{
|
||||
*/
|
||||
|
||||
//! @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.
|
||||
* listed in mix_defs.h.
|
||||
*/
|
||||
virtual int eosType() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Molar Thermodynamic Properties
|
||||
* @{
|
||||
*/
|
||||
//! @}
|
||||
//! @name Molar Thermodynamic Properties
|
||||
//! @{
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
virtual doublereal enthalpy_mole() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Utilities for Solvent ID and Molality
|
||||
* @{
|
||||
*/
|
||||
/// 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;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Mechanical Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Potential Energy
|
||||
*
|
||||
* Species may have an additional potential energy due to the
|
||||
* presence of external gravitation or electric fields. These
|
||||
* methods allow specifying a potential energy for individual
|
||||
* species.
|
||||
* @{
|
||||
*/
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
virtual doublereal cv_mole() const;
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
@ -469,18 +380,6 @@ public:
|
|||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
/// 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;
|
||||
|
||||
//! Returns an array of partial molar enthalpies for the species
|
||||
//! in the mixture.
|
||||
/*!
|
||||
|
|
@ -541,7 +440,6 @@ public:
|
|||
*/
|
||||
virtual void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
||||
|
||||
//! Return an array of partial molar volumes for the
|
||||
//! species in the mixture. Units: m^3/kmol.
|
||||
/*!
|
||||
|
|
@ -576,7 +474,6 @@ public:
|
|||
*
|
||||
* @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of the
|
||||
* log Activity Coefficients. length = m_kk
|
||||
*
|
||||
*/
|
||||
virtual void getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const;
|
||||
|
||||
|
|
@ -589,68 +486,17 @@ public:
|
|||
*
|
||||
* @param dlnActCoeffdT Output vector of temperature derivatives of the
|
||||
* log Activity Coefficients. length = m_kk
|
||||
*
|
||||
*/
|
||||
virtual void getdlnActCoeffdT(doublereal* dlnActCoeffdT) const;
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Properties of the Standard State of the Species in the Solution
|
||||
//@{
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Thermodynamic Values for the Species Reference States
|
||||
//@{
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// The methods below are not virtual, and should not
|
||||
// be overloaded.
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @name Specific Properties
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @name Setting the State
|
||||
*
|
||||
* These methods set all or part of the thermodynamic
|
||||
* state.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
/**
|
||||
* @name Chemical Equilibrium
|
||||
* Routines that implement the Chemical equilibrium capability
|
||||
* for a single phase, based on the element-potential method.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
/// @}
|
||||
/// @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 files importCTML.cpp and
|
||||
/// ThermoFactory.cpp.
|
||||
|
||||
|
||||
/*!
|
||||
* @internal Initialize. This method is provided to allow
|
||||
* subclasses to perform any initialization required after all
|
||||
|
|
@ -666,7 +512,6 @@ public:
|
|||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
|
||||
/**
|
||||
* Import and initialize a ThermoPhase object
|
||||
*
|
||||
|
|
@ -683,11 +528,9 @@ public:
|
|||
*/
|
||||
void initThermoXML(XML_Node& phaseNode, const std::string& id);
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Derivatives of Thermodynamic Variables needed for Applications
|
||||
* @{
|
||||
*/
|
||||
//! @}
|
||||
//! @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
|
||||
|
|
@ -736,7 +579,6 @@ public:
|
|||
*/
|
||||
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
|
||||
|
|
@ -760,7 +602,6 @@ public:
|
|||
//@}
|
||||
|
||||
private:
|
||||
|
||||
//! Process an XML node called "binaryNeutralSpeciesParameters"
|
||||
/*!
|
||||
* This node contains all of the parameters necessary to describe
|
||||
|
|
@ -780,7 +621,6 @@ private:
|
|||
*/
|
||||
void resizeNumInteractions(const size_t num);
|
||||
|
||||
|
||||
//! Initialize lengths of local variables after all species have
|
||||
//! been identified.
|
||||
void initLengths();
|
||||
|
|
@ -831,7 +671,6 @@ private:
|
|||
doublereal err(const std::string& msg) const;
|
||||
|
||||
protected:
|
||||
|
||||
//! number of binary interaction expressions
|
||||
size_t numBinaryInteractions_;
|
||||
|
||||
|
|
@ -849,16 +688,13 @@ protected:
|
|||
*/
|
||||
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
|
||||
mutable std::vector< vector_fp> m_HE_m_ij;
|
||||
|
||||
|
||||
//! Entropy term for the binary mole fraction interaction of the
|
||||
//! excess gibbs free energy expression
|
||||
mutable std::vector< vector_fp> m_SE_m_ij;
|
||||
|
|
@ -875,20 +711,10 @@ protected:
|
|||
*/
|
||||
int formTempModel_;
|
||||
|
||||
|
||||
//! Two dimensional array of derivatives of activity coefficients wrt mole fractions
|
||||
mutable Array2D dlnActCoeff_dX_;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -60,12 +60,8 @@ class VPStandardStateTP : public ThermoPhase
|
|||
{
|
||||
|
||||
public:
|
||||
//! @name Constructors and Duplicators for %VPStandardStateTP
|
||||
|
||||
/*!
|
||||
*
|
||||
* @name Constructors and Duplicators for %VPStandardStateTP
|
||||
*
|
||||
*/
|
||||
/// Constructor.
|
||||
VPStandardStateTP();
|
||||
|
||||
|
|
@ -84,16 +80,11 @@ public:
|
|||
//! Destructor.
|
||||
virtual ~VPStandardStateTP();
|
||||
|
||||
/*
|
||||
* Duplication routine
|
||||
*/
|
||||
//! Duplication routine
|
||||
virtual ThermoPhase* duplMyselfAsThermoPhase() const;
|
||||
|
||||
//@}
|
||||
|
||||
/**
|
||||
* @name Utilities (VPStandardStateTP)
|
||||
*/
|
||||
//! @name Utilities (VPStandardStateTP)
|
||||
//@{
|
||||
/**
|
||||
* Equation of state type flag. The base class returns
|
||||
|
|
@ -110,12 +101,10 @@ public:
|
|||
//! 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
|
||||
* - Temperature-based activities,
|
||||
* `cSS_CONVENTION_TEMPERATURE 0` (default)
|
||||
* - Variable Pressure and Temperature-based activities,
|
||||
* `cSS_CONVENTION_VPSS 1`
|
||||
*/
|
||||
virtual int standardStateConvention() const;
|
||||
|
||||
|
|
@ -141,17 +130,14 @@ public:
|
|||
err("getdlnActCoeffdlnN_diag");
|
||||
}
|
||||
|
||||
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution (VPStandardStateTP)
|
||||
/// @name Partial Molar Properties of the Solution (VPStandardStateTP)
|
||||
//@{
|
||||
|
||||
|
||||
//! 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,
|
||||
* \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
|
||||
|
|
@ -165,14 +151,12 @@ 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 (VPStandardStateTP)
|
||||
*
|
||||
* 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.
|
||||
* _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.
|
||||
*/
|
||||
//@{
|
||||
|
||||
|
|
@ -271,7 +255,6 @@ public:
|
|||
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
|
||||
|
|
@ -282,7 +265,6 @@ public:
|
|||
*/
|
||||
virtual void setTemperature(const doublereal temp);
|
||||
|
||||
|
||||
//! Set the internally stored pressure (Pa) at constant
|
||||
//! temperature and composition
|
||||
/*!
|
||||
|
|
@ -405,7 +387,6 @@ public:
|
|||
*/
|
||||
//@{
|
||||
|
||||
|
||||
//! Returns the vector of nondimensional
|
||||
//! enthalpies of the reference state at the current temperature
|
||||
//! of the solution and the reference pressure for the species.
|
||||
|
|
@ -434,7 +415,6 @@ public:
|
|||
//! 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.
|
||||
|
|
@ -488,16 +468,9 @@ public:
|
|||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getStandardVolumes_ref(doublereal* vol) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//! @name Initialization Methods - For Internal use (VPStandardState)
|
||||
/*!
|
||||
* The following methods are used in the process of constructing
|
||||
|
|
@ -521,23 +494,6 @@ public:
|
|||
*/
|
||||
virtual void setParametersFromXML(const XML_Node& eosdata) {}
|
||||
|
||||
//! @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.
|
||||
*
|
||||
* @see importCTML.cpp
|
||||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
//! Initialize a ThermoPhase object, potentially reading activity
|
||||
|
|
@ -634,9 +590,7 @@ protected:
|
|||
*/
|
||||
std::vector<PDSS*> m_PDSS_storage;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
//! VPStandardStateTP has its own err routine
|
||||
/*!
|
||||
* @param msg Error message string
|
||||
|
|
|
|||
|
|
@ -30,9 +30,6 @@ using namespace ctml;
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
/*
|
||||
* Default constructor
|
||||
*/
|
||||
DebyeHuckel::DebyeHuckel() :
|
||||
MolalityVPSSTP(),
|
||||
m_formDH(DHFORM_DILUTE_LIMIT),
|
||||
|
|
@ -55,14 +52,6 @@ DebyeHuckel::DebyeHuckel() :
|
|||
m_npActCoeff[2] = 1.545E-3;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
DebyeHuckel::DebyeHuckel(const std::string& inputFile,
|
||||
const std::string& id) :
|
||||
MolalityVPSSTP(),
|
||||
|
|
@ -108,12 +97,6 @@ DebyeHuckel::DebyeHuckel(XML_Node& phaseRoot, const std::string& id) :
|
|||
importPhase(*findXMLPhase(&phaseRoot, id), this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy Constructor:
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working copy constructor
|
||||
*/
|
||||
DebyeHuckel::DebyeHuckel(const DebyeHuckel& b) :
|
||||
MolalityVPSSTP(),
|
||||
m_formDH(DHFORM_DILUTE_LIMIT),
|
||||
|
|
@ -136,12 +119,6 @@ DebyeHuckel::DebyeHuckel(const DebyeHuckel& b) :
|
|||
*this = b;
|
||||
}
|
||||
|
||||
/*
|
||||
* operator=()
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working assignment operator
|
||||
*/
|
||||
DebyeHuckel& DebyeHuckel::
|
||||
operator=(const DebyeHuckel& b)
|
||||
{
|
||||
|
|
@ -187,13 +164,6 @@ operator=(const DebyeHuckel& b)
|
|||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ~DebyeHuckel(): (virtual)
|
||||
*
|
||||
* Destructor for DebyeHuckel. Release objects that
|
||||
* it owns.
|
||||
*/
|
||||
DebyeHuckel::~DebyeHuckel()
|
||||
{
|
||||
if (m_waterProps) {
|
||||
|
|
@ -202,24 +172,11 @@ DebyeHuckel::~DebyeHuckel()
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* duplMyselfAsThermoPhase():
|
||||
*
|
||||
* This routine operates at the ThermoPhase level to
|
||||
* duplicate the current object. It uses the copy constructor
|
||||
* defined above.
|
||||
*/
|
||||
ThermoPhase* DebyeHuckel::duplMyselfAsThermoPhase() const
|
||||
{
|
||||
return new DebyeHuckel(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
int DebyeHuckel::eosType() const
|
||||
{
|
||||
int res;
|
||||
|
|
@ -243,23 +200,15 @@ int DebyeHuckel::eosType() const
|
|||
//
|
||||
// -------- Molar Thermodynamic Properties of the Solution ---------------
|
||||
//
|
||||
/*
|
||||
* Molar enthalpy of the solution. Units: J/kmol.
|
||||
*/
|
||||
doublereal DebyeHuckel::enthalpy_mole() const
|
||||
{
|
||||
getPartialMolarEnthalpies(DATA_PTR(m_tmpV));
|
||||
return mean_X(DATA_PTR(m_tmpV));
|
||||
}
|
||||
|
||||
/*
|
||||
* Molar internal energy of the solution. Units: J/kmol.
|
||||
*
|
||||
* This is calculated from the soln enthalpy and then
|
||||
* subtracting pV.
|
||||
*/
|
||||
doublereal DebyeHuckel::intEnergy_mole() const
|
||||
{
|
||||
// This is calculated from the soln enthalpy and then subtracting pV.
|
||||
double hh = enthalpy_mole();
|
||||
double pres = pressure();
|
||||
double molarV = 1.0/molarDensity();
|
||||
|
|
@ -267,30 +216,18 @@ doublereal DebyeHuckel::intEnergy_mole() const
|
|||
return uu;
|
||||
}
|
||||
|
||||
/*
|
||||
* Molar soln entropy at constant pressure. Units: J/kmol/K.
|
||||
*
|
||||
* This is calculated from the partial molar entropies.
|
||||
*/
|
||||
doublereal DebyeHuckel::entropy_mole() const
|
||||
{
|
||||
getPartialMolarEntropies(DATA_PTR(m_tmpV));
|
||||
return mean_X(DATA_PTR(m_tmpV));
|
||||
}
|
||||
|
||||
// Molar Gibbs function. Units: J/kmol.
|
||||
doublereal DebyeHuckel::gibbs_mole() const
|
||||
{
|
||||
getChemPotentials(DATA_PTR(m_tmpV));
|
||||
return mean_X(DATA_PTR(m_tmpV));
|
||||
}
|
||||
|
||||
/*
|
||||
* Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
*
|
||||
* Returns the solution heat capacition at constant pressure.
|
||||
* This is calculated from the partial molar heat capacities.
|
||||
*/
|
||||
doublereal DebyeHuckel::cp_mole() const
|
||||
{
|
||||
getPartialMolarCp(DATA_PTR(m_tmpV));
|
||||
|
|
@ -298,7 +235,6 @@ doublereal DebyeHuckel::cp_mole() const
|
|||
return val;
|
||||
}
|
||||
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
doublereal DebyeHuckel::cv_mole() const
|
||||
{
|
||||
//getPartialMolarCv(m_tmpV.begin());
|
||||
|
|
@ -311,11 +247,6 @@ doublereal DebyeHuckel::cv_mole() const
|
|||
// ------- Mechanical Equation of State Properties ------------------------
|
||||
//
|
||||
|
||||
/*
|
||||
* Pressure. Units: Pa.
|
||||
* For this incompressible system, we return the internally stored
|
||||
* independent value of the pressure.
|
||||
*/
|
||||
doublereal DebyeHuckel::pressure() const
|
||||
{
|
||||
return m_Pcurrent;
|
||||
|
|
@ -348,27 +279,6 @@ void DebyeHuckel::setState_TP(doublereal t, doublereal p)
|
|||
calcDensity();
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* 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 DebyeHuckel::calcDensity()
|
||||
{
|
||||
if (m_waterSS) {
|
||||
|
|
@ -392,17 +302,6 @@ void DebyeHuckel::calcDensity()
|
|||
Phase::setDensity(dd);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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]
|
||||
*
|
||||
* It's equal to zero for this model, since the molar volume
|
||||
* doesn't change with pressure or temperature.
|
||||
*/
|
||||
doublereal DebyeHuckel::isothermalCompressibility() const
|
||||
{
|
||||
throw CanteraError("DebyeHuckel::isothermalCompressibility",
|
||||
|
|
@ -410,17 +309,6 @@ doublereal DebyeHuckel::isothermalCompressibility() const
|
|||
return 0.0;
|
||||
}
|
||||
|
||||
/*
|
||||
* The 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]
|
||||
*
|
||||
* It's equal to zero for this model, since the molar volume
|
||||
* doesn't change with pressure or temperature.
|
||||
*/
|
||||
doublereal DebyeHuckel::thermalExpansionCoeff() const
|
||||
{
|
||||
throw CanteraError("DebyeHuckel::thermalExpansionCoeff",
|
||||
|
|
@ -428,22 +316,6 @@ doublereal DebyeHuckel::thermalExpansionCoeff() const
|
|||
return 0.0;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* NOTE: This is an overwritten function from the State.h
|
||||
* class
|
||||
*/
|
||||
void DebyeHuckel::setDensity(doublereal rho)
|
||||
{
|
||||
double dens = density();
|
||||
|
|
@ -453,15 +325,6 @@ void DebyeHuckel::setDensity(doublereal rho)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Overwritten setMolarDensity() function is necessary because the
|
||||
* density is not an independent variable.
|
||||
*
|
||||
* This function will now throw an error condition.
|
||||
*
|
||||
* NOTE: This is a virtual function, overwritten function from the State.h
|
||||
* class
|
||||
*/
|
||||
void DebyeHuckel::setMolarDensity(const doublereal conc)
|
||||
{
|
||||
double concI = molarDensity();
|
||||
|
|
@ -471,34 +334,15 @@ void DebyeHuckel::setMolarDensity(const doublereal conc)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Overwritten setTemperature(double) from State.h. This
|
||||
* function sets the temperature, and makes sure that
|
||||
* the value propagates to underlying objects.
|
||||
*/
|
||||
void DebyeHuckel::setTemperature(const doublereal temp)
|
||||
{
|
||||
setState_TP(temp, m_Pcurrent);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// ------- Activities and Activity Concentrations
|
||||
//
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
void DebyeHuckel::getActivityConcentrations(doublereal* c) const
|
||||
{
|
||||
double c_solvent = standardConcentration();
|
||||
|
|
@ -508,61 +352,18 @@ void DebyeHuckel::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.
|
||||
*
|
||||
* 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 reaction rates
|
||||
* based on the molality of species proportional to the
|
||||
* molality of the species.
|
||||
*/
|
||||
doublereal DebyeHuckel::standardConcentration(size_t k) const
|
||||
{
|
||||
double mvSolvent = m_speciesSize[m_indexSolvent];
|
||||
return 1.0 / mvSolvent;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the natural logarithm of the standard
|
||||
* concentration of the kth species
|
||||
*/
|
||||
doublereal DebyeHuckel::logStandardConc(size_t k) const
|
||||
{
|
||||
double c_solvent = standardConcentration(k);
|
||||
return log(c_solvent);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the units of the standard and general concentrations
|
||||
* Note they have the same units, as their divisor is
|
||||
* defined to be equal to the activity of the kth species
|
||||
* in the solution, which is unitless.
|
||||
*
|
||||
* This routine is used in print out applications where the
|
||||
* units are needed. Usually, MKS units are assumed throughout
|
||||
* the program and in the XML input files.
|
||||
*
|
||||
* On return uA contains the powers of the units (MKS assumed)
|
||||
* of the standard concentrations and generalized concentrations
|
||||
* for the kth species.
|
||||
*
|
||||
* uA[0] = kmol units - default = 1
|
||||
* uA[1] = m units - default = -nDim(), the number of spatial
|
||||
* dimensions in the Phase class.
|
||||
* uA[2] = kg units - default = 0;
|
||||
* uA[3] = Pa(pressure) units - default = 0;
|
||||
* uA[4] = Temperature units - default = 0;
|
||||
* uA[5] = time units - default = 0
|
||||
*/
|
||||
void DebyeHuckel::getUnitsStandardConc(double* uA, int k, int sizeUA) const
|
||||
{
|
||||
for (int i = 0; i < sizeUA; i++) {
|
||||
|
|
@ -587,14 +388,6 @@ void DebyeHuckel::getUnitsStandardConc(double* uA, int k, int sizeUA) const
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the array of non-dimensional activities at
|
||||
* the current solution temperature, pressure, and
|
||||
* solution concentration.
|
||||
* (note solvent activity coefficient is on the molar scale).
|
||||
*
|
||||
*/
|
||||
void DebyeHuckel::getActivities(doublereal* ac) const
|
||||
{
|
||||
_updateStandardStateThermo();
|
||||
|
|
@ -613,17 +406,6 @@ void DebyeHuckel::getActivities(doublereal* ac) const
|
|||
exp(m_lnActCoeffMolal[m_indexSolvent]) * xmolSolvent;
|
||||
}
|
||||
|
||||
/*
|
||||
* getMolalityActivityCoefficients() (virtual, const)
|
||||
*
|
||||
* Get the array of non-dimensional Molality based
|
||||
* activity coefficients at
|
||||
* the current solution temperature, pressure, and
|
||||
* solution concentration.
|
||||
* (note solvent activity coefficient is on the molar scale).
|
||||
*
|
||||
* Note, most of the work is done in an internal private routine
|
||||
*/
|
||||
void DebyeHuckel::
|
||||
getMolalityActivityCoefficients(doublereal* acMolality) const
|
||||
{
|
||||
|
|
@ -639,21 +421,6 @@ getMolalityActivityCoefficients(doublereal* acMolality) const
|
|||
//
|
||||
// ------ 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.
|
||||
*
|
||||
* \f[
|
||||
* \mu_k = \mu^{o}_k(T,P) + R T ln(m_k)
|
||||
* \f]
|
||||
*
|
||||
* \f[
|
||||
* \mu_solvent = \mu^{o}_solvent(T,P) +
|
||||
* R T ((X_solvent - 1.0) / X_solvent)
|
||||
* \f]
|
||||
*/
|
||||
void DebyeHuckel::getChemPotentials(doublereal* mu) const
|
||||
{
|
||||
double xx;
|
||||
|
|
@ -682,19 +449,6 @@ void DebyeHuckel::getChemPotentials(doublereal* mu) const
|
|||
RT * (log(xx) + m_lnActCoeffMolal[m_indexSolvent]);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns an array of partial molar enthalpies for the species
|
||||
* in the mixture.
|
||||
* Units (J/kmol)
|
||||
*
|
||||
* We calculate this quantity partially from the relation and
|
||||
* partially by calling the standard state enthalpy function.
|
||||
*
|
||||
* hbar_i = - T**2 * d(chemPot_i/T)/dT
|
||||
*
|
||||
* We calculate
|
||||
*/
|
||||
void DebyeHuckel::getPartialMolarEnthalpies(doublereal* hbar) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -729,35 +483,6 @@ void DebyeHuckel::getPartialMolarEnthalpies(doublereal* hbar) const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* getPartialMolarEntropies() (virtual, const)
|
||||
*
|
||||
* 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)
|
||||
*
|
||||
* d(chemPot_i)/dT = -sbar_i
|
||||
*
|
||||
* For this phase, the partial molar entropies are equal to the
|
||||
* SS species entropies plus the ideal solution contribution.following
|
||||
* contribution:
|
||||
* \f[
|
||||
* \bar s_k(T,P) = \hat s^0_k(T) - R log(M0 * molality[k])
|
||||
* \f]
|
||||
* \f[
|
||||
* \bar s_solvent(T,P) = \hat s^0_solvent(T)
|
||||
* - R ((xmolSolvent - 1.0) / xmolSolvent)
|
||||
* \f]
|
||||
*
|
||||
* The reference-state pure-species entropies,\f$ \hat 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
|
||||
*/
|
||||
void DebyeHuckel::
|
||||
getPartialMolarEntropies(doublereal* sbar) const
|
||||
{
|
||||
|
|
@ -807,25 +532,6 @@ getPartialMolarEntropies(doublereal* sbar) const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* getPartialMolarVolumes() (virtual, const)
|
||||
*
|
||||
* returns an array of partial molar volumes of the species
|
||||
* in the solution. Units: m^3 kmol-1.
|
||||
*
|
||||
* For this solution, the partial molar volumes are normally
|
||||
* equal to theconstant species molar volumes, except
|
||||
* when the activity coefficients depend on pressure.
|
||||
*
|
||||
* The general relation is
|
||||
*
|
||||
* vbar_i = d(chemPot_i)/dP at const T, n
|
||||
*
|
||||
* = V0_i + d(Gex)/dP)_T,M
|
||||
*
|
||||
* = V0_i + RT d(lnActCoeffi)dP _T,M
|
||||
*
|
||||
*/
|
||||
void DebyeHuckel::getPartialMolarVolumes(doublereal* vbar) const
|
||||
{
|
||||
getStandardVolumes(vbar);
|
||||
|
|
@ -841,15 +547,6 @@ void DebyeHuckel::getPartialMolarVolumes(doublereal* vbar) const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Partial molar heat capacity of the solution:
|
||||
* 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).
|
||||
*
|
||||
* Cp = -T d2(chemPot_i)/dT2
|
||||
*/
|
||||
void DebyeHuckel::getPartialMolarCp(doublereal* cpbar) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -886,19 +583,10 @@ void DebyeHuckel::getPartialMolarCp(doublereal* cpbar) const
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* -------------- Utilities -------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* Initialization routine for a DebyeHuckel phase.
|
||||
*
|
||||
* This is a virtual routine. This routine will call initThermo()
|
||||
* for the parent class as well.
|
||||
*/
|
||||
void DebyeHuckel::initThermo()
|
||||
{
|
||||
MolalityVPSSTP::initThermo();
|
||||
|
|
@ -934,24 +622,6 @@ static int interp_est(const std::string& estString)
|
|||
return rval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Process the XML file after species are set up.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
void DebyeHuckel::
|
||||
initThermoXML(XML_Node& phaseNode, const std::string& id)
|
||||
{
|
||||
|
|
@ -1461,14 +1131,6 @@ initThermoXML(XML_Node& phaseNode, const std::string& id)
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
* @internal
|
||||
* Set equation of state parameters. The number and meaning of
|
||||
* these depends on the subclass.
|
||||
* @param n number of parameters
|
||||
* @param c array of \i n coefficients
|
||||
*
|
||||
*/
|
||||
void DebyeHuckel::setParameters(int n, doublereal* const c)
|
||||
{
|
||||
}
|
||||
|
|
@ -1477,44 +1139,10 @@ void DebyeHuckel::getParameters(int& n, doublereal* const c) const
|
|||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Set equation of state parameter values from XML
|
||||
* entries. This method is called by function importPhase in
|
||||
* file importCTML.cpp 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 eosdata An XML_Node object corresponding to
|
||||
* the "thermo" entry for this phase in the input file.
|
||||
*
|
||||
* HKM -> Right now, the parameters are set elsewhere (initThermoXML)
|
||||
* It just didn't seem to fit.
|
||||
*/
|
||||
void DebyeHuckel::setParametersFromXML(const XML_Node& eosdata)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Report the molar volume of species k
|
||||
*
|
||||
* units - \f$ m^3 kmol^-1 \f$
|
||||
*/
|
||||
// double DebyeHuckel::speciesMolarVolume(int k) const {
|
||||
// return m_speciesSize[k];
|
||||
//}
|
||||
|
||||
|
||||
/*
|
||||
* A_Debye_TP() (virtual)
|
||||
*
|
||||
* Returns the A_Debye parameter as a function of temperature
|
||||
* and pressure.
|
||||
*
|
||||
* The default is to assume that it is constant, given
|
||||
* in the initialization process and stored in the
|
||||
* member double, m_A_Debye
|
||||
*/
|
||||
double DebyeHuckel::A_Debye_TP(double tempArg, double presArg) const
|
||||
{
|
||||
double T = temperature();
|
||||
|
|
@ -1542,16 +1170,6 @@ double DebyeHuckel::A_Debye_TP(double tempArg, double presArg) const
|
|||
return A;
|
||||
}
|
||||
|
||||
/*
|
||||
* dA_DebyedT_TP() (virtual)
|
||||
*
|
||||
* Returns the derivative of the A_Debye parameter with
|
||||
* respect to temperature as a function of temperature
|
||||
* and pressure.
|
||||
*
|
||||
* units = A_Debye has units of sqrt(gmol kg-1).
|
||||
* Temp has units of Kelvin.
|
||||
*/
|
||||
double DebyeHuckel::dA_DebyedT_TP(double tempArg, double presArg) const
|
||||
{
|
||||
double T = temperature();
|
||||
|
|
@ -1577,16 +1195,6 @@ double DebyeHuckel::dA_DebyedT_TP(double tempArg, double presArg) const
|
|||
return dAdT;
|
||||
}
|
||||
|
||||
/*
|
||||
* d2A_DebyedT2_TP() (virtual)
|
||||
*
|
||||
* Returns the 2nd derivative of the A_Debye parameter with
|
||||
* respect to temperature as a function of temperature
|
||||
* and pressure.
|
||||
*
|
||||
* units = A_Debye has units of sqrt(gmol kg-1).
|
||||
* Temp has units of Kelvin.
|
||||
*/
|
||||
double DebyeHuckel::d2A_DebyedT2_TP(double tempArg, double presArg) const
|
||||
{
|
||||
double T = temperature();
|
||||
|
|
@ -1612,16 +1220,6 @@ double DebyeHuckel::d2A_DebyedT2_TP(double tempArg, double presArg) const
|
|||
return d2AdT2;
|
||||
}
|
||||
|
||||
/*
|
||||
* dA_DebyedP_TP() (virtual)
|
||||
*
|
||||
* Returns the derivative of the A_Debye parameter with
|
||||
* respect to pressure, as a function of temperature
|
||||
* and pressure.
|
||||
*
|
||||
* units = A_Debye has units of sqrt(gmol kg-1).
|
||||
* Pressure has units of pascals.
|
||||
*/
|
||||
double DebyeHuckel::dA_DebyedP_TP(double tempArg, double presArg) const
|
||||
{
|
||||
double T = temperature();
|
||||
|
|
@ -1647,13 +1245,10 @@ double DebyeHuckel::dA_DebyedP_TP(double tempArg, double presArg) const
|
|||
return dAdP;
|
||||
}
|
||||
|
||||
/*
|
||||
* ----------- Critical State Properties --------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* ---------- Other Property Functions
|
||||
*/
|
||||
|
||||
double DebyeHuckel::AionicRadius(int k) const
|
||||
{
|
||||
return m_Aionic[k];
|
||||
|
|
@ -1663,10 +1258,6 @@ double DebyeHuckel::AionicRadius(int k) const
|
|||
* ------------ Private and Restricted Functions ------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* Bail out of functions with an error exit if they are not
|
||||
* implemented.
|
||||
*/
|
||||
doublereal DebyeHuckel::err(const std::string& msg) const
|
||||
{
|
||||
throw CanteraError("DebyeHuckel",
|
||||
|
|
@ -1674,13 +1265,6 @@ doublereal DebyeHuckel::err(const std::string& msg) const
|
|||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* initLengths():
|
||||
*
|
||||
* This internal function adjusts the lengths of arrays based on
|
||||
* the number of species
|
||||
*/
|
||||
void DebyeHuckel::initLengths()
|
||||
{
|
||||
m_kk = nSpecies();
|
||||
|
|
@ -1705,13 +1289,6 @@ void DebyeHuckel::initLengths()
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* nonpolarActCoeff() (private)
|
||||
*
|
||||
* Static function that implements the non-polar species
|
||||
* salt-out modifications.
|
||||
* Returns the calculated activity coefficients.
|
||||
*/
|
||||
double DebyeHuckel::_nonpolarActCoeff(double IionicMolality) const
|
||||
{
|
||||
double I2 = IionicMolality * IionicMolality;
|
||||
|
|
@ -1722,16 +1299,7 @@ double DebyeHuckel::_nonpolarActCoeff(double IionicMolality) const
|
|||
return pow(10.0 , l10actCoeff);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* _osmoticCoeffHelgesonFixedForm()
|
||||
*
|
||||
* Formula for the osmotic coefficient that occurs in
|
||||
* the GWB. It is originally from Helgeson for a variable
|
||||
* NaCl brine. It's to be used with extreme caution.
|
||||
*/
|
||||
double DebyeHuckel::
|
||||
_osmoticCoeffHelgesonFixedForm() const
|
||||
double DebyeHuckel::_osmoticCoeffHelgesonFixedForm() const
|
||||
{
|
||||
const double a0 = 1.454;
|
||||
const double b0 = 0.02236;
|
||||
|
|
@ -1750,17 +1318,7 @@ _osmoticCoeffHelgesonFixedForm() const
|
|||
return oc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* _activityWaterHelgesonFixedForm()
|
||||
*
|
||||
* Formula for the log of the activity of the water
|
||||
* solvent that occurs in
|
||||
* the GWB. It is originally from Helgeson for a variable
|
||||
* NaCl brine. It's to be used with extreme caution.
|
||||
*/
|
||||
double DebyeHuckel::
|
||||
_lnactivityWaterHelgesonFixedForm() const
|
||||
double DebyeHuckel::_lnactivityWaterHelgesonFixedForm() const
|
||||
{
|
||||
/*
|
||||
* Update the internally stored vector of molalities
|
||||
|
|
@ -1780,19 +1338,6 @@ _lnactivityWaterHelgesonFixedForm() const
|
|||
return lac;
|
||||
}
|
||||
|
||||
/*
|
||||
* s_update_lnMolalityActCoeff():
|
||||
*
|
||||
* Using internally stored values, this function calculates
|
||||
* the activity coefficients for all species.
|
||||
*
|
||||
* The ln(activity_solvent) is first calculated for the
|
||||
* solvent. Then the molar based activity coefficient
|
||||
* is calculated and returned.
|
||||
*
|
||||
* ( Note this is the main routine for implementing the
|
||||
* activity coefficient formulation.)
|
||||
*/
|
||||
void DebyeHuckel::s_update_lnMolalityActCoeff() const
|
||||
{
|
||||
double z_k, zs_k1, zs_k2;
|
||||
|
|
@ -2051,18 +1596,6 @@ void DebyeHuckel::s_update_lnMolalityActCoeff() const
|
|||
lnActivitySolvent - log(xmolSolvent);
|
||||
}
|
||||
|
||||
/*
|
||||
* s_update_dMolalityActCoeff_dT() (private, const )
|
||||
*
|
||||
* Using internally stored values, this function calculates
|
||||
* the temperature derivative of the logarithm of the
|
||||
* activity coefficient for all species in the mechanism.
|
||||
*
|
||||
* We assume that the activity coefficients are current.
|
||||
*
|
||||
* solvent activity coefficient is on the molality
|
||||
* scale. Its derivative is too.
|
||||
*/
|
||||
void DebyeHuckel::s_update_dlnMolalityActCoeff_dT() const
|
||||
{
|
||||
double z_k, coeff, tmp, y, yp1, sigma, tmpLn;
|
||||
|
|
@ -2190,19 +1723,6 @@ void DebyeHuckel::s_update_dlnMolalityActCoeff_dT() const
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
* s_update_d2lnMolalityActCoeff_dT2() (private, const )
|
||||
*
|
||||
* Using internally stored values, this function calculates
|
||||
* the temperature 2nd derivative of the logarithm of the
|
||||
* activity coefficient
|
||||
* for all species in the mechanism.
|
||||
*
|
||||
* We assume that the activity coefficients are current.
|
||||
*
|
||||
* solvent activity coefficient is on the molality
|
||||
* scale. Its derivatives are too.
|
||||
*/
|
||||
void DebyeHuckel::s_update_d2lnMolalityActCoeff_dT2() const
|
||||
{
|
||||
double z_k, coeff, tmp, y, yp1, sigma, tmpLn;
|
||||
|
|
@ -2325,19 +1845,6 @@ void DebyeHuckel::s_update_d2lnMolalityActCoeff_dT2() const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* s_update_dlnMolalityActCoeff_dP() (private, const )
|
||||
*
|
||||
* Using internally stored values, this function calculates
|
||||
* the pressure derivative of the logarithm of the
|
||||
* activity coefficient for all species in the mechanism.
|
||||
*
|
||||
* We assume that the activity coefficients, molalities,
|
||||
* and A_Debye are current.
|
||||
*
|
||||
* solvent activity coefficient is on the molality
|
||||
* scale. Its derivatives are too.
|
||||
*/
|
||||
void DebyeHuckel::s_update_dlnMolalityActCoeff_dP() const
|
||||
{
|
||||
double z_k, coeff, tmp, y, yp1, sigma, tmpLn;
|
||||
|
|
@ -2464,25 +1971,4 @@ void DebyeHuckel::s_update_dlnMolalityActCoeff_dP() const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Updates the standard state thermodynamic functions at the current T and P of the solution.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* This function gets 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.
|
||||
*/
|
||||
// void DebyeHuckel::_updateStandardStateThermo() const {
|
||||
// doublereal tnow = temperature();
|
||||
// doublereal pnow = m_Pcurrent;
|
||||
// if (m_waterSS) {
|
||||
// m_waterSS->setTempPressure(tnow, pnow);
|
||||
// }
|
||||
// m_VPSS_ptr->setState_TP(tnow, pnow);
|
||||
// VPStandardStateTP::updateStandardStateThermo();
|
||||
|
||||
//}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,10 +26,6 @@ using namespace std;
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
/*
|
||||
* Default constructor.
|
||||
*
|
||||
*/
|
||||
GibbsExcessVPSSTP::GibbsExcessVPSSTP() :
|
||||
VPStandardStateTP(),
|
||||
moleFractions_(0),
|
||||
|
|
@ -43,12 +39,6 @@ GibbsExcessVPSSTP::GibbsExcessVPSSTP() :
|
|||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy Constructor:
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working copy constructor
|
||||
*/
|
||||
GibbsExcessVPSSTP::GibbsExcessVPSSTP(const GibbsExcessVPSSTP& b) :
|
||||
VPStandardStateTP(),
|
||||
moleFractions_(0),
|
||||
|
|
@ -63,12 +53,6 @@ GibbsExcessVPSSTP::GibbsExcessVPSSTP(const GibbsExcessVPSSTP& b) :
|
|||
GibbsExcessVPSSTP::operator=(b);
|
||||
}
|
||||
|
||||
/*
|
||||
* operator=()
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working assignment operator
|
||||
*/
|
||||
GibbsExcessVPSSTP& GibbsExcessVPSSTP::
|
||||
operator=(const GibbsExcessVPSSTP& b)
|
||||
{
|
||||
|
|
@ -90,31 +74,16 @@ operator=(const GibbsExcessVPSSTP& b)
|
|||
return *this;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* ~GibbsExcessVPSSTP(): (virtual)
|
||||
*
|
||||
* Destructor: does nothing:
|
||||
*
|
||||
*/
|
||||
GibbsExcessVPSSTP::~GibbsExcessVPSSTP()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine duplicates the current object and returns
|
||||
* a pointer to ThermoPhase.
|
||||
*/
|
||||
ThermoPhase*
|
||||
GibbsExcessVPSSTP::duplMyselfAsThermoPhase() const
|
||||
{
|
||||
return new GibbsExcessVPSSTP(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* -------------- Utilities -------------------------------
|
||||
*/
|
||||
|
||||
void GibbsExcessVPSSTP::setMassFractions(const doublereal* const y)
|
||||
{
|
||||
Phase::setMassFractions(y);
|
||||
|
|
@ -139,44 +108,21 @@ void GibbsExcessVPSSTP::setMoleFractions_NoNorm(const doublereal* const x)
|
|||
getMoleFractions(DATA_PTR(moleFractions_));
|
||||
}
|
||||
|
||||
|
||||
void GibbsExcessVPSSTP::setConcentrations(const doublereal* const c)
|
||||
{
|
||||
Phase::setConcentrations(c);
|
||||
getMoleFractions(DATA_PTR(moleFractions_));
|
||||
}
|
||||
|
||||
|
||||
// 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 GibbsExcessVPSSTP class also returns
|
||||
* zero, as it is a non-complete class.
|
||||
*/
|
||||
int GibbsExcessVPSSTP::eosType() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ------------ Molar Thermodynamic Properties ----------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* ------------ Mechanical Properties ------------------------------
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
void GibbsExcessVPSSTP::setPressure(doublereal p)
|
||||
{
|
||||
setState_TP(temperature(), p);
|
||||
|
|
@ -215,17 +161,15 @@ void GibbsExcessVPSSTP::setState_TP(doublereal t, doublereal p)
|
|||
calcDensity();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* - Activities, Standard States, Activity Concentrations -----------
|
||||
*/
|
||||
|
||||
void GibbsExcessVPSSTP::getActivityConcentrations(doublereal* c) const
|
||||
{
|
||||
getActivities(c);
|
||||
}
|
||||
|
||||
|
||||
doublereal GibbsExcessVPSSTP::standardConcentration(size_t k) const
|
||||
{
|
||||
return 1.0;
|
||||
|
|
@ -261,7 +205,6 @@ void GibbsExcessVPSSTP::getActivityCoefficients(doublereal* const ac) const
|
|||
}
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void GibbsExcessVPSSTP::getElectrochemPotentials(doublereal* mu) const
|
||||
{
|
||||
|
|
@ -276,16 +219,6 @@ void GibbsExcessVPSSTP::getElectrochemPotentials(doublereal* mu) const
|
|||
* ------------ Partial Molar Properties of the Solution ------------
|
||||
*/
|
||||
|
||||
// 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.
|
||||
*/
|
||||
void GibbsExcessVPSSTP::getPartialMolarVolumes(doublereal* vbar) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -299,7 +232,6 @@ const vector_fp& GibbsExcessVPSSTP::getPartialMolarVolumes() const
|
|||
return getStandardVolumes();
|
||||
}
|
||||
|
||||
|
||||
doublereal GibbsExcessVPSSTP::err(const std::string& msg) const
|
||||
{
|
||||
throw CanteraError("GibbsExcessVPSSTP","Base class method "
|
||||
|
|
@ -307,8 +239,6 @@ doublereal GibbsExcessVPSSTP::err(const std::string& msg) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
double GibbsExcessVPSSTP::checkMFSum(const doublereal* const x) const
|
||||
{
|
||||
doublereal norm = accumulate(x, x + m_kk, 0.0);
|
||||
|
|
@ -319,28 +249,6 @@ double GibbsExcessVPSSTP::checkMFSum(const doublereal* const x) const
|
|||
return norm;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the units of the standard and general concentrations
|
||||
* Note they have the same units, as their divisor is
|
||||
* defined to be equal to the activity of the kth species
|
||||
* in the solution, which is unitless.
|
||||
*
|
||||
* This routine is used in print out applications where the
|
||||
* units are needed. Usually, MKS units are assumed throughout
|
||||
* the program and in the XML input files.
|
||||
*
|
||||
* On return uA contains the powers of the units (MKS assumed)
|
||||
* of the standard concentrations and generalized concentrations
|
||||
* for the kth species.
|
||||
*
|
||||
* uA[0] = kmol units - default = 1
|
||||
* uA[1] = m units - default = -nDim(), the number of spatial
|
||||
* dimensions in the Phase class.
|
||||
* uA[2] = kg units - default = 0;
|
||||
* uA[3] = Pa(pressure) units - default = 0;
|
||||
* uA[4] = Temperature units - default = 0;
|
||||
* uA[5] = time units - default = 0
|
||||
*/
|
||||
void GibbsExcessVPSSTP::getUnitsStandardConc(double* uA, int k, int sizeUA) const
|
||||
{
|
||||
for (int i = 0; i < sizeUA; i++) {
|
||||
|
|
@ -365,20 +273,6 @@ void GibbsExcessVPSSTP::getUnitsStandardConc(double* uA, int k, int sizeUA) cons
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @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.
|
||||
*
|
||||
* @see importCTML.cpp
|
||||
*/
|
||||
void GibbsExcessVPSSTP::initThermo()
|
||||
{
|
||||
initLengths();
|
||||
|
|
@ -386,9 +280,6 @@ void GibbsExcessVPSSTP::initThermo()
|
|||
getMoleFractions(DATA_PTR(moleFractions_));
|
||||
}
|
||||
|
||||
|
||||
// Initialize lengths of local variables after all species have
|
||||
// been identified.
|
||||
void GibbsExcessVPSSTP::initLengths()
|
||||
{
|
||||
m_kk = nSpecies();
|
||||
|
|
@ -402,6 +293,4 @@ void GibbsExcessVPSSTP::initLengths()
|
|||
m_pp.resize(m_kk);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -28,13 +28,6 @@ using namespace ctml;
|
|||
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
|
||||
//! utility function to assign an integer value from a string
|
||||
//! for the ElectrolyteSpeciesType field.
|
||||
/*!
|
||||
* @param estString string name of the electrolyte species type
|
||||
*/
|
||||
int HMWSoln::interp_est(const std::string& estString)
|
||||
{
|
||||
const char* cc = estString.c_str();
|
||||
|
|
@ -60,13 +53,6 @@ int HMWSoln::interp_est(const std::string& estString)
|
|||
return rval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Process an XML node called "SimpleSaltParameters.
|
||||
* This node contains all of the parameters necessary to describe
|
||||
* the Pitzer model for that particular binary salt.
|
||||
* This function reads the XML file and writes the coefficients
|
||||
* it finds to an internal data structures.
|
||||
*/
|
||||
void HMWSoln::readXMLBinarySalt(XML_Node& BinSalt)
|
||||
{
|
||||
string xname = BinSalt.name();
|
||||
|
|
@ -268,11 +254,6 @@ void HMWSoln::readXMLBinarySalt(XML_Node& BinSalt)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process an XML node called "thetaAnion".
|
||||
* This node contains all of the parameters necessary to describe
|
||||
* the binary interactions between two anions.
|
||||
*/
|
||||
void HMWSoln::readXMLThetaAnion(XML_Node& BinSalt)
|
||||
{
|
||||
string xname = BinSalt.name();
|
||||
|
|
@ -355,11 +336,6 @@ void HMWSoln::readXMLThetaAnion(XML_Node& BinSalt)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process an XML node called "thetaCation".
|
||||
* This node contains all of the parameters necessary to describe
|
||||
* the binary interactions between two cation.
|
||||
*/
|
||||
void HMWSoln::readXMLThetaCation(XML_Node& BinSalt)
|
||||
{
|
||||
string xname = BinSalt.name();
|
||||
|
|
@ -442,11 +418,6 @@ void HMWSoln::readXMLThetaCation(XML_Node& BinSalt)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Process an XML node called "readXMLPsiCommonCation".
|
||||
* This node contains all of the parameters necessary to describe
|
||||
* the binary interactions between two anions and one common cation.
|
||||
*/
|
||||
void HMWSoln::readXMLPsiCommonCation(XML_Node& BinSalt)
|
||||
{
|
||||
string xname = BinSalt.name();
|
||||
|
|
@ -588,11 +559,6 @@ void HMWSoln::readXMLPsiCommonCation(XML_Node& BinSalt)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process an XML node called "PsiCommonAnion".
|
||||
* This node contains all of the parameters necessary to describe
|
||||
* the binary interactions between two cations and one common anion.
|
||||
*/
|
||||
void HMWSoln::readXMLPsiCommonAnion(XML_Node& BinSalt)
|
||||
{
|
||||
string xname = BinSalt.name();
|
||||
|
|
@ -735,14 +701,6 @@ void HMWSoln::readXMLPsiCommonAnion(XML_Node& BinSalt)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Process an XML node called "LambdaNeutral".
|
||||
* This node contains all of the parameters necessary to describe
|
||||
* the binary interactions between one neutral species and
|
||||
* any other species (neutral or otherwise) in the mechanism.
|
||||
*/
|
||||
void HMWSoln::readXMLLambdaNeutral(XML_Node& BinSalt)
|
||||
{
|
||||
string xname = BinSalt.name();
|
||||
|
|
@ -824,11 +782,6 @@ void HMWSoln::readXMLLambdaNeutral(XML_Node& BinSalt)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process an XML node called "MunnnNeutral".
|
||||
* This node contains all of the parameters necessary to describe
|
||||
* the self-ternary interactions for one neutral species.
|
||||
*/
|
||||
void HMWSoln::readXMLMunnnNeutral(XML_Node& BinSalt)
|
||||
{
|
||||
string xname = BinSalt.name();
|
||||
|
|
@ -899,11 +852,6 @@ void HMWSoln::readXMLMunnnNeutral(XML_Node& BinSalt)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Process an XML node called "readXMLZetaCation".
|
||||
* This node contains all of the parameters necessary to describe
|
||||
* the ternary interactions between a neutral, a cation and an anion
|
||||
*/
|
||||
void HMWSoln::readXMLZetaCation(const XML_Node& BinSalt)
|
||||
{
|
||||
string xname = BinSalt.name();
|
||||
|
|
@ -1004,11 +952,6 @@ void HMWSoln::readXMLZetaCation(const XML_Node& BinSalt)
|
|||
}
|
||||
}
|
||||
|
||||
// Process an XML node called "croppingCoefficients"
|
||||
// for the cropping coefficients values
|
||||
/*
|
||||
* @param acNode Activity Coefficient XML Node
|
||||
*/
|
||||
void HMWSoln::readXMLCroppingCoefficients(const XML_Node& acNode)
|
||||
{
|
||||
|
||||
|
|
@ -1035,32 +978,12 @@ void HMWSoln::readXMLCroppingCoefficients(const XML_Node& acNode)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialization routine for a HMWSoln phase.
|
||||
*
|
||||
* This is a virtual routine. This routine will call initThermo()
|
||||
* for the parent class as well.
|
||||
*/
|
||||
void HMWSoln::initThermo()
|
||||
{
|
||||
MolalityVPSSTP::initThermo();
|
||||
initLengths();
|
||||
}
|
||||
|
||||
/*
|
||||
* Import, construct, and initialize a HMWSoln phase
|
||||
* specification from an XML tree into the current object.
|
||||
*
|
||||
* This routine is a precursor to constructPhaseXML(XML_Node*)
|
||||
* routine, which does most of the work.
|
||||
*
|
||||
* @param infile 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.
|
||||
*/
|
||||
void HMWSoln::constructPhaseFile(std::string inputFile, std::string id)
|
||||
{
|
||||
|
||||
|
|
@ -1092,33 +1015,6 @@ void HMWSoln::constructPhaseFile(std::string inputFile, std::string id)
|
|||
delete fxml;
|
||||
}
|
||||
|
||||
/*
|
||||
* Import, construct, and initialize a HMWSoln phase
|
||||
* specification from an XML tree into the current object.
|
||||
*
|
||||
* Most of the work is carried out by the cantera base
|
||||
* routine, importPhase(). That routine imports all of the
|
||||
* species and element data, including the standard states
|
||||
* of the species.
|
||||
*
|
||||
* Then, In this routine, we read the information
|
||||
* particular to the specification of the activity
|
||||
* coefficient model for the Pitzer parameterization.
|
||||
*
|
||||
* We also read information about the molar volumes of the
|
||||
* standard states if present in the XML file.
|
||||
*
|
||||
* @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 HMWSoln::constructPhaseXML(XML_Node& phaseNode, std::string id)
|
||||
{
|
||||
string stemp;
|
||||
|
|
@ -1247,26 +1143,6 @@ void HMWSoln::constructPhaseXML(XML_Node& phaseNode, std::string id)
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Process the XML file after species are set up.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
void HMWSoln::
|
||||
initThermoXML(XML_Node& phaseNode, const std::string& id)
|
||||
{
|
||||
|
|
@ -1825,8 +1701,7 @@ initThermoXML(XML_Node& phaseNode, const std::string& id)
|
|||
//}
|
||||
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Precalculate the IMS Cutoff parameters for typeCutoff = 2
|
||||
|
||||
void HMWSoln::calcIMSCutoffParams_()
|
||||
{
|
||||
IMS_afCut_ = 1.0 / (std::exp(1.0) * IMS_gamma_k_min_);
|
||||
|
|
@ -1877,7 +1752,6 @@ void HMWSoln::calcIMSCutoffParams_()
|
|||
}
|
||||
}
|
||||
|
||||
// Precalculate the MC Cutoff parameters
|
||||
void HMWSoln::calcMCCutoffParams_()
|
||||
{
|
||||
MC_X_o_min_ = 0.35;
|
||||
|
|
|
|||
|
|
@ -28,9 +28,6 @@ using namespace ctml;
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
/*
|
||||
* Default constructor
|
||||
*/
|
||||
IdealMolalSoln::IdealMolalSoln() :
|
||||
MolalityVPSSTP(),
|
||||
m_formGC(2),
|
||||
|
|
@ -38,13 +35,13 @@ IdealMolalSoln::IdealMolalSoln() :
|
|||
IMS_X_o_cutoff_(0.20),
|
||||
IMS_gamma_o_min_(0.00001),
|
||||
IMS_gamma_k_min_(10.0),
|
||||
IMS_cCut_(.05),
|
||||
IMS_slopefCut_(0.6),
|
||||
IMS_slopegCut_(0.0),
|
||||
IMS_cCut_(.05),
|
||||
IMS_dfCut_(0.0),
|
||||
IMS_efCut_(0.0),
|
||||
IMS_afCut_(0.0),
|
||||
IMS_bfCut_(0.0),
|
||||
IMS_slopegCut_(0.0),
|
||||
IMS_dgCut_(0.0),
|
||||
IMS_egCut_(0.0),
|
||||
IMS_agCut_(0.0),
|
||||
|
|
@ -52,12 +49,6 @@ IdealMolalSoln::IdealMolalSoln() :
|
|||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy Constructor:
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working copy constructor
|
||||
*/
|
||||
IdealMolalSoln::IdealMolalSoln(const IdealMolalSoln& b) :
|
||||
MolalityVPSSTP(b)
|
||||
{
|
||||
|
|
@ -68,12 +59,6 @@ IdealMolalSoln::IdealMolalSoln(const IdealMolalSoln& b) :
|
|||
*this = b;
|
||||
}
|
||||
|
||||
/*
|
||||
* operator=()
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working assignment operator
|
||||
*/
|
||||
IdealMolalSoln& IdealMolalSoln::
|
||||
operator=(const IdealMolalSoln& b)
|
||||
{
|
||||
|
|
@ -111,13 +96,13 @@ IdealMolalSoln::IdealMolalSoln(const std::string& inputFile,
|
|||
IMS_X_o_cutoff_(0.2),
|
||||
IMS_gamma_o_min_(0.00001),
|
||||
IMS_gamma_k_min_(10.0),
|
||||
IMS_cCut_(.05),
|
||||
IMS_slopefCut_(0.6),
|
||||
IMS_slopegCut_(0.0),
|
||||
IMS_cCut_(.05),
|
||||
IMS_dfCut_(0.0),
|
||||
IMS_efCut_(0.0),
|
||||
IMS_afCut_(0.0),
|
||||
IMS_bfCut_(0.0),
|
||||
IMS_slopegCut_(0.0),
|
||||
IMS_dgCut_(0.0),
|
||||
IMS_egCut_(0.0),
|
||||
IMS_agCut_(0.0),
|
||||
|
|
@ -133,13 +118,13 @@ IdealMolalSoln::IdealMolalSoln(XML_Node& root, const std::string& id) :
|
|||
IMS_X_o_cutoff_(0.2),
|
||||
IMS_gamma_o_min_(0.00001),
|
||||
IMS_gamma_k_min_(10.0),
|
||||
IMS_cCut_(.05),
|
||||
IMS_slopefCut_(0.6),
|
||||
IMS_slopegCut_(0.0),
|
||||
IMS_cCut_(.05),
|
||||
IMS_dfCut_(0.0),
|
||||
IMS_efCut_(0.0),
|
||||
IMS_afCut_(0.0),
|
||||
IMS_bfCut_(0.0),
|
||||
IMS_slopegCut_(0.0),
|
||||
IMS_dgCut_(0.0),
|
||||
IMS_egCut_(0.0),
|
||||
IMS_agCut_(0.0),
|
||||
|
|
@ -148,43 +133,15 @@ IdealMolalSoln::IdealMolalSoln(XML_Node& root, const std::string& id) :
|
|||
importPhase(*findXMLPhase(&root, id), this);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* ~IdealMolalSoln(): (virtual)
|
||||
*
|
||||
* Destructor: does nothing:
|
||||
*
|
||||
*/
|
||||
IdealMolalSoln::~IdealMolalSoln()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
ThermoPhase* IdealMolalSoln::duplMyselfAsThermoPhase() const
|
||||
{
|
||||
return new IdealMolalSoln(*this);
|
||||
}
|
||||
|
||||
//
|
||||
// -------- 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,
|
||||
* \f[
|
||||
* \bar{h}(T, P, X_k) = \sum_k X_k \bar{h}_k(T)
|
||||
* \f]
|
||||
* The formula is written in terms of the partial molar enthalpies.
|
||||
* \f$ \bar{h}_k(T, p, m_k) \f$.
|
||||
* See the partial molar enthalpy function, getPartialMolarEnthalpies(),
|
||||
* for details.
|
||||
*
|
||||
* Units: J/kmol
|
||||
*/
|
||||
doublereal IdealMolalSoln::enthalpy_mole() const
|
||||
{
|
||||
getPartialMolarEnthalpies(DATA_PTR(m_tmpV));
|
||||
|
|
@ -193,70 +150,24 @@ doublereal IdealMolalSoln::enthalpy_mole() const
|
|||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
* Molar internal energy of the solution: Units: J/kmol.
|
||||
*
|
||||
* 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]
|
||||
* The formula is written in terms of the partial molar internal energy.
|
||||
* \f$ \bar{u}_k(T, p, m_k) \f$.
|
||||
*/
|
||||
doublereal IdealMolalSoln::intEnergy_mole() const
|
||||
{
|
||||
getPartialMolarEnthalpies(DATA_PTR(m_tmpV));
|
||||
return mean_X(DATA_PTR(m_tmpV));
|
||||
}
|
||||
|
||||
/*
|
||||
* Molar entropy of the solution: Units J/kmol/K.
|
||||
*
|
||||
* 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]
|
||||
* The formula is written in terms of the partial molar entropies.
|
||||
* \f$ \bar{s}_k(T, p, m_k) \f$.
|
||||
* See the partial molar entropies function, getPartialMolarEntropies(),
|
||||
* for details.
|
||||
*
|
||||
* Units: J/kmol/K.
|
||||
*/
|
||||
doublereal IdealMolalSoln::entropy_mole() const
|
||||
{
|
||||
getPartialMolarEntropies(DATA_PTR(m_tmpV));
|
||||
return mean_X(DATA_PTR(m_tmpV));
|
||||
}
|
||||
|
||||
/*
|
||||
* Molar Gibbs function for the solution: Units J/kmol.
|
||||
*
|
||||
* Returns the gibbs free energy of the solution per mole
|
||||
* of the solution.
|
||||
*
|
||||
* \f[
|
||||
* \bar{g}(T, P, X_k) = \sum_k X_k \mu_k(T)
|
||||
* \f]
|
||||
*
|
||||
* Units: J/kmol
|
||||
*/
|
||||
doublereal IdealMolalSoln::gibbs_mole() const
|
||||
{
|
||||
getChemPotentials(DATA_PTR(m_tmpV));
|
||||
return mean_X(DATA_PTR(m_tmpV));
|
||||
}
|
||||
|
||||
/*
|
||||
* Molar heat capacity at constant pressure: Units: J/kmol/K.
|
||||
* * \f[
|
||||
* \bar{c}_p(T, P, X_k) = \sum_k X_k \bar{c}_{p,k}(T)
|
||||
* \f]
|
||||
*
|
||||
* Units: J/kmol/K
|
||||
*/
|
||||
doublereal IdealMolalSoln::cp_mole() const
|
||||
{
|
||||
getPartialMolarCp(DATA_PTR(m_tmpV));
|
||||
|
|
@ -264,11 +175,6 @@ doublereal IdealMolalSoln::cp_mole() const
|
|||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
* Molar heat capacity at constant volume: Units: J/kmol/K.
|
||||
* NOT IMPLEMENTED.
|
||||
* Units: J/kmol/K
|
||||
*/
|
||||
doublereal IdealMolalSoln::cv_mole() const
|
||||
{
|
||||
return err("not implemented");
|
||||
|
|
@ -278,13 +184,6 @@ doublereal IdealMolalSoln::cv_mole() const
|
|||
// ------- Mechanical Equation of State Properties ------------------------
|
||||
//
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
void IdealMolalSoln::setPressure(doublereal p)
|
||||
{
|
||||
setState_TP(temperature(), p);
|
||||
|
|
@ -304,53 +203,16 @@ void IdealMolalSoln::calcDensity()
|
|||
Phase::setDensity(dd);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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]
|
||||
*
|
||||
* It's equal to zero for this model, since the molar volume
|
||||
* doesn't change with pressure or temperature.
|
||||
*/
|
||||
doublereal IdealMolalSoln::isothermalCompressibility() const
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/*
|
||||
* The 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]
|
||||
*
|
||||
* It's equal to zero for this model, since the molar volume
|
||||
* doesn't change with pressure or temperature.
|
||||
*/
|
||||
doublereal IdealMolalSoln::thermalExpansionCoeff() const
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* NOTE: This is an overwritten function from the State.h
|
||||
* class
|
||||
*/
|
||||
void IdealMolalSoln::setDensity(const doublereal rho)
|
||||
{
|
||||
double dens = density();
|
||||
|
|
@ -360,15 +222,6 @@ void IdealMolalSoln::setDensity(const doublereal rho)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Overwritten setMolarDensity() function is necessary because the
|
||||
* density is not an independent variable.
|
||||
*
|
||||
* This function will now throw an error condition.
|
||||
*
|
||||
* NOTE: This is a virtual function, overwritten function from the State.h
|
||||
* class
|
||||
*/
|
||||
void IdealMolalSoln::setMolarDensity(const doublereal conc)
|
||||
{
|
||||
double concI = Phase::molarDensity();
|
||||
|
|
@ -391,19 +244,6 @@ void IdealMolalSoln::setState_TP(doublereal temp, doublereal pres)
|
|||
// ------- Activities and Activity Concentrations
|
||||
//
|
||||
|
||||
/*
|
||||
* This method returns an array of activity concentrations \f$ C^a_k\f$.
|
||||
* \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. These activity concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions.
|
||||
*
|
||||
* @param c Array of activity concentrations. The
|
||||
* units depend upon the implementation of the
|
||||
* reaction rate expressions within the phase.
|
||||
*/
|
||||
void IdealMolalSoln::getActivityConcentrations(doublereal* c) const
|
||||
{
|
||||
if (m_formGC != 1) {
|
||||
|
|
@ -421,18 +261,6 @@ void IdealMolalSoln::getActivityConcentrations(doublereal* c) const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The standard concentration \f$ C^s_k \f$ used to normalize
|
||||
* the activity concentration. In many cases, this quantity
|
||||
* will be the same for all species in a phase - for example,
|
||||
* for an ideal gas \f$ C^s_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.
|
||||
*
|
||||
*/
|
||||
doublereal IdealMolalSoln::standardConcentration(size_t k) const
|
||||
{
|
||||
double c0 = 1.0, mvSolvent;
|
||||
|
|
@ -450,38 +278,12 @@ doublereal IdealMolalSoln::standardConcentration(size_t k) const
|
|||
return c0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the natural logarithm of the standard
|
||||
* concentration of the kth species
|
||||
*/
|
||||
doublereal IdealMolalSoln::logStandardConc(size_t k) const
|
||||
{
|
||||
double c0 = standardConcentration(k);
|
||||
return log(c0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the units of the standard and general concentrations
|
||||
* Note they have the same units, as their divisor is
|
||||
* defined to be equal to the activity of the kth species
|
||||
* in the solution, which is unitless.
|
||||
*
|
||||
* This routine is used in print out applications where the
|
||||
* units are needed. Usually, MKS units are assumed throughout
|
||||
* the program and in the XML input files.
|
||||
*
|
||||
* On return uA contains the powers of the units (MKS assumed)
|
||||
* of the standard concentrations and generalized concentrations
|
||||
* for the kth species.
|
||||
*
|
||||
* uA[0] = kmol units - default = 1
|
||||
* uA[1] = m units - default = -nDim(), the number of spatial
|
||||
* dimensions in the Phase class.
|
||||
* uA[2] = kg units - default = 0;
|
||||
* uA[3] = Pa(pressure) units - default = 0;
|
||||
* uA[4] = Temperature units - default = 0;
|
||||
* uA[5] = time units - default = 0
|
||||
*/
|
||||
void IdealMolalSoln::getUnitsStandardConc(double* uA, int k, int sizeUA) const
|
||||
{
|
||||
int eos = eosType();
|
||||
|
|
@ -513,14 +315,6 @@ void IdealMolalSoln::getUnitsStandardConc(double* uA, int k, int sizeUA) const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the array of non-dimensional molality-based
|
||||
* activities at the current solution temperature,
|
||||
* pressure, and solution concentration.
|
||||
*
|
||||
* The max against xmolSolventMIN is to limit the activity
|
||||
* coefficient to be finite as the solvent mf goes to zero.
|
||||
*/
|
||||
void IdealMolalSoln::getActivities(doublereal* ac) const
|
||||
{
|
||||
_updateStandardStateThermo();
|
||||
|
|
@ -534,6 +328,8 @@ void IdealMolalSoln::getActivities(doublereal* ac) const
|
|||
ac[k] = m_molalities[k];
|
||||
}
|
||||
double xmolSolvent = moleFraction(m_indexSolvent);
|
||||
// Limit the activity coefficient to be finite as the solvent mole
|
||||
// fraction goes to zero.
|
||||
xmolSolvent = std::max(m_xmolSolventMIN, xmolSolvent);
|
||||
ac[m_indexSolvent] =
|
||||
exp((xmolSolvent - 1.0)/xmolSolvent);
|
||||
|
|
@ -553,17 +349,6 @@ void IdealMolalSoln::getActivities(doublereal* ac) const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the array of non-dimensional Molality based
|
||||
* activity coefficients at
|
||||
* the current solution temperature, pressure, and
|
||||
* solution concentration.
|
||||
* See Denbigh
|
||||
* (note solvent activity coefficient is on the molar scale).
|
||||
*
|
||||
* The max against xmolSolventMIN is to limit the activity
|
||||
* coefficient to be finite as the solvent mf goes to zero.
|
||||
*/
|
||||
void IdealMolalSoln::
|
||||
getMolalityActivityCoefficients(doublereal* acMolality) const
|
||||
{
|
||||
|
|
@ -572,6 +357,8 @@ getMolalityActivityCoefficients(doublereal* acMolality) const
|
|||
acMolality[k] = 1.0;
|
||||
}
|
||||
double xmolSolvent = moleFraction(m_indexSolvent);
|
||||
// Limit the activity coefficient to be finite as the solvent mole
|
||||
// fraction goes to zero.
|
||||
xmolSolvent = std::max(m_xmolSolventMIN, xmolSolvent);
|
||||
acMolality[m_indexSolvent] =
|
||||
exp((xmolSolvent - 1.0)/xmolSolvent) / xmolSolvent;
|
||||
|
|
@ -588,27 +375,6 @@ getMolalityActivityCoefficients(doublereal* acMolality) const
|
|||
// ------ 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.
|
||||
*
|
||||
* \f[
|
||||
* \mu_k = \mu^{o}_k(T,P) + R T \ln(\frac{m_k}{m^\Delta})
|
||||
* \f]
|
||||
* \f[
|
||||
* \mu_w = \mu^{o}_w(T,P) +
|
||||
* R T ((X_w - 1.0) / X_w)
|
||||
* \f]
|
||||
*
|
||||
* \f$ w \f$ refers to the solvent species.
|
||||
* \f$ X_w \f$ is the mole fraction of the solvent.
|
||||
* \f$ m_k \f$ is the molality of the kth solute.
|
||||
* \f$ m^\Delta is 1 gmol solute per kg solvent. \f$
|
||||
*
|
||||
* Units: J/kmol.
|
||||
*/
|
||||
void IdealMolalSoln::getChemPotentials(doublereal* mu) const
|
||||
{
|
||||
double xx;
|
||||
|
|
@ -667,11 +433,6 @@ void IdealMolalSoln::getChemPotentials(doublereal* mu) const
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns an array of partial molar enthalpies for the species
|
||||
* in the mixture: Units (J/kmol).
|
||||
*
|
||||
*/
|
||||
void IdealMolalSoln::getPartialMolarEnthalpies(doublereal* hbar) const
|
||||
{
|
||||
getEnthalpy_RT(hbar);
|
||||
|
|
@ -681,33 +442,6 @@ void IdealMolalSoln::getPartialMolarEnthalpies(doublereal* hbar) const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* \f[
|
||||
* \bar{s}_k(T,P) = s^0_k(T) - R log( m_k )
|
||||
* \f]
|
||||
* \f[
|
||||
* \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.
|
||||
* @see SpeciesThermo
|
||||
*/
|
||||
void IdealMolalSoln::getPartialMolarEntropies(doublereal* sbar) const
|
||||
{
|
||||
getEntropy_R(sbar);
|
||||
|
|
@ -747,36 +481,11 @@ void IdealMolalSoln::getPartialMolarEntropies(doublereal* sbar) const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns an array of partial molar volumes of the species
|
||||
* in the solution: Units: m^3 kmol-1.
|
||||
*
|
||||
* For this solution, the partial molar volumes are equal to the
|
||||
* constant species molar volumes.
|
||||
*
|
||||
* Units: m^3 kmol-1.
|
||||
*/
|
||||
void IdealMolalSoln::getPartialMolarVolumes(doublereal* vbar) const
|
||||
{
|
||||
getStandardVolumes(vbar);
|
||||
}
|
||||
|
||||
/*
|
||||
* Partial molar heat capacity of the solution: Units: 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[
|
||||
* \bar{Cp}_k(T,P) = {Cp}^0_k(T)
|
||||
* \f]
|
||||
*
|
||||
* For this solution, this is equal to the reference state
|
||||
* heat capacities.
|
||||
*
|
||||
* Units: J/kmol/K
|
||||
*/
|
||||
void IdealMolalSoln::getPartialMolarCp(doublereal* cpbar) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -790,54 +499,16 @@ void IdealMolalSoln::getPartialMolarCp(doublereal* cpbar) const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* -------- Properties of the Standard State of the Species
|
||||
* in the Solution ------------------
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ------ Thermodynamic Values for the Species Reference States ---
|
||||
*/
|
||||
|
||||
// -> This is handled by VPStandardStatesTP
|
||||
|
||||
/*
|
||||
* -------------- Utilities -------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* Initialization routine for an IdealMolalSoln phase.
|
||||
*
|
||||
* This is a virtual routine. This routine will call initThermo()
|
||||
* for the parent class as well.
|
||||
*/
|
||||
void IdealMolalSoln::initThermo()
|
||||
{
|
||||
initLengths();
|
||||
MolalityVPSSTP::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.
|
||||
*/
|
||||
void IdealMolalSoln::initThermoXML(XML_Node& phaseNode, const std::string& id)
|
||||
{
|
||||
/*
|
||||
|
|
@ -1010,14 +681,6 @@ void IdealMolalSoln::initThermoXML(XML_Node& phaseNode, const std::string& id)
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
* @internal
|
||||
* Set equation of state parameters. The number and meaning of
|
||||
* these depends on the subclass.
|
||||
* @param n number of parameters
|
||||
* @param c array of \i n coefficients
|
||||
*
|
||||
*/
|
||||
void IdealMolalSoln::setParameters(int n, doublereal* const c)
|
||||
{
|
||||
}
|
||||
|
|
@ -1026,28 +689,10 @@ void IdealMolalSoln::getParameters(int& n, doublereal* const c) const
|
|||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Set equation of state parameter values from XML
|
||||
* entries. This method is called by function importPhase in
|
||||
* file importCTML.cpp 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 eosdata An XML_Node object corresponding to
|
||||
* the "thermo" entry for this phase in the input file.
|
||||
*
|
||||
* HKM -> Right now, the parameters are set elsewhere (initThermo)
|
||||
* It just didn't seem to fit.
|
||||
*/
|
||||
void IdealMolalSoln::setParametersFromXML(const XML_Node& eosdata)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* ----------- Critical State Properties --------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* ------------ Private and Restricted Functions ------------------
|
||||
*/
|
||||
|
|
@ -1063,18 +708,6 @@ doublereal IdealMolalSoln::err(const std::string& msg) const
|
|||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// This function will be called to update the internally stored
|
||||
// natural logarithm of the molality activity coefficients
|
||||
/*
|
||||
* Normally they are all one. However, sometimes they are not,
|
||||
* due to stability schemes
|
||||
*
|
||||
* gamma_k_molar = gamma_k_molal / Xmol_solvent
|
||||
*
|
||||
* gamma_o_molar = gamma_o_molal
|
||||
*/
|
||||
void IdealMolalSoln::s_updateIMS_lnMolalityActCoeff() const
|
||||
{
|
||||
double tmp;
|
||||
|
|
@ -1187,11 +820,6 @@ void IdealMolalSoln::s_updateIMS_lnMolalityActCoeff() const
|
|||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* This internal function adjusts the lengths of arrays.
|
||||
*
|
||||
* This function is not virtual nor is it inherited
|
||||
*/
|
||||
void IdealMolalSoln::initLengths()
|
||||
{
|
||||
m_kk = nSpecies();
|
||||
|
|
@ -1205,7 +833,6 @@ void IdealMolalSoln::initLengths()
|
|||
IMS_lnActCoeffMolal_.resize(m_kk);
|
||||
}
|
||||
|
||||
|
||||
void IdealMolalSoln::calcIMSCutoffParams_()
|
||||
{
|
||||
IMS_afCut_ = 1.0 / (std::exp(1.0) * IMS_gamma_k_min_);
|
||||
|
|
@ -1257,4 +884,3 @@ void IdealMolalSoln::calcIMSCutoffParams_()
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,9 +24,6 @@ using namespace std;
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
/*
|
||||
* Default constructor
|
||||
*/
|
||||
IdealSolnGasVPSS::IdealSolnGasVPSS() :
|
||||
VPStandardStateTP(),
|
||||
m_idealGas(0),
|
||||
|
|
@ -34,7 +31,6 @@ IdealSolnGasVPSS::IdealSolnGasVPSS() :
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
IdealSolnGasVPSS::IdealSolnGasVPSS(const std::string& infile, std::string id) :
|
||||
VPStandardStateTP(),
|
||||
m_idealGas(0),
|
||||
|
|
@ -52,15 +48,6 @@ IdealSolnGasVPSS::IdealSolnGasVPSS(const std::string& infile, std::string id) :
|
|||
importPhase(*xphase, this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy Constructor:
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working copy constructor.
|
||||
*
|
||||
* The copy constructor just calls the assignment operator
|
||||
* to do the heavy lifting.
|
||||
*/
|
||||
IdealSolnGasVPSS::IdealSolnGasVPSS(const IdealSolnGasVPSS& b) :
|
||||
VPStandardStateTP(),
|
||||
m_idealGas(0),
|
||||
|
|
@ -69,12 +56,6 @@ IdealSolnGasVPSS::IdealSolnGasVPSS(const IdealSolnGasVPSS& b) :
|
|||
*this = b;
|
||||
}
|
||||
|
||||
/*
|
||||
* operator=()
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working assignment operator
|
||||
*/
|
||||
IdealSolnGasVPSS& IdealSolnGasVPSS::
|
||||
operator=(const IdealSolnGasVPSS& b)
|
||||
{
|
||||
|
|
@ -93,18 +74,10 @@ operator=(const IdealSolnGasVPSS& b)
|
|||
return *this;
|
||||
}
|
||||
|
||||
/*
|
||||
* ~IdealSolnGasVPSS(): (virtual)
|
||||
*
|
||||
*/
|
||||
IdealSolnGasVPSS::~IdealSolnGasVPSS()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Duplication function.
|
||||
* This calls the copy constructor for this object.
|
||||
*/
|
||||
ThermoPhase* IdealSolnGasVPSS::duplMyselfAsThermoPhase() const
|
||||
{
|
||||
return new IdealSolnGasVPSS(*this);
|
||||
|
|
@ -118,12 +91,10 @@ int IdealSolnGasVPSS::eosType() const
|
|||
return cIdealSolnGasVPSS_iscv;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ------------Molar Thermodynamic Properties -------------------------
|
||||
*/
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
doublereal IdealSolnGasVPSS::enthalpy_mole() const
|
||||
{
|
||||
updateStandardStateThermo();
|
||||
|
|
@ -132,7 +103,6 @@ doublereal IdealSolnGasVPSS::enthalpy_mole() const
|
|||
mean_X(DATA_PTR(enth_RT)));
|
||||
}
|
||||
|
||||
/// Molar internal energy. Units: J/kmol.
|
||||
doublereal IdealSolnGasVPSS::intEnergy_mole() const
|
||||
{
|
||||
doublereal p0 = pressure();
|
||||
|
|
@ -140,7 +110,6 @@ doublereal IdealSolnGasVPSS::intEnergy_mole() const
|
|||
return (enthalpy_mole() - p0 / md);
|
||||
}
|
||||
|
||||
/// Molar entropy. Units: J/kmol/K.
|
||||
doublereal IdealSolnGasVPSS::entropy_mole() const
|
||||
{
|
||||
updateStandardStateThermo();
|
||||
|
|
@ -149,13 +118,11 @@ doublereal IdealSolnGasVPSS::entropy_mole() const
|
|||
|
||||
}
|
||||
|
||||
/// Molar Gibbs function. Units: J/kmol.
|
||||
doublereal IdealSolnGasVPSS::gibbs_mole() const
|
||||
{
|
||||
return enthalpy_mole() - temperature() * entropy_mole();
|
||||
}
|
||||
|
||||
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
doublereal IdealSolnGasVPSS::cp_mole() const
|
||||
{
|
||||
updateStandardStateThermo();
|
||||
|
|
@ -163,11 +130,9 @@ doublereal IdealSolnGasVPSS::cp_mole() const
|
|||
return GasConstant * (mean_X(DATA_PTR(cp_R)));
|
||||
}
|
||||
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
doublereal IdealSolnGasVPSS::cv_mole() const
|
||||
{
|
||||
return cp_mole() - GasConstant;
|
||||
|
||||
}
|
||||
|
||||
void IdealSolnGasVPSS::setPressure(doublereal p)
|
||||
|
|
@ -236,10 +201,6 @@ void IdealSolnGasVPSS::getActivityConcentrations(doublereal* c) const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the standard concentration \f$ C^0_k \f$, which is used to normalize
|
||||
* the generalized concentration.
|
||||
*/
|
||||
doublereal IdealSolnGasVPSS::standardConcentration(size_t k) const
|
||||
{
|
||||
if (m_idealGas) {
|
||||
|
|
@ -260,10 +221,6 @@ doublereal IdealSolnGasVPSS::standardConcentration(size_t k) const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the natural logarithm of the standard
|
||||
* concentration of the kth species
|
||||
*/
|
||||
doublereal IdealSolnGasVPSS::logStandardConc(size_t k) const
|
||||
{
|
||||
double c = standardConcentration(k);
|
||||
|
|
@ -271,32 +228,6 @@ doublereal IdealSolnGasVPSS::logStandardConc(size_t k) const
|
|||
return lc;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* getUnitsStandardConcentration()
|
||||
*
|
||||
* Returns the units of the standard and general concentrations
|
||||
* Note they have the same units, as their divisor is
|
||||
* defined to be equal to the activity of the kth species
|
||||
* in the solution, which is unitless.
|
||||
*
|
||||
* This routine is used in print out applications where the
|
||||
* units are needed. Usually, MKS units are assumed throughout
|
||||
* the program and in the XML input files.
|
||||
*
|
||||
* uA[0] = kmol units - default = 1
|
||||
* uA[1] = m units - default = -nDim(), the number of spatial
|
||||
* dimensions in the Phase class.
|
||||
* uA[2] = kg units - default = 0;
|
||||
* uA[3] = Pa(pressure) units - default = 0;
|
||||
* uA[4] = Temperature units - default = 0;
|
||||
* uA[5] = time units - default = 0
|
||||
*
|
||||
* For EOS types other than cIdealSolidSolnPhase1, the default
|
||||
* kmol/m3 holds for standard concentration units. For
|
||||
* cIdealSolidSolnPhase0 type, the standard concentration is
|
||||
* unitless.
|
||||
*/
|
||||
void IdealSolnGasVPSS::getUnitsStandardConc(double* uA, int, int sizeUA) const
|
||||
{
|
||||
int eos = eosType();
|
||||
|
|
@ -328,10 +259,6 @@ void IdealSolnGasVPSS::getUnitsStandardConc(double* uA, int, int sizeUA) const
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the array of non-dimensional activity coefficients
|
||||
*/
|
||||
void IdealSolnGasVPSS::getActivityCoefficients(doublereal* ac) const
|
||||
{
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
|
|
@ -343,15 +270,6 @@ void IdealSolnGasVPSS::getActivityCoefficients(doublereal* ac) const
|
|||
* ---- 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.
|
||||
*/
|
||||
void IdealSolnGasVPSS::getChemPotentials_RT(doublereal* muRT) const
|
||||
{
|
||||
getChemPotentials(muRT);
|
||||
|
|
@ -372,7 +290,6 @@ void IdealSolnGasVPSS::getChemPotentials(doublereal* mu) const
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void IdealSolnGasVPSS::getPartialMolarEnthalpies(doublereal* hbar) const
|
||||
{
|
||||
getEnthalpy_RT(hbar);
|
||||
|
|
@ -410,24 +327,12 @@ void IdealSolnGasVPSS::getPartialMolarVolumes(doublereal* vbar) const
|
|||
getStandardVolumes(vbar);
|
||||
}
|
||||
|
||||
/*
|
||||
* ----- Thermodynamic Values for the Species Reference States ----
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Perform initializations after all species have been
|
||||
* added.
|
||||
*/
|
||||
void IdealSolnGasVPSS::initThermo()
|
||||
{
|
||||
initLengths();
|
||||
VPStandardStateTP::initThermo();
|
||||
}
|
||||
|
||||
|
||||
void IdealSolnGasVPSS::setToEquilState(const doublereal* mu_RT)
|
||||
{
|
||||
double tmp, tmp2;
|
||||
|
|
@ -461,33 +366,12 @@ void IdealSolnGasVPSS::setToEquilState(const doublereal* mu_RT)
|
|||
setState_PX(pres, &m_pp[0]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the internal lengths.
|
||||
* (this is not a virtual function)
|
||||
*/
|
||||
void IdealSolnGasVPSS::initLengths()
|
||||
{
|
||||
m_kk = nSpecies();
|
||||
m_pp.resize(m_kk, 0.0);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This routine initializes the lengths in the current object and
|
||||
* then calls the parent routine.
|
||||
*/
|
||||
void IdealSolnGasVPSS::initThermoXML(XML_Node& phaseNode, const std::string& id)
|
||||
{
|
||||
IdealSolnGasVPSS::initLengths();
|
||||
|
|
@ -555,5 +439,3 @@ void IdealSolnGasVPSS::setParametersFromXML(const XML_Node& thermoNode)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,11 +31,6 @@ using namespace std;
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* Default constructor.
|
||||
*
|
||||
*/
|
||||
IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP() :
|
||||
GibbsExcessVPSSTP(),
|
||||
ionSolnType_(cIonSolnType_SINGLEANION),
|
||||
|
|
@ -54,32 +49,6 @@ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP() :
|
|||
{
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
// Construct and initialize an IonsFromNeutralVPSSTP object
|
||||
// directly from an ASCII 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.
|
||||
*
|
||||
* @param inputFile 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 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::IonsFromNeutralVPSSTP(const std::string& inputFile,
|
||||
const std::string& id,
|
||||
ThermoPhase* neutralPhase) :
|
||||
|
|
@ -107,7 +76,7 @@ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(const std::string& inputFile,
|
|||
//dlnActCoeff_NeutralMolecule.resize(numNeutMolSpec);
|
||||
//dX_NeutralMolecule.resize(numNeutMolSpec);
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(XML_Node& phaseRoot,
|
||||
const std::string& id, ThermoPhase* neutralPhase) :
|
||||
GibbsExcessVPSSTP(),
|
||||
|
|
@ -136,14 +105,6 @@ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(XML_Node& phaseRoot,
|
|||
dX_NeutralMolecule.resize(numNeutMolSpec);
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
|
||||
/*
|
||||
* Copy Constructor:
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working copy constructor
|
||||
*/
|
||||
IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(const IonsFromNeutralVPSSTP& b) :
|
||||
GibbsExcessVPSSTP(),
|
||||
ionSolnType_(cIonSolnType_SINGLEANION),
|
||||
|
|
@ -163,13 +124,7 @@ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(const IonsFromNeutralVPSSTP& b) :
|
|||
{
|
||||
IonsFromNeutralVPSSTP::operator=(b);
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* operator=()
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working assignment operator
|
||||
*/
|
||||
|
||||
IonsFromNeutralVPSSTP& IonsFromNeutralVPSSTP::
|
||||
operator=(const IonsFromNeutralVPSSTP& b)
|
||||
{
|
||||
|
|
@ -232,13 +187,6 @@ operator=(const IonsFromNeutralVPSSTP& b)
|
|||
return *this;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* ~IonsFromNeutralVPSSTP(): (virtual)
|
||||
*
|
||||
* Destructor: does nothing:
|
||||
*
|
||||
*/
|
||||
IonsFromNeutralVPSSTP::~IonsFromNeutralVPSSTP()
|
||||
{
|
||||
if (IOwnNThermoPhase_) {
|
||||
|
|
@ -247,30 +195,12 @@ IonsFromNeutralVPSSTP::~IonsFromNeutralVPSSTP()
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine duplicates the current object and returns
|
||||
* a pointer to ThermoPhase.
|
||||
*/
|
||||
ThermoPhase*
|
||||
IonsFromNeutralVPSSTP::duplMyselfAsThermoPhase() const
|
||||
{
|
||||
return new IonsFromNeutralVPSSTP(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Import, construct, and initialize a phase
|
||||
* specification from an XML tree into the current object.
|
||||
*
|
||||
* This routine is a precursor to constructPhaseXML(XML_Node*)
|
||||
* routine, which does most of the work.
|
||||
*
|
||||
* @param infile 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.
|
||||
*/
|
||||
void IonsFromNeutralVPSSTP::constructPhaseFile(std::string inputFile, std::string id)
|
||||
{
|
||||
|
||||
|
|
@ -302,34 +232,6 @@ void IonsFromNeutralVPSSTP::constructPhaseFile(std::string inputFile, std::strin
|
|||
delete fxml;
|
||||
}
|
||||
|
||||
/*
|
||||
* Import, construct, and initialize a HMWSoln phase
|
||||
* specification from an XML tree into the current object.
|
||||
*
|
||||
* Most of the work is carried out by the cantera base
|
||||
* routine, importPhase(). That routine imports all of the
|
||||
* species and element data, including the standard states
|
||||
* of the species.
|
||||
*
|
||||
* Then, In this routine, we read the information
|
||||
* particular to the specification of the activity
|
||||
* coefficient model for the Pitzer parameterization.
|
||||
*
|
||||
* We also read information about the molar volumes of the
|
||||
* standard states if present in the XML file.
|
||||
*
|
||||
* @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 IonsFromNeutralVPSSTP::constructPhaseXML(XML_Node& phaseNode, std::string id)
|
||||
{
|
||||
string stemp;
|
||||
|
|
@ -398,45 +300,25 @@ void IonsFromNeutralVPSSTP::constructPhaseXML(XML_Node& phaseNode, std::string i
|
|||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* -------------- 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 IonsFromNeutralVPSSTP class also returns
|
||||
* zero, as it is a non-complete class.
|
||||
*/
|
||||
int IonsFromNeutralVPSSTP::eosType() const
|
||||
{
|
||||
return cIonsFromNeutral;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ------------ Molar Thermodynamic Properties ----------------------
|
||||
*/
|
||||
/*
|
||||
* Molar enthalpy of the solution. Units: J/kmol.
|
||||
*/
|
||||
|
||||
doublereal IonsFromNeutralVPSSTP::enthalpy_mole() const
|
||||
{
|
||||
getPartialMolarEnthalpies(DATA_PTR(m_pp));
|
||||
return mean_X(DATA_PTR(m_pp));
|
||||
}
|
||||
|
||||
/**
|
||||
* Molar internal energy of the solution. Units: J/kmol.
|
||||
*
|
||||
* This is calculated from the soln enthalpy and then
|
||||
* subtracting pV.
|
||||
*/
|
||||
doublereal IonsFromNeutralVPSSTP::intEnergy_mole() const
|
||||
{
|
||||
double hh = enthalpy_mole();
|
||||
|
|
@ -446,28 +328,18 @@ doublereal IonsFromNeutralVPSSTP::intEnergy_mole() const
|
|||
return uu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Molar soln entropy at constant pressure. Units: J/kmol/K.
|
||||
*
|
||||
* This is calculated from the partial molar entropies.
|
||||
*/
|
||||
doublereal IonsFromNeutralVPSSTP::entropy_mole() const
|
||||
{
|
||||
getPartialMolarEntropies(DATA_PTR(m_pp));
|
||||
return mean_X(DATA_PTR(m_pp));
|
||||
}
|
||||
|
||||
/// Molar Gibbs function. Units: J/kmol.
|
||||
doublereal IonsFromNeutralVPSSTP::gibbs_mole() const
|
||||
{
|
||||
getChemPotentials(DATA_PTR(m_pp));
|
||||
return mean_X(DATA_PTR(m_pp));
|
||||
}
|
||||
/** Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
*
|
||||
* Returns the solution heat capacition at constant pressure.
|
||||
* This is calculated from the partial molar heat capacities.
|
||||
*/
|
||||
|
||||
doublereal IonsFromNeutralVPSSTP::cp_mole() const
|
||||
{
|
||||
getPartialMolarCp(DATA_PTR(m_pp));
|
||||
|
|
@ -475,7 +347,6 @@ doublereal IonsFromNeutralVPSSTP::cp_mole() const
|
|||
return val;
|
||||
}
|
||||
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
doublereal IonsFromNeutralVPSSTP::cv_mole() const
|
||||
{
|
||||
// Need to revisit this, as it is wrong
|
||||
|
|
@ -484,11 +355,11 @@ doublereal IonsFromNeutralVPSSTP::cv_mole() const
|
|||
//err("not implemented");
|
||||
//return 0.0;
|
||||
}
|
||||
//===========================================================================================================
|
||||
|
||||
/*
|
||||
* - Activities, Standard States, Activity Concentrations -----------
|
||||
*/
|
||||
//===========================================================================================================
|
||||
|
||||
void IonsFromNeutralVPSSTP::getDissociationCoeffs(vector_fp& coeffs,
|
||||
vector_fp& charges, std::vector<size_t>& neutMolIndex) const
|
||||
{
|
||||
|
|
@ -496,12 +367,7 @@ void IonsFromNeutralVPSSTP::getDissociationCoeffs(vector_fp& coeffs,
|
|||
charges = m_speciesCharge;
|
||||
neutMolIndex = fm_invert_ionForNeutral;
|
||||
}
|
||||
//===========================================================================================================
|
||||
// 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.
|
||||
*/
|
||||
|
||||
void IonsFromNeutralVPSSTP::getActivityCoefficients(doublereal* ac) const
|
||||
{
|
||||
|
||||
|
|
@ -524,20 +390,10 @@ void IonsFromNeutralVPSSTP::getActivityCoefficients(doublereal* ac) const
|
|||
}
|
||||
|
||||
/*
|
||||
* --------- Partial Molar Properties of the Solution -------------------------------
|
||||
* --------- 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
|
||||
*/
|
||||
void
|
||||
IonsFromNeutralVPSSTP::getChemPotentials(doublereal* mu) const
|
||||
void IonsFromNeutralVPSSTP::getChemPotentials(doublereal* mu) const
|
||||
{
|
||||
size_t icat, jNeut;
|
||||
doublereal xx, fact2;
|
||||
|
|
@ -602,21 +458,6 @@ IonsFromNeutralVPSSTP::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]
|
||||
*
|
||||
*/
|
||||
void IonsFromNeutralVPSSTP::getPartialMolarEnthalpies(doublereal* hbar) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -643,20 +484,6 @@ void IonsFromNeutralVPSSTP::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}
|
||||
* \f]
|
||||
*
|
||||
*/
|
||||
void IonsFromNeutralVPSSTP::getPartialMolarEntropies(doublereal* sbar) const
|
||||
{
|
||||
double xx;
|
||||
|
|
@ -684,26 +511,6 @@ void IonsFromNeutralVPSSTP::getPartialMolarEntropies(doublereal* sbar) 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. mole fraction,
|
||||
* molality, etc.) 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 dlnActCoeffdlnX Output vector of log(mole fraction)
|
||||
* derivatives of the log Activity Coefficients.
|
||||
* length = m_kk
|
||||
*/
|
||||
void IonsFromNeutralVPSSTP::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const
|
||||
{
|
||||
s_update_lnActCoeff();
|
||||
|
|
@ -713,26 +520,7 @@ void IonsFromNeutralVPSSTP::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_
|
|||
dlnActCoeffdlnX_diag[k] = dlnActCoeffdlnX_diag_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
// 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 log(mole fraction)
|
||||
* derivatives of the log Activity Coefficients.
|
||||
* length = m_kk
|
||||
*/
|
||||
|
||||
void IonsFromNeutralVPSSTP::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const
|
||||
{
|
||||
s_update_lnActCoeff();
|
||||
|
|
@ -742,7 +530,7 @@ void IonsFromNeutralVPSSTP::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_
|
|||
dlnActCoeffdlnN_diag[k] = dlnActCoeffdlnN_diag_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void IonsFromNeutralVPSSTP::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeffdlnN)
|
||||
{
|
||||
s_update_lnActCoeff();
|
||||
|
|
@ -754,26 +542,19 @@ void IonsFromNeutralVPSSTP::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnA
|
|||
}
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void IonsFromNeutralVPSSTP::setTemperature(const doublereal temp)
|
||||
{
|
||||
double p = pressure();
|
||||
IonsFromNeutralVPSSTP::setState_TP(temp, p);
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void IonsFromNeutralVPSSTP::setPressure(doublereal p)
|
||||
{
|
||||
double t = temperature();
|
||||
IonsFromNeutralVPSSTP::setState_TP(t, 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)
|
||||
*/
|
||||
|
||||
void IonsFromNeutralVPSSTP::setState_TP(doublereal t, doublereal p)
|
||||
{
|
||||
/*
|
||||
|
|
@ -792,11 +573,6 @@ void IonsFromNeutralVPSSTP::setState_TP(doublereal t, doublereal p)
|
|||
Phase::setDensity(dd);
|
||||
}
|
||||
|
||||
// Calculate ion mole fractions from neutral molecule
|
||||
// mole fractions.
|
||||
/*
|
||||
* @param mf Dump the mole fractions into this vector.
|
||||
*/
|
||||
void IonsFromNeutralVPSSTP::calcIonMoleFractions(doublereal* const mf) const
|
||||
{
|
||||
doublereal fmij;
|
||||
|
|
@ -833,21 +609,7 @@ void IonsFromNeutralVPSSTP::calcIonMoleFractions(doublereal* const mf) const
|
|||
}
|
||||
|
||||
}
|
||||
//====================================================================================================================
|
||||
// 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
void IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions() const
|
||||
{
|
||||
size_t icat, jNeut;
|
||||
|
|
@ -956,21 +718,7 @@ void IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions() const
|
|||
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
// 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
void IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads(const doublereal* const dx, doublereal* const dy) const
|
||||
{
|
||||
doublereal fmij;
|
||||
|
|
@ -1075,7 +823,6 @@ void IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads(const doublereal* const
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void IonsFromNeutralVPSSTP::setMassFractions(const doublereal* const y)
|
||||
{
|
||||
GibbsExcessVPSSTP::setMassFractions(y);
|
||||
|
|
@ -1104,7 +851,6 @@ void IonsFromNeutralVPSSTP::setMoleFractions_NoNorm(const doublereal* const x)
|
|||
neutralMoleculePhase_->setMoleFractions_NoNorm(DATA_PTR(NeutralMolecMoleFractions_));
|
||||
}
|
||||
|
||||
|
||||
void IonsFromNeutralVPSSTP::setConcentrations(const doublereal* const c)
|
||||
{
|
||||
GibbsExcessVPSSTP::setConcentrations(c);
|
||||
|
|
@ -1116,7 +862,6 @@ void IonsFromNeutralVPSSTP::setConcentrations(const doublereal* const c)
|
|||
* ------------ Partial Molar Properties of the Solution ------------
|
||||
*/
|
||||
|
||||
|
||||
doublereal IonsFromNeutralVPSSTP::err(const std::string& msg) const
|
||||
{
|
||||
throw CanteraError("IonsFromNeutralVPSSTP","Base class method "
|
||||
|
|
@ -1124,29 +869,12 @@ doublereal IonsFromNeutralVPSSTP::err(const std::string& msg) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* @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.
|
||||
*
|
||||
* @see importCTML.cpp
|
||||
*/
|
||||
void IonsFromNeutralVPSSTP::initThermo()
|
||||
{
|
||||
initLengths();
|
||||
GibbsExcessVPSSTP::initThermo();
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
// Initialize lengths of local variables after all species have
|
||||
// been identified.
|
||||
void IonsFromNeutralVPSSTP::initLengths()
|
||||
{
|
||||
m_kk = nSpecies();
|
||||
|
|
@ -1171,7 +899,7 @@ void IonsFromNeutralVPSSTP::initLengths()
|
|||
dX_NeutralMolecule.resize(numNeutralMoleculeSpecies_, 0.0);
|
||||
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
//! Return the factor overlap
|
||||
/*!
|
||||
* @param elnamesVN
|
||||
|
|
@ -1180,7 +908,6 @@ void IonsFromNeutralVPSSTP::initLengths()
|
|||
* @param elnamesVI
|
||||
* @param elemVectorI
|
||||
* @param nElementsI
|
||||
*
|
||||
*/
|
||||
static double factorOverlap(const std::vector<std::string>& elnamesVN ,
|
||||
const std::vector<double>& elemVectorN,
|
||||
|
|
@ -1207,22 +934,7 @@ static double factorOverlap(const std::vector<std::string>& elnamesVN ,
|
|||
}
|
||||
return fMax;
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* initThermoXML() (virtual from ThermoPhase)
|
||||
* 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 IonsFromNeutralVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
|
||||
{
|
||||
string stemp;
|
||||
|
|
@ -1426,13 +1138,7 @@ void IonsFromNeutralVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string
|
|||
* have charge conservation.
|
||||
*/
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Update the activity coefficients
|
||||
/*
|
||||
* This function will be called to update the internally stored
|
||||
* natural logarithm of the activity coefficients
|
||||
*
|
||||
*/
|
||||
|
||||
void IonsFromNeutralVPSSTP::s_update_lnActCoeff() const
|
||||
{
|
||||
size_t icat, jNeut;
|
||||
|
|
@ -1481,17 +1187,7 @@ void IonsFromNeutralVPSSTP::s_update_lnActCoeff() 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
|
||||
*/
|
||||
|
||||
void IonsFromNeutralVPSSTP::getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds,
|
||||
doublereal* dlnActCoeffds) const
|
||||
{
|
||||
|
|
@ -1556,12 +1252,7 @@ void IonsFromNeutralVPSSTP::getdlnActCoeffds(const doublereal dTds, const double
|
|||
}
|
||||
|
||||
}
|
||||
//====================================================================================================================
|
||||
// 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
|
||||
*/
|
||||
|
||||
void IonsFromNeutralVPSSTP::s_update_dlnActCoeffdT() const
|
||||
{
|
||||
size_t icat, jNeut;
|
||||
|
|
@ -1615,11 +1306,7 @@ void IonsFromNeutralVPSSTP::s_update_dlnActCoeffdT() const
|
|||
}
|
||||
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* This function will be called to update the internally stored
|
||||
* temperature derivative of the natural logarithm of the activity coefficients
|
||||
*/
|
||||
|
||||
void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnX_diag() const
|
||||
{
|
||||
size_t icat, jNeut;
|
||||
|
|
@ -1673,11 +1360,7 @@ void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnX_diag() const
|
|||
}
|
||||
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* This function will be called to update the internally stored
|
||||
* temperature derivative of the natural logarithm of the activity coefficients
|
||||
*/
|
||||
|
||||
void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN_diag() const
|
||||
{
|
||||
size_t icat, jNeut;
|
||||
|
|
@ -1731,14 +1414,7 @@ void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN_diag() const
|
|||
}
|
||||
|
||||
}
|
||||
//====================================================================================================================
|
||||
// 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.
|
||||
*/
|
||||
|
||||
void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN() const
|
||||
{
|
||||
size_t kcat = 0, kNeut = 0, mcat = 0, mNeut = 0;
|
||||
|
|
@ -1823,6 +1499,5 @@ void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN() const
|
|||
break;
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
}
|
||||
//======================================================================================================================
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
* employ excess gibbs free energy formulations related to Margules
|
||||
* expansions (see \ref thermoprops
|
||||
* and class \link Cantera::MargulesVPSSTP MargulesVPSSTP\endlink).
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (2009) Sandia Corporation. Under the terms of
|
||||
|
|
@ -22,11 +21,6 @@ using namespace std;
|
|||
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
/*
|
||||
* Default constructor.
|
||||
*
|
||||
*/
|
||||
MargulesVPSSTP::MargulesVPSSTP() :
|
||||
GibbsExcessVPSSTP(),
|
||||
numBinaryInteractions_(0),
|
||||
|
|
@ -35,15 +29,6 @@ MargulesVPSSTP::MargulesVPSSTP() :
|
|||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
|
||||
*/
|
||||
MargulesVPSSTP::MargulesVPSSTP(const std::string& inputFile, const std::string& id) :
|
||||
GibbsExcessVPSSTP(),
|
||||
numBinaryInteractions_(0),
|
||||
|
|
@ -62,25 +47,12 @@ MargulesVPSSTP::MargulesVPSSTP(XML_Node& phaseRoot, const std::string& id) :
|
|||
importPhase(*findXMLPhase(&phaseRoot, id), this);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Copy Constructor:
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working copy constructor
|
||||
*/
|
||||
MargulesVPSSTP::MargulesVPSSTP(const MargulesVPSSTP& b) :
|
||||
GibbsExcessVPSSTP()
|
||||
{
|
||||
MargulesVPSSTP::operator=(b);
|
||||
}
|
||||
|
||||
/*
|
||||
* operator=()
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working assignment operator
|
||||
*/
|
||||
MargulesVPSSTP& MargulesVPSSTP::
|
||||
operator=(const MargulesVPSSTP& b)
|
||||
{
|
||||
|
|
@ -111,34 +83,16 @@ operator=(const MargulesVPSSTP& b)
|
|||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* ~MargulesVPSSTP(): (virtual)
|
||||
*
|
||||
* Destructor: does nothing:
|
||||
*
|
||||
*/
|
||||
MargulesVPSSTP::~MargulesVPSSTP()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine duplicates the current object and returns
|
||||
* a pointer to ThermoPhase.
|
||||
*/
|
||||
ThermoPhase*
|
||||
MargulesVPSSTP::duplMyselfAsThermoPhase() const
|
||||
{
|
||||
return new MargulesVPSSTP(*this);
|
||||
}
|
||||
|
||||
// Special constructor for a hard-coded problem
|
||||
/*
|
||||
*
|
||||
* LiKCl treating the PseudoBinary layer as passthrough.
|
||||
* -> test to predict the eutectic and liquidus correctly.
|
||||
*
|
||||
*/
|
||||
MargulesVPSSTP::MargulesVPSSTP(int testProb) :
|
||||
GibbsExcessVPSSTP(),
|
||||
numBinaryInteractions_(0),
|
||||
|
|
@ -197,41 +151,19 @@ MargulesVPSSTP::MargulesVPSSTP(int testProb) :
|
|||
m_pSpecies_A_ij[0] = iKCl;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* -------------- 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 MargulesVPSSTP class also returns
|
||||
* zero, as it is a non-complete class.
|
||||
*/
|
||||
int MargulesVPSSTP::eosType() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* ------------ Molar Thermodynamic Properties ----------------------
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* - Activities, Standard States, Activity Concentrations -----------
|
||||
*/
|
||||
|
||||
|
||||
//====================================================================================================================
|
||||
// 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.
|
||||
*/
|
||||
void MargulesVPSSTP::getLnActivityCoefficients(doublereal* lnac) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -246,13 +178,11 @@ void MargulesVPSSTP::getLnActivityCoefficients(doublereal* lnac) const
|
|||
lnac[k] = lnActCoeff_Scaled_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
/*
|
||||
* ------------ Partial Molar Properties of the Solution ------------
|
||||
*/
|
||||
|
||||
|
||||
|
||||
void MargulesVPSSTP::getElectrochemPotentials(doublereal* mu) const
|
||||
{
|
||||
getChemPotentials(mu);
|
||||
|
|
@ -262,7 +192,6 @@ void MargulesVPSSTP::getElectrochemPotentials(doublereal* mu) const
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void MargulesVPSSTP::getChemPotentials(doublereal* mu) const
|
||||
{
|
||||
doublereal xx;
|
||||
|
|
@ -284,7 +213,6 @@ void MargulesVPSSTP::getChemPotentials(doublereal* mu) const
|
|||
}
|
||||
}
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
doublereal MargulesVPSSTP::enthalpy_mole() const
|
||||
{
|
||||
size_t kk = nSpecies();
|
||||
|
|
@ -297,7 +225,6 @@ doublereal MargulesVPSSTP::enthalpy_mole() const
|
|||
return h;
|
||||
}
|
||||
|
||||
/// Molar entropy. Units: J/kmol.
|
||||
doublereal MargulesVPSSTP::entropy_mole() const
|
||||
{
|
||||
size_t kk = nSpecies();
|
||||
|
|
@ -310,7 +237,6 @@ doublereal MargulesVPSSTP::entropy_mole() const
|
|||
return s;
|
||||
}
|
||||
|
||||
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
doublereal MargulesVPSSTP::cp_mole() const
|
||||
{
|
||||
size_t kk = nSpecies();
|
||||
|
|
@ -323,26 +249,11 @@ doublereal MargulesVPSSTP::cp_mole() const
|
|||
return cp;
|
||||
}
|
||||
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
doublereal MargulesVPSSTP::cv_mole() const
|
||||
{
|
||||
return cp_mole() - GasConstant;
|
||||
}
|
||||
|
||||
// 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]
|
||||
*
|
||||
*/
|
||||
void MargulesVPSSTP::getPartialMolarEnthalpies(doublereal* hbar) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -369,20 +280,6 @@ void MargulesVPSSTP::getPartialMolarEnthalpies(doublereal* hbar) const
|
|||
}
|
||||
}
|
||||
|
||||
// Returns an array of partial molar heat capacities 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}
|
||||
* \f]
|
||||
*
|
||||
*/
|
||||
void MargulesVPSSTP::getPartialMolarCp(doublereal* cpbar) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -408,20 +305,6 @@ void MargulesVPSSTP::getPartialMolarCp(doublereal* cpbar) 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}
|
||||
* \f]
|
||||
*
|
||||
*/
|
||||
void MargulesVPSSTP::getPartialMolarEntropies(doublereal* sbar) const
|
||||
{
|
||||
double xx;
|
||||
|
|
@ -449,20 +332,6 @@ void MargulesVPSSTP::getPartialMolarEntropies(doublereal* sbar) const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ------------ Partial Molar Properties of the Solution ------------
|
||||
*/
|
||||
|
||||
// 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.
|
||||
*/
|
||||
void MargulesVPSSTP::getPartialMolarVolumes(doublereal* vbar) const
|
||||
{
|
||||
|
||||
|
|
@ -505,50 +374,18 @@ doublereal MargulesVPSSTP::err(const std::string& msg) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @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.
|
||||
*
|
||||
* @see importCTML.cpp
|
||||
*/
|
||||
void MargulesVPSSTP::initThermo()
|
||||
{
|
||||
initLengths();
|
||||
GibbsExcessVPSSTP::initThermo();
|
||||
}
|
||||
|
||||
|
||||
// Initialize lengths of local variables after all species have
|
||||
// been identified.
|
||||
void MargulesVPSSTP::initLengths()
|
||||
{
|
||||
m_kk = nSpecies();
|
||||
dlnActCoeffdlnN_.resize(m_kk, m_kk);
|
||||
}
|
||||
|
||||
/*
|
||||
* initThermoXML() (virtual from ThermoPhase)
|
||||
* 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 MargulesVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
|
||||
{
|
||||
string stemp;
|
||||
|
|
@ -617,15 +454,7 @@ void MargulesVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
|
|||
|
||||
|
||||
}
|
||||
//===================================================================================================================
|
||||
|
||||
// Update the activity coefficients
|
||||
/*
|
||||
* This function will be called to update the internally stored
|
||||
* natural logarithm of the activity coefficients
|
||||
*
|
||||
* he = X_A X_B(B + C X_B)
|
||||
*/
|
||||
void MargulesVPSSTP::s_update_lnActCoeff() const
|
||||
{
|
||||
size_t iA, iB, iK;
|
||||
|
|
@ -653,14 +482,7 @@ void MargulesVPSSTP::s_update_lnActCoeff() const
|
|||
lnActCoeff_Scaled_[iB] += XA * g0g1XB + XAXB * g1;
|
||||
}
|
||||
}
|
||||
//===================================================================================================================
|
||||
// Update the derivative of the log of the activity coefficients wrt T
|
||||
/*
|
||||
* This function will be called to update the internally stored
|
||||
* natural logarithm of the activity coefficients
|
||||
*
|
||||
* he = X_A X_B(B + C X_B)
|
||||
*/
|
||||
|
||||
void MargulesVPSSTP::s_update_dlnActCoeff_dT() const
|
||||
{
|
||||
size_t iA, iB, iK;
|
||||
|
|
@ -696,7 +518,7 @@ void MargulesVPSSTP::s_update_dlnActCoeff_dT() const
|
|||
d2lnActCoeffdT2_Scaled_[iB] -= mult * XA * g0g1XB + XAXB * g1;
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void MargulesVPSSTP::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const
|
||||
{
|
||||
s_update_dlnActCoeff_dT();
|
||||
|
|
@ -704,7 +526,7 @@ void MargulesVPSSTP::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const
|
|||
dlnActCoeffdT[k] = dlnActCoeffdT_Scaled_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void MargulesVPSSTP::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const
|
||||
{
|
||||
s_update_dlnActCoeff_dT();
|
||||
|
|
@ -712,24 +534,10 @@ void MargulesVPSSTP::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const
|
|||
d2lnActCoeffdT2[k] = d2lnActCoeffdT2_Scaled_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
// 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.
|
||||
*/
|
||||
void MargulesVPSSTP::getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds,
|
||||
doublereal* dlnActCoeffds) const
|
||||
{
|
||||
|
||||
|
||||
size_t iA, iB, iK;
|
||||
double XA, XB, g0 , g1, dXA, dXB;
|
||||
double T = temperature();
|
||||
|
|
@ -763,15 +571,7 @@ void MargulesVPSSTP::getdlnActCoeffds(const doublereal dTds, const doublereal*
|
|||
dlnActCoeffds[iB] += dXA * g02g1XB + g2XAdXB;
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Update the derivative of the log of the activity coefficients wrt dlnN
|
||||
/*
|
||||
* This function will be called to update the internally stored gradients of the
|
||||
* logarithm of the activity coefficients. These are used in the determination
|
||||
* of the diffusion coefficients.
|
||||
*
|
||||
* he = X_A X_B(B + C X_B)
|
||||
*/
|
||||
|
||||
void MargulesVPSSTP::s_update_dlnActCoeff_dlnN_diag() const
|
||||
{
|
||||
size_t iA, iB, iK, delAK, delBK;
|
||||
|
|
@ -827,14 +627,6 @@ void MargulesVPSSTP::s_update_dlnActCoeff_dlnN_diag() const
|
|||
}
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
// Update the derivative of the log of the activity coefficients wrt dlnN
|
||||
/*
|
||||
* This function will be called to update the internally stored gradients of the
|
||||
* logarithm of the activity coefficients. These are used in the determination
|
||||
* of the diffusion coefficients.
|
||||
*
|
||||
*/
|
||||
void MargulesVPSSTP::s_update_dlnActCoeff_dlnN() const
|
||||
{
|
||||
size_t iA, iB;
|
||||
|
|
@ -902,7 +694,7 @@ void MargulesVPSSTP::s_update_dlnActCoeff_dlnN() const
|
|||
}
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void MargulesVPSSTP::s_update_dlnActCoeff_dlnX_diag() const
|
||||
{
|
||||
doublereal T = temperature();
|
||||
|
|
@ -924,7 +716,6 @@ void MargulesVPSSTP::s_update_dlnActCoeff_dlnX_diag() const
|
|||
}
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
void MargulesVPSSTP::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const
|
||||
{
|
||||
s_update_dlnActCoeff_dlnN_diag();
|
||||
|
|
@ -932,7 +723,7 @@ void MargulesVPSSTP::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) c
|
|||
dlnActCoeffdlnN_diag[k] = dlnActCoeffdlnN_diag_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void MargulesVPSSTP::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const
|
||||
{
|
||||
s_update_dlnActCoeff_dlnX_diag();
|
||||
|
|
@ -940,7 +731,7 @@ void MargulesVPSSTP::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) c
|
|||
dlnActCoeffdlnX_diag[k] = dlnActCoeffdlnX_diag_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void MargulesVPSSTP::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeffdlnN)
|
||||
{
|
||||
s_update_dlnActCoeff_dlnN();
|
||||
|
|
@ -951,7 +742,7 @@ void MargulesVPSSTP::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeff
|
|||
}
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void MargulesVPSSTP::resizeNumInteractions(const size_t num)
|
||||
{
|
||||
numBinaryInteractions_ = num;
|
||||
|
|
@ -970,17 +761,8 @@ void MargulesVPSSTP::resizeNumInteractions(const size_t num)
|
|||
|
||||
m_pSpecies_A_ij.resize(num, npos);
|
||||
m_pSpecies_B_ij.resize(num, npos);
|
||||
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
/*
|
||||
* Process an XML node called "binaryNeutralSpeciesParameters"
|
||||
* This node contains all of the parameters necessary to describe
|
||||
* the Margules Interaction for a single binary interaction
|
||||
* This function reads the XML file and writes the coefficients
|
||||
* it finds to an internal data structures.
|
||||
*/
|
||||
void MargulesVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
||||
{
|
||||
string xname = xmLBinarySpecies.name();
|
||||
|
|
@ -1096,11 +878,7 @@ void MargulesVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
|||
m_VSE_b_ij[iSpot] = vParams[0];
|
||||
m_VSE_c_ij[iSpot] = vParams[1];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,11 +23,6 @@ using namespace std;
|
|||
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
/*
|
||||
* Default constructor.
|
||||
*
|
||||
*/
|
||||
MixedSolventElectrolyte::MixedSolventElectrolyte() :
|
||||
MolarityIonicVPSSTP(),
|
||||
numBinaryInteractions_(0),
|
||||
|
|
@ -36,15 +31,6 @@ MixedSolventElectrolyte::MixedSolventElectrolyte() :
|
|||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
|
||||
*/
|
||||
MixedSolventElectrolyte::MixedSolventElectrolyte(const std::string& inputFile,
|
||||
const std::string& id) :
|
||||
MolarityIonicVPSSTP(),
|
||||
|
|
@ -65,25 +51,12 @@ MixedSolventElectrolyte::MixedSolventElectrolyte(XML_Node& phaseRoot,
|
|||
importPhase(*findXMLPhase(&phaseRoot, id), this);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Copy Constructor:
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working copy constructor
|
||||
*/
|
||||
MixedSolventElectrolyte::MixedSolventElectrolyte(const MixedSolventElectrolyte& b) :
|
||||
MolarityIonicVPSSTP()
|
||||
{
|
||||
MixedSolventElectrolyte::operator=(b);
|
||||
}
|
||||
|
||||
/*
|
||||
* operator=()
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working assignment operator
|
||||
*/
|
||||
MixedSolventElectrolyte& MixedSolventElectrolyte::
|
||||
operator=(const MixedSolventElectrolyte& b)
|
||||
{
|
||||
|
|
@ -114,42 +87,22 @@ operator=(const MixedSolventElectrolyte& b)
|
|||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* ~MixedSolventElectrolyte(): (virtual)
|
||||
*
|
||||
* Destructor: does nothing:
|
||||
*
|
||||
*/
|
||||
MixedSolventElectrolyte::~MixedSolventElectrolyte()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine duplicates the current object and returns
|
||||
* a pointer to ThermoPhase.
|
||||
*/
|
||||
ThermoPhase*
|
||||
MixedSolventElectrolyte::duplMyselfAsThermoPhase() const
|
||||
{
|
||||
return new MixedSolventElectrolyte(*this);
|
||||
}
|
||||
|
||||
// Special constructor for a hard-coded problem
|
||||
/*
|
||||
*
|
||||
* LiKCl treating the PseudoBinary layer as passthrough.
|
||||
* -> test to predict the eutectic and liquidus correctly.
|
||||
*
|
||||
*/
|
||||
MixedSolventElectrolyte::MixedSolventElectrolyte(int testProb) :
|
||||
MolarityIonicVPSSTP(),
|
||||
numBinaryInteractions_(0),
|
||||
formMargules_(0),
|
||||
formTempModel_(0)
|
||||
{
|
||||
|
||||
|
||||
initThermoFile("LiKCl_liquid.xml", "");
|
||||
|
||||
|
||||
|
|
@ -201,39 +154,19 @@ MixedSolventElectrolyte::MixedSolventElectrolyte(int testProb) :
|
|||
m_pSpecies_A_ij[0] = iKCl;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* -------------- 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 MixedSolventElectrolyte class also returns
|
||||
* zero, as it is a non-complete class.
|
||||
*/
|
||||
int MixedSolventElectrolyte::eosType() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* ------------ Molar Thermodynamic Properties ----------------------
|
||||
*/
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* - Activities, Standard States, Activity Concentrations -----------
|
||||
*/
|
||||
//====================================================================================================================
|
||||
// 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.
|
||||
*/
|
||||
|
||||
void MixedSolventElectrolyte::getActivityCoefficients(doublereal* ac) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -248,13 +181,11 @@ void MixedSolventElectrolyte::getActivityCoefficients(doublereal* ac) const
|
|||
ac[k] = exp(lnActCoeff_Scaled_[k]);
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
/*
|
||||
* ------------ Partial Molar Properties of the Solution ------------
|
||||
*/
|
||||
|
||||
|
||||
|
||||
void MixedSolventElectrolyte::getElectrochemPotentials(doublereal* mu) const
|
||||
{
|
||||
getChemPotentials(mu);
|
||||
|
|
@ -264,7 +195,6 @@ void MixedSolventElectrolyte::getElectrochemPotentials(doublereal* mu) const
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void MixedSolventElectrolyte::getChemPotentials(doublereal* mu) const
|
||||
{
|
||||
doublereal xx;
|
||||
|
|
@ -289,7 +219,6 @@ void MixedSolventElectrolyte::getChemPotentials(doublereal* mu) const
|
|||
}
|
||||
}
|
||||
|
||||
/// Molar enthalpy. Units: J/kmol.
|
||||
doublereal MixedSolventElectrolyte::enthalpy_mole() const
|
||||
{
|
||||
size_t kk = nSpecies();
|
||||
|
|
@ -302,7 +231,6 @@ doublereal MixedSolventElectrolyte::enthalpy_mole() const
|
|||
return h;
|
||||
}
|
||||
|
||||
/// Molar entropy. Units: J/kmol.
|
||||
doublereal MixedSolventElectrolyte::entropy_mole() const
|
||||
{
|
||||
size_t kk = nSpecies();
|
||||
|
|
@ -315,7 +243,6 @@ doublereal MixedSolventElectrolyte::entropy_mole() const
|
|||
return s;
|
||||
}
|
||||
|
||||
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
doublereal MixedSolventElectrolyte::cp_mole() const
|
||||
{
|
||||
size_t kk = nSpecies();
|
||||
|
|
@ -328,26 +255,11 @@ doublereal MixedSolventElectrolyte::cp_mole() const
|
|||
return cp;
|
||||
}
|
||||
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
doublereal MixedSolventElectrolyte::cv_mole() const
|
||||
{
|
||||
return cp_mole() - GasConstant;
|
||||
}
|
||||
|
||||
// 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]
|
||||
*
|
||||
*/
|
||||
void MixedSolventElectrolyte::getPartialMolarEnthalpies(doublereal* hbar) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -374,20 +286,6 @@ void MixedSolventElectrolyte::getPartialMolarEnthalpies(doublereal* hbar) const
|
|||
}
|
||||
}
|
||||
|
||||
// Returns an array of partial molar heat capacities 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}
|
||||
* \f]
|
||||
*
|
||||
*/
|
||||
void MixedSolventElectrolyte::getPartialMolarCp(doublereal* cpbar) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -413,20 +311,6 @@ void MixedSolventElectrolyte::getPartialMolarCp(doublereal* cpbar) 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}
|
||||
* \f]
|
||||
*
|
||||
*/
|
||||
void MixedSolventElectrolyte::getPartialMolarEntropies(doublereal* sbar) const
|
||||
{
|
||||
double xx;
|
||||
|
|
@ -454,20 +338,6 @@ void MixedSolventElectrolyte::getPartialMolarEntropies(doublereal* sbar) const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ------------ Partial Molar Properties of the Solution ------------
|
||||
*/
|
||||
|
||||
// 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.
|
||||
*/
|
||||
void MixedSolventElectrolyte::getPartialMolarVolumes(doublereal* vbar) const
|
||||
{
|
||||
int delAK, delBK;
|
||||
|
|
@ -510,50 +380,18 @@ doublereal MixedSolventElectrolyte::err(const std::string& msg) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @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.
|
||||
*
|
||||
* @see importCTML.cpp
|
||||
*/
|
||||
void MixedSolventElectrolyte::initThermo()
|
||||
{
|
||||
initLengths();
|
||||
MolarityIonicVPSSTP::initThermo();
|
||||
}
|
||||
|
||||
|
||||
// Initialize lengths of local variables after all species have
|
||||
// been identified.
|
||||
void MixedSolventElectrolyte::initLengths()
|
||||
{
|
||||
m_kk = nSpecies();
|
||||
dlnActCoeffdlnN_.resize(m_kk, m_kk);
|
||||
}
|
||||
|
||||
/*
|
||||
* initThermoXML() (virtual from ThermoPhase)
|
||||
* 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 MixedSolventElectrolyte::initThermoXML(XML_Node& phaseNode, const std::string& id)
|
||||
{
|
||||
string subname = "MixedSolventElectrolyte::initThermoXML";
|
||||
|
|
@ -618,15 +456,7 @@ void MixedSolventElectrolyte::initThermoXML(XML_Node& phaseNode, const std::stri
|
|||
|
||||
|
||||
}
|
||||
//===================================================================================================================
|
||||
|
||||
// Update the activity coefficients
|
||||
/*
|
||||
* This function will be called to update the internally stored
|
||||
* natural logarithm of the activity coefficients
|
||||
*
|
||||
* he = X_A X_B(B + C X_B)
|
||||
*/
|
||||
void MixedSolventElectrolyte::s_update_lnActCoeff() const
|
||||
{
|
||||
int delAK, delBK;
|
||||
|
|
@ -653,14 +483,7 @@ void MixedSolventElectrolyte::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
|
||||
* natural logarithm of the activity coefficients
|
||||
*
|
||||
* he = X_A X_B(B + C X_B)
|
||||
*/
|
||||
|
||||
void MixedSolventElectrolyte::s_update_dlnActCoeff_dT() const
|
||||
{
|
||||
int delAK, delBK;
|
||||
|
|
@ -690,7 +513,7 @@ void MixedSolventElectrolyte::s_update_dlnActCoeff_dT() const
|
|||
}
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void MixedSolventElectrolyte::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const
|
||||
{
|
||||
s_update_dlnActCoeff_dT();
|
||||
|
|
@ -698,7 +521,7 @@ void MixedSolventElectrolyte::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const
|
|||
dlnActCoeffdT[k] = dlnActCoeffdT_Scaled_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void MixedSolventElectrolyte::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const
|
||||
{
|
||||
s_update_dlnActCoeff_dT();
|
||||
|
|
@ -706,19 +529,7 @@ void MixedSolventElectrolyte::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) co
|
|||
d2lnActCoeffdT2[k] = d2lnActCoeffdT2_Scaled_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
// 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.
|
||||
*/
|
||||
void MixedSolventElectrolyte::getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds,
|
||||
doublereal* dlnActCoeffds) const
|
||||
{
|
||||
|
|
@ -760,15 +571,7 @@ void MixedSolventElectrolyte::getdlnActCoeffds(const doublereal dTds, const dou
|
|||
}
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Update the derivative of the log of the activity coefficients wrt dlnN
|
||||
/*
|
||||
* This function will be called to update the internally stored gradients of the
|
||||
* logarithm of the activity coefficients. These are used in the determination
|
||||
* of the diffusion coefficients.
|
||||
*
|
||||
* he = X_A X_B(B + C X_B)
|
||||
*/
|
||||
|
||||
void MixedSolventElectrolyte::s_update_dlnActCoeff_dlnN_diag() const
|
||||
{
|
||||
int delAK, delBK;
|
||||
|
|
@ -824,14 +627,6 @@ void MixedSolventElectrolyte::s_update_dlnActCoeff_dlnN_diag() const
|
|||
}
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
// Update the derivative of the log of the activity coefficients wrt dlnN
|
||||
/*
|
||||
* This function will be called to update the internally stored gradients of the
|
||||
* logarithm of the activity coefficients. These are used in the determination
|
||||
* of the diffusion coefficients.
|
||||
*
|
||||
*/
|
||||
void MixedSolventElectrolyte::s_update_dlnActCoeff_dlnN() const
|
||||
{
|
||||
doublereal delAK, delBK;
|
||||
|
|
@ -897,7 +692,7 @@ void MixedSolventElectrolyte::s_update_dlnActCoeff_dlnN() const
|
|||
}
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void MixedSolventElectrolyte::s_update_dlnActCoeff_dlnX_diag() const
|
||||
{
|
||||
doublereal XA, XB, g0 , g1;
|
||||
|
|
@ -922,7 +717,7 @@ void MixedSolventElectrolyte::s_update_dlnActCoeff_dlnX_diag() const
|
|||
}
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
|
||||
void MixedSolventElectrolyte::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const
|
||||
{
|
||||
s_update_dlnActCoeff_dlnN_diag();
|
||||
|
|
@ -930,7 +725,7 @@ void MixedSolventElectrolyte::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdln
|
|||
dlnActCoeffdlnN_diag[k] = dlnActCoeffdlnN_diag_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void MixedSolventElectrolyte::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const
|
||||
{
|
||||
s_update_dlnActCoeff_dlnX_diag();
|
||||
|
|
@ -938,7 +733,7 @@ void MixedSolventElectrolyte::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdln
|
|||
dlnActCoeffdlnX_diag[k] = dlnActCoeffdlnX_diag_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void MixedSolventElectrolyte::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeffdlnN)
|
||||
{
|
||||
s_update_dlnActCoeff_dlnN();
|
||||
|
|
@ -949,7 +744,7 @@ void MixedSolventElectrolyte::getdlnActCoeffdlnN(const size_t ld, doublereal* dl
|
|||
}
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void MixedSolventElectrolyte::resizeNumInteractions(const size_t num)
|
||||
{
|
||||
numBinaryInteractions_ = num;
|
||||
|
|
@ -970,15 +765,7 @@ void MixedSolventElectrolyte::resizeNumInteractions(const size_t num)
|
|||
m_pSpecies_B_ij.resize(num, npos);
|
||||
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
/*
|
||||
* Process an XML node called "binaryNeutralSpeciesParameters"
|
||||
* This node contains all of the parameters necessary to describe
|
||||
* the Margules Interaction for a single binary interaction
|
||||
* This function reads the XML file and writes the coefficients
|
||||
* it finds to an internal data structures.
|
||||
*/
|
||||
void MixedSolventElectrolyte::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
||||
{
|
||||
string xname = xmLBinarySpecies.name();
|
||||
|
|
@ -1095,11 +882,7 @@ void MixedSolventElectrolyte::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
|||
m_VSE_b_ij[iSpot] = vParams[0];
|
||||
m_VSE_c_ij[iSpot] = vParams[1];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,16 +28,6 @@ using namespace std;
|
|||
namespace Cantera
|
||||
{
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
MolalityVPSSTP::MolalityVPSSTP() :
|
||||
VPStandardStateTP(),
|
||||
m_indexSolvent(0),
|
||||
|
|
@ -55,12 +45,6 @@ MolalityVPSSTP::MolalityVPSSTP() :
|
|||
m_chargeNeutralityNecessary = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy Constructor:
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working copy constructor
|
||||
*/
|
||||
MolalityVPSSTP::MolalityVPSSTP(const MolalityVPSSTP& b) :
|
||||
VPStandardStateTP(),
|
||||
m_indexSolvent(b.m_indexSolvent),
|
||||
|
|
@ -73,12 +57,6 @@ MolalityVPSSTP::MolalityVPSSTP(const MolalityVPSSTP& b) :
|
|||
*this = operator=(b);
|
||||
}
|
||||
|
||||
/*
|
||||
* operator=()
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working assignment operator
|
||||
*/
|
||||
MolalityVPSSTP& MolalityVPSSTP::
|
||||
operator=(const MolalityVPSSTP& b)
|
||||
{
|
||||
|
|
@ -95,21 +73,10 @@ operator=(const MolalityVPSSTP& b)
|
|||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* ~MolalityVPSSTP(): (virtual)
|
||||
*
|
||||
* Destructor: does nothing:
|
||||
*
|
||||
*/
|
||||
MolalityVPSSTP::~MolalityVPSSTP()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine duplicates the current object and returns
|
||||
* a pointer to ThermoPhase.
|
||||
*/
|
||||
ThermoPhase*
|
||||
MolalityVPSSTP::duplMyselfAsThermoPhase() const
|
||||
{
|
||||
|
|
@ -120,25 +87,11 @@ MolalityVPSSTP::duplMyselfAsThermoPhase() const
|
|||
* -------------- 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.
|
||||
*/
|
||||
int MolalityVPSSTP::eosType() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 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.
|
||||
*/
|
||||
void MolalityVPSSTP::setpHScale(const int pHscaleType)
|
||||
{
|
||||
m_pHScalingType = pHscaleType;
|
||||
|
|
@ -148,24 +101,11 @@ void MolalityVPSSTP::setpHScale(const int pHscaleType)
|
|||
}
|
||||
}
|
||||
|
||||
// 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.
|
||||
*/
|
||||
int MolalityVPSSTP::pHScale() const
|
||||
{
|
||||
return m_pHScalingType;
|
||||
}
|
||||
|
||||
/*
|
||||
* setSolvent():
|
||||
* Utilities for Solvent ID and Molality
|
||||
* Here we also calculate and store the molecular weight
|
||||
* of the solvent and the m_Mnaught parameter.
|
||||
* @param k index of the solvent.
|
||||
*/
|
||||
void MolalityVPSSTP::setSolvent(size_t k)
|
||||
{
|
||||
if (k >= m_kk) {
|
||||
|
|
@ -179,18 +119,11 @@ void MolalityVPSSTP::setSolvent(size_t k)
|
|||
m_Mnaught = m_weightSolvent / 1000.;
|
||||
}
|
||||
|
||||
/*
|
||||
* return the solvent id index number.
|
||||
*/
|
||||
size_t MolalityVPSSTP::solventIndex() const
|
||||
{
|
||||
return m_indexSolvent;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets the minimum mole fraction in the molality formulation. The
|
||||
* minimum mole fraction must be in the range 0 to 0.9.
|
||||
*/
|
||||
void MolalityVPSSTP::
|
||||
setMoleFSolventMin(doublereal xmolSolventMIN)
|
||||
{
|
||||
|
|
@ -202,29 +135,11 @@ setMoleFSolventMin(doublereal xmolSolventMIN)
|
|||
m_xmolSolventMIN = xmolSolventMIN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the minimum mole fraction in the molality formulation.
|
||||
*/
|
||||
doublereal MolalityVPSSTP::moleFSolventMin() const
|
||||
{
|
||||
return m_xmolSolventMIN;
|
||||
}
|
||||
|
||||
/*
|
||||
* calcMolalities():
|
||||
* We calculate the vector of molalities of the species
|
||||
* in the phase and store the result internally:
|
||||
* \f[
|
||||
* m_i = (n_i) / (1000 * M_o * n_{o,p})
|
||||
* \f]
|
||||
* where
|
||||
* - \f$ M_o \f$ is the molecular weight of the solvent
|
||||
* - \f$ n_o \f$ is the mole fraction of the solvent
|
||||
* - \f$ n_i \f$ is the mole fraction of the solute.
|
||||
* - \f$ n_{o,p} = max (n_{o, min}, n_o) \f$
|
||||
* - \f$ n_{o,min} \f$ = minimum mole fraction of solvent allowed
|
||||
* in the denominator.
|
||||
*/
|
||||
void MolalityVPSSTP::calcMolalities() const
|
||||
{
|
||||
getMoleFractions(DATA_PTR(m_molalities));
|
||||
|
|
@ -238,21 +153,6 @@ void MolalityVPSSTP::calcMolalities() const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* getMolalities():
|
||||
* We calculate the vector of molalities of the species
|
||||
* in the phase
|
||||
* \f[
|
||||
* m_i = (n_i) / (1000 * M_o * n_{o,p})
|
||||
* \f]
|
||||
* where
|
||||
* - \f$ M_o \f$ is the molecular weight of the solvent
|
||||
* - \f$ n_o \f$ is the mole fraction of the solvent
|
||||
* - \f$ n_i \f$ is the mole fraction of the solute.
|
||||
* - \f$ n_{o,p} = max (n_{o, min}, n_o) \f$
|
||||
* - \f$ n_{o,min} \f$ = minimum mole fraction of solvent allowed
|
||||
* in the denominator.
|
||||
*/
|
||||
void MolalityVPSSTP::getMolalities(doublereal* const molal) const
|
||||
{
|
||||
calcMolalities();
|
||||
|
|
@ -261,24 +161,8 @@ void MolalityVPSSTP::getMolalities(doublereal* const molal) const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* setMolalities():
|
||||
* 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.
|
||||
*
|
||||
* m_i = (n_i) / (W_o/1000 * n_o_p)
|
||||
*
|
||||
* where M_o is the molecular weight of the solvent
|
||||
* n_o is the mole fraction of the solvent
|
||||
* n_i is the mole fraction of the solute.
|
||||
* n_o_p = max (n_o_min, n_o)
|
||||
* n_o_min = minimum mole fraction of solvent allowed
|
||||
* in the denominator.
|
||||
*/
|
||||
void MolalityVPSSTP::setMolalities(const doublereal* const molal)
|
||||
{
|
||||
|
||||
double Lsum = 1.0 / m_Mnaught;
|
||||
for (size_t k = 1; k < m_kk; k++) {
|
||||
m_molalities[k] = molal[k];
|
||||
|
|
@ -306,16 +190,13 @@ void MolalityVPSSTP::setMolalities(const doublereal* const molal)
|
|||
calcMolalities();
|
||||
}
|
||||
|
||||
/*
|
||||
* setMolalitiesByName()
|
||||
*
|
||||
* This routine sets the molalities by name
|
||||
* HKM -> Might need to be more complicated here, setting
|
||||
* neutrals so that the existing mole fractions are
|
||||
* preserved.
|
||||
*/
|
||||
void MolalityVPSSTP::setMolalitiesByName(compositionMap& mMap)
|
||||
{
|
||||
/*
|
||||
* HKM -> Might need to be more complicated here, setting
|
||||
* neutrals so that the existing mole fractions are
|
||||
* preserved.
|
||||
*/
|
||||
size_t kk = nSpecies();
|
||||
doublereal x;
|
||||
/*
|
||||
|
|
@ -396,46 +277,16 @@ void MolalityVPSSTP::setMolalitiesByName(compositionMap& mMap)
|
|||
calcMolalities();
|
||||
}
|
||||
|
||||
/*
|
||||
* setMolalitiesByNames()
|
||||
*
|
||||
* Set the molalities of the solutes by name
|
||||
*/
|
||||
void MolalityVPSSTP::setMolalitiesByName(const std::string& x)
|
||||
{
|
||||
compositionMap xx = parseCompString(x, speciesNames());
|
||||
setMolalitiesByName(xx);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ------------ Molar Thermodynamic Properties ----------------------
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* - Activities, Standard States, Activity Concentrations -----------
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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).
|
||||
* (solvent is still on molar basis).
|
||||
* cAC_CONVENTION_MOLALITY 1
|
||||
*
|
||||
* We set the convention to molality here.
|
||||
*/
|
||||
int MolalityVPSSTP::activityConvention() const
|
||||
{
|
||||
return cAC_CONVENTION_MOLALITY;
|
||||
|
|
@ -463,19 +314,6 @@ void MolalityVPSSTP::getActivities(doublereal* ac) const
|
|||
err("getActivities");
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the array of non-dimensional activity coefficients at
|
||||
* the current solution temperature, pressure, and
|
||||
* solution concentration.
|
||||
* These are mole fraction based activity coefficients. In this
|
||||
* object, their calculation is based on translating the values
|
||||
* of Molality based activity coefficients.
|
||||
* See Denbigh p. 278 for a thorough discussion.
|
||||
*
|
||||
* Note, the solvent is treated differently. getMolalityActivityCoeff()
|
||||
* returns the molar based solvent activity coefficient already.
|
||||
* Therefore, we do not have to divide by x_s here.
|
||||
*/
|
||||
void MolalityVPSSTP::getActivityCoefficients(doublereal* ac) const
|
||||
{
|
||||
getMolalityActivityCoefficients(ac);
|
||||
|
|
@ -489,38 +327,12 @@ void MolalityVPSSTP::getActivityCoefficients(doublereal* ac) const
|
|||
}
|
||||
}
|
||||
|
||||
// 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.
|
||||
*
|
||||
* Note these activity coefficients have the current pH scale applied to them.
|
||||
*
|
||||
* @param acMolality Output vector containing the molality based activity coefficients.
|
||||
* length: m_kk.
|
||||
*/
|
||||
void MolalityVPSSTP::getMolalityActivityCoefficients(doublereal* acMolality) const
|
||||
{
|
||||
getUnscaledMolalityActivityCoefficients(acMolality);
|
||||
applyphScale(acMolality);
|
||||
}
|
||||
|
||||
/*
|
||||
* osmotic coefficient:
|
||||
*
|
||||
* Calculate the osmotic coefficient of the solvent. Note there
|
||||
* are lots of definitions of the osmotic coefficient floating
|
||||
* around. We use the one defined in the Pitzer's book:
|
||||
* (Activity Coeff in Electrolyte Solutions, K. S. Pitzer
|
||||
* CRC Press, Boca Raton, 1991, p. 85, Eqn. 28).
|
||||
*
|
||||
* Definition:
|
||||
* - sum(m_i) * Mnaught * oc = ln(activity_solvent)
|
||||
*/
|
||||
doublereal MolalityVPSSTP::osmoticCoefficient() const
|
||||
{
|
||||
/*
|
||||
|
|
@ -543,7 +355,6 @@ doublereal MolalityVPSSTP::osmoticCoefficient() const
|
|||
return oc;
|
||||
}
|
||||
|
||||
|
||||
void MolalityVPSSTP::getElectrochemPotentials(doublereal* mu) const
|
||||
{
|
||||
getChemPotentials(mu);
|
||||
|
|
@ -553,11 +364,6 @@ void MolalityVPSSTP::getElectrochemPotentials(doublereal* mu) const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ------------ Partial Molar Properties of the Solution ------------
|
||||
*/
|
||||
|
||||
|
||||
doublereal MolalityVPSSTP::err(const std::string& msg) const
|
||||
{
|
||||
throw CanteraError("MolalityVPSSTP","Base class method "
|
||||
|
|
@ -565,28 +371,6 @@ doublereal MolalityVPSSTP::err(const std::string& msg) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the units of the standard and general concentrations
|
||||
* Note they have the same units, as their divisor is
|
||||
* defined to be equal to the activity of the kth species
|
||||
* in the solution, which is unitless.
|
||||
*
|
||||
* This routine is used in print out applications where the
|
||||
* units are needed. Usually, MKS units are assumed throughout
|
||||
* the program and in the XML input files.
|
||||
*
|
||||
* On return uA contains the powers of the units (MKS assumed)
|
||||
* of the standard concentrations and generalized concentrations
|
||||
* for the kth species.
|
||||
*
|
||||
* uA[0] = kmol units - default = 1
|
||||
* uA[1] = m units - default = -nDim(), the number of spatial
|
||||
* dimensions in the Phase class.
|
||||
* uA[2] = kg units - default = 0;
|
||||
* uA[3] = Pa(pressure) units - default = 0;
|
||||
* uA[4] = Temperature units - default = 0;
|
||||
* uA[5] = time units - default = 0
|
||||
*/
|
||||
void MolalityVPSSTP::getUnitsStandardConc(double* uA, int k, int sizeUA) const
|
||||
{
|
||||
for (int i = 0; i < sizeUA; i++) {
|
||||
|
|
@ -617,9 +401,6 @@ void MolalityVPSSTP::setToEquilState(const doublereal* lambda_RT)
|
|||
err("setToEquilState");
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the thermodynamic state.
|
||||
*/
|
||||
void MolalityVPSSTP::setStateFromXML(const XML_Node& state)
|
||||
{
|
||||
VPStandardStateTP::setStateFromXML(state);
|
||||
|
|
@ -633,10 +414,6 @@ void MolalityVPSSTP::setStateFromXML(const XML_Node& state)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the temperature (K), pressure (Pa), and molalities
|
||||
* (gmol kg-1) of the solutes
|
||||
*/
|
||||
void MolalityVPSSTP::setState_TPM(doublereal t, doublereal p,
|
||||
const doublereal* const molalities)
|
||||
{
|
||||
|
|
@ -644,18 +421,12 @@ void MolalityVPSSTP::setState_TPM(doublereal t, doublereal p,
|
|||
setState_TP(t, p);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the temperature (K), pressure (Pa), and molalities.
|
||||
*/
|
||||
void MolalityVPSSTP::setState_TPM(doublereal t, doublereal p, compositionMap& m)
|
||||
{
|
||||
setMolalitiesByName(m);
|
||||
setState_TP(t, p);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the temperature (K), pressure (Pa), and molality.
|
||||
*/
|
||||
void MolalityVPSSTP::setState_TPM(doublereal t, doublereal p, const std::string& m)
|
||||
{
|
||||
setMolalitiesByName(m);
|
||||
|
|
@ -663,19 +434,6 @@ void MolalityVPSSTP::setState_TPM(doublereal t, doublereal p, const std::string&
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* @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.
|
||||
*
|
||||
* @see importCTML.cpp
|
||||
*/
|
||||
void MolalityVPSSTP::initThermo()
|
||||
{
|
||||
initLengths();
|
||||
|
|
@ -691,48 +449,16 @@ void MolalityVPSSTP::initThermo()
|
|||
m_indexCLM = findCLMIndex();
|
||||
}
|
||||
|
||||
// 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.
|
||||
*
|
||||
* @param acMolality Output vector containing the molality based activity coefficients.
|
||||
* length: m_kk.
|
||||
*/
|
||||
void MolalityVPSSTP::getUnscaledMolalityActivityCoefficients(doublereal* acMolality) const
|
||||
{
|
||||
err("getUnscaledMolalityActivityCoefficients");
|
||||
}
|
||||
|
||||
// Apply the current phScale to a set of activity Coefficients or activities
|
||||
/*
|
||||
* See the Eq3/6 Manual for a thorough discussion.
|
||||
*
|
||||
* @param acMolality input/Output vector containing the molality based
|
||||
* activity coefficients. length: m_kk.
|
||||
*/
|
||||
void MolalityVPSSTP::applyphScale(doublereal* acMolality) const
|
||||
{
|
||||
err("applyphScale");
|
||||
}
|
||||
|
||||
// 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 Cl- is. 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.
|
||||
*/
|
||||
size_t MolalityVPSSTP::findCLMIndex() const
|
||||
{
|
||||
size_t indexCLM = npos;
|
||||
|
|
@ -798,21 +524,6 @@ void MolalityVPSSTP::initLengths()
|
|||
m_molalities.resize(m_kk);
|
||||
}
|
||||
|
||||
/*
|
||||
* initThermoXML() (virtual from ThermoPhase)
|
||||
* 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 MolalityVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
|
||||
{
|
||||
|
||||
|
|
@ -830,8 +541,6 @@ void MolalityVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
|
|||
*/
|
||||
std::string MolalityVPSSTP::report(bool show_thermo) const
|
||||
{
|
||||
|
||||
|
||||
char p[800];
|
||||
string s = "";
|
||||
try {
|
||||
|
|
@ -947,9 +656,6 @@ std::string MolalityVPSSTP::report(bool show_thermo) const
|
|||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
* Format a summary of the mixture state for output.
|
||||
*/
|
||||
void MolalityVPSSTP::getCsvReportData(std::vector<std::string>& names,
|
||||
std::vector<vector_fp>& data) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,11 +27,7 @@ using namespace std;
|
|||
|
||||
namespace Cantera
|
||||
{
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* Default constructor.
|
||||
*
|
||||
*/
|
||||
|
||||
MolarityIonicVPSSTP::MolarityIonicVPSSTP() :
|
||||
GibbsExcessVPSSTP(),
|
||||
PBType_(PBTYPE_PASSTHROUGH),
|
||||
|
|
@ -43,15 +39,7 @@ MolarityIonicVPSSTP::MolarityIonicVPSSTP() :
|
|||
neutralPBindexStart(0)
|
||||
{
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
MolarityIonicVPSSTP::MolarityIonicVPSSTP(const std::string& inputFile,
|
||||
const std::string& id) :
|
||||
GibbsExcessVPSSTP(),
|
||||
|
|
@ -65,7 +53,7 @@ MolarityIonicVPSSTP::MolarityIonicVPSSTP(const std::string& inputFile,
|
|||
{
|
||||
initThermoFile(inputFile, id);
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
MolarityIonicVPSSTP::MolarityIonicVPSSTP(XML_Node& phaseRoot,
|
||||
const std::string& id) :
|
||||
GibbsExcessVPSSTP(),
|
||||
|
|
@ -79,13 +67,7 @@ MolarityIonicVPSSTP::MolarityIonicVPSSTP(XML_Node& phaseRoot,
|
|||
{
|
||||
importPhase(*findXMLPhase(&phaseRoot, id), this);
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* Copy Constructor:
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working copy constructor
|
||||
*/
|
||||
|
||||
MolarityIonicVPSSTP::MolarityIonicVPSSTP(const MolarityIonicVPSSTP& b) :
|
||||
GibbsExcessVPSSTP(),
|
||||
PBType_(PBTYPE_PASSTHROUGH),
|
||||
|
|
@ -98,13 +80,7 @@ MolarityIonicVPSSTP::MolarityIonicVPSSTP(const MolarityIonicVPSSTP& b) :
|
|||
{
|
||||
*this = operator=(b);
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* operator=()
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working assignment operator
|
||||
*/
|
||||
|
||||
MolarityIonicVPSSTP& MolarityIonicVPSSTP::
|
||||
operator=(const MolarityIonicVPSSTP& b)
|
||||
{
|
||||
|
|
@ -127,22 +103,11 @@ operator=(const MolarityIonicVPSSTP& b)
|
|||
|
||||
return *this;
|
||||
}
|
||||
//====================================================================================================================
|
||||
/**
|
||||
*
|
||||
* ~MolarityIonicVPSSTP(): (virtual)
|
||||
*
|
||||
* Destructor: does nothing:
|
||||
*
|
||||
*/
|
||||
|
||||
MolarityIonicVPSSTP::~MolarityIonicVPSSTP()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine duplicates the current object and returns
|
||||
* a pointer to ThermoPhase.
|
||||
*/
|
||||
ThermoPhase*
|
||||
MolarityIonicVPSSTP::duplMyselfAsThermoPhase() const
|
||||
{
|
||||
|
|
@ -152,30 +117,15 @@ MolarityIonicVPSSTP::duplMyselfAsThermoPhase() const
|
|||
/*
|
||||
* -------------- 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 MolarityIonicVPSSTP class also returns
|
||||
* zero, as it is a non-complete class.
|
||||
*/
|
||||
int MolarityIonicVPSSTP::eosType() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* ------------ Molar Thermodynamic Properties ----------------------
|
||||
*/
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* - Activities, Standard States, Activity Concentrations -----------
|
||||
*/
|
||||
//====================================================================================================================
|
||||
|
||||
void MolarityIonicVPSSTP::getLnActivityCoefficients(doublereal* lnac) const
|
||||
{
|
||||
|
|
@ -191,7 +141,7 @@ void MolarityIonicVPSSTP::getLnActivityCoefficients(doublereal* lnac) const
|
|||
lnac[k] = lnActCoeff_Scaled_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void MolarityIonicVPSSTP::getChemPotentials(doublereal* mu) const
|
||||
{
|
||||
doublereal xx;
|
||||
|
|
@ -215,7 +165,6 @@ void MolarityIonicVPSSTP::getChemPotentials(doublereal* mu) const
|
|||
mu[k] += RT * (log(xx) + lnActCoeff_Scaled_[k]);
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void MolarityIonicVPSSTP::getElectrochemPotentials(doublereal* mu) const
|
||||
{
|
||||
|
|
@ -226,21 +175,6 @@ void MolarityIonicVPSSTP::getElectrochemPotentials(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]
|
||||
*
|
||||
*/
|
||||
void MolarityIonicVPSSTP::getPartialMolarEnthalpies(doublereal* hbar) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -266,21 +200,7 @@ void MolarityIonicVPSSTP::getPartialMolarEnthalpies(doublereal* hbar) const
|
|||
hbar[k] -= RTT * dlnActCoeffdT_Scaled_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Returns an array of partial molar heat capacities 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}
|
||||
* \f]
|
||||
*
|
||||
*/
|
||||
|
||||
void MolarityIonicVPSSTP::getPartialMolarCp(doublereal* cpbar) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -305,21 +225,7 @@ void MolarityIonicVPSSTP::getPartialMolarCp(doublereal* cpbar) const
|
|||
cpbar[k] *= GasConstant;
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
// 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}
|
||||
* \f]
|
||||
*
|
||||
*/
|
||||
|
||||
void MolarityIonicVPSSTP::getPartialMolarEntropies(doublereal* sbar) const
|
||||
{
|
||||
double xx;
|
||||
|
|
@ -346,16 +252,7 @@ void MolarityIonicVPSSTP::getPartialMolarEntropies(doublereal* sbar) const
|
|||
sbar[k] *= GasConstant;
|
||||
}
|
||||
}
|
||||
// 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.
|
||||
*/
|
||||
|
||||
void MolarityIonicVPSSTP::getPartialMolarVolumes(doublereal* vbar) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -366,7 +263,7 @@ void MolarityIonicVPSSTP::getPartialMolarVolumes(doublereal* vbar) const
|
|||
vbar[iK] += 0.0;
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void MolarityIonicVPSSTP::calcPseudoBinaryMoleFractions() const
|
||||
{
|
||||
size_t k;
|
||||
|
|
@ -447,65 +344,36 @@ void MolarityIonicVPSSTP::calcPseudoBinaryMoleFractions() const
|
|||
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
// Update the activity coefficients
|
||||
/*
|
||||
* This function will be called to update the internally stored
|
||||
* natural logarithm of the activity coefficients
|
||||
*
|
||||
*/
|
||||
void MolarityIonicVPSSTP::s_update_lnActCoeff() const
|
||||
{
|
||||
for (size_t k = 0; k < m_kk; k++) {
|
||||
lnActCoeff_Scaled_[k] = 0.0;
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void MolarityIonicVPSSTP::s_update_dlnActCoeff_dT() const
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
//====================================================================================================================
|
||||
// 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 is the natural way to handle concentration derivatives in this routine.
|
||||
*/
|
||||
|
||||
void MolarityIonicVPSSTP::s_update_dlnActCoeff_dX_() const
|
||||
{
|
||||
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
/*
|
||||
* ------------ Partial Molar Properties of the Solution ------------
|
||||
*/
|
||||
//====================================================================================================================
|
||||
|
||||
doublereal MolarityIonicVPSSTP::err(const std::string& msg) const
|
||||
{
|
||||
throw CanteraError("MolarityIonicVPSSTP","Base class method "
|
||||
+msg+" called. Equation of state type: "+int2str(eosType()));
|
||||
return 0;
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* @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.
|
||||
*
|
||||
* @see importCTML.cpp
|
||||
*/
|
||||
|
||||
void MolarityIonicVPSSTP::initThermo()
|
||||
{
|
||||
GibbsExcessVPSSTP::initThermo();
|
||||
|
|
@ -543,29 +411,13 @@ void MolarityIonicVPSSTP::initThermo()
|
|||
PBType_ = PBTYPE_PASSTHROUGH;
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Initialize lengths of local variables after all species have been identified.
|
||||
|
||||
void MolarityIonicVPSSTP::initLengths()
|
||||
{
|
||||
m_kk = nSpecies();
|
||||
moleFractionsTmp_.resize(m_kk);
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* initThermoXML() (virtual from ThermoPhase)
|
||||
* 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 MolarityIonicVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
|
||||
{
|
||||
std::string subname = "MolarityIonicVPSSTP::initThermoXML";
|
||||
|
|
@ -628,22 +480,13 @@ void MolarityIonicVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string&
|
|||
*/
|
||||
GibbsExcessVPSSTP::initThermoXML(phaseNode, id);
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Process an XML node called "binaryNeutralSpeciesParameters"
|
||||
/*
|
||||
* This node contains all of the parameters necessary to describe
|
||||
* a single binary interaction. This function reads the XML file and writes the coefficients
|
||||
* it finds to an internal data structures.
|
||||
*/
|
||||
|
||||
void MolarityIonicVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
||||
{
|
||||
std::string xname = xmLBinarySpecies.name();
|
||||
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* Format a summary of the mixture state for output.
|
||||
*/
|
||||
|
||||
std::string MolarityIonicVPSSTP::report(bool show_thermo) const
|
||||
{
|
||||
char p[800];
|
||||
|
|
@ -718,6 +561,5 @@ std::string MolarityIonicVPSSTP::report(bool show_thermo) const
|
|||
}
|
||||
return s;
|
||||
}
|
||||
//====================================================================================================================
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
/**
|
||||
* @file
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (2009) Sandia Corporation. Under the terms of
|
||||
|
|
@ -19,13 +18,6 @@ using namespace std;
|
|||
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* Default constructor.
|
||||
*
|
||||
* HKM - Checked for Transition
|
||||
*/
|
||||
PhaseCombo_Interaction::PhaseCombo_Interaction() :
|
||||
GibbsExcessVPSSTP(),
|
||||
numBinaryInteractions_(0),
|
||||
|
|
@ -33,17 +25,7 @@ PhaseCombo_Interaction::PhaseCombo_Interaction() :
|
|||
formTempModel_(0)
|
||||
{
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* HKM - Checked for Transition
|
||||
*/
|
||||
|
||||
PhaseCombo_Interaction::PhaseCombo_Interaction(const std::string& inputFile,
|
||||
const std::string& id) :
|
||||
GibbsExcessVPSSTP(),
|
||||
|
|
@ -53,12 +35,7 @@ PhaseCombo_Interaction::PhaseCombo_Interaction(const std::string& inputFile,
|
|||
{
|
||||
initThermoFile(inputFile, id);
|
||||
}
|
||||
//====================================================================================================================
|
||||
//
|
||||
/*
|
||||
*
|
||||
* HKM - Checked for Transition
|
||||
*/
|
||||
|
||||
PhaseCombo_Interaction::PhaseCombo_Interaction(XML_Node& phaseRoot,
|
||||
const std::string& id) :
|
||||
GibbsExcessVPSSTP(),
|
||||
|
|
@ -69,29 +46,12 @@ PhaseCombo_Interaction::PhaseCombo_Interaction(XML_Node& phaseRoot,
|
|||
importPhase(*findXMLPhase(&phaseRoot, id), this);
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* Copy Constructor:
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working copy constructor
|
||||
*
|
||||
* HKM - Checked for Transition
|
||||
*/
|
||||
PhaseCombo_Interaction::PhaseCombo_Interaction(const PhaseCombo_Interaction& b) :
|
||||
GibbsExcessVPSSTP()
|
||||
{
|
||||
PhaseCombo_Interaction::operator=(b);
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* operator=()
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working assignment operator
|
||||
*
|
||||
* HKM - Checked for Transition
|
||||
*/
|
||||
|
||||
PhaseCombo_Interaction& PhaseCombo_Interaction::
|
||||
operator=(const PhaseCombo_Interaction& b)
|
||||
{
|
||||
|
|
@ -121,37 +81,17 @@ operator=(const PhaseCombo_Interaction& b)
|
|||
|
||||
return *this;
|
||||
}
|
||||
//====================================================================================================================
|
||||
/**
|
||||
*
|
||||
* ~PhaseCombo_Interaction(): (virtual)
|
||||
*
|
||||
* Destructor: does nothing:
|
||||
*
|
||||
* HKM - Checked for Transition
|
||||
*/
|
||||
|
||||
PhaseCombo_Interaction::~PhaseCombo_Interaction()
|
||||
{
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* This routine duplicates the current object and returnsa pointer to ThermoPhase.
|
||||
*
|
||||
* HKM - Checked for Transition
|
||||
*/
|
||||
|
||||
ThermoPhase*
|
||||
PhaseCombo_Interaction::duplMyselfAsThermoPhase() const
|
||||
{
|
||||
return new PhaseCombo_Interaction(*this);
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Special constructor for a hard-coded problem
|
||||
/*
|
||||
*
|
||||
* LiKCl treating the PseudoBinary layer as passthrough.
|
||||
* -> test to predict the eutectic and liquidus correctly.
|
||||
*
|
||||
*/
|
||||
|
||||
PhaseCombo_Interaction::PhaseCombo_Interaction(int testProb) :
|
||||
GibbsExcessVPSSTP(),
|
||||
numBinaryInteractions_(0),
|
||||
|
|
@ -211,40 +151,20 @@ PhaseCombo_Interaction::PhaseCombo_Interaction(int testProb) :
|
|||
m_pSpecies_B_ij[0] = iLi2;
|
||||
throw CanteraError("", "unimplemented");
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
/*
|
||||
* -------------- 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 PhaseCombo_Interaction class also returns
|
||||
* zero, as it is a non-complete class.
|
||||
*/
|
||||
int PhaseCombo_Interaction::eosType() const
|
||||
{
|
||||
return cPhaseCombo_Interaction;
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* ------------ Molar Thermodynamic Properties ----------------------
|
||||
*/
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* - Activities, Standard States, Activity Concentrations -----------
|
||||
*/
|
||||
//====================================================================================================================
|
||||
// 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.
|
||||
*/
|
||||
|
||||
void PhaseCombo_Interaction::getActivityCoefficients(doublereal* ac) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -264,8 +184,6 @@ void PhaseCombo_Interaction::getActivityCoefficients(doublereal* ac) const
|
|||
* ------------ Partial Molar Properties of the Solution ------------
|
||||
*/
|
||||
|
||||
//====================================================================================================================
|
||||
|
||||
void PhaseCombo_Interaction::getElectrochemPotentials(doublereal* mu) const
|
||||
{
|
||||
getChemPotentials(mu);
|
||||
|
|
@ -275,7 +193,6 @@ void PhaseCombo_Interaction::getElectrochemPotentials(doublereal* mu) const
|
|||
}
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
void PhaseCombo_Interaction::getChemPotentials(doublereal* mu) const
|
||||
{
|
||||
doublereal xx;
|
||||
|
|
@ -299,8 +216,7 @@ void PhaseCombo_Interaction::getChemPotentials(doublereal* mu) const
|
|||
mu[k] += RT * (log(xx) + lnActCoeff_Scaled_[k]);
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Molar enthalpy. Units: J/kmol.
|
||||
|
||||
doublereal PhaseCombo_Interaction::enthalpy_mole() const
|
||||
{
|
||||
size_t kk = nSpecies();
|
||||
|
|
@ -312,8 +228,7 @@ doublereal PhaseCombo_Interaction::enthalpy_mole() const
|
|||
}
|
||||
return h;
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Molar entropy. Units: J/kmol.
|
||||
|
||||
doublereal PhaseCombo_Interaction::entropy_mole() const
|
||||
{
|
||||
size_t kk = nSpecies();
|
||||
|
|
@ -325,8 +240,7 @@ doublereal PhaseCombo_Interaction::entropy_mole() const
|
|||
}
|
||||
return s;
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
|
||||
doublereal PhaseCombo_Interaction::cp_mole() const
|
||||
{
|
||||
size_t kk = nSpecies();
|
||||
|
|
@ -338,27 +252,12 @@ doublereal PhaseCombo_Interaction::cp_mole() const
|
|||
}
|
||||
return cp;
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
|
||||
doublereal PhaseCombo_Interaction::cv_mole() const
|
||||
{
|
||||
return cp_mole() - GasConstant;
|
||||
}
|
||||
//====================================================================================================================
|
||||
// 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]
|
||||
*
|
||||
*/
|
||||
|
||||
void PhaseCombo_Interaction::getPartialMolarEnthalpies(doublereal* hbar) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -384,20 +283,7 @@ void PhaseCombo_Interaction::getPartialMolarEnthalpies(doublereal* hbar) const
|
|||
hbar[k] -= RTT * dlnActCoeffdT_Scaled_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Returns an array of partial molar heat capacities 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}
|
||||
* \f]
|
||||
*
|
||||
*/
|
||||
|
||||
void PhaseCombo_Interaction::getPartialMolarCp(doublereal* cpbar) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -422,21 +308,7 @@ void PhaseCombo_Interaction::getPartialMolarCp(doublereal* cpbar) const
|
|||
cpbar[k] *= GasConstant;
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
// 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}
|
||||
* \f]
|
||||
*
|
||||
*/
|
||||
|
||||
void PhaseCombo_Interaction::getPartialMolarEntropies(doublereal* sbar) const
|
||||
{
|
||||
double xx;
|
||||
|
|
@ -463,20 +335,7 @@ void PhaseCombo_Interaction::getPartialMolarEntropies(doublereal* sbar) const
|
|||
sbar[k] *= GasConstant;
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* ------------ Partial Molar Properties of the Solution ------------
|
||||
*/
|
||||
|
||||
// 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.
|
||||
*/
|
||||
void PhaseCombo_Interaction::getPartialMolarVolumes(doublereal* vbar) const
|
||||
{
|
||||
int delAK, delBK;
|
||||
|
|
@ -512,7 +371,7 @@ void PhaseCombo_Interaction::getPartialMolarVolumes(doublereal* vbar) const
|
|||
}
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
doublereal PhaseCombo_Interaction::err(const std::string& msg) const
|
||||
{
|
||||
throw CanteraError("PhaseCombo_Interaction","Base class method "
|
||||
|
|
@ -520,50 +379,18 @@ doublereal PhaseCombo_Interaction::err(const std::string& msg) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* @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.
|
||||
*
|
||||
* @see importCTML.cpp
|
||||
*/
|
||||
void PhaseCombo_Interaction::initThermo()
|
||||
{
|
||||
initLengths();
|
||||
GibbsExcessVPSSTP::initThermo();
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
// Initialize lengths of local variables after all species have
|
||||
// been identified.
|
||||
void PhaseCombo_Interaction::initLengths()
|
||||
{
|
||||
m_kk = nSpecies();
|
||||
dlnActCoeffdlnN_.resize(m_kk, m_kk);
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* initThermoXML() (virtual from ThermoPhase)
|
||||
* 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 PhaseCombo_Interaction::initThermoXML(XML_Node& phaseNode, const std::string& id)
|
||||
{
|
||||
string subname = "PhaseCombo_Interaction::initThermoXML";
|
||||
|
|
@ -630,16 +457,7 @@ void PhaseCombo_Interaction::initThermoXML(XML_Node& phaseNode, const std::strin
|
|||
|
||||
|
||||
}
|
||||
//===================================================================================================================
|
||||
// Update the activity coefficients
|
||||
/*
|
||||
* This function will be called to update the internally stored
|
||||
* natural logarithm of the activity coefficients
|
||||
*
|
||||
* he = X_A X_B(B + C X_B)
|
||||
*
|
||||
* HKM - Checked for Transition
|
||||
*/
|
||||
|
||||
void PhaseCombo_Interaction::s_update_lnActCoeff() const
|
||||
{
|
||||
int delAK, delBK;
|
||||
|
|
@ -680,16 +498,7 @@ void PhaseCombo_Interaction::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
|
||||
* natural logarithm of the activity coefficients
|
||||
*
|
||||
* he = X_A X_B(B + C X_B)
|
||||
*
|
||||
* HKM - Checked for Transition
|
||||
*/
|
||||
|
||||
void PhaseCombo_Interaction::s_update_dlnActCoeff_dT() const
|
||||
{
|
||||
int delAK, delBK;
|
||||
|
|
@ -719,11 +528,7 @@ void PhaseCombo_Interaction::s_update_dlnActCoeff_dT() const
|
|||
}
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
//
|
||||
/*
|
||||
* HKM - Checked for Transition
|
||||
*/
|
||||
|
||||
void PhaseCombo_Interaction::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const
|
||||
{
|
||||
s_update_dlnActCoeff_dT();
|
||||
|
|
@ -731,11 +536,7 @@ void PhaseCombo_Interaction::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const
|
|||
dlnActCoeffdT[k] = dlnActCoeffdT_Scaled_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
//
|
||||
/*
|
||||
* HKM - Checked for Transition
|
||||
*/
|
||||
|
||||
void PhaseCombo_Interaction::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const
|
||||
{
|
||||
s_update_dlnActCoeff_dT();
|
||||
|
|
@ -743,21 +544,7 @@ void PhaseCombo_Interaction::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) con
|
|||
d2lnActCoeffdT2[k] = d2lnActCoeffdT2_Scaled_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
// 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.
|
||||
*
|
||||
* HKM - Checked for Transition
|
||||
*/
|
||||
void PhaseCombo_Interaction::getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds,
|
||||
doublereal* dlnActCoeffds) const
|
||||
{
|
||||
|
|
@ -809,19 +596,7 @@ void PhaseCombo_Interaction::getdlnActCoeffds(const doublereal dTds, const doub
|
|||
}
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Update the derivative of the log of the activity coefficients wrt the log of the corresponding species number density
|
||||
/*
|
||||
* This function will be called to update the internally stored gradients of the
|
||||
* logarithm of the activity coefficients. These are used in the determination
|
||||
* of the diffusion coefficients.
|
||||
*
|
||||
* he = X_A X_B(B + C X_B)
|
||||
*
|
||||
* This function only carries out the diagonal calculation
|
||||
*
|
||||
* HKM - Checked for Transition
|
||||
*/
|
||||
|
||||
void PhaseCombo_Interaction::s_update_dlnActCoeff_dlnN_diag() const
|
||||
{
|
||||
int delAK, delBK;
|
||||
|
|
@ -872,15 +647,7 @@ void PhaseCombo_Interaction::s_update_dlnActCoeff_dlnN_diag() const
|
|||
}
|
||||
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Update the derivative of the log of the activity coefficients wrt ln N_k
|
||||
/*
|
||||
* This function will be called to update the internally stored gradients of the
|
||||
* logarithm of the activity coefficients. These are used in the determination
|
||||
* of the diffusion coefficients.
|
||||
*
|
||||
* HKM - Checked for Transition
|
||||
*/
|
||||
|
||||
void PhaseCombo_Interaction::s_update_dlnActCoeff_dlnN() const
|
||||
{
|
||||
doublereal delAK, delBK;
|
||||
|
|
@ -947,7 +714,7 @@ void PhaseCombo_Interaction::s_update_dlnActCoeff_dlnN() const
|
|||
}
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void PhaseCombo_Interaction::s_update_dlnActCoeff_dlnX_diag() const
|
||||
{
|
||||
doublereal XA, XB, g0 , g1;
|
||||
|
|
@ -972,11 +739,6 @@ void PhaseCombo_Interaction::s_update_dlnActCoeff_dlnX_diag() const
|
|||
throw CanteraError("", "unimplemented");
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
//
|
||||
/*
|
||||
* HKM - Checked for Transition
|
||||
*/
|
||||
void PhaseCombo_Interaction::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const
|
||||
{
|
||||
s_update_dlnActCoeff_dlnN_diag();
|
||||
|
|
@ -984,11 +746,7 @@ void PhaseCombo_Interaction::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN
|
|||
dlnActCoeffdlnN_diag[k] = dlnActCoeffdlnN_diag_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
//
|
||||
/*
|
||||
* HKM - Checked for Transition
|
||||
*/
|
||||
|
||||
void PhaseCombo_Interaction::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const
|
||||
{
|
||||
s_update_dlnActCoeff_dlnX_diag();
|
||||
|
|
@ -996,11 +754,7 @@ void PhaseCombo_Interaction::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX
|
|||
dlnActCoeffdlnX_diag[k] = dlnActCoeffdlnX_diag_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
//
|
||||
/*
|
||||
* HKM - Checked for Transition
|
||||
*/
|
||||
|
||||
void PhaseCombo_Interaction::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeffdlnN)
|
||||
{
|
||||
s_update_dlnActCoeff_dlnN();
|
||||
|
|
@ -1011,11 +765,7 @@ void PhaseCombo_Interaction::getdlnActCoeffdlnN(const size_t ld, doublereal* dln
|
|||
}
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
//
|
||||
/*
|
||||
* HKM - Checked for Transition
|
||||
*/
|
||||
|
||||
void PhaseCombo_Interaction::resizeNumInteractions(const size_t num)
|
||||
{
|
||||
numBinaryInteractions_ = num;
|
||||
|
|
@ -1035,15 +785,7 @@ void PhaseCombo_Interaction::resizeNumInteractions(const size_t num)
|
|||
m_pSpecies_A_ij.resize(num, npos);
|
||||
m_pSpecies_B_ij.resize(num, npos);
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
/*
|
||||
* Process an XML node called "binaryNeutralSpeciesParameters"
|
||||
* This node contains all of the parameters necessary to describe
|
||||
* the Margules Interaction for a single binary interaction
|
||||
* This function reads the XML file and writes the coefficients
|
||||
* it finds to an internal data structures.
|
||||
*/
|
||||
void PhaseCombo_Interaction::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
||||
{
|
||||
string xname = xmLBinarySpecies.name();
|
||||
|
|
@ -1160,10 +902,7 @@ void PhaseCombo_Interaction::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
|||
m_VSE_b_ij[iSpot] = vParams[0];
|
||||
m_VSE_c_ij[iSpot] = vParams[1];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
}
|
||||
//======================================================================================================================
|
||||
|
|
|
|||
|
|
@ -26,11 +26,6 @@ using namespace std;
|
|||
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
/*
|
||||
* Default constructor.
|
||||
*
|
||||
*/
|
||||
PseudoBinaryVPSSTP::PseudoBinaryVPSSTP() :
|
||||
GibbsExcessVPSSTP(),
|
||||
PBType_(PBTYPE_PASSTHROUGH),
|
||||
|
|
@ -45,12 +40,6 @@ PseudoBinaryVPSSTP::PseudoBinaryVPSSTP() :
|
|||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy Constructor:
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working copy constructor
|
||||
*/
|
||||
PseudoBinaryVPSSTP::PseudoBinaryVPSSTP(const PseudoBinaryVPSSTP& b) :
|
||||
GibbsExcessVPSSTP(),
|
||||
PBType_(PBTYPE_PASSTHROUGH),
|
||||
|
|
@ -66,12 +55,6 @@ PseudoBinaryVPSSTP::PseudoBinaryVPSSTP(const PseudoBinaryVPSSTP& b) :
|
|||
*this = operator=(b);
|
||||
}
|
||||
|
||||
/*
|
||||
* operator=()
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working assignment operator
|
||||
*/
|
||||
PseudoBinaryVPSSTP& PseudoBinaryVPSSTP::
|
||||
operator=(const PseudoBinaryVPSSTP& b)
|
||||
{
|
||||
|
|
@ -97,57 +80,21 @@ operator=(const PseudoBinaryVPSSTP& b)
|
|||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* ~PseudoBinaryVPSSTP(): (virtual)
|
||||
*
|
||||
* Destructor: does nothing:
|
||||
*
|
||||
*/
|
||||
PseudoBinaryVPSSTP::~PseudoBinaryVPSSTP()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine duplicates the current object and returns
|
||||
* a pointer to ThermoPhase.
|
||||
*/
|
||||
ThermoPhase*
|
||||
PseudoBinaryVPSSTP::duplMyselfAsThermoPhase() const
|
||||
{
|
||||
return new PseudoBinaryVPSSTP(*this);
|
||||
}
|
||||
|
||||
/*
|
||||
* -------------- 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 PseudoBinaryVPSSTP class also returns
|
||||
* zero, as it is a non-complete class.
|
||||
*/
|
||||
int PseudoBinaryVPSSTP::eosType() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ------------ Molar Thermodynamic Properties ----------------------
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* - Activities, Standard States, Activity Concentrations -----------
|
||||
*/
|
||||
|
||||
|
||||
doublereal PseudoBinaryVPSSTP::standardConcentration(size_t k) const
|
||||
{
|
||||
err("standardConcentration");
|
||||
|
|
@ -160,8 +107,6 @@ doublereal PseudoBinaryVPSSTP::logStandardConc(size_t k) const
|
|||
return -1.0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PseudoBinaryVPSSTP::getElectrochemPotentials(doublereal* mu) const
|
||||
{
|
||||
getChemPotentials(mu);
|
||||
|
|
@ -231,11 +176,6 @@ void PseudoBinaryVPSSTP::calcPseudoBinaryMoleFractions() const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ------------ Partial Molar Properties of the Solution ------------
|
||||
*/
|
||||
|
||||
|
||||
doublereal PseudoBinaryVPSSTP::err(const std::string& msg) const
|
||||
{
|
||||
throw CanteraError("PseudoBinaryVPSSTP","Base class method "
|
||||
|
|
@ -243,64 +183,25 @@ doublereal PseudoBinaryVPSSTP::err(const std::string& msg) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @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.
|
||||
*
|
||||
* @see importCTML.cpp
|
||||
*/
|
||||
void PseudoBinaryVPSSTP::initThermo()
|
||||
{
|
||||
initLengths();
|
||||
GibbsExcessVPSSTP::initThermo();
|
||||
}
|
||||
|
||||
|
||||
// Initialize lengths of local variables after all species have
|
||||
// been identified.
|
||||
void PseudoBinaryVPSSTP::initLengths()
|
||||
{
|
||||
m_kk = nSpecies();
|
||||
moleFractions_.resize(m_kk);
|
||||
}
|
||||
|
||||
/*
|
||||
* initThermoXML() (virtual from ThermoPhase)
|
||||
* 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 PseudoBinaryVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
|
||||
{
|
||||
|
||||
|
||||
GibbsExcessVPSSTP::initThermoXML(phaseNode, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a summary of the mixture state for output.
|
||||
*/
|
||||
std::string PseudoBinaryVPSSTP::report(bool show_thermo) const
|
||||
{
|
||||
|
||||
|
||||
char p[800];
|
||||
string s = "";
|
||||
try {
|
||||
|
|
@ -374,6 +275,4 @@ std::string PseudoBinaryVPSSTP::report(bool show_thermo) const
|
|||
return s;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,12 +23,6 @@ using namespace std;
|
|||
|
||||
namespace Cantera
|
||||
{
|
||||
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* Default constructor.
|
||||
*
|
||||
*/
|
||||
RedlichKisterVPSSTP::RedlichKisterVPSSTP() :
|
||||
GibbsExcessVPSSTP(),
|
||||
numBinaryInteractions_(0),
|
||||
|
|
@ -42,16 +36,7 @@ RedlichKisterVPSSTP::RedlichKisterVPSSTP() :
|
|||
dlnActCoeff_dX_()
|
||||
{
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* 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.
|
||||
|
||||
*/
|
||||
RedlichKisterVPSSTP::RedlichKisterVPSSTP(const std::string& inputFile,
|
||||
const std::string& id) :
|
||||
GibbsExcessVPSSTP(),
|
||||
|
|
@ -67,7 +52,7 @@ RedlichKisterVPSSTP::RedlichKisterVPSSTP(const std::string& inputFile,
|
|||
{
|
||||
initThermoFile(inputFile, id);
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
RedlichKisterVPSSTP::RedlichKisterVPSSTP(XML_Node& phaseRoot,
|
||||
const std::string& id) :
|
||||
GibbsExcessVPSSTP(),
|
||||
|
|
@ -83,14 +68,7 @@ RedlichKisterVPSSTP::RedlichKisterVPSSTP(XML_Node& phaseRoot,
|
|||
{
|
||||
importPhase(*findXMLPhase(&phaseRoot, id), this);
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Special constructor for a hard-coded problem
|
||||
/*
|
||||
*
|
||||
* LiKCl treating the PseudoBinary layer as passthrough.
|
||||
* -> test to predict the eutectic and liquidus correctly.
|
||||
*
|
||||
*/
|
||||
|
||||
RedlichKisterVPSSTP::RedlichKisterVPSSTP(int testProb) :
|
||||
GibbsExcessVPSSTP(),
|
||||
numBinaryInteractions_(0),
|
||||
|
|
@ -136,16 +114,8 @@ RedlichKisterVPSSTP::RedlichKisterVPSSTP(int testProb) :
|
|||
"Unable to find VLi");
|
||||
}
|
||||
m_pSpecies_B_ij[0] = iVLi;
|
||||
|
||||
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* Copy Constructor:
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working copy constructor
|
||||
*/
|
||||
|
||||
RedlichKisterVPSSTP::RedlichKisterVPSSTP(const RedlichKisterVPSSTP& b) :
|
||||
GibbsExcessVPSSTP(),
|
||||
numBinaryInteractions_(0),
|
||||
|
|
@ -160,13 +130,7 @@ RedlichKisterVPSSTP::RedlichKisterVPSSTP(const RedlichKisterVPSSTP& b) :
|
|||
{
|
||||
RedlichKisterVPSSTP::operator=(b);
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* operator=()
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working assignment operator
|
||||
*/
|
||||
|
||||
RedlichKisterVPSSTP& RedlichKisterVPSSTP::
|
||||
operator=(const RedlichKisterVPSSTP& b)
|
||||
{
|
||||
|
|
@ -188,51 +152,25 @@ operator=(const RedlichKisterVPSSTP& b)
|
|||
|
||||
return *this;
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
*
|
||||
* ~RedlichKisterVPSSTP(): (virtual)
|
||||
*
|
||||
* Destructor: does nothing:
|
||||
*
|
||||
*/
|
||||
|
||||
RedlichKisterVPSSTP::~RedlichKisterVPSSTP()
|
||||
{
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* This routine duplicates the current object and returns
|
||||
* a pointer to ThermoPhase.
|
||||
*/
|
||||
|
||||
ThermoPhase*
|
||||
RedlichKisterVPSSTP::duplMyselfAsThermoPhase() const
|
||||
{
|
||||
return new RedlichKisterVPSSTP(*this);
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
// 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 RedlichKisterVPSSTP class also returns
|
||||
* zero, as it is a non-complete class.
|
||||
*/
|
||||
int RedlichKisterVPSSTP::eosType() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* ------------ Molar Thermodynamic Properties ----------------------
|
||||
*/
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* - Activities, Standard States, Activity Concentrations -----------
|
||||
*/
|
||||
//====================================================================================================================
|
||||
|
||||
void RedlichKisterVPSSTP::getLnActivityCoefficients(doublereal* lnac) const
|
||||
{
|
||||
|
|
@ -248,11 +186,11 @@ void RedlichKisterVPSSTP::getLnActivityCoefficients(doublereal* lnac) const
|
|||
lnac[k] = lnActCoeff_Scaled_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
/*
|
||||
* ------------ Partial Molar Properties of the Solution ------------
|
||||
*/
|
||||
//====================================================================================================================
|
||||
|
||||
void RedlichKisterVPSSTP::getElectrochemPotentials(doublereal* mu) const
|
||||
{
|
||||
getChemPotentials(mu);
|
||||
|
|
@ -261,7 +199,7 @@ void RedlichKisterVPSSTP::getElectrochemPotentials(doublereal* mu) const
|
|||
mu[k] += ve*charge(k);
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void RedlichKisterVPSSTP::getChemPotentials(doublereal* mu) const
|
||||
{
|
||||
doublereal xx;
|
||||
|
|
@ -285,8 +223,7 @@ void RedlichKisterVPSSTP::getChemPotentials(doublereal* mu) const
|
|||
mu[k] += RT * (log(xx) + lnActCoeff_Scaled_[k]);
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
//Molar enthalpy. Units: J/kmol.
|
||||
|
||||
doublereal RedlichKisterVPSSTP::enthalpy_mole() const
|
||||
{
|
||||
size_t kk = nSpecies();
|
||||
|
|
@ -298,8 +235,7 @@ doublereal RedlichKisterVPSSTP::enthalpy_mole() const
|
|||
}
|
||||
return h;
|
||||
}
|
||||
//====================================================================================================================
|
||||
/// Molar entropy. Units: J/kmol.
|
||||
|
||||
doublereal RedlichKisterVPSSTP::entropy_mole() const
|
||||
{
|
||||
size_t kk = nSpecies();
|
||||
|
|
@ -311,8 +247,7 @@ doublereal RedlichKisterVPSSTP::entropy_mole() const
|
|||
}
|
||||
return s;
|
||||
}
|
||||
//====================================================================================================================
|
||||
/// Molar heat capacity at constant pressure. Units: J/kmol/K.
|
||||
|
||||
doublereal RedlichKisterVPSSTP::cp_mole() const
|
||||
{
|
||||
size_t kk = nSpecies();
|
||||
|
|
@ -324,27 +259,12 @@ doublereal RedlichKisterVPSSTP::cp_mole() const
|
|||
}
|
||||
return cp;
|
||||
}
|
||||
//====================================================================================================================
|
||||
/// Molar heat capacity at constant volume. Units: J/kmol/K.
|
||||
|
||||
doublereal RedlichKisterVPSSTP::cv_mole() const
|
||||
{
|
||||
return cp_mole() - GasConstant;
|
||||
}
|
||||
//====================================================================================================================
|
||||
// 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]
|
||||
*
|
||||
*/
|
||||
|
||||
void RedlichKisterVPSSTP::getPartialMolarEnthalpies(doublereal* hbar) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -370,21 +290,7 @@ void RedlichKisterVPSSTP::getPartialMolarEnthalpies(doublereal* hbar) const
|
|||
hbar[k] -= RTT * dlnActCoeffdT_Scaled_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Returns an array of partial molar heat capacities 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}
|
||||
* \f]
|
||||
*
|
||||
*/
|
||||
|
||||
void RedlichKisterVPSSTP::getPartialMolarCp(doublereal* cpbar) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -409,21 +315,7 @@ void RedlichKisterVPSSTP::getPartialMolarCp(doublereal* cpbar) const
|
|||
cpbar[k] *= GasConstant;
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
// 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}
|
||||
* \f]
|
||||
*
|
||||
*/
|
||||
|
||||
void RedlichKisterVPSSTP::getPartialMolarEntropies(doublereal* sbar) const
|
||||
{
|
||||
double xx;
|
||||
|
|
@ -451,20 +343,6 @@ void RedlichKisterVPSSTP::getPartialMolarEntropies(doublereal* sbar) const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ------------ Partial Molar Properties of the Solution ------------
|
||||
*/
|
||||
//====================================================================================================================
|
||||
// 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.
|
||||
*/
|
||||
void RedlichKisterVPSSTP::getPartialMolarVolumes(doublereal* vbar) const
|
||||
{
|
||||
/*
|
||||
|
|
@ -476,52 +354,26 @@ void RedlichKisterVPSSTP::getPartialMolarVolumes(doublereal* vbar) const
|
|||
vbar[iK] += 0.0;
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
doublereal RedlichKisterVPSSTP::err(const std::string& msg) const
|
||||
{
|
||||
throw CanteraError("RedlichKisterVPSSTP","Base class method "
|
||||
+msg+" called. Equation of state type: "+int2str(eosType()));
|
||||
return 0;
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* @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.
|
||||
*
|
||||
* @see importCTML.cpp
|
||||
*/
|
||||
|
||||
void RedlichKisterVPSSTP::initThermo()
|
||||
{
|
||||
initLengths();
|
||||
GibbsExcessVPSSTP::initThermo();
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Initialize lengths of local variables after all species have
|
||||
// been identified.
|
||||
|
||||
void RedlichKisterVPSSTP::initLengths()
|
||||
{
|
||||
m_kk = nSpecies();
|
||||
dlnActCoeffdlnN_.resize(m_kk, m_kk);
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* initThermoXML() (virtual from ThermoPhase)
|
||||
* 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 RedlichKisterVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
|
||||
{
|
||||
std::string subname = "RedlichKisterVPSSTP::initThermoXML";
|
||||
|
|
@ -583,13 +435,7 @@ void RedlichKisterVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string&
|
|||
*/
|
||||
GibbsExcessVPSSTP::initThermoXML(phaseNode, id);
|
||||
}
|
||||
//===================================================================================================================
|
||||
// Update the activity coefficients
|
||||
/*
|
||||
* This function will be called to update the internally stored
|
||||
* natural logarithm of the activity coefficients
|
||||
*
|
||||
*/
|
||||
|
||||
void RedlichKisterVPSSTP::s_update_lnActCoeff() const
|
||||
{
|
||||
doublereal XA, XB;
|
||||
|
|
@ -660,14 +506,7 @@ void RedlichKisterVPSSTP::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
|
||||
* natural logarithm of the activity coefficients
|
||||
*
|
||||
|
||||
*/
|
||||
void RedlichKisterVPSSTP::s_update_dlnActCoeff_dT() const
|
||||
{
|
||||
doublereal XA, XB;
|
||||
|
|
@ -713,7 +552,7 @@ void RedlichKisterVPSSTP::s_update_dlnActCoeff_dT() const
|
|||
}
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void RedlichKisterVPSSTP::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const
|
||||
{
|
||||
s_update_dlnActCoeff_dT();
|
||||
|
|
@ -721,7 +560,7 @@ void RedlichKisterVPSSTP::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const
|
|||
dlnActCoeffdT[k] = dlnActCoeffdT_Scaled_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void RedlichKisterVPSSTP::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const
|
||||
{
|
||||
s_update_dlnActCoeff_dT();
|
||||
|
|
@ -729,7 +568,7 @@ void RedlichKisterVPSSTP::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const
|
|||
d2lnActCoeffdT2[k] = d2lnActCoeffdT2_Scaled_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void RedlichKisterVPSSTP::s_update_dlnActCoeff_dX_() const
|
||||
{
|
||||
doublereal XA, XB;
|
||||
|
|
@ -800,18 +639,7 @@ void RedlichKisterVPSSTP::s_update_dlnActCoeff_dX_() 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
|
||||
* units are 1/units(s). if s is a physical coordinate then the units are 1/m.
|
||||
*/
|
||||
|
||||
void RedlichKisterVPSSTP::getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds,
|
||||
doublereal* dlnActCoeffds) const
|
||||
{
|
||||
|
|
@ -825,7 +653,6 @@ void RedlichKisterVPSSTP::getdlnActCoeffds(const doublereal dTds, const doublere
|
|||
}
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
void RedlichKisterVPSSTP::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const
|
||||
{
|
||||
s_update_dlnActCoeff_dX_();
|
||||
|
|
@ -836,7 +663,7 @@ void RedlichKisterVPSSTP::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_di
|
|||
}
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void RedlichKisterVPSSTP::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const
|
||||
{
|
||||
s_update_dlnActCoeff_dX_();
|
||||
|
|
@ -844,7 +671,7 @@ void RedlichKisterVPSSTP::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_di
|
|||
dlnActCoeffdlnX_diag[k] = dlnActCoeffdlnX_diag_[k];
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void RedlichKisterVPSSTP::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeffdlnN)
|
||||
{
|
||||
s_update_dlnActCoeff_dX_();
|
||||
|
|
@ -855,7 +682,7 @@ void RedlichKisterVPSSTP::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnAct
|
|||
}
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
void RedlichKisterVPSSTP::resizeNumInteractions(const size_t num)
|
||||
{
|
||||
numBinaryInteractions_ = num;
|
||||
|
|
@ -866,13 +693,7 @@ void RedlichKisterVPSSTP::resizeNumInteractions(const size_t num)
|
|||
m_SE_m_ij.resize(num);
|
||||
dlnActCoeff_dX_.resize(num, num, 0.0);
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Process an XML node called "binaryNeutralSpeciesParameters"
|
||||
/*
|
||||
* This node contains all of the parameters necessary to describe the RedlichKister Interaction for
|
||||
* a single binary interaction. This function reads the XML file and writes the coefficients
|
||||
* it finds to an internal data structures.
|
||||
*/
|
||||
|
||||
void RedlichKisterVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
||||
{
|
||||
std::string xname = xmLBinarySpecies.name();
|
||||
|
|
@ -961,7 +782,7 @@ void RedlichKisterVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
|||
m_N_ij.push_back(Npoly);
|
||||
resizeNumInteractions(numBinaryInteractions_);
|
||||
}
|
||||
//====================================================================================================================
|
||||
|
||||
#ifdef DEBUG_MODE
|
||||
void RedlichKisterVPSSTP::Vint(double& VintOut, double& voltsOut)
|
||||
{
|
||||
|
|
@ -1010,6 +831,4 @@ void RedlichKisterVPSSTP::Vint(double& VintOut, double& voltsOut)
|
|||
voltsOut = Volts + termp;
|
||||
}
|
||||
#endif
|
||||
//====================================================================================================================
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,15 +34,6 @@ VPStandardStateTP::VPStandardStateTP() :
|
|||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy Constructor:
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working copy constructor.
|
||||
*
|
||||
* The copy constructor just calls the assignment operator
|
||||
* to do the heavy lifting.
|
||||
*/
|
||||
VPStandardStateTP::VPStandardStateTP(const VPStandardStateTP& b) :
|
||||
ThermoPhase(),
|
||||
m_Pcurrent(OneAtm),
|
||||
|
|
@ -54,12 +45,6 @@ VPStandardStateTP::VPStandardStateTP(const VPStandardStateTP& b) :
|
|||
VPStandardStateTP::operator=(b);
|
||||
}
|
||||
|
||||
/*
|
||||
* operator=()
|
||||
*
|
||||
* Note this stuff will not work until the underlying phase
|
||||
* has a working assignment operator
|
||||
*/
|
||||
VPStandardStateTP&
|
||||
VPStandardStateTP::operator=(const VPStandardStateTP& b)
|
||||
{
|
||||
|
|
@ -126,10 +111,6 @@ VPStandardStateTP::operator=(const VPStandardStateTP& b)
|
|||
return *this;
|
||||
}
|
||||
//====================================================================================================================
|
||||
/*
|
||||
* ~VPStandardStateTP(): (virtual)
|
||||
*
|
||||
*/
|
||||
VPStandardStateTP::~VPStandardStateTP()
|
||||
{
|
||||
for (int k = 0; k < (int) m_PDSS_storage.size(); k++) {
|
||||
|
|
@ -138,38 +119,16 @@ VPStandardStateTP::~VPStandardStateTP()
|
|||
delete m_VPSS_ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
* Duplication function.
|
||||
* This calls the copy constructor for this object.
|
||||
*/
|
||||
ThermoPhase* VPStandardStateTP::duplMyselfAsThermoPhase() const
|
||||
{
|
||||
return new VPStandardStateTP(*this);
|
||||
}
|
||||
|
||||
// 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
|
||||
*/
|
||||
int VPStandardStateTP::standardStateConvention() const
|
||||
{
|
||||
return cSS_CONVENTION_VPSS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ------------Molar Thermodynamic Properties -------------------------
|
||||
*/
|
||||
|
||||
|
||||
doublereal VPStandardStateTP::err(const std::string& msg) const
|
||||
{
|
||||
throw CanteraError("VPStandardStateTP","Base class method "
|
||||
|
|
@ -177,19 +136,6 @@ doublereal VPStandardStateTP::err(const std::string& msg) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* ---- 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.
|
||||
*/
|
||||
void VPStandardStateTP::getChemPotentials_RT(doublereal* muRT) const
|
||||
{
|
||||
getChemPotentials(muRT);
|
||||
|
|
@ -220,14 +166,6 @@ void VPStandardStateTP::getEnthalpy_RT(doublereal* hrt) const
|
|||
|
||||
//================================================================================================
|
||||
#ifdef H298MODIFY_CAPABILITY
|
||||
// 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
|
||||
*/
|
||||
void VPStandardStateTP::modifyOneHf298SS(const size_t& k, const doublereal Hf298New)
|
||||
{
|
||||
m_spthermo->modifyOneHf298(k, Hf298New);
|
||||
|
|
@ -282,37 +220,18 @@ const vector_fp& VPStandardStateTP::getStandardVolumes() const
|
|||
* ----- 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.
|
||||
*/
|
||||
void VPStandardStateTP::getEnthalpy_RT_ref(doublereal* hrt) const
|
||||
{
|
||||
updateStandardStateThermo();
|
||||
m_VPSS_ptr->getEnthalpy_RT_ref(hrt);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the vector of nondimensional
|
||||
* enthalpies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*/
|
||||
void VPStandardStateTP::getGibbs_RT_ref(doublereal* grt) const
|
||||
{
|
||||
updateStandardStateThermo();
|
||||
m_VPSS_ptr->getGibbs_RT_ref(grt);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 is filled in here so that derived classes don't have to
|
||||
* take care of it.
|
||||
*/
|
||||
void VPStandardStateTP::getGibbs_ref(doublereal* g) const
|
||||
{
|
||||
updateStandardStateThermo();
|
||||
|
|
@ -325,45 +244,24 @@ const vector_fp& VPStandardStateTP::Gibbs_RT_ref() const
|
|||
return m_VPSS_ptr->Gibbs_RT_ref();
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the vector of nondimensional
|
||||
* entropies of the reference state at the current temperature
|
||||
* of the solution and the reference pressure for the species.
|
||||
*/
|
||||
void VPStandardStateTP::getEntropy_R_ref(doublereal* er) const
|
||||
{
|
||||
updateStandardStateThermo();
|
||||
m_VPSS_ptr->getEntropy_R_ref(er);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
void VPStandardStateTP::getCp_R_ref(doublereal* cpr) const
|
||||
{
|
||||
updateStandardStateThermo();
|
||||
m_VPSS_ptr->getCp_R_ref(cpr);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
void VPStandardStateTP::getStandardVolumes_ref(doublereal* vol) const
|
||||
{
|
||||
updateStandardStateThermo();
|
||||
m_VPSS_ptr->getStandardVolumes_ref(vol);
|
||||
}
|
||||
|
||||
/*
|
||||
* Perform initializations after all species have been
|
||||
* added.
|
||||
*/
|
||||
void VPStandardStateTP::initThermo()
|
||||
{
|
||||
initLengths();
|
||||
|
|
@ -465,25 +363,10 @@ VPStandardStateTP::providePDSS(size_t k) const
|
|||
return m_PDSS_storage[k];
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This routine initializes the lengths in the current object and
|
||||
* then calls the parent routine.
|
||||
*/
|
||||
void VPStandardStateTP::initThermoXML(XML_Node& phaseNode, const std::string& id)
|
||||
{
|
||||
// initialize the lengths in the current object and then call the parent
|
||||
// routine.
|
||||
VPStandardStateTP::initLengths();
|
||||
|
||||
//m_VPSS_ptr->initThermo();
|
||||
|
|
@ -504,20 +387,6 @@ VPSSMgr* VPStandardStateTP::provideVPSSMgr()
|
|||
return m_VPSS_ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
* void _updateStandardStateThermo() (protected, virtual, const)
|
||||
*
|
||||
* If m_useTmpStandardStateStorage is true,
|
||||
* This function must be called for every call to functions in this
|
||||
* class that need standard state properties.
|
||||
* Child classes may require that it be called even if m_useTmpStandardStateStorage
|
||||
* is not true.
|
||||
* It checks to see whether the temperature has changed and
|
||||
* thus the ss thermodynamics functions for all of the species
|
||||
* must be recalculated.
|
||||
*
|
||||
* This
|
||||
*/
|
||||
void VPStandardStateTP::_updateStandardStateThermo() const
|
||||
{
|
||||
double Tnow = temperature();
|
||||
|
|
@ -536,5 +405,3 @@ void VPStandardStateTP::updateStandardStateThermo() const
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue