Doxygen update -
Added DebyeHuckel to doxygen. There are still unfilled entries Started filling in how the Molality formulation is carried out.
This commit is contained in:
parent
a4f1ab3d74
commit
f87e536ac3
8 changed files with 640 additions and 387 deletions
|
|
@ -230,8 +230,8 @@ namespace Cantera {
|
|||
* @param vol Output vector containing the standard state volumes.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
void IdealGasPhase::getStandardVolumes(doublereal *vol) const {
|
||||
doublereal tmp = _RT() / pressure();
|
||||
void IdealGasPhase::getStandardVolumes(doublereal *vol) const {
|
||||
double tmp = 1.0 / molarDensity();
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
vol[k] = tmp;
|
||||
}
|
||||
|
|
@ -292,15 +292,22 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the vector of nondimensional
|
||||
* constant pressure heat capacities of the reference state
|
||||
* at the current temperature and reference pressure.
|
||||
*/
|
||||
void IdealGasPhase::getCp_R_ref(doublereal *cprt) const {
|
||||
const array_fp& _cpr = cp_R_ref();
|
||||
copy(_cpr.begin(), _cpr.end(), cprt);
|
||||
/**
|
||||
* Returns the vector of nondimensional
|
||||
* constant pressure heat capacities of the reference state
|
||||
* at the current temperature and reference pressure.
|
||||
*/
|
||||
void IdealGasPhase::getCp_R_ref(doublereal *cprt) const {
|
||||
const array_fp& _cpr = cp_R_ref();
|
||||
copy(_cpr.begin(), _cpr.end(), cprt);
|
||||
}
|
||||
|
||||
void IdealGasPhase::getStandardVolumes_ref(doublereal *vol) const {
|
||||
doublereal tmp = _RT() / m_p0;
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
vol[k] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// new methods defined here -------------------------------
|
||||
|
|
|
|||
|
|
@ -472,6 +472,15 @@ namespace Cantera {
|
|||
*/
|
||||
virtual void getCp_R_ref(doublereal *cprt) const;
|
||||
|
||||
//! Get the molar volumes of the species standard states at the current
|
||||
//! <I>T</I> and <I>P_ref</I> of the solution.
|
||||
/*!
|
||||
* units = m^3 / kmol
|
||||
*
|
||||
* @param vol Output vector containing the standard state volumes.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getStandardVolumes_ref(doublereal *vol) const;
|
||||
|
||||
//@}
|
||||
/// @name New Methods Defined Here -------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -45,19 +45,23 @@ namespace Cantera {
|
|||
*
|
||||
*
|
||||
* The calculation of thermodynamic functions within %ThermoPhase is
|
||||
* broken down roughly into two or more steps. First, the standard state properties
|
||||
* of all of the species are calculated at the current temperature and at either
|
||||
* broken down roughly into two or more steps. First, the standard state
|
||||
* properties
|
||||
* of all of the species are calculated at the current temperature and at
|
||||
* either
|
||||
* the current pressure or at a reference pressure. If the calculation is
|
||||
* carried out at a refereence pressure instead of at the current pressure
|
||||
* the calculation is called a "reference state properties" calculation,
|
||||
* just to make the distinction (even though it may be considered to be
|
||||
* a fixed-pressure standard-state calculation). The next step is to
|
||||
* adjust the reference state calculation to the current pressure. The thermodynamic
|
||||
* adjust the reference state calculation to the current pressure. The
|
||||
* thermodynamic
|
||||
* functions then are considered to be at the standard state of each species.
|
||||
* Lastly the mixing contributions are added to arrive at the thermodynamic
|
||||
* functions for the solution.
|
||||
*
|
||||
* The %ThermoPhase class provides interfaces to thermodynamic properties calculated for
|
||||
* The %ThermoPhase class provides interfaces to thermodynamic properties
|
||||
* calculated for
|
||||
* the reference state of each species, the standard state values for
|
||||
* each species, the thermodynamic functions for solution values, both
|
||||
* on a per mole of solution basis (i.e., enthalpy_mole()), on a per kg of
|
||||
|
|
@ -66,7 +70,8 @@ namespace Cantera {
|
|||
* getPartialMolarEnthalpies(double *hbar)).
|
||||
* At each level, functions for the enthalpy, entropy, Gibbs free energy,
|
||||
* internal energy, and volume are provided. So, 5 levels (reference state,
|
||||
* standard state, partial molar, per mole of solution, and per mass of solution)
|
||||
* standard state, partial molar, per mole of solution, and per mass of
|
||||
* solution)
|
||||
* and 5 functions multiplied together makes 25 possible functions. That's
|
||||
* why %ThermoPhase is such a large class.
|
||||
*
|
||||
|
|
@ -97,7 +102,8 @@ namespace Cantera {
|
|||
* .
|
||||
*
|
||||
* The following additional objects inherit from %ThermoPhase. Most of these
|
||||
* are associated with an electrochemistry capability that is under construction.
|
||||
* are associated with an electrochemistry capability that is under
|
||||
* construction.
|
||||
*
|
||||
* - DebyeHuckel in thermo/DebyeHuckel.h
|
||||
* - SingleSpeciesTP in thermo/SingleSpeciesTP.h
|
||||
|
|
@ -296,7 +302,7 @@ namespace Cantera {
|
|||
|
||||
//! Return the thermodynamic pressure (Pa).
|
||||
/*!
|
||||
* This method must be overloaded in derived classes. Since the
|
||||
* This method must be overloaded in derived classes. Since the
|
||||
* mass density, temperature, and mass fractions are stored,
|
||||
* this method should use these values to implement the
|
||||
* mechanical equation of state \f$ P(T, \rho, Y_1, \dots,
|
||||
|
|
@ -323,16 +329,16 @@ namespace Cantera {
|
|||
err("setPressure");
|
||||
}
|
||||
|
||||
//! Returns the isothermal compressibility. Units: 1/Pa.
|
||||
/*!
|
||||
* The isothermal compressibility is defined as
|
||||
* \f[
|
||||
* \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal isothermalCompressibility() const {
|
||||
err("isothermalCompressibility"); return -1.0;
|
||||
}
|
||||
//! Returns the isothermal compressibility. Units: 1/Pa.
|
||||
/*!
|
||||
* The isothermal compressibility is defined as
|
||||
* \f[
|
||||
* \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
|
||||
* \f]
|
||||
*/
|
||||
virtual doublereal isothermalCompressibility() const {
|
||||
err("isothermalCompressibility"); return -1.0;
|
||||
}
|
||||
|
||||
//! Return the volumetric thermal expansion coefficient. Units: 1/K.
|
||||
/*!
|
||||
|
|
@ -394,27 +400,27 @@ namespace Cantera {
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* This method returns the convention used in specification
|
||||
* of the activities, of which there are currently two, molar-
|
||||
* and molality-based conventions.
|
||||
*
|
||||
* 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 acvtivities
|
||||
* (unit activity of solutes at a hypothetical 1 molal
|
||||
* solution referenced to infinite dilution at all
|
||||
* pressures and temperatures).
|
||||
* cAC_CONVENTION_MOLALITY 1
|
||||
*/
|
||||
virtual int activityConvention() const;
|
||||
|
||||
|
||||
//! This method returns the convention used in specification
|
||||
//! of the activities, of which there are currently two, molar-
|
||||
//! and molality-based conventions.
|
||||
/*!
|
||||
* 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 acvtivities
|
||||
* (unit activity of solutes at a hypothetical 1 molal
|
||||
* solution referenced to infinite dilution at all
|
||||
* pressures and temperatures).
|
||||
* cAC_CONVENTION_MOLALITY 1
|
||||
*/
|
||||
virtual int activityConvention() const;
|
||||
|
||||
|
||||
//! This method returns an array of generalized concentrations
|
||||
/*!
|
||||
|
|
@ -478,7 +484,7 @@ namespace Cantera {
|
|||
* units are needed. Usually, MKS units are assumed throughout
|
||||
* the program and in the XML input files.
|
||||
*
|
||||
* The base %ThermoPhase class assigns thedefault quantities
|
||||
* The base %ThermoPhase class assigns the default quantities
|
||||
* of (kmol/m3) for all species.
|
||||
* Inherited classes are responsible for overriding the default
|
||||
* values if necessary.
|
||||
|
|
@ -497,40 +503,36 @@ namespace Cantera {
|
|||
*/
|
||||
virtual void getUnitsStandardConc(double *uA, int k = 0,
|
||||
int sizeUA = 6);
|
||||
|
||||
/**
|
||||
* Get the array of non-dimensional activities at
|
||||
* the current solution temperature, pressure, and
|
||||
* solution concentration.
|
||||
*
|
||||
* We resolve this function at this level by calling
|
||||
* on the activityConcentration function. However,
|
||||
* derived classes may want to override this default
|
||||
* implementation.
|
||||
*
|
||||
* @param a Output vector of activities. Length: m_kk.
|
||||
*/
|
||||
virtual void getActivities(doublereal* a);
|
||||
|
||||
/**
|
||||
* Get the array of non-dimensional molar-based
|
||||
* activity coefficients at
|
||||
* the current solution temperature, pressure, and
|
||||
* solution concentration.
|
||||
*
|
||||
* @param ac Output vector of activity coefficients. Length: m_kk.
|
||||
*/
|
||||
virtual void getActivityCoefficients(doublereal* ac) const {
|
||||
if (m_kk == 1) {
|
||||
ac[0] = 1.0;
|
||||
|
||||
//! Get the array of non-dimensional activities at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
*
|
||||
* We resolve this function at this level by calling
|
||||
* on the activityConcentration function. However,
|
||||
* derived classes may want to override this default
|
||||
* implementation.
|
||||
*
|
||||
* @param a Output vector of activities. Length: m_kk.
|
||||
*/
|
||||
virtual void getActivities(doublereal* a);
|
||||
|
||||
//! Get the array of non-dimensional molar-based activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* @param ac Output vector of activity coefficients. Length: m_kk.
|
||||
*/
|
||||
virtual void getActivityCoefficients(doublereal* ac) const {
|
||||
if (m_kk == 1) {
|
||||
ac[0] = 1.0;
|
||||
} else {
|
||||
err("getActivityCoefficients");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
//@}
|
||||
/// @name Partial Molar Properties of the Solution
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Get the array of non-dimensional species chemical potentials
|
||||
|
|
@ -559,22 +561,22 @@ namespace Cantera {
|
|||
err("getChemPotentials");
|
||||
}
|
||||
|
||||
//! Get the species electrochemical potentials.
|
||||
/*!
|
||||
* These are partial molar quantities. This method adds a term \f$ Fz_k
|
||||
* \phi_k \f$ to each chemical potential.
|
||||
*
|
||||
* @param mu Output vector of species electrochemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
void getElectrochemPotentials(doublereal* mu) const {
|
||||
getChemPotentials(mu);
|
||||
double ve = Faraday * electricPotential();
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
mu[k] += ve*charge(k);
|
||||
}
|
||||
//! Get the species electrochemical potentials.
|
||||
/*!
|
||||
* These are partial molar quantities. This method adds a term \f$ Fz_k
|
||||
* \phi_k \f$ to each chemical potential.
|
||||
*
|
||||
* @param mu Output vector of species electrochemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
void getElectrochemPotentials(doublereal* mu) const {
|
||||
getChemPotentials(mu);
|
||||
double ve = Faraday * electricPotential();
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
mu[k] += ve*charge(k);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//! Get the species partial molar enthalpies. Units: J/kmol.
|
||||
/*!
|
||||
* @param hbar Output vector of species partial molar enthalpies.
|
||||
|
|
@ -1083,15 +1085,15 @@ namespace Cantera {
|
|||
*/
|
||||
bool getElementPotentials(doublereal* lambda) const;
|
||||
|
||||
//@}
|
||||
//@}
|
||||
|
||||
|
||||
//---------------------------------------------------------
|
||||
/// @name Critical State Properties.
|
||||
/// These methods are only implemented by some subclasses, and may
|
||||
/// be moved out of ThermoPhase at a later date.
|
||||
//---------------------------------------------------------
|
||||
/// @name Critical State Properties.
|
||||
/// These methods are only implemented by some subclasses, and may
|
||||
/// be moved out of ThermoPhase at a later date.
|
||||
|
||||
//@{
|
||||
//@{
|
||||
|
||||
/// Critical temperature (K).
|
||||
virtual doublereal critTemperature() const {
|
||||
|
|
@ -1136,7 +1138,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
|
||||
//@}
|
||||
//@}
|
||||
|
||||
|
||||
//! @name Initialization Methods - For Internal Use (%ThermoPhase)
|
||||
|
|
@ -1172,21 +1174,24 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @internal Install a species thermodynamic property
|
||||
* manager. The species thermodynamic property manager
|
||||
* computes properties of the pure species for use in
|
||||
* constructing solution properties. It is meant for internal
|
||||
* use, and some classes derived from ThermoPhase may not use
|
||||
* any species thermodynamic property manager. This method is
|
||||
* called by function importPhase() in importCTML.cpp.
|
||||
*
|
||||
* @param spthermo input pointer to the species thermodynamic property
|
||||
* manager.
|
||||
*/
|
||||
void setSpeciesThermo(SpeciesThermo* spthermo)
|
||||
{ m_spthermo = spthermo; }
|
||||
|
||||
|
||||
//! Install a species thermodynamic property manager.
|
||||
/*!
|
||||
* The species thermodynamic property manager
|
||||
* computes properties of the pure species for use in
|
||||
* constructing solution properties. It is meant for internal
|
||||
* use, and some classes derived from ThermoPhase may not use
|
||||
* any species thermodynamic property manager. This method is
|
||||
* called by function importPhase() in importCTML.cpp.
|
||||
*
|
||||
* @param spthermo input pointer to the species thermodynamic property
|
||||
* manager.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
void setSpeciesThermo(SpeciesThermo* spthermo)
|
||||
{ m_spthermo = spthermo; }
|
||||
|
||||
/**
|
||||
* @internal Return a reference to the species thermodynamic property
|
||||
* manager. @todo This method will fail if no species thermo
|
||||
|
|
@ -1331,21 +1336,22 @@ namespace Cantera {
|
|||
*/
|
||||
virtual void setParametersFromXML(const XML_Node& eosdata) {}
|
||||
|
||||
/**
|
||||
* Set the initial state of the phase to the conditions
|
||||
* specified in the state XML element.
|
||||
*
|
||||
* This method sets the temperature, pressure, and mole
|
||||
* fraction vector to a set default value.
|
||||
*
|
||||
* @param state AN XML_Node object corresponding to
|
||||
* the "state" entry for this phase in the
|
||||
* input file.
|
||||
*/
|
||||
virtual void setStateFromXML(const XML_Node& state);
|
||||
|
||||
//! Set the initial state of the phase to the conditions
|
||||
//! specified in the state XML element.
|
||||
/*!
|
||||
*
|
||||
* This method sets the temperature, pressure, and mole
|
||||
* fraction vector to a set default value.
|
||||
*
|
||||
* @param state AN XML_Node object corresponding to
|
||||
* the "state" entry for this phase in the
|
||||
* input file.
|
||||
*/
|
||||
virtual void setStateFromXML(const XML_Node& state);
|
||||
|
||||
|
||||
//@}
|
||||
//@}
|
||||
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -473,7 +473,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* 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,
|
||||
|
|
@ -678,7 +678,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
*
|
||||
* getPartialMolarEntropies() (virtual, const)
|
||||
*
|
||||
|
|
@ -910,10 +910,7 @@ namespace Cantera {
|
|||
getStandardChemPotentials(gpure);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* getEnthalpy_RT() (virtual, const)
|
||||
*
|
||||
/*
|
||||
* Get the array of nondimensional Enthalpy functions for the ss
|
||||
* species at the current <I>T</I> and <I>P</I> of the solution.
|
||||
* We assume an incompressible constant partial molar
|
||||
|
|
@ -942,9 +939,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getEntropy_R() (virtual, const)
|
||||
*
|
||||
/*
|
||||
* Get the nondimensional Entropies for the species
|
||||
* standard states at the current T and P of the solution.
|
||||
*
|
||||
|
|
@ -952,6 +947,9 @@ namespace Cantera {
|
|||
* due to the zero volume expansivity:
|
||||
* i.e., (dS/dp)_T = (dV/dT)_P = 0.0
|
||||
*
|
||||
* The solvent water entropy is obtained from a pure water
|
||||
* equation of state model.
|
||||
*
|
||||
* @param sr Vector of length m_kk, which on return sr[k]
|
||||
* will contain the nondimensional
|
||||
* standard state entropy of species k.
|
||||
|
|
@ -965,7 +963,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Get the nondimensional heat capacity at constant pressure
|
||||
* function for the species
|
||||
* standard states at the current T and P of the solution.
|
||||
|
|
@ -976,6 +974,9 @@ namespace Cantera {
|
|||
* \f$ Cp^{ref}_k(T)\f$ is the constant pressure heat capacity
|
||||
* of species <I>k</I> at the reference pressure, \f$p_{ref}\f$.
|
||||
*
|
||||
* The solvent water heat capacity is obtained from a pure water
|
||||
* equation of state model.
|
||||
*
|
||||
* @param cpr Vector of length m_kk, which on return cpr[k]
|
||||
* will contain the nondimensional
|
||||
* constant pressure heat capacity for species k.
|
||||
|
|
@ -988,7 +989,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Get the molar volumes of each species in their standard
|
||||
* states at the current
|
||||
* <I>T</I> and <I>P</I> of the solution.
|
||||
|
|
|
|||
|
|
@ -105,6 +105,11 @@ namespace Cantera {
|
|||
*
|
||||
* <b> Specification of Species Standard %State Properties </b>
|
||||
*
|
||||
* The standard states are on the unit molality basis. Therefore, in the
|
||||
* documentation below, the normal \f$ o \f$ superscript is replaced with
|
||||
* the \f$ \triangle \f$ symbol. The reference state symbol is now
|
||||
* \f$ \triangle, ref \f$.
|
||||
*
|
||||
*
|
||||
* It is assumed that the reference state thermodynamics may be
|
||||
* obtained by a pointer to a populated species thermodynamic property
|
||||
|
|
@ -122,7 +127,7 @@ namespace Cantera {
|
|||
* The enthalpy function is given by the following relation.
|
||||
*
|
||||
* \f[
|
||||
* \raggedright h^o_k(T,P) = h^{ref}_k(T) + \tilde v \left( P - P_{ref} \right)
|
||||
* \raggedright h^\triangle_k(T,P) = h^{\triangle,ref}_k(T) + \tilde v \left( P - P_{ref} \right)
|
||||
* \f]
|
||||
*
|
||||
* For an incompressible,
|
||||
|
|
@ -133,12 +138,26 @@ namespace Cantera {
|
|||
* enthalpy to compute the molar internal energy.
|
||||
*
|
||||
* \f[
|
||||
* u^o_k(T,P) = h^{ref}_k(T) - P_{ref} \tilde v
|
||||
* u^\triangle_k(T,P) = h^{\triangle,ref}_k(T) - P_{ref} \tilde v
|
||||
* \f]
|
||||
*
|
||||
* The standard state heat capacity and entropy are independent
|
||||
* of pressure. The standard state gibbs free energy is obtained
|
||||
* from the enthalpy and entropy functions.
|
||||
*
|
||||
* The vector Constituents::m_speciesSize[] is used to hold the
|
||||
* base values of species sizes. These are defined as the
|
||||
* molar volumes of species at infinite dilution at 300 K and 1 atm
|
||||
* of water. m_speciesSize are calculated during the initialization of the
|
||||
* %DebyeHuckel object and are then not touched.
|
||||
*
|
||||
* The current model assumes that an incompressible molar volume for
|
||||
* all solutes. The molar volume for the water solvent, however,
|
||||
* is obtained from a pure water equation of state, waterSS.
|
||||
* Therefore, the water standard state varies with both T and P.
|
||||
* It is an error to request standard state water properties at a T and P
|
||||
* where the water phase is not a stable phase, i.e., beyond its
|
||||
* spinodal curve.
|
||||
*
|
||||
*
|
||||
* <b> Specification of Solution Thermodynamic Properties </b>
|
||||
|
|
@ -146,7 +165,7 @@ namespace Cantera {
|
|||
* All solution properties are obtained from the standard state
|
||||
* species functions, since there is only one species in the phase.
|
||||
*
|
||||
* <b> Application within %Kinetics Managers </b>
|
||||
* <b> %Application within %Kinetics Managers </b>
|
||||
*
|
||||
* The standard concentration is equal to 1.0. This means that the
|
||||
* kinetics operator works on an (activities basis). Since this
|
||||
|
|
@ -166,7 +185,7 @@ namespace Cantera {
|
|||
* appear in the rate constant expression, since it's a stoichiometric
|
||||
* phase and the activity is always equal to 1.0.
|
||||
*
|
||||
* <b> Instanteation of the Class </b>
|
||||
* <b> Instantiation of the Class </b>
|
||||
*
|
||||
* The constructor for this phase is NOT located in the default ThermoFactory
|
||||
* for %Cantera. However, a new %StoichSubstanceSSTP may be created by
|
||||
|
|
@ -333,17 +352,22 @@ namespace Cantera {
|
|||
* thrown.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Pressure. Units: Pa.
|
||||
//! Return the thermodynamic pressure (Pa).
|
||||
/*!
|
||||
* For this incompressible system, we return the internally storred
|
||||
* independent value of the pressure.
|
||||
*/
|
||||
*/
|
||||
virtual doublereal pressure() const;
|
||||
|
||||
/**
|
||||
* Set the pressure at constant temperature. Units: Pa.
|
||||
* This method sets a constant within the object.
|
||||
* The mass density is not a function of pressure.
|
||||
//! Set the internally storred pressure (Pa) at constant
|
||||
//! temperature and composition
|
||||
/*!
|
||||
* This method sets a constant within the object.
|
||||
* The mass density is not a function of pressure.
|
||||
*
|
||||
* @param p input Pressure (Pa)
|
||||
*
|
||||
* @todo Implement a variable pressure capability
|
||||
*/
|
||||
virtual void setPressure(doublereal p);
|
||||
|
||||
|
|
@ -395,7 +419,7 @@ namespace Cantera {
|
|||
* NOTE: This is an overwritten function from the State.h
|
||||
* class
|
||||
*
|
||||
* @param density Input density (kg/m^3).
|
||||
* @param rho Input density (kg/m^3).
|
||||
*/
|
||||
void setDensity(doublereal rho);
|
||||
|
||||
|
|
@ -455,40 +479,6 @@ namespace Cantera {
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Set the potential energy of species k to pe.
|
||||
* Units: J/kmol.
|
||||
* This function must be reimplemented in inherited classes
|
||||
* of ThermoPhase.
|
||||
*/
|
||||
virtual void setPotentialEnergy(int k, doublereal pe) {
|
||||
err("setPotentialEnergy");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the potential energy of species k.
|
||||
* Units: J/kmol.
|
||||
* This function must be reimplemented in inherited classes
|
||||
* of ThermoPhase.
|
||||
*/
|
||||
virtual doublereal potentialEnergy(int k) const {
|
||||
return err("potentialEnergy");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the electric potential of this phase (V).
|
||||
* This is used by classes InterfaceKinetics and EdgeKinetics to
|
||||
* compute the rates of charge-transfer reactions, and in computing
|
||||
* the electrochemical potentials of the species.
|
||||
*/
|
||||
void setElectricPotential(doublereal v) {
|
||||
m_phi = v;
|
||||
}
|
||||
|
||||
/// The electric potential of this phase (V).
|
||||
doublereal electricPotential() const { return m_phi; }
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Activities, Standard States, and Activity Concentrations
|
||||
|
|
@ -517,9 +507,10 @@ namespace Cantera {
|
|||
*/
|
||||
virtual void getActivityConcentrations(doublereal* c) const;
|
||||
|
||||
/**
|
||||
//! Return the standard concentration for the kth species
|
||||
/*!
|
||||
* The standard concentration \f$ C^0_k \f$ used to normalize
|
||||
* the generalized concentration. In many cases, this quantity
|
||||
* the activity (i.e., generalized) concentration. In many cases, this quantity
|
||||
* will be the same for all species in a phase - for example,
|
||||
* for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this
|
||||
* reason, this method returns a single value, instead of an
|
||||
|
|
@ -527,18 +518,29 @@ namespace Cantera {
|
|||
* 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.
|
||||
*
|
||||
* @param k Optional parameter indicating the species. The default
|
||||
* is to assume this refers to species 0.
|
||||
* @return
|
||||
* Returns the standard Concentration in units of m3 kmol-1.
|
||||
*/
|
||||
virtual doublereal standardConcentration(int k=0) const;
|
||||
|
||||
/**
|
||||
* Returns the natural logarithm of the standard
|
||||
* concentration of the kth species
|
||||
//! Natural logarithm of the standard concentration of the kth species.
|
||||
/*!
|
||||
* @param k index of the species (defaults to zero)
|
||||
*/
|
||||
virtual doublereal logStandardConc(int k=0) const;
|
||||
|
||||
/**
|
||||
* Returns the units of the standard and generalized
|
||||
* concentrations Note they have the same units, as their
|
||||
//! Returns the units of the standard and generalized concentrations.
|
||||
/*!
|
||||
* Note they have the same units, as their
|
||||
* ratio is defined to be equal to the activity of the kth
|
||||
* species in the solution, which is unitless.
|
||||
*
|
||||
|
|
@ -546,6 +548,12 @@ namespace Cantera {
|
|||
* units are needed. Usually, MKS units are assumed throughout
|
||||
* the program and in the XML input files.
|
||||
*
|
||||
* The base %ThermoPhase class assigns the default quantities
|
||||
* of (kmol/m3) for all species.
|
||||
* Inherited classes are responsible for overriding the default
|
||||
* values if necessary.
|
||||
*
|
||||
* @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.
|
||||
|
|
@ -553,25 +561,37 @@ namespace Cantera {
|
|||
* 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.
|
||||
*/
|
||||
virtual void getUnitsStandardConc(double *uA, int k = 0,
|
||||
int sizeUA = 6);
|
||||
|
||||
/**
|
||||
* Get the array of non-dimensional molality-based activities at
|
||||
* the current solution temperature, pressure, and
|
||||
* solution concentration.
|
||||
//! Get the array of non-dimensional activities at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
*
|
||||
* We resolve this function at this level by calling
|
||||
* on the activityConcentration function. However,
|
||||
* derived classes may want to override this default
|
||||
* implementation.
|
||||
*
|
||||
* (note solvent is on molar scale).
|
||||
*
|
||||
* @param ac Output vector of activities. Length: m_kk.
|
||||
*/
|
||||
virtual void getActivities(doublereal* ac) const;
|
||||
|
||||
/**
|
||||
* Get the array of non-dimensional molality-based
|
||||
* activity coefficients at
|
||||
* the current solution temperature, pressure, and
|
||||
* solution concentration.
|
||||
* (note solvent is on molar scale. The solvent molar
|
||||
* based activity coefficient is returned).
|
||||
//! Get the array of non-dimensional molality-based
|
||||
//! activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* note solvent is on molar scale. The solvent molar
|
||||
* based activity coefficient is returned.
|
||||
*
|
||||
* @param acMolality Vector of Molality-based activity coefficients
|
||||
* Length: m_kk
|
||||
*/
|
||||
virtual void
|
||||
getMolalityActivityCoefficients(doublereal* acMolality) const;
|
||||
|
|
@ -580,19 +600,22 @@ namespace Cantera {
|
|||
/// @name Partial Molar Properties of the Solution -----------------
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Get the species chemical potentials. Units: J/kmol.
|
||||
|
||||
//! 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^{ref}_k(T) + V_k * (p - p_o) + R T ln(X_k)
|
||||
* \mu_k = \mu^{\triangle}_k(T,P) + R T ln(\gamma_k^{\triangle} m_k)
|
||||
* \f]
|
||||
* or another way to phrase this is
|
||||
* \f[
|
||||
* \mu_k = \mu^o_k(T,p) + R T ln(X_k)
|
||||
* \f]
|
||||
* where \f$ \mu^o_k(T,p) = \mu^{ref}_k(T) + V_k * (p - p_o)\f$
|
||||
*
|
||||
* where
|
||||
*
|
||||
* @param mu Output vector of species chemical
|
||||
* potentials. Length: m_kk. Units: J/kmol
|
||||
*/
|
||||
virtual void getChemPotentials(doublereal* mu) const;
|
||||
|
||||
|
|
@ -662,15 +685,22 @@ namespace Cantera {
|
|||
*/
|
||||
virtual void 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, thepartial molar volumes are equal to the
|
||||
//! Get the species partial molar volumes. Units: m^3/kmol.
|
||||
/*!
|
||||
* For this solution, the partial molar volumes are equal to the
|
||||
* constant species molar volumes.
|
||||
*
|
||||
* @param vbar Output vector of speciar partial molar volumes.
|
||||
* Length = m_kk. units are m^3/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarVolumes(doublereal* vbar) const;
|
||||
|
||||
//! Get the partial molar heat capacities Units: J/kmol/K
|
||||
/*!
|
||||
* @param cpbar Output vector of species partial molar heat
|
||||
* capacities at constant pressure.
|
||||
* Length = m_kk. units are J/kmol/K.
|
||||
*/
|
||||
virtual void getPartialMolarCp(doublereal* cpbar) const;
|
||||
|
||||
|
||||
|
|
@ -681,7 +711,14 @@ namespace Cantera {
|
|||
//@{
|
||||
|
||||
|
||||
/**
|
||||
|
||||
//! Get the array of chemical potentials at unit activity for the species
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* These are the standard state chemical potentials \f$ \mu^0_k(T,P)
|
||||
* \f$. The values are evaluated at the current
|
||||
* temperature and pressure of the solution
|
||||
*
|
||||
* Get the standard state chemical potentials of the species.
|
||||
* This is the array of chemical potentials at unit activity
|
||||
* \f$ \mu^0_k(T,P) \f$.
|
||||
|
|
@ -692,87 +729,119 @@ namespace Cantera {
|
|||
* equilibrium constant Kc. Therefore, Kc will also depend
|
||||
* on T and P. This is the norm for liquid and solid systems.
|
||||
*
|
||||
* units = J / kmol
|
||||
* @param mu Output vector of chemical potentials.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getStandardChemPotentials(doublereal* mu) const;
|
||||
|
||||
/**
|
||||
* Get the nondimensional gibbs function for the species
|
||||
* standard states at the current T and P of the solution.
|
||||
*
|
||||
//! Get the nondimensional Gibbs functions for the species
|
||||
//! in their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* The standard states are on the unit molality basis.
|
||||
* \f[
|
||||
* \mu^0_k(T,P) = \mu^{ref}_k(T) + (P - P_{ref}) * V_k
|
||||
* \mu^{\triangle}_k(T,P) = \mu^{\triangle,ref}_k(T) + (P - P_{ref}) * V_k
|
||||
* \f]
|
||||
* where \f$V_k\f$ is the molar volume of pure species <I>k</I>.
|
||||
* \f$ \mu^{ref}_k(T)\f$ is the chemical potential of pure
|
||||
*
|
||||
* where \f$V_k\f$ is the molar volume of pure species <I>k</I>.
|
||||
* \f$ \mu^{\triangle,ref}_k(T)\f$ is the chemical potential of pure
|
||||
* species <I>k</I> at the reference pressure, \f$P_{ref}\f$.
|
||||
*
|
||||
* @param grt Vector of length m_kk, which on return sr[k]
|
||||
* will contain the nondimensional
|
||||
* standard state gibbs function for species k.
|
||||
* @param grt Output vector of nondimensional standard state gibbs free energies
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getGibbs_RT(doublereal* grt) const;
|
||||
|
||||
/**
|
||||
* Get the nondimensional Gibbs functions for the standard
|
||||
* state of the species at the current T and P.
|
||||
//! Get the Gibbs functions for the standard
|
||||
//! state of the species at the current <I>T</I> and <I>P</I> of the solution
|
||||
/*!
|
||||
* The standard states are on the unit molality basis.
|
||||
* Units are Joules/kmol
|
||||
* @param gpure Output vector of standard state gibbs free energies
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getPureGibbs(doublereal* gpure) const;
|
||||
|
||||
/**
|
||||
*
|
||||
* getEnthalpy_RT() (virtual, const)
|
||||
*
|
||||
* Get the array of nondimensional Enthalpy functions for the
|
||||
* standard states
|
||||
* species at the current <I>T</I> and <I>P</I> of the solution.
|
||||
//! Get the nondimensional Enthalpy functions for the species
|
||||
//! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* The standard states are on the unit molality basis.
|
||||
* We assume an incompressible constant partial molar
|
||||
* volume here:
|
||||
* \f[
|
||||
* h^0_k(T,P) = h^{ref}_k(T) + (P - P_{ref}) * V_k
|
||||
* \f]
|
||||
* where \f$V_k\f$ is the molar volume of SS species <I>k<\I>.
|
||||
* volume for the solutes.
|
||||
*
|
||||
* \f[
|
||||
* h^{\triangle}_k(T,P) = h^{\triangle,ref}_k(T) + (P - P_{ref}) * V_k
|
||||
* \f]
|
||||
*
|
||||
* where \f$V_k\f$ is the molar volume of SS species <I>k</I>.
|
||||
* \f$ h^{ref}_k(T)\f$ is the enthalpy of the SS
|
||||
* species <I>k<\I> at the reference pressure, \f$P_{ref}\f$.
|
||||
* species <I>k</I> at the reference pressure, \f$P_{ref}\f$.
|
||||
*
|
||||
* The solvent water enthalpy is obtained from a pure water
|
||||
* equation of state model.
|
||||
*
|
||||
* @param hrt Output vector of nondimensional standard state enthalpies.
|
||||
* Length: m_kk.
|
||||
*/
|
||||
virtual void getEnthalpy_RT(doublereal* hrt) const;
|
||||
|
||||
/**
|
||||
* Get the nondimensional Entropies for the species
|
||||
* standard states at the current T and P of the solution.
|
||||
//! Get the array of nondimensional Entropy functions for the
|
||||
//! standard state species at the current <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
*
|
||||
* The standard states are on the unit molality basis.
|
||||
*
|
||||
* \f[
|
||||
* s^{\triangle}_k(T,P) = s^{\triangle,ref}_k(T)
|
||||
* \f]
|
||||
*
|
||||
* Note, this is equal to the reference state entropies
|
||||
* due to the zero volume expansivity:
|
||||
* i.e., (dS/dp)_T = (dV/dT)_P = 0.0
|
||||
*
|
||||
* @param sr Vector of length m_kk, which on return sr[k]
|
||||
* will contain the nondimensional
|
||||
* standard state entropy of species k.
|
||||
* The solvent water entropy is obtained from a pure water
|
||||
* equation of state model.
|
||||
*
|
||||
* @param sr Output vector of nondimensional standard state entropies.
|
||||
* Length: m_kk. The solvent water is species 0, always.
|
||||
*/
|
||||
virtual void getEntropy_R(doublereal* sr) const;
|
||||
|
||||
/**
|
||||
* Get the nondimensional heat capacity at constant pressure
|
||||
* function for the species
|
||||
* standard states at the current T and P of the solution.
|
||||
//! Get the nondimensional Heat Capacities at constant
|
||||
//! pressure for the species standard states
|
||||
//! at the current <I>T</I> and <I>P</I> of the solution
|
||||
/*!
|
||||
* The standard states are on the unit molality basis.
|
||||
* For the solutes:
|
||||
* \f[
|
||||
* Cp^0_k(T,P) = Cp^{ref}_k(T)
|
||||
* Cp^\triangle_k(T,P) = Cp^{\triangle,ref}_k(T)
|
||||
* \f]
|
||||
* where \f$V_k\f$ is the molar volume of pure species <I>k</I>.
|
||||
*
|
||||
* \f$ Cp^{ref}_k(T)\f$ is the constant pressure heat capacity
|
||||
* of species <I>k</I> at the reference pressure, \f$p_{ref}\f$.
|
||||
*
|
||||
* The solute heat capacity is obtained from a pure water
|
||||
* equation of state model, so it depends on T and P.
|
||||
*
|
||||
* @param cpr Vector of length m_kk, which on return cpr[k]
|
||||
* will contain the nondimensional
|
||||
* constant pressure heat capacity for species k.
|
||||
* constant pressure heat capacity for species k.
|
||||
*/
|
||||
virtual void getCp_R(doublereal* cpr) const;
|
||||
|
||||
/**
|
||||
* Get the molar volumes of each species in their standard
|
||||
* states at the current
|
||||
* <I>T</I> and <I>P</I> of the solution.
|
||||
//! Get the molar volumes of the species standard states at the current
|
||||
//! <I>T</I> and <I>P</I> of the solution.
|
||||
/*!
|
||||
* The current model assumes that an incompressible molar volume for
|
||||
* all solutes. The molar volume for the water solvent, however,
|
||||
* is obtained from a pure water equation of state, waterSS.
|
||||
* Therefore, the water standard state varies with both T and P.
|
||||
* It is an error to request the water molar volume at a T and P
|
||||
* where the water phase is not stable phase.
|
||||
*
|
||||
* units = m^3 / kmol
|
||||
*
|
||||
* @param vol Output vector containing the standard state volumes.
|
||||
* Length: m_kk. The solvent water is species 0, always.
|
||||
*/
|
||||
virtual void getStandardVolumes(doublereal *vol) const;
|
||||
|
||||
|
|
@ -810,14 +879,17 @@ namespace Cantera {
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* This method is used by the ChemEquil equilibrium solver.
|
||||
//!This method is used by the ChemEquil equilibrium solver.
|
||||
/*!
|
||||
* It sets the state such that the chemical potentials satisfy
|
||||
* \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m}
|
||||
* \left(\frac{\lambda_m} {\hat R T}\right) \f] where
|
||||
* \f$ \lambda_m \f$ is the element potential of element m. The
|
||||
* temperature is unchanged. Any phase (ideal or not) that
|
||||
* implements this method can be equilibrated by ChemEquil.
|
||||
*
|
||||
* @param lambda_RT Input vector of dimensionless element potentials
|
||||
* The length is equal to nElements().
|
||||
*/
|
||||
virtual void setToEquilState(const doublereal* lambda_RT) {
|
||||
err("setToEquilState");
|
||||
|
|
@ -827,27 +899,38 @@ namespace Cantera {
|
|||
//@}
|
||||
|
||||
|
||||
/**
|
||||
//! Set the equation of state parameters
|
||||
/*!
|
||||
* @internal
|
||||
* Set equation of state parameters. The number and meaning of
|
||||
* these depends on the subclass.
|
||||
* The number and meaning of these depends on the subclass.
|
||||
*
|
||||
* @param n number of parameters
|
||||
* @param c array of \i n coefficients
|
||||
*
|
||||
* @param c array of \a n coefficients
|
||||
*/
|
||||
virtual void setParameters(int n, doublereal* c);
|
||||
|
||||
//! Get the equation of state parameters in a vector
|
||||
/*!
|
||||
* @internal
|
||||
* The number and meaning of these depends on the subclass.
|
||||
*
|
||||
* @param n number of parameters
|
||||
* @param c array of \a n coefficients
|
||||
*/
|
||||
virtual void getParameters(int &n, doublereal * const c);
|
||||
|
||||
/**
|
||||
* Set equation of state parameter values from XML
|
||||
* entries. This method is called by function importPhase in
|
||||
//! 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.
|
||||
* model. Note, this method is called before the phase is
|
||||
* initialzed with elements and/or species.
|
||||
*
|
||||
* @param eosdata An XML_Node object corresponding to
|
||||
* the "thermo" entry for this phase in the input file.
|
||||
* the "thermo" entry for this phase in the input file.
|
||||
*/
|
||||
virtual void setParametersFromXML(const XML_Node& eosdata);
|
||||
|
||||
|
|
@ -892,17 +975,7 @@ namespace Cantera {
|
|||
* -------------- Utilities -------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @internal Install a species thermodynamic property
|
||||
* manager. The species thermodynamic property manager
|
||||
* computes properties of the pure species for use in
|
||||
* constructing solution properties. It is meant for internal
|
||||
* use, and some classes derived from ThermoPhase may not use
|
||||
* any species thermodynamic property manager.
|
||||
*/
|
||||
void setSpeciesThermo(SpeciesThermo* spthermo)
|
||||
{ m_spthermo = spthermo; }
|
||||
|
||||
|
||||
/**
|
||||
* Return a reference to the species thermodynamic property
|
||||
* manager. @todo This method will fail if no species thermo
|
||||
|
|
@ -926,10 +999,9 @@ namespace Cantera {
|
|||
*/
|
||||
virtual void initThermo();
|
||||
|
||||
/*
|
||||
* Initialization of a DebyeHuckel phase using an
|
||||
* xml file
|
||||
*
|
||||
|
||||
//! Initialization of a DebyeHuckel phase using an xml file
|
||||
/*!
|
||||
* This routine is a precursor to initThermo(XML_Node*)
|
||||
* routine, which does most of the work.
|
||||
*
|
||||
|
|
@ -971,20 +1043,6 @@ namespace Cantera {
|
|||
|
||||
virtual void initThermoXML(XML_Node& phaseNode, std::string id);
|
||||
|
||||
/**
|
||||
* Report the molar volume of species k
|
||||
*
|
||||
* units - \f$ m^3 kmol^-1 \f$
|
||||
*/
|
||||
//double speciesMolarVolume(int k) const;
|
||||
|
||||
/**
|
||||
* Fill in a return vector containing the species molar volumes
|
||||
* units - \f$ m^3 kmol^-1 \f$
|
||||
*/
|
||||
//void getSpeciesMolarVolumes(double *smv) const;
|
||||
|
||||
|
||||
/**
|
||||
* Value of the Debye Huckel constant as a function of temperature
|
||||
* and pressure.
|
||||
|
|
|
|||
|
|
@ -763,16 +763,6 @@ namespace Cantera {
|
|||
* -------------- Utilities -------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @internal Install a species thermodynamic property
|
||||
* manager. The species thermodynamic property manager
|
||||
* computes properties of the pure species for use in
|
||||
* constructing solution properties. It is meant for internal
|
||||
* use, and some classes derived from ThermoPhase may not use
|
||||
* any species thermodynamic property manager.
|
||||
*/
|
||||
void setSpeciesThermo(SpeciesThermo* spthermo)
|
||||
{ m_spthermo = spthermo; }
|
||||
|
||||
/**
|
||||
* Return a reference to the species thermodynamic property
|
||||
|
|
|
|||
|
|
@ -357,7 +357,7 @@ namespace Cantera {
|
|||
* - Activities, Standard States, Activity Concentrations -----------
|
||||
*/
|
||||
|
||||
/**
|
||||
/*
|
||||
* This method returns the activity convention.
|
||||
* Currently, there are two activity conventions
|
||||
* Molar-based activities
|
||||
|
|
@ -380,7 +380,7 @@ namespace Cantera {
|
|||
return cAC_CONVENTION_MOLALITY;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Get the array of non-dimensional activity coefficients at
|
||||
* the current solution temperature, pressure, and
|
||||
* solution concentration.
|
||||
|
|
@ -406,7 +406,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* osmotic coefficient:
|
||||
*
|
||||
* Calculate the osmotic coefficient of the solvent. Note there
|
||||
|
|
@ -452,7 +452,7 @@ namespace Cantera {
|
|||
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
|
||||
|
|
@ -485,7 +485,6 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the thermodynamic state.
|
||||
*/
|
||||
|
|
@ -501,7 +500,7 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Set the temperature (K), pressure (Pa), and molalities
|
||||
* (gmol kg-1) of the solutes
|
||||
*/
|
||||
|
|
@ -512,14 +511,18 @@ namespace Cantera {
|
|||
setPressure(p);
|
||||
}
|
||||
|
||||
/** Set the temperature (K), pressure (Pa), and molalities. */
|
||||
/*
|
||||
* Set the temperature (K), pressure (Pa), and molalities.
|
||||
*/
|
||||
void MolalityVPSSTP::setState_TPM(doublereal t, doublereal p, compositionMap& m) {
|
||||
setMolalitiesByName(m);
|
||||
setTemperature(t);
|
||||
setPressure(p);
|
||||
}
|
||||
|
||||
/** Set the temperature (K), pressure (Pa), and molality. */
|
||||
/*
|
||||
* Set the temperature (K), pressure (Pa), and molality.
|
||||
*/
|
||||
void MolalityVPSSTP::setState_TPM(doublereal t, doublereal p, const std::string& m) {
|
||||
setMolalitiesByName(m);
|
||||
setTemperature(t);
|
||||
|
|
@ -527,7 +530,7 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* @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
|
||||
|
|
@ -555,7 +558,7 @@ namespace Cantera {
|
|||
m_molalities.resize(m_kk);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* initThermoXML() (virtual from ThermoPhase)
|
||||
* Import and initialize a ThermoPhase object
|
||||
*
|
||||
|
|
|
|||
|
|
@ -27,13 +27,134 @@ namespace Cantera {
|
|||
* @ingroup thermoprops
|
||||
*/
|
||||
|
||||
/**
|
||||
/*!
|
||||
* MolalityVPSSTP is a derived class of ThermoPhase that handles
|
||||
* variable pressure standard state methods for calculating
|
||||
* thermodynamic properties that are further based on
|
||||
* molality-scaled activities.
|
||||
* These include most of the methods
|
||||
* for calculating liquid electrolyte thermodynamics.
|
||||
* This category incorporates most of the methods
|
||||
* for calculating liquid electrolyte thermodynamics that have been
|
||||
* developed since the 1970's.
|
||||
*
|
||||
* This class adds additional functions onto the %ThermoPhase interface
|
||||
* that handle molality based standard states. The %ThermoPhase
|
||||
* class includes a member function, ThermoPhase::activityConvention()
|
||||
* that indicates which convention the activities are based on. The
|
||||
* default is to assume activities are based on the molar convention.
|
||||
* However, classes which derive from the MolalityVPSSTP class return
|
||||
* <b>cAC_CONVENTION_MOLALITY</b> from this member function.
|
||||
*
|
||||
* The molality of a solute, \f$ m_i \f$, is defined as
|
||||
*
|
||||
* \f[
|
||||
* m_i = \frac{n_i}{\tilde{M}_o n_o}
|
||||
* \f]
|
||||
* where
|
||||
* \f[
|
||||
* \tilde{M}_o = \frac{M_o}{1000}
|
||||
* \f]
|
||||
*
|
||||
* where \f$ M_o \f$ is the molecular weight of the solvent. The molality
|
||||
* has units of gmol kg<SUP>-1</SUP>. For the solute, the molality may be
|
||||
* considered as the amount of gmol's of solute per kg of solvent, a natural
|
||||
* experimental quantity.
|
||||
*
|
||||
* The formulas for calculating mole fractions if given the molalities of
|
||||
* the solutes is stated below. First calculate \f$ L^{sum} \f$, an intermediate
|
||||
* quantity.
|
||||
*
|
||||
* \f[
|
||||
* L^{sum} = \frac{1}{\tilde{M}_o X_o} = \frac{1}{\tilde{M}_o} + \sum_{i\ne o} m_i
|
||||
* \f]
|
||||
* Then,
|
||||
* \f[
|
||||
* X_o = \frac{1}{\tilde{M}_o L^{sum}}
|
||||
* \f]
|
||||
* \f[
|
||||
* X_i = \frac{m_i}{L^{sum}}
|
||||
* \f]
|
||||
* where \f$ X_o \f$ is the mole fraction of solvent, and \f$ X_o \f$ is the
|
||||
* mole fraction of solute <I>i</I>. Thus, the molality scale and the mole fraction
|
||||
* scale offer a one-to-one mapping between each other, except in the limit
|
||||
* of a zero solvent mole fraction.
|
||||
*
|
||||
* The standard states for thermodynamic objects that derive from <b>MolalityVPSSTP</b>
|
||||
* are on the unit molality basis. Chemical potentials
|
||||
* of the solutes, \f$ \mu_k \f$, and the solvent, \f$ \mu_o \f$, which are based
|
||||
* on the molality form, have the following general format:
|
||||
*
|
||||
* \f[
|
||||
* \mu_k = \mu^{\triangle}_k(T,P) + R T ln(\gamma_k^{\triangle} \frac{m_k}{m^\triangle})
|
||||
* \f]
|
||||
* \f[
|
||||
* \mu_o = \mu^o_o(T,P) + RT ln(a_o)
|
||||
* \f]
|
||||
*
|
||||
* where \f$ \gamma_k^{\triangle} \f$ is the molality based activity coefficient for species
|
||||
* \f$k\f$.
|
||||
*
|
||||
* The chemical potential of the solvent is thus expressed in a different format
|
||||
* than the chemical potential of the solutes. Additionally, the activity of the
|
||||
* solvent, \f$ a_o \f$, is further reexpressed in terms of an osmotic coefficient,
|
||||
* \f$ \phi \f$.
|
||||
* \f[
|
||||
* \phi = \frac{- ln(a_o)}{\tilde{M}_o \sum_{i \ne o} m_i}
|
||||
* \f]
|
||||
*
|
||||
* MolalityVPSSTP::osmoticCoefficient() returns the value of \f$ \phi \f$.
|
||||
* Note there are a few of definitions of the osmotic coefficient floating
|
||||
* around. We use the one defined in
|
||||
* (Activity Coefficients in Electrolyte Solutions, K. S. Pitzer
|
||||
* CRC Press, Boca Raton, 1991, p. 85, Eqn. 28). This definition is most clearly
|
||||
* related to theoretical calculation.
|
||||
*
|
||||
* The molar-based activity coefficients \f$ \gamma_k \f$ may be calculated
|
||||
* from the molality-based
|
||||
* activity coefficients, \f$ \gamma_k^\triangle \f$ by the following
|
||||
* formula.
|
||||
* \f[
|
||||
* \gamma_k = \frac{\gamma_k^\triangle}{X_o}
|
||||
* \f]
|
||||
* For purposes of establishing a convention, the molar activity coefficient of the
|
||||
* solvent is set equal to the molality-based activity coefficient of the
|
||||
* solvent:
|
||||
* \f[
|
||||
* \gamma_o = \gamma_o^\triangle
|
||||
* \f]
|
||||
*
|
||||
* The molality-based and molarity-based standard states may be related to one
|
||||
* another by the following formula.
|
||||
*
|
||||
* \f[
|
||||
* \mu_k^\triangle(T,P) = \mu_k^o(T,P) + R T \ln(\tilde{M}_o m^\triangle)
|
||||
* \f]
|
||||
*
|
||||
* An important convention is followed in all routines that derive from <b>%MolalityVPSSTP</b>.
|
||||
* Standard state thermodynamic functions and reference state thermodynamic functions
|
||||
* return the molality-based quantities. Also all functions which return
|
||||
* activities return the molality-based activities. The reason for this convention
|
||||
* has been discussed in supporting memos. However, it's important because the
|
||||
* term in the equation above is non-trivial. For example it's equal to 2.38 kcal gmol<SUP>-1</SUP>
|
||||
* for water at 298 K.
|
||||
*
|
||||
*
|
||||
* In order to prevent a singularity, this class includes the concept of a minimum
|
||||
* value for the solvent mole fraction. All calculations involving the formulation
|
||||
* of activity coefficients and other non-ideal solution behavior adhere to
|
||||
* this concept of a minimul value for the solvent mole fraction. This makes sense
|
||||
* because these solution behavior were all designed and measured far away from
|
||||
* the zero solvent singularity condition and are not applicable in that limit.
|
||||
*
|
||||
*
|
||||
* This objects add a layer that supports molality. It inherits from VPStandardStateTP.
|
||||
*
|
||||
* All objects that derive from this are assumed to have molality based standard states.
|
||||
*
|
||||
* @todo Make two solvent minimum fractions. One would be for calculation of the non-ideal
|
||||
* factors. The other one would be for purposes of stoichiometry evaluation. the
|
||||
* stoichiometry evaluation one would be a 1E-13 limit. Anything less would create
|
||||
* problems with roundoff error.
|
||||
*
|
||||
*/
|
||||
class MolalityVPSSTP : public VPStandardStateTP {
|
||||
|
||||
|
|
@ -85,8 +206,10 @@ namespace Cantera {
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Equation of state type flag. The ThermoPhase base class returns
|
||||
|
||||
//! 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
|
||||
|
|
@ -130,9 +253,7 @@ namespace Cantera {
|
|||
*/
|
||||
void setMoleFSolventMin(doublereal xmolSolventMIN);
|
||||
|
||||
/**
|
||||
* Returns the solvent index.
|
||||
*/
|
||||
//! Returns the solvent index.
|
||||
int solventIndex() const;
|
||||
|
||||
/**
|
||||
|
|
@ -141,60 +262,72 @@ namespace Cantera {
|
|||
*/
|
||||
doublereal moleFSolventMin() const;
|
||||
|
||||
|
||||
//! Calculates the molality of all species andstores the result internally.
|
||||
//! Calculates the molality of all species and stores the result internally.
|
||||
/*!
|
||||
* We calculate the vector of molalities of the species
|
||||
* in the phase and store the result internally:
|
||||
* \f[
|
||||
* m_i = (n_i) / (1000 * M_o * n_{o,p})
|
||||
* m_i = \frac{X_i}{1000 * M_o * X_{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
|
||||
* - \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}^{min} \f$ = minimum mole fraction of solvent allowed
|
||||
* in the denominator.
|
||||
*/
|
||||
void calcMolalities() const;
|
||||
|
||||
|
||||
//! This function will return the molalities of the species.
|
||||
/*!
|
||||
* We calculate the vector of molalities of the species
|
||||
* in the phase
|
||||
* \f[
|
||||
* m_i = (n_i) / (1000 * M_o * n_{o,p})
|
||||
* m_i = \frac{X_i}{1000 * M_o * X_{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
|
||||
* - \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}^{min} \f$ = minimum mole fraction of solvent allowed
|
||||
* in the denominator.
|
||||
*
|
||||
* @param molal Output vector of molalities. Length: m_kk.
|
||||
*/
|
||||
void getMolalities(doublereal * const molal) const;
|
||||
|
||||
//! Set the molalities of a phase
|
||||
//! Set the molalities of the solutes in a phase
|
||||
/*!
|
||||
* Set the molalities of the solutes in a phase. Note, the entry for the
|
||||
* solvent is not used.
|
||||
* Note, the entry for the solvent is not used.
|
||||
* We are supplied with the molalities of all of the
|
||||
* solute species. We then calculate the mole fractions of all
|
||||
* species and update the ThermoPhase object.
|
||||
* species and update the %ThermoPhase object.
|
||||
* \f[
|
||||
* m_i = \frac{X_i}{M_o/1000 * X_{o,p}}
|
||||
* \f]
|
||||
* where
|
||||
* - \f$M_o\f$ is the molecular weight of the solvent
|
||||
* - \f$X_o\f$ is the mole fraction of the solvent
|
||||
* - \f$X_i\f$ is the mole fraction of the solute.
|
||||
* - \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.
|
||||
*
|
||||
* 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.
|
||||
* The formulas for calculating mole fractions are
|
||||
* \f[
|
||||
* L^{sum} = \frac{1}{\tilde{M}_o X_o} = \frac{1}{\tilde{M}_o} + \sum_{i\ne o} m_i
|
||||
* \f]
|
||||
* Then,
|
||||
* \f[
|
||||
* X_o = \frac{1}{\tilde{M}_o L^{sum}}
|
||||
* \f]
|
||||
* \f[
|
||||
* X_i = \frac{m_i}{L^{sum}}
|
||||
* \f]
|
||||
* It is currently an error if the solvent mole fraction is attempted to be set
|
||||
* to a value lower than \f$X_o^{min}\f$.
|
||||
*
|
||||
* @param molal Input vector of molalities. Length: m_kk.
|
||||
*/
|
||||
|
|
@ -338,48 +471,87 @@ namespace Cantera {
|
|||
virtual void getUnitsStandardConc(double *uA, int k = 0,
|
||||
int sizeUA = 6);
|
||||
|
||||
/**
|
||||
* Get the array of non-dimensional activities (molality
|
||||
* based for this class and classes that derive from it) at
|
||||
* the current solution temperature, pressure, and
|
||||
* solution concentration.
|
||||
|
||||
//! Get the array of non-dimensional activities (molality
|
||||
//! based for this class and classes that derive from it) at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* All standard state properties for molality-based phases are
|
||||
* evaluated consistent with the molality scale. Therefore, this function
|
||||
* must return molality-based activities.
|
||||
*
|
||||
* @param ac Output vector of activities. Length: m_kk.
|
||||
* \f[
|
||||
* a_i^\triangle = \gamma_k^{\triangle} \frac{m_k}{m^\triangle}
|
||||
* \f]
|
||||
*
|
||||
* This function must be implemented in derived classes.
|
||||
*
|
||||
* @param ac Output vector of molality-based activities. Length: m_kk.
|
||||
*/
|
||||
virtual void getActivities(doublereal* ac) const {
|
||||
err("getActivities");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array of non-dimensional activity coefficients at
|
||||
* the current solution temperature, pressure, and
|
||||
* solution concentration.
|
||||
//! Get the array of non-dimensional activity coefficients at
|
||||
//! the current solution temperature, pressure, and solution concentration.
|
||||
/*!
|
||||
* These are mole-fraction based activity coefficients. In this
|
||||
* object, their calculation is based on translating the values
|
||||
* of the molality based activity coefficients.
|
||||
* See Denbigh p. 278 for a thorough discussion
|
||||
* of the molality-based activity coefficients.
|
||||
* See Denbigh p. 278 for a thorough discussion.
|
||||
*
|
||||
* The molar-based activity coefficients \f$ \gamma_k \f$ may be calculated from the
|
||||
* molality-based
|
||||
* activity coefficients, \f$ \gamma_k^\triangle \f$ by the following
|
||||
* formula.
|
||||
* \f[
|
||||
* \gamma_k = \frac{\gamma_k^\triangle}{X_o}
|
||||
* \f]
|
||||
*
|
||||
* For purposes of establishing a convention, the molar activity coefficient of the
|
||||
* solvent is set equal to the molality-based activity coefficient of the
|
||||
* solvent:
|
||||
*
|
||||
* \f[
|
||||
* \gamma_o = \gamma_o^\triangle
|
||||
* \f]
|
||||
*
|
||||
* Derived classes don't need to overload this function. This function is
|
||||
* handled at this level.
|
||||
*
|
||||
* @param ac Output vector containing the mole-fraction based activity coefficients.
|
||||
* length: m_kk.
|
||||
*/
|
||||
void 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
|
||||
//! 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.
|
||||
*
|
||||
* @param acMolality Output vector containing the molality based activity coefficients.
|
||||
* length: m_kk.
|
||||
*/
|
||||
virtual void getMolalityActivityCoefficients(doublereal *acMolality)
|
||||
const {
|
||||
virtual void getMolalityActivityCoefficients(doublereal *acMolality) const {
|
||||
err("getMolalityActivityCoefficients");
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the osmotic coefficient
|
||||
|
||||
//! Calculate the osmotic coefficient
|
||||
/*!
|
||||
* \f[
|
||||
* \phi = \frac{- ln(a_o)}{\tilde{M}_o \sum_{i \ne o} m_i}
|
||||
* \f]
|
||||
*
|
||||
* Note there are a few of definitions of the osmotic coefficient floating
|
||||
* around. We use the one defined in
|
||||
* (Activity Coefficients in Electrolyte Solutions, K. S. Pitzer
|
||||
* CRC Press, Boca Raton, 1991, p. 85, Eqn. 28). This definition is most clearly
|
||||
* related to theoretical calculation.
|
||||
*
|
||||
* units = dimensionless
|
||||
*/
|
||||
virtual double osmoticCoefficient() const;
|
||||
|
|
@ -469,13 +641,12 @@ namespace Cantera {
|
|||
}
|
||||
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
/**
|
||||
* Set equation of state parameter values from XML
|
||||
* entries. This method is called by function importPhase in
|
||||
//! 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
|
||||
|
|
@ -488,10 +659,16 @@ namespace Cantera {
|
|||
* set to the "name":"molalities pairs found within that
|
||||
* XML block. The solvent concentration is then set
|
||||
* to everything else.
|
||||
*
|
||||
* The function first calls the overloaded function ,
|
||||
* VPStandardStateTP::setStateFromXML(), to pick up the parent class
|
||||
* behavior.
|
||||
*
|
||||
* usage: Overloaded functions should call this function
|
||||
* before carrying out their own behavior.
|
||||
*
|
||||
* @param state An XML_Node object corresponding to
|
||||
* the "state" entry for this phase in the input file.
|
||||
*
|
||||
*/
|
||||
virtual void setStateFromXML(const XML_Node& state);
|
||||
|
||||
|
|
@ -501,7 +678,8 @@ namespace Cantera {
|
|||
/// 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
|
||||
|
|
@ -585,10 +763,11 @@ namespace Cantera {
|
|||
* molal_solvent = 0 when xmol_solvent = 0.
|
||||
*/
|
||||
doublereal m_xmolSolventMIN;
|
||||
|
||||
//! This is the multiplication factor that goes inside
|
||||
//! log expressions involving the molalities of species.
|
||||
/*!
|
||||
* This is the multiplication factor that goes inside
|
||||
* log expressions involving the molalities of species.
|
||||
* Its equal to Wt_0 / 1000.
|
||||
* Its equal to Wt_0 / 1000,
|
||||
* where Wt_0 = weight of solvent (kg/kmol)
|
||||
*/
|
||||
doublereal m_Mnaught;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue