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:
Harry Moffat 2007-03-05 01:01:27 +00:00
parent a4f1ab3d74
commit f87e536ac3
8 changed files with 640 additions and 387 deletions

View file

@ -230,8 +230,8 @@ namespace Cantera {
* @param vol Output vector containing the standard state volumes. * @param vol Output vector containing the standard state volumes.
* Length: m_kk. * Length: m_kk.
*/ */
void IdealGasPhase::getStandardVolumes(doublereal *vol) const { void IdealGasPhase::getStandardVolumes(doublereal *vol) const {
doublereal tmp = _RT() / pressure(); double tmp = 1.0 / molarDensity();
for (int k = 0; k < m_kk; k++) { for (int k = 0; k < m_kk; k++) {
vol[k] = tmp; vol[k] = tmp;
} }
@ -292,15 +292,22 @@ namespace Cantera {
} }
} }
/** /**
* Returns the vector of nondimensional * Returns the vector of nondimensional
* constant pressure heat capacities of the reference state * constant pressure heat capacities of the reference state
* at the current temperature and reference pressure. * at the current temperature and reference pressure.
*/ */
void IdealGasPhase::getCp_R_ref(doublereal *cprt) const { void IdealGasPhase::getCp_R_ref(doublereal *cprt) const {
const array_fp& _cpr = cp_R_ref(); const array_fp& _cpr = cp_R_ref();
copy(_cpr.begin(), _cpr.end(), cprt); 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 ------------------------------- // new methods defined here -------------------------------

View file

@ -472,6 +472,15 @@ namespace Cantera {
*/ */
virtual void getCp_R_ref(doublereal *cprt) const; 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 ------------------------------------------------- /// @name New Methods Defined Here -------------------------------------------------

View file

@ -45,19 +45,23 @@ namespace Cantera {
* *
* *
* The calculation of thermodynamic functions within %ThermoPhase is * The calculation of thermodynamic functions within %ThermoPhase is
* broken down roughly into two or more steps. First, the standard state properties * broken down roughly into two or more steps. First, the standard state
* of all of the species are calculated at the current temperature and at either * 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 * the current pressure or at a reference pressure. If the calculation is
* carried out at a refereence pressure instead of at the current pressure * carried out at a refereence pressure instead of at the current pressure
* the calculation is called a "reference state properties" calculation, * the calculation is called a "reference state properties" calculation,
* just to make the distinction (even though it may be considered to be * just to make the distinction (even though it may be considered to be
* a fixed-pressure standard-state calculation). The next step is to * 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. * functions then are considered to be at the standard state of each species.
* Lastly the mixing contributions are added to arrive at the thermodynamic * Lastly the mixing contributions are added to arrive at the thermodynamic
* functions for the solution. * 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 * the reference state of each species, the standard state values for
* each species, the thermodynamic functions for solution values, both * 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 * 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)). * getPartialMolarEnthalpies(double *hbar)).
* At each level, functions for the enthalpy, entropy, Gibbs free energy, * At each level, functions for the enthalpy, entropy, Gibbs free energy,
* internal energy, and volume are provided. So, 5 levels (reference state, * 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 * and 5 functions multiplied together makes 25 possible functions. That's
* why %ThermoPhase is such a large class. * why %ThermoPhase is such a large class.
* *
@ -97,7 +102,8 @@ namespace Cantera {
* . * .
* *
* The following additional objects inherit from %ThermoPhase. Most of these * 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 * - DebyeHuckel in thermo/DebyeHuckel.h
* - SingleSpeciesTP in thermo/SingleSpeciesTP.h * - SingleSpeciesTP in thermo/SingleSpeciesTP.h
@ -296,7 +302,7 @@ namespace Cantera {
//! Return the thermodynamic pressure (Pa). //! 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, * mass density, temperature, and mass fractions are stored,
* this method should use these values to implement the * this method should use these values to implement the
* mechanical equation of state \f$ P(T, \rho, Y_1, \dots, * mechanical equation of state \f$ P(T, \rho, Y_1, \dots,
@ -323,16 +329,16 @@ namespace Cantera {
err("setPressure"); err("setPressure");
} }
//! Returns the isothermal compressibility. Units: 1/Pa. //! Returns the isothermal compressibility. Units: 1/Pa.
/*! /*!
* The isothermal compressibility is defined as * The isothermal compressibility is defined as
* \f[ * \f[
* \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
* \f] * \f]
*/ */
virtual doublereal isothermalCompressibility() const { virtual doublereal isothermalCompressibility() const {
err("isothermalCompressibility"); return -1.0; err("isothermalCompressibility"); return -1.0;
} }
//! Return the volumetric thermal expansion coefficient. Units: 1/K. //! Return the volumetric thermal expansion coefficient. Units: 1/K.
/*! /*!
@ -394,26 +400,26 @@ namespace Cantera {
* @{ * @{
*/ */
/**
* This method returns the convention used in specification //! This method returns the convention used in specification
* of the activities, of which there are currently two, molar- //! of the activities, of which there are currently two, molar-
* and molality-based conventions. //! and molality-based conventions.
* /*!
* Currently, there are two activity conventions: * Currently, there are two activity conventions:
* - Molar-based activities * - Molar-based activities
* Unit activity of species at either a hypothetical pure * %Unit activity of species at either a hypothetical pure
* solution of the species or at a hypothetical * solution of the species or at a hypothetical
* pure ideal solution at infinite dilution * pure ideal solution at infinite dilution
* cAC_CONVENTION_MOLAR 0 * cAC_CONVENTION_MOLAR 0
* - default * - default
* *
* - Molality-based acvtivities * - Molality-based acvtivities
* (unit activity of solutes at a hypothetical 1 molal * (unit activity of solutes at a hypothetical 1 molal
* solution referenced to infinite dilution at all * solution referenced to infinite dilution at all
* pressures and temperatures). * pressures and temperatures).
* cAC_CONVENTION_MOLALITY 1 * cAC_CONVENTION_MOLALITY 1
*/ */
virtual int activityConvention() const; virtual int activityConvention() const;
//! This method returns an array of generalized concentrations //! This method returns an array of generalized concentrations
@ -478,7 +484,7 @@ namespace Cantera {
* units are needed. Usually, MKS units are assumed throughout * units are needed. Usually, MKS units are assumed throughout
* the program and in the XML input files. * 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. * of (kmol/m3) for all species.
* Inherited classes are responsible for overriding the default * Inherited classes are responsible for overriding the default
* values if necessary. * values if necessary.
@ -498,39 +504,35 @@ namespace Cantera {
virtual void getUnitsStandardConc(double *uA, int k = 0, virtual void getUnitsStandardConc(double *uA, int k = 0,
int sizeUA = 6); int sizeUA = 6);
/** //! Get the array of non-dimensional activities at
* Get the array of non-dimensional activities at //! the current solution temperature, pressure, and solution concentration.
* the current solution temperature, pressure, and /*!
* solution concentration. *
* * We resolve this function at this level by calling
* We resolve this function at this level by calling * on the activityConcentration function. However,
* on the activityConcentration function. However, * derived classes may want to override this default
* derived classes may want to override this default * implementation.
* implementation. *
* * @param a Output vector of activities. Length: m_kk.
* @param a Output vector of activities. Length: m_kk. */
*/ virtual void getActivities(doublereal* a);
virtual void getActivities(doublereal* a);
/** //! Get the array of non-dimensional molar-based activity coefficients at
* Get the array of non-dimensional molar-based //! the current solution temperature, pressure, and solution concentration.
* activity coefficients at /*!
* the current solution temperature, pressure, and * @param ac Output vector of activity coefficients. Length: m_kk.
* solution concentration. */
* virtual void getActivityCoefficients(doublereal* ac) const {
* @param ac Output vector of activity coefficients. Length: m_kk. if (m_kk == 1) {
*/ ac[0] = 1.0;
virtual void getActivityCoefficients(doublereal* ac) const {
if (m_kk == 1) {
ac[0] = 1.0;
} else { } else {
err("getActivityCoefficients"); 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 * Get the array of non-dimensional species chemical potentials
@ -559,21 +561,21 @@ namespace Cantera {
err("getChemPotentials"); err("getChemPotentials");
} }
//! Get the species electrochemical potentials. //! Get the species electrochemical potentials.
/*! /*!
* These are partial molar quantities. This method adds a term \f$ Fz_k * These are partial molar quantities. This method adds a term \f$ Fz_k
* \phi_k \f$ to each chemical potential. * \phi_k \f$ to each chemical potential.
* *
* @param mu Output vector of species electrochemical * @param mu Output vector of species electrochemical
* potentials. Length: m_kk. Units: J/kmol * potentials. Length: m_kk. Units: J/kmol
*/ */
void getElectrochemPotentials(doublereal* mu) const { void getElectrochemPotentials(doublereal* mu) const {
getChemPotentials(mu); getChemPotentials(mu);
double ve = Faraday * electricPotential(); double ve = Faraday * electricPotential();
for (int k = 0; k < m_kk; k++) { for (int k = 0; k < m_kk; k++) {
mu[k] += ve*charge(k); mu[k] += ve*charge(k);
}
} }
}
//! Get the species partial molar enthalpies. Units: J/kmol. //! Get the species partial molar enthalpies. Units: J/kmol.
/*! /*!
@ -1083,15 +1085,15 @@ namespace Cantera {
*/ */
bool getElementPotentials(doublereal* lambda) const; bool getElementPotentials(doublereal* lambda) const;
//@} //@}
//--------------------------------------------------------- //---------------------------------------------------------
/// @name Critical State Properties. /// @name Critical State Properties.
/// These methods are only implemented by some subclasses, and may /// These methods are only implemented by some subclasses, and may
/// be moved out of ThermoPhase at a later date. /// be moved out of ThermoPhase at a later date.
//@{ //@{
/// Critical temperature (K). /// Critical temperature (K).
virtual doublereal critTemperature() const { virtual doublereal critTemperature() const {
@ -1136,7 +1138,7 @@ namespace Cantera {
} }
//@} //@}
//! @name Initialization Methods - For Internal Use (%ThermoPhase) //! @name Initialization Methods - For Internal Use (%ThermoPhase)
@ -1172,20 +1174,23 @@ namespace Cantera {
} }
/**
* @internal Install a species thermodynamic property //! Install a species thermodynamic property manager.
* manager. The species thermodynamic property manager /*!
* computes properties of the pure species for use in * The species thermodynamic property manager
* constructing solution properties. It is meant for internal * computes properties of the pure species for use in
* use, and some classes derived from ThermoPhase may not use * constructing solution properties. It is meant for internal
* any species thermodynamic property manager. This method is * use, and some classes derived from ThermoPhase may not use
* called by function importPhase() in importCTML.cpp. * 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. * @param spthermo input pointer to the species thermodynamic property
*/ * manager.
void setSpeciesThermo(SpeciesThermo* spthermo) *
{ m_spthermo = spthermo; } * @internal
*/
void setSpeciesThermo(SpeciesThermo* spthermo)
{ m_spthermo = spthermo; }
/** /**
* @internal Return a reference to the species thermodynamic property * @internal Return a reference to the species thermodynamic property
@ -1331,21 +1336,22 @@ namespace Cantera {
*/ */
virtual void setParametersFromXML(const XML_Node& eosdata) {} virtual void setParametersFromXML(const XML_Node& eosdata) {}
/**
* Set the initial state of the phase to the conditions //! Set the initial state of the phase to the conditions
* specified in the state XML element. //! specified in the state XML element.
* /*!
* This method sets the temperature, pressure, and mole *
* fraction vector to a set default value. * 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 * @param state AN XML_Node object corresponding to
* input file. * the "state" entry for this phase in the
*/ * input file.
virtual void setStateFromXML(const XML_Node& state); */
virtual void setStateFromXML(const XML_Node& state);
//@} //@}
protected: protected:

View file

@ -473,7 +473,7 @@ namespace Cantera {
} }
} }
/** /*
* The standard concentration \f$ C^0_k \f$ used to normalize * The standard concentration \f$ C^0_k \f$ used to normalize
* the generalized concentration. In many cases, this quantity * the generalized concentration. In many cases, this quantity
* will be the same for all species in a phase - for example, * will be the same for all species in a phase - for example,
@ -678,7 +678,7 @@ namespace Cantera {
} }
} }
/** /*
* *
* getPartialMolarEntropies() (virtual, const) * getPartialMolarEntropies() (virtual, const)
* *
@ -910,10 +910,7 @@ namespace Cantera {
getStandardChemPotentials(gpure); getStandardChemPotentials(gpure);
} }
/** /*
*
* getEnthalpy_RT() (virtual, const)
*
* Get the array of nondimensional Enthalpy functions for the ss * Get the array of nondimensional Enthalpy functions for the ss
* species at the current <I>T</I> and <I>P</I> of the solution. * species at the current <I>T</I> and <I>P</I> of the solution.
* We assume an incompressible constant partial molar * We assume an incompressible constant partial molar
@ -942,9 +939,7 @@ namespace Cantera {
} }
} }
/** /*
* getEntropy_R() (virtual, const)
*
* Get the nondimensional Entropies for the species * Get the nondimensional Entropies for the species
* standard states at the current T and P of the solution. * standard states at the current T and P of the solution.
* *
@ -952,6 +947,9 @@ namespace Cantera {
* due to the zero volume expansivity: * due to the zero volume expansivity:
* i.e., (dS/dp)_T = (dV/dT)_P = 0.0 * 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] * @param sr Vector of length m_kk, which on return sr[k]
* will contain the nondimensional * will contain the nondimensional
* standard state entropy of species k. * standard state entropy of species k.
@ -965,7 +963,7 @@ namespace Cantera {
} }
} }
/** /*
* Get the nondimensional heat capacity at constant pressure * Get the nondimensional heat capacity at constant pressure
* function for the species * function for the species
* standard states at the current T and P of the solution. * 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 * \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$. * 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] * @param cpr Vector of length m_kk, which on return cpr[k]
* will contain the nondimensional * will contain the nondimensional
* constant pressure heat capacity for species k. * constant pressure heat capacity for species k.
@ -988,7 +989,7 @@ namespace Cantera {
} }
} }
/** /*
* Get the molar volumes of each species in their standard * Get the molar volumes of each species in their standard
* states at the current * states at the current
* <I>T</I> and <I>P</I> of the solution. * <I>T</I> and <I>P</I> of the solution.

View file

@ -105,6 +105,11 @@ namespace Cantera {
* *
* <b> Specification of Species Standard %State Properties </b> * <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 * It is assumed that the reference state thermodynamics may be
* obtained by a pointer to a populated species thermodynamic property * 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. * The enthalpy function is given by the following relation.
* *
* \f[ * \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] * \f]
* *
* For an incompressible, * For an incompressible,
@ -133,20 +138,34 @@ namespace Cantera {
* enthalpy to compute the molar internal energy. * enthalpy to compute the molar internal energy.
* *
* \f[ * \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] * \f]
* *
* The standard state heat capacity and entropy are independent * The standard state heat capacity and entropy are independent
* of pressure. The standard state gibbs free energy is obtained * of pressure. The standard state gibbs free energy is obtained
* from the enthalpy and entropy functions. * 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> * <b> Specification of Solution Thermodynamic Properties </b>
* *
* All solution properties are obtained from the standard state * All solution properties are obtained from the standard state
* species functions, since there is only one species in the phase. * 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 * The standard concentration is equal to 1.0. This means that the
* kinetics operator works on an (activities basis). Since this * 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 * appear in the rate constant expression, since it's a stoichiometric
* phase and the activity is always equal to 1.0. * 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 * The constructor for this phase is NOT located in the default ThermoFactory
* for %Cantera. However, a new %StoichSubstanceSSTP may be created by * for %Cantera. However, a new %StoichSubstanceSSTP may be created by
@ -333,17 +352,22 @@ namespace Cantera {
* thrown. * thrown.
*/ */
/** //! Return the thermodynamic pressure (Pa).
* Pressure. Units: Pa. /*!
* For this incompressible system, we return the internally storred * For this incompressible system, we return the internally storred
* independent value of the pressure. * independent value of the pressure.
*/ */
virtual doublereal pressure() const; virtual doublereal pressure() const;
/** //! Set the internally storred pressure (Pa) at constant
* Set the pressure at constant temperature. Units: Pa. //! temperature and composition
* This method sets a constant within the object. /*!
* The mass density is not a function of pressure. * 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); virtual void setPressure(doublereal p);
@ -395,7 +419,7 @@ namespace Cantera {
* NOTE: This is an overwritten function from the State.h * NOTE: This is an overwritten function from the State.h
* class * class
* *
* @param density Input density (kg/m^3). * @param rho Input density (kg/m^3).
*/ */
void setDensity(doublereal rho); 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 * @name Activities, Standard States, and Activity Concentrations
@ -517,9 +507,10 @@ namespace Cantera {
*/ */
virtual void getActivityConcentrations(doublereal* c) const; 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 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, * 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 * 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 * 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 * concentration is species-specific (e.g. surface species of
* different sizes), this method may be called with an * different sizes), this method may be called with an
* optional parameter indicating the species. * 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; virtual doublereal standardConcentration(int k=0) const;
/** //! Natural logarithm of the standard concentration of the kth species.
* Returns the 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; virtual doublereal logStandardConc(int k=0) const;
/** //! Returns the units of the standard and generalized concentrations.
* Returns the units of the standard and generalized /*!
* concentrations Note they have the same units, as their * Note they have the same units, as their
* ratio is defined to be equal to the activity of the kth * ratio is defined to be equal to the activity of the kth
* species in the solution, which is unitless. * species in the solution, which is unitless.
* *
@ -546,6 +548,12 @@ namespace Cantera {
* units are needed. Usually, MKS units are assumed throughout * units are needed. Usually, MKS units are assumed throughout
* the program and in the XML input files. * 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[0] = kmol units - default = 1
* uA[1] = m units - default = -nDim(), the number of spatial * uA[1] = m units - default = -nDim(), the number of spatial
* dimensions in the Phase class. * dimensions in the Phase class.
@ -553,25 +561,37 @@ namespace Cantera {
* uA[3] = Pa(pressure) units - default = 0; * uA[3] = Pa(pressure) units - default = 0;
* uA[4] = Temperature units - default = 0; * uA[4] = Temperature units - default = 0;
* uA[5] = time 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, virtual void getUnitsStandardConc(double *uA, int k = 0,
int sizeUA = 6); int sizeUA = 6);
/** //! Get the array of non-dimensional activities at
* Get the array of non-dimensional molality-based activities at //! the current solution temperature, pressure, and solution concentration.
* 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). * (note solvent is on molar scale).
*
* @param ac Output vector of activities. Length: m_kk.
*/ */
virtual void getActivities(doublereal* ac) const; virtual void getActivities(doublereal* ac) const;
/** //! Get the array of non-dimensional molality-based
* Get the array of non-dimensional molality-based //! activity coefficients at
* activity coefficients at //! the current solution temperature, pressure, and solution concentration.
* the current solution temperature, pressure, and /*!
* solution concentration. * note solvent is on molar scale. The solvent molar
* (note solvent is on molar scale. The solvent molar * based activity coefficient is returned.
* based activity coefficient is returned). *
* @param acMolality Vector of Molality-based activity coefficients
* Length: m_kk
*/ */
virtual void virtual void
getMolalityActivityCoefficients(doublereal* acMolality) const; getMolalityActivityCoefficients(doublereal* acMolality) const;
@ -580,19 +600,22 @@ namespace Cantera {
/// @name Partial Molar Properties of the Solution ----------------- /// @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 * This function returns a vector of chemical potentials of the
* species in solution. * species in solution.
*
* \f[ * \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] * \f]
* or another way to phrase this is * or another way to phrase this is
* \f[ *
* \mu_k = \mu^o_k(T,p) + R T ln(X_k) * where
* \f] *
* where \f$ \mu^o_k(T,p) = \mu^{ref}_k(T) + V_k * (p - p_o)\f$ * @param mu Output vector of species chemical
* potentials. Length: m_kk. Units: J/kmol
*/ */
virtual void getChemPotentials(doublereal* mu) const; virtual void getChemPotentials(doublereal* mu) const;
@ -662,15 +685,22 @@ namespace Cantera {
*/ */
virtual void getPartialMolarEntropies(doublereal* sbar) const; virtual void getPartialMolarEntropies(doublereal* sbar) const;
/** //! Get the species partial molar volumes. Units: m^3/kmol.
* 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
*
* For this solution, thepartial molar volumes are equal to the
* constant species molar volumes. * 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; 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; 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. * Get the standard state chemical potentials of the species.
* This is the array of chemical potentials at unit activity * This is the array of chemical potentials at unit activity
* \f$ \mu^0_k(T,P) \f$. * \f$ \mu^0_k(T,P) \f$.
@ -692,87 +729,119 @@ namespace Cantera {
* equilibrium constant Kc. Therefore, Kc will also depend * equilibrium constant Kc. Therefore, Kc will also depend
* on T and P. This is the norm for liquid and solid systems. * 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; virtual void getStandardChemPotentials(doublereal* mu) const;
/** //! Get the nondimensional Gibbs functions for the species
* Get the nondimensional gibbs function for the species //! in their standard states at the current <I>T</I> and <I>P</I> of the solution.
* standard states at the current T and P of the solution. /*!
* * The standard states are on the unit molality basis.
* \f[ * \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] * \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$. * species <I>k</I> at the reference pressure, \f$P_{ref}\f$.
* *
* @param grt Vector of length m_kk, which on return sr[k] * @param grt Output vector of nondimensional standard state gibbs free energies
* will contain the nondimensional * Length: m_kk.
* standard state gibbs function for species k.
*/ */
virtual void getGibbs_RT(doublereal* grt) const; virtual void getGibbs_RT(doublereal* grt) const;
/** //! Get the Gibbs functions for the standard
* Get the nondimensional Gibbs functions for the standard //! state of the species at the current <I>T</I> and <I>P</I> of the solution
* state of the species at the current T and P. /*!
* 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; virtual void getPureGibbs(doublereal* gpure) const;
/** //! Get the nondimensional Enthalpy functions for the species
* //! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
* getEnthalpy_RT() (virtual, const) /*!
* * The standard states are on the unit molality basis.
* 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.
* We assume an incompressible constant partial molar * We assume an incompressible constant partial molar
* volume here: * volume for the solutes.
* \f[ *
* h^0_k(T,P) = h^{ref}_k(T) + (P - P_{ref}) * V_k * \f[
* \f] * h^{\triangle}_k(T,P) = h^{\triangle,ref}_k(T) + (P - P_{ref}) * V_k
* where \f$V_k\f$ is the molar volume of SS species <I>k<\I>. * \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 * \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; virtual void getEnthalpy_RT(doublereal* hrt) const;
/** //! Get the array of nondimensional Entropy functions for the
* Get the nondimensional Entropies for the species //! standard state species at the current <I>T</I> and <I>P</I> of the solution.
* standard states at the current T and P 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 * Note, this is equal to the reference state entropies
* due to the zero volume expansivity: * due to the zero volume expansivity:
* i.e., (dS/dp)_T = (dV/dT)_P = 0.0 * i.e., (dS/dp)_T = (dV/dT)_P = 0.0
* *
* @param sr Vector of length m_kk, which on return sr[k] * The solvent water entropy is obtained from a pure water
* will contain the nondimensional * equation of state model.
* standard state entropy of species k. *
* @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; virtual void getEntropy_R(doublereal* sr) const;
/** //! Get the nondimensional Heat Capacities at constant
* Get the nondimensional heat capacity at constant pressure //! pressure for the species standard states
* function for the species //! at the current <I>T</I> and <I>P</I> of the solution
* standard states at the current T and P of the solution. /*!
* The standard states are on the unit molality basis.
* For the solutes:
* \f[ * \f[
* Cp^0_k(T,P) = Cp^{ref}_k(T) * Cp^\triangle_k(T,P) = Cp^{\triangle,ref}_k(T)
* \f] * \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 * \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$. * 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] * @param cpr Vector of length m_kk, which on return cpr[k]
* will contain the nondimensional * 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; virtual void getCp_R(doublereal* cpr) const;
/** //! Get the molar volumes of the species standard states at the current
* Get the molar volumes of each species in their standard //! <I>T</I> and <I>P</I> of the solution.
* 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 * 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; 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 * It sets the state such that the chemical potentials satisfy
* \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m} * \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m}
* \left(\frac{\lambda_m} {\hat R T}\right) \f] where * \left(\frac{\lambda_m} {\hat R T}\right) \f] where
* \f$ \lambda_m \f$ is the element potential of element m. The * \f$ \lambda_m \f$ is the element potential of element m. The
* temperature is unchanged. Any phase (ideal or not) that * temperature is unchanged. Any phase (ideal or not) that
* implements this method can be equilibrated by ChemEquil. * 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) { virtual void setToEquilState(const doublereal* lambda_RT) {
err("setToEquilState"); err("setToEquilState");
@ -827,27 +899,38 @@ namespace Cantera {
//@} //@}
/** //! Set the equation of state parameters
/*!
* @internal * @internal
* Set equation of state parameters. The number and meaning of * The number and meaning of these depends on the subclass.
* these depends on the subclass.
* @param n number of parameters
* @param c array of \i n coefficients
* *
* @param n number of parameters
* @param c array of \a n coefficients
*/ */
virtual void setParameters(int n, doublereal* c); 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); virtual void getParameters(int &n, doublereal * const c);
/** //! 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 *
* This method is called by function importPhase() in
* file importCTML.cpp when processing a phase definition in * file importCTML.cpp when processing a phase definition in
* an input file. It should be overloaded in subclasses to set * an input file. It should be overloaded in subclasses to set
* any parameters that are specific to that particular phase * 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 * @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); virtual void setParametersFromXML(const XML_Node& eosdata);
@ -892,16 +975,6 @@ namespace Cantera {
* -------------- Utilities ------------------------------- * -------------- 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 * Return a reference to the species thermodynamic property
@ -926,10 +999,9 @@ namespace Cantera {
*/ */
virtual void initThermo(); virtual void initThermo();
/*
* Initialization of a DebyeHuckel phase using an //! Initialization of a DebyeHuckel phase using an xml file
* xml file /*!
*
* This routine is a precursor to initThermo(XML_Node*) * This routine is a precursor to initThermo(XML_Node*)
* routine, which does most of the work. * routine, which does most of the work.
* *
@ -971,20 +1043,6 @@ namespace Cantera {
virtual void initThermoXML(XML_Node& phaseNode, std::string id); 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 * Value of the Debye Huckel constant as a function of temperature
* and pressure. * and pressure.

View file

@ -763,16 +763,6 @@ namespace Cantera {
* -------------- Utilities ------------------------------- * -------------- 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 * Return a reference to the species thermodynamic property

View file

@ -357,7 +357,7 @@ namespace Cantera {
* - Activities, Standard States, Activity Concentrations ----------- * - Activities, Standard States, Activity Concentrations -----------
*/ */
/** /*
* This method returns the activity convention. * This method returns the activity convention.
* Currently, there are two activity conventions * Currently, there are two activity conventions
* Molar-based activities * Molar-based activities
@ -380,7 +380,7 @@ namespace Cantera {
return cAC_CONVENTION_MOLALITY; return cAC_CONVENTION_MOLALITY;
} }
/** /*
* Get the array of non-dimensional activity coefficients at * Get the array of non-dimensional activity coefficients at
* the current solution temperature, pressure, and * the current solution temperature, pressure, and
* solution concentration. * solution concentration.
@ -406,7 +406,7 @@ namespace Cantera {
} }
} }
/** /*
* osmotic coefficient: * osmotic coefficient:
* *
* Calculate the osmotic coefficient of the solvent. Note there * Calculate the osmotic coefficient of the solvent. Note there
@ -452,7 +452,7 @@ namespace Cantera {
return 0; return 0;
} }
/** /*
* Returns the units of the standard and general concentrations * Returns the units of the standard and general concentrations
* Note they have the same units, as their divisor is * Note they have the same units, as their divisor is
* defined to be equal to the activity of the kth species * defined to be equal to the activity of the kth species
@ -485,7 +485,6 @@ namespace Cantera {
} }
} }
/* /*
* Set the thermodynamic state. * Set the thermodynamic state.
*/ */
@ -501,7 +500,7 @@ namespace Cantera {
} }
} }
/** /*
* Set the temperature (K), pressure (Pa), and molalities * Set the temperature (K), pressure (Pa), and molalities
* (gmol kg-1) of the solutes * (gmol kg-1) of the solutes
*/ */
@ -512,14 +511,18 @@ namespace Cantera {
setPressure(p); 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) { void MolalityVPSSTP::setState_TPM(doublereal t, doublereal p, compositionMap& m) {
setMolalitiesByName(m); setMolalitiesByName(m);
setTemperature(t); setTemperature(t);
setPressure(p); 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) { void MolalityVPSSTP::setState_TPM(doublereal t, doublereal p, const std::string& m) {
setMolalitiesByName(m); setMolalitiesByName(m);
setTemperature(t); setTemperature(t);
@ -527,7 +530,7 @@ namespace Cantera {
} }
/** /*
* @internal Initialize. This method is provided to allow * @internal Initialize. This method is provided to allow
* subclasses to perform any initialization required after all * subclasses to perform any initialization required after all
* species have been added. For example, it might be used to * species have been added. For example, it might be used to
@ -555,7 +558,7 @@ namespace Cantera {
m_molalities.resize(m_kk); m_molalities.resize(m_kk);
} }
/** /*
* initThermoXML() (virtual from ThermoPhase) * initThermoXML() (virtual from ThermoPhase)
* Import and initialize a ThermoPhase object * Import and initialize a ThermoPhase object
* *

View file

@ -27,13 +27,134 @@ namespace Cantera {
* @ingroup thermoprops * @ingroup thermoprops
*/ */
/** /*!
* MolalityVPSSTP is a derived class of ThermoPhase that handles * MolalityVPSSTP is a derived class of ThermoPhase that handles
* variable pressure standard state methods for calculating * variable pressure standard state methods for calculating
* thermodynamic properties that are further based on * thermodynamic properties that are further based on
* molality-scaled activities. * molality-scaled activities.
* These include most of the methods * This category incorporates most of the methods
* for calculating liquid electrolyte thermodynamics. * 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 { 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 * zero. Subclasses should define this to return a unique
* non-zero value. Known constants defined for this purpose are * non-zero value. Known constants defined for this purpose are
* listed in mix_defs.h. The MolalityVPSSTP class also returns * listed in mix_defs.h. The MolalityVPSSTP class also returns
@ -130,9 +253,7 @@ namespace Cantera {
*/ */
void setMoleFSolventMin(doublereal xmolSolventMIN); void setMoleFSolventMin(doublereal xmolSolventMIN);
/** //! Returns the solvent index.
* Returns the solvent index.
*/
int solventIndex() const; int solventIndex() const;
/** /**
@ -141,60 +262,72 @@ namespace Cantera {
*/ */
doublereal moleFSolventMin() const; doublereal moleFSolventMin() const;
//! Calculates the molality of all species and stores the result internally.
//! Calculates the molality of all species andstores the result internally.
/*! /*!
* We calculate the vector of molalities of the species * We calculate the vector of molalities of the species
* in the phase and store the result internally: * in the phase and store the result internally:
* \f[ * \f[
* m_i = (n_i) / (1000 * M_o * n_{o,p}) * m_i = \frac{X_i}{1000 * M_o * X_{o,p}}
* \f] * \f]
* where * where
* - \f$ M_o \f$ is the molecular weight of the solvent * - \f$ M_o \f$ is the molecular weight of the solvent
* - \f$ n_o \f$ is the mole fraction of the solvent * - \f$ X_o \f$ is the mole fraction of the solvent
* - \f$ n_i \f$ is the mole fraction of the solute. * - \f$ X_i \f$ is the mole fraction of the solute.
* - \f$ n_{o,p} = max (n_{o, min}, n_o) \f$ * - \f$ X_{o,p} = max (X_{o}^{min}, X_o) \f$
* - \f$ n_{o,min} \f$ = minimum mole fraction of solvent allowed * - \f$ X_{o}^{min} \f$ = minimum mole fraction of solvent allowed
* in the denominator. * in the denominator.
*/ */
void calcMolalities() const; void calcMolalities() const;
//! This function will return the molalities of the species. //! This function will return the molalities of the species.
/*! /*!
* We calculate the vector of molalities of the species * We calculate the vector of molalities of the species
* in the phase * in the phase
* \f[ * \f[
* m_i = (n_i) / (1000 * M_o * n_{o,p}) * m_i = \frac{X_i}{1000 * M_o * X_{o,p}}
* \f] * \f]
* where * where
* - \f$ M_o \f$ is the molecular weight of the solvent * - \f$ M_o \f$ is the molecular weight of the solvent
* - \f$ n_o \f$ is the mole fraction of the solvent * - \f$ X_o \f$ is the mole fraction of the solvent
* - \f$ n_i \f$ is the mole fraction of the solute. * - \f$ X_i \f$ is the mole fraction of the solute.
* - \f$ n_{o,p} = max (n_{o, min}, n_o) \f$ * - \f$ X_{o,p} = \max (X_{o}^{min}, X_o) \f$
* - \f$ n_{o,min} \f$ = minimum mole fraction of solvent allowed * - \f$ X_{o}^{min} \f$ = minimum mole fraction of solvent allowed
* in the denominator. * in the denominator.
* *
* @param molal Output vector of molalities. Length: m_kk. * @param molal Output vector of molalities. Length: m_kk.
*/ */
void getMolalities(doublereal * const molal) const; 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 * Note, the entry for the solvent is not used.
* solvent is not used.
* We are supplied with the molalities of all of the * We are supplied with the molalities of all of the
* solute species. We then calculate the mole fractions of all * 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) * The formulas for calculating mole fractions are
* * \f[
* where M_o is the molecular weight of the solvent * L^{sum} = \frac{1}{\tilde{M}_o X_o} = \frac{1}{\tilde{M}_o} + \sum_{i\ne o} m_i
* n_o is the mole fraction of the solvent * \f]
* n_i is the mole fraction of the solute. * Then,
* n_o_p = max (n_o_min, n_o) * \f[
* n_o_min = minimum mole fraction of solvent allowed * X_o = \frac{1}{\tilde{M}_o L^{sum}}
* in the denominator. * \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. * @param molal Input vector of molalities. Length: m_kk.
*/ */
@ -338,48 +471,87 @@ namespace Cantera {
virtual void getUnitsStandardConc(double *uA, int k = 0, virtual void getUnitsStandardConc(double *uA, int k = 0,
int sizeUA = 6); int sizeUA = 6);
/**
* Get the array of non-dimensional activities (molality //! Get the array of non-dimensional activities (molality
* based for this class and classes that derive from it) at //! based for this class and classes that derive from it) at
* the current solution temperature, pressure, and //! the current solution temperature, pressure, and solution concentration.
* 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 { virtual void getActivities(doublereal* ac) const {
err("getActivities"); err("getActivities");
} }
/** //! Get the array of non-dimensional activity coefficients at
* Get the array of non-dimensional activity coefficients at //! the current solution temperature, pressure, and solution concentration.
* the current solution temperature, pressure, and /*!
* solution concentration.
* These are mole-fraction based activity coefficients. In this * These are mole-fraction based activity coefficients. In this
* object, their calculation is based on translating the values * object, their calculation is based on translating the values
* of the molality based activity coefficients. * of the molality-based activity coefficients.
* See Denbigh p. 278 for a thorough discussion * 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. * @param ac Output vector containing the mole-fraction based activity coefficients.
* length: m_kk. * length: m_kk.
*/ */
void getActivityCoefficients(doublereal* ac) const; void getActivityCoefficients(doublereal* ac) const;
/** //! Get the array of non-dimensional molality based
* Get the array of non-dimensional molality based //! activity coefficients at the current solution temperature,
* activity coefficients at the current solution temperature, //! pressure, and solution concentration.
* pressure, and solution concentration. /*!
* See Denbigh p. 278 for a thorough discussion * 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. * @param acMolality Output vector containing the molality based activity coefficients.
* length: m_kk. * length: m_kk.
*/ */
virtual void getMolalityActivityCoefficients(doublereal *acMolality) virtual void getMolalityActivityCoefficients(doublereal *acMolality) const {
const {
err("getMolalityActivityCoefficients"); 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 * units = dimensionless
*/ */
virtual double osmoticCoefficient() const; virtual double osmoticCoefficient() const;
@ -469,13 +641,12 @@ namespace Cantera {
} }
//@} //@}
/** //! 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 * This method is called by function importPhase() in
* file importCTML.cpp when processing a phase definition in * file importCTML.cpp when processing a phase definition in
* an input file. It should be overloaded in subclasses to set * an input file. It should be overloaded in subclasses to set
* any parameters that are specific to that particular phase * any parameters that are specific to that particular phase
@ -489,9 +660,15 @@ namespace Cantera {
* XML block. The solvent concentration is then set * XML block. The solvent concentration is then set
* to everything else. * 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 * @param state An XML_Node object corresponding to
* the "state" entry for this phase in the input file. * the "state" entry for this phase in the input file.
*
*/ */
virtual void setStateFromXML(const XML_Node& state); virtual void setStateFromXML(const XML_Node& state);
@ -501,7 +678,8 @@ namespace Cantera {
/// To see how they are used, see files importCTML.cpp and /// To see how they are used, see files importCTML.cpp and
/// ThermoFactory.cpp. /// ThermoFactory.cpp.
/**
/*!
* @internal Initialize. This method is provided to allow * @internal Initialize. This method is provided to allow
* subclasses to perform any initialization required after all * subclasses to perform any initialization required after all
* species have been added. For example, it might be used to * species have been added. For example, it might be used to
@ -585,10 +763,11 @@ namespace Cantera {
* molal_solvent = 0 when xmol_solvent = 0. * molal_solvent = 0 when xmol_solvent = 0.
*/ */
doublereal m_xmolSolventMIN; 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 * Its equal to Wt_0 / 1000,
* log expressions involving the molalities of species.
* Its equal to Wt_0 / 1000.
* where Wt_0 = weight of solvent (kg/kmol) * where Wt_0 = weight of solvent (kg/kmol)
*/ */
doublereal m_Mnaught; doublereal m_Mnaught;