diff --git a/include/cantera/thermo/ConstDensityThermo.h b/include/cantera/thermo/ConstDensityThermo.h index 808dcc006..654f31f6e 100644 --- a/include/cantera/thermo/ConstDensityThermo.h +++ b/include/cantera/thermo/ConstDensityThermo.h @@ -16,12 +16,13 @@ namespace Cantera { -//! Overloads the virtual methods of class ThermoPhase to implement the -//! incompressible equation of state. +//! Overloads the virtual methods of class ThermoPhase to implement the +//! incompressible equation of state. /** * Specification of Solution Thermodynamic Properties * - * The density is assumed to be constant, no matter what the concentration of the solution. + * The density is assumed to be constant, no matter what the concentration of + * the solution. * * @ingroup thermoprops */ @@ -31,278 +32,109 @@ public: //! Constructor. ConstDensityThermo() {} - //! Copy Constructor - /*! - * @param right Object to be copied - */ ConstDensityThermo(const ConstDensityThermo& right); - - //! Assignment Operator - /*! - * @param right Object to be copied - */ ConstDensityThermo& operator=(const ConstDensityThermo& right); - - //! Duplication routine for objects which inherit from ThermoPhase - /*! - * This virtual routine can be used to duplicate objects - * derived from ThermoPhase even if the application only has - * a pointer to ThermoPhase to work with. - */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; //! Returns a constant corresponding to this class's equation of state virtual int eosType() const; - /// Molar enthalpy. Units: J/kmol. virtual doublereal enthalpy_mole() const; - - /// Molar entropy. Units: J/kmol/K. virtual doublereal entropy_mole() const; - - /// Molar heat capacity at constant pressure. Units: J/kmol/K. virtual doublereal cp_mole() const; - - /// Molar heat capacity at constant volume. Units: J/kmol/K. virtual doublereal cv_mole() const; //! Return the thermodynamic pressure (Pa). virtual doublereal pressure() const; - //! Set the internally stored pressure (Pa) at constant - //! temperature and composition + //! Set the internally stored pressure (Pa) at constant temperature and + //! composition /*! * @param p input Pressure (Pa) */ virtual void setPressure(doublereal p); - //! This method returns an array of generalized concentrations - /*! - * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / - * C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration - * defined below and \f$ a_k \f$ are activities used in the - * thermodynamic functions. These activity (or generalized) - * concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. Note that they may - * or may not have units of concentration --- they might be - * partial pressures, mole fractions, or surface coverages, - * for example. - * - * @param c Output array of generalized concentrations. The - * units depend upon the implementation of the - * reaction rate expressions within the phase. - */ virtual void getActivityConcentrations(doublereal* c) const; - - //! Get the array of non-dimensional molar-based activity coefficients at - //! the current solution temperature, pressure, and solution concentration. - /*! - * @param ac Output vector of activity coefficients. Length: m_kk. - */ virtual void getActivityCoefficients(doublereal* ac) const; - //! Get the species chemical potentials. Units: J/kmol. - /*! - * This function returns a vector of chemical potentials of the - * species in solution at the current temperature, pressure - * and mole fraction of the solution. - * - * @param mu Output vector of species chemical - * potentials. Length: m_kk. Units: J/kmol - */ virtual void getChemPotentials(doublereal* mu) const; - - //! Get the array of chemical potentials at unit activity for the species - //! at their standard states at the current T and P of the solution. - /*! - * These are the standard state chemical potentials \f$ \mu^0_k(T,P) - * \f$. The values are evaluated at the current - * temperature and pressure of the solution - * - * @param mu0 Output vector of chemical potentials. - * Length: m_kk. - */ virtual void getStandardChemPotentials(doublereal* mu0) const; - //! Return the standard concentration for the kth species - /*! - * The standard concentration \f$ C^0_k \f$ used to normalize - * the activity (i.e., generalized) concentration. In many cases, this quantity - * will be the same for all species in a phase - for example, - * for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this - * reason, this method returns a single value, instead of an - * array. However, for phases in which the standard - * concentration is species-specific (e.g. surface species of - * different sizes), this method may be called with an - * optional parameter indicating the species. - * - * @param k Optional parameter indicating the species. The default - * is to assume this refers to species 0. - * @return - * Returns the standard Concentration in units of m3 kmol-1. - */ + //! Returns the standard Concentration in units of m3 kmol-1. + //! @copydoc ThermoPhase::standardConcentration virtual doublereal standardConcentration(size_t k=0) const; - //! Get the Gibbs functions for the standard - //! state of the species at the current T and P of the solution - /*! - * Units are Joules/kmol - * @param gpure Output vector of standard state Gibbs free energies - * Length: m_kk. - */ virtual void getPureGibbs(doublereal* gpure) const { const vector_fp& gibbsrt = gibbs_RT(); scale(gibbsrt.begin(), gibbsrt.end(), gpure, RT()); } - //! Get the nondimensional Enthalpy functions for the species - //! at their standard states at the current T and P of the solution. - /*! - * @param hrt Output vector of nondimensional standard state enthalpies. - * Length: m_kk. - */ void getEnthalpy_RT(doublereal* hrt) const { const vector_fp& _h = enthalpy_RT(); std::copy(_h.begin(), _h.end(), hrt); } - //! Get the array of nondimensional Entropy functions for the - //! standard state species at the current T and P of the solution. - /*! - * @param sr Output vector of nondimensional standard state entropies. - * Length: m_kk. - */ void getEntropy_R(doublereal* sr) const { const vector_fp& _s = entropy_R(); std::copy(_s.begin(), _s.end(), sr); } - //! Get the nondimensional Gibbs functions for the species - //! in their standard states at the current T and P of the solution. - /*! - * @param grt Output vector of nondimensional standard state Gibbs free energies - * Length: m_kk. - */ virtual void getGibbs_RT(doublereal* grt) const { const vector_fp& gibbsrt = gibbs_RT(); std::copy(gibbsrt.begin(), gibbsrt.end(), grt); } - //! Get the nondimensional Heat Capacities at constant - //! pressure for the species standard states - //! at the current T and P of the solution - /*! - * @param cpr Output vector of nondimensional standard state heat capacities - * Length: m_kk. - */ void getCp_R(doublereal* cpr) const { const vector_fp& _cpr = cp_R(); std::copy(_cpr.begin(), _cpr.end(), cpr); } - //! Returns a reference to the vector of nondimensional - //! enthalpies of the reference state at the current temperature - //! of the solution and the reference pressure for the species. + //! Returns a reference to the vector of nondimensional enthalpies of the + //! reference state at the current temperature of the solution and the + //! reference pressure for the species. const vector_fp& enthalpy_RT() const { _updateThermo(); return m_h0_RT; } - //! Returns a reference to the vector of nondimensional - //! Gibbs Free Energies of the reference state at the current temperature - //! of the solution and the reference pressure for the species. + //! Returns a reference to the vector of nondimensional Gibbs Free Energies + //! of the reference state at the current temperature of the solution and + //! the reference pressure for the species. const vector_fp& gibbs_RT() const { _updateThermo(); return m_g0_RT; } - //! Returns a reference to the vector of nondimensional - //! entropies of the reference state at the current temperature - //! of the solution and the reference pressure for each species. + //! Returns a reference to the vector of nondimensional entropies of the + //! reference state at the current temperature of the solution and the + //! reference pressure for each species. const vector_fp& entropy_R() const { _updateThermo(); return m_s0_R; } - //! Returns a reference to the vector of nondimensional - //! constant pressure heat capacities of the reference state - //! at the current temperature of the solution - //! and reference pressure for each species. + //! Returns a reference to the vector of nondimensional constant pressure + //! heat capacities of the reference state at the current temperature of the + //! solution and reference pressure for each species. const vector_fp& cp_R() const { _updateThermo(); return m_cp0_R; } - //! Initialize the ThermoPhase object after all species have been set up - /*! - * @internal Initialize. - * - * This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called from ThermoPhase::initThermoXML(), - * which is called from importPhase(), - * just prior to returning from function importPhase(). - */ virtual void initThermo(); - //!This method is used by the ChemEquil equilibrium solver. - /*! - * It sets the state such that the chemical potentials satisfy - * \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m} - * \left(\frac{\lambda_m} {\hat R T}\right) \f] where - * \f$ \lambda_m \f$ is the element potential of element m. The - * temperature is unchanged. Any phase (ideal or not) that - * implements this method can be equilibrated by ChemEquil. - * - * @param lambda_RT Input vector of dimensionless element potentials - * The length is equal to nElements(). - */ virtual void setToEquilState(const doublereal* lambda_RT); - //! Set the equation of state parameters - /*! - * @internal - * The number and meaning of these depends on the subclass. - * - * @param n number of parameters - * @param c array of \a n coefficients - */ virtual void setParameters(int n, doublereal* const c) { setDensity(c[0]); } - //! Get the equation of state parameters in a vector - /*! - * @internal - * The number and meaning of these depends on the subclass. - * - * @param n number of parameters - * @param c array of \a n coefficients - */ virtual void getParameters(int& n, doublereal* const c) const { double d = density(); c[0] = d; n = 1; } - //! Set equation of state parameter values from XML entries. - /*! - * - * This method is called by function importPhase() when processing a phase - * definition in an input file. It should be overloaded in subclasses to set - * any parameters that are specific to that particular phase - * model. Note, this method is called before the phase is - * initialized with elements and/or species. - * - * @param eosdata An XML_Node object corresponding to - * the "thermo" entry for this phase in the input file. - */ virtual void setParametersFromXML(const XML_Node& eosdata); protected: diff --git a/include/cantera/thermo/DebyeHuckel.h b/include/cantera/thermo/DebyeHuckel.h index 28de6e157..96b9ce803 100644 --- a/include/cantera/thermo/DebyeHuckel.h +++ b/include/cantera/thermo/DebyeHuckel.h @@ -48,33 +48,31 @@ class PDSS_Water; /** * @ingroup thermoprops * - * Class DebyeHuckel represents a dilute liquid electrolyte phase which - * obeys the Debye Huckel formulation for nonideality. + * Class DebyeHuckel represents a dilute liquid electrolyte phase which obeys + * the Debye Huckel formulation for nonideality. * - * The concentrations of the ionic species are assumed to obey the electroneutrality - * condition. + * The concentrations of the ionic species are assumed to obey the + * electroneutrality condition. * *
*

Specification of Species Standard State Properties

*
* * 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 + * 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 - * manager class (see ThermoPhase::m_spthermo). How to relate pressure - * changes to the reference state thermodynamics is resolved at this level. + * It is assumed that the reference state thermodynamics may be obtained by a + * pointer to a populated species thermodynamic property manager class (see + * ThermoPhase::m_spthermo). How to relate pressure changes to the reference + * state thermodynamics is resolved at this level. * - * For an incompressible, - * stoichiometric substance, the molar internal energy is - * independent of pressure. Since the thermodynamic properties - * are specified by giving the standard-state enthalpy, the - * term \f$ P_0 \hat v\f$ is subtracted from the specified molar - * enthalpy to compute the molar internal energy. The entropy is - * assumed to be independent of the pressure. + * For an incompressible, stoichiometric substance, the molar internal energy is + * independent of pressure. Since the thermodynamic properties are specified by + * giving the standard-state enthalpy, the term \f$ P_0 \hat v\f$ is subtracted + * from the specified molar enthalpy to compute the molar internal energy. The + * entropy is assumed to be independent of the pressure. * * The enthalpy function is given by the following relation. * @@ -83,42 +81,38 @@ class PDSS_Water; * + \tilde v \left( P - P_{ref} \right) * \f] * - * For an incompressible, - * stoichiometric substance, the molar internal energy is - * independent of pressure. Since the thermodynamic properties - * are specified by giving the standard-state enthalpy, the - * term \f$ P_{ref} \tilde v\f$ is subtracted from the specified reference molar - * enthalpy to compute the molar internal energy. + * For an incompressible, stoichiometric substance, the molar internal energy is + * independent of pressure. Since the thermodynamic properties are specified by + * giving the standard-state enthalpy, the term \f$ P_{ref} \tilde v\f$ is + * subtracted from the specified reference molar enthalpy to compute the molar + * internal energy. * * \f[ * u^\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 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 Phase::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 vector Phase::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. + * 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. * *
*

Specification of Solution Thermodynamic Properties

*
* - * 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: + * 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}) @@ -127,66 +121,65 @@ class PDSS_Water; * \mu_o = \mu^o_o(T,P) + RT ln(a_o) * \f] * - * where \f$ \gamma_k^{\triangle} \f$ is the molality based activity coefficient for species - * \f$k\f$. + * where \f$ \gamma_k^{\triangle} \f$ is the molality based activity coefficient + * for species \f$k\f$. * - * Individual activity coefficients of ions can not be independently measured. Instead, - * only binary pairs forming electroneutral solutions can be measured. + * Individual activity coefficients of ions can not be independently measured. + * Instead, only binary pairs forming electroneutral solutions can be measured. * *

Ionic Strength

* - * Most of the parameterizations within the model use the ionic strength - * as a key variable. The ionic strength, \f$ I\f$ is defined as follows + * Most of the parameterizations within the model use the ionic strength as a + * key variable. The ionic strength, \f$ I\f$ is defined as follows * * \f[ * I = \frac{1}{2} \sum_k{m_k z_k^2} * \f] * - * \f$ m_k \f$ is the molality of the kth species. \f$ z_k \f$ is the charge - * of the kth species. Note, the ionic strength is a defined units quantity. - * The molality has defined units of gmol kg-1, and therefore the ionic - * strength has units of sqrt( gmol kg-1). + * \f$ m_k \f$ is the molality of the kth species. \f$ z_k \f$ is the charge of + * the kth species. Note, the ionic strength is a defined units quantity. The + * molality has defined units of gmol kg-1, and therefore the ionic strength has + * units of sqrt( gmol kg-1). * - * In some instances, from some authors, a different - * formulation is used for the ionic strength in the equations below. The different - * formulation is due to the possibility of the existence of weak acids and how - * association wrt to the weak acid equilibrium relation affects the calculation - * of the activity coefficients via the assumed value of the ionic strength. + * In some instances, from some authors, a different formulation is used for the + * ionic strength in the equations below. The different formulation is due to + * the possibility of the existence of weak acids and how association wrt to the + * weak acid equilibrium relation affects the calculation of the activity + * coefficients via the assumed value of the ionic strength. * - * If we are to assume that the association reaction doesn't have an effect - * on the ionic strength, then we will want to consider the associated weak - * acid as in effect being fully dissociated, when we calculate an effective - * value for the ionic strength. We will call this calculated value, the - * stoichiometric ionic strength, \f$ I_s \f$, putting a subscript s to denote - * it from the more straightforward calculation of \f$ I \f$. + * If we are to assume that the association reaction doesn't have an effect on + * the ionic strength, then we will want to consider the associated weak acid as + * in effect being fully dissociated, when we calculate an effective value for + * the ionic strength. We will call this calculated value, the stoichiometric + * ionic strength, \f$ I_s \f$, putting a subscript s to denote it from the more + * straightforward calculation of \f$ I \f$. * * \f[ * I_s = \frac{1}{2} \sum_k{m_k^s z_k^2} * \f] * - * Here, \f$ m_k^s \f$ is the value of the molalities calculated assuming that - * all weak acid-base pairs are in their fully dissociated states. This calculation may - * be simplified by considering that the weakly associated acid may be made up of two - * charged species, k1 and k2, each with their own charges, obeying the following relationship: + * Here, \f$ m_k^s \f$ is the value of the molalities calculated assuming that + * all weak acid-base pairs are in their fully dissociated states. This + * calculation may be simplified by considering that the weakly associated acid + * may be made up of two charged species, k1 and k2, each with their own + * charges, obeying the following relationship: * * \f[ * z_k = z_{k1} + z_{k2} * \f] - * Then, we may only need to specify one charge value, say, \f$ z_{k1}\f$, - * the cation charge number, - * in order to get both numbers, since we have already specified \f$ z_k \f$ - * in the definition of original species. - * Then, the stoichiometric ionic strength may be calculated via the following formula. + * Then, we may only need to specify one charge value, say, \f$ z_{k1}\f$, the + * cation charge number, in order to get both numbers, since we have already + * specified \f$ z_k \f$ in the definition of original species. Then, the + * stoichiometric ionic strength may be calculated via the following formula. * * \f[ * I_s = \frac{1}{2} \left(\sum_{k,ions}{m_k z_k^2}+ * \sum_{k,weak_assoc}(m_k z_{k1}^2 + m_k z_{k2}^2) \right) * \f] * - * The specification of which species are weakly associated acids is made in the input - * file via the - * stoichIsMods XML block, where the charge for k1 is also specified. - * An example is given below: + * The specification of which species are weakly associated acids is made in the + * input file via the stoichIsMods XML block, where the charge for k1 + * is also specified. An example is given below: * * @code * @@ -194,9 +187,9 @@ class PDSS_Water; * * @endcode * - * Because we need the concept of a weakly associated acid in order to calculated - * \f$ I_s \f$ we need to - * catalog all species in the phase. This is done using the following categories: + * Because we need the concept of a weakly associated acid in order to calculate + * \f$ I_s \f$ we need to catalog all species in the phase. This is done using + * the following categories: * * - cEST_solvent Solvent species (neutral) * - cEST_chargedSpecies Charged species (charged) @@ -210,17 +203,15 @@ class PDSS_Water; * - cEST_polarNeutral Polar neutral species * - cEST_nonpolarNeutral Non polar neutral species * - * Polar and non-polar neutral species are differentiated, because some additions - * to the activity - * coefficient expressions distinguish between these two types of solutes. This is the so-called - * salt-out effect. + * Polar and non-polar neutral species are differentiated, because some + * additions to the activity coefficient expressions distinguish between these + * two types of solutes. This is the so-called salt-out effect. * - * The type of species is specified in the electrolyteSpeciesType XML block. - * Note, this is not - * considered a part of the specification of the standard state for the species, - * at this time. Therefore, - * this information is put under the activityCoefficient XML block. An example - * is given below + * The type of species is specified in the electrolyteSpeciesType XML + * block. Note, this is not considered a part of the specification of the + * standard state for the species, at this time. Therefore, this information is + * put under the activityCoefficient XML block. An example is given + * below * * @code * @@ -233,51 +224,52 @@ class PDSS_Water; * * @endcode * - * Much of the species electrolyte type information is inferred from other information in the - * input file. For example, as species which is charged is given the "chargedSpecies" default - * category. A neutral solute species is put into the "nonpolarNeutral" category by default. + * Much of the species electrolyte type information is inferred from other + * information in the input file. For example, as species which is charged is + * given the "chargedSpecies" default category. A neutral solute species is put + * into the "nonpolarNeutral" category by default. * * The specification of solute activity coefficients depends on the model - * assumed for the Debye-Huckel term. The model is set by the - * internal parameter #m_formDH. We will now describe each category in its own section. + * assumed for the Debye-Huckel term. The model is set by the internal parameter + * #m_formDH. We will now describe each category in its own section. * - *

Debye-Huckel Dilute Limit

+ *

Debye-Huckel Dilute Limit

* - * DHFORM_DILUTE_LIMIT = 0 + * DHFORM_DILUTE_LIMIT = 0 * - * This form assumes a dilute limit to DH, and is mainly for informational purposes: - * \f[ - * \ln(\gamma_k^\triangle) = - z_k^2 A_{Debye} \sqrt{I} - * \f] - * where \f$ I\f$ is the ionic strength - * \f[ - * I = \frac{1}{2} \sum_k{m_k z_k^2} - * \f] + * This form assumes a dilute limit to DH, and is mainly for informational purposes: + * \f[ + * \ln(\gamma_k^\triangle) = - z_k^2 A_{Debye} \sqrt{I} + * \f] + * where \f$ I\f$ is the ionic strength + * \f[ + * I = \frac{1}{2} \sum_k{m_k z_k^2} + * \f] * - * The activity for the solvent water,\f$ a_o \f$, is not independent and must be - * determined from the Gibbs-Duhem relation. + * The activity for the solvent water,\f$ a_o \f$, is not independent and must + * be determined from the Gibbs-Duhem relation. * - * \f[ - * \ln(a_o) = \frac{X_o - 1.0}{X_o} + \frac{ 2 A_{Debye} \tilde{M}_o}{3} (I)^{3/2} - * \f] + * \f[ + * \ln(a_o) = \frac{X_o - 1.0}{X_o} + \frac{ 2 A_{Debye} \tilde{M}_o}{3} (I)^{3/2} + * \f] * - *

Bdot Formulation

+ *

Bdot Formulation

* * DHFORM_BDOT_AK = 1 * - * This form assumes Bethke's format for the Debye Huckel activity coefficient: + * This form assumes Bethke's format for the Debye Huckel activity coefficient: * - * \f[ - * \ln(\gamma_k^\triangle) = -z_k^2 \frac{A_{Debye} \sqrt{I}}{ 1 + B_{Debye} a_k \sqrt{I}} + * \f[ + * \ln(\gamma_k^\triangle) = -z_k^2 \frac{A_{Debye} \sqrt{I}}{ 1 + B_{Debye} a_k \sqrt{I}} * + \log(10) B^{dot}_k I - * \f] + * \f] * - * Note, this particular form where \f$ a_k \f$ can differ in multielectrolyte - * solutions has problems with respect to a Gibbs-Duhem analysis. However, - * we include it here because there is a lot of data fit to it. + * Note, this particular form where \f$ a_k \f$ can differ in multielectrolyte + * solutions has problems with respect to a Gibbs-Duhem analysis. However, we + * include it here because there is a lot of data fit to it. * - * The activity for the solvent water,\f$ a_o \f$, is not independent and must be - * determined from the Gibbs-Duhem relation. Here, we use: + * The activity for the solvent water,\f$ a_o \f$, is not independent and must + * be determined from the Gibbs-Duhem relation. Here, we use: * * \f[ * \ln(a_o) = \frac{X_o - 1.0}{X_o} @@ -293,18 +285,18 @@ class PDSS_Water; * Additionally, Helgeson's formulation for the water activity is offered as an * alternative. * - *

Bdot Formulation with Uniform Size Parameter in the Denominator

+ *

Bdot Formulation with Uniform Size Parameter in the Denominator

* - * DHFORM_BDOT_AUNIFORM = 2 + * DHFORM_BDOT_AUNIFORM = 2 * - * This form assumes Bethke's format for the Debye-Huckel activity coefficient + * This form assumes Bethke's format for the Debye-Huckel activity coefficient * - * \f[ + * \f[ * \ln(\gamma_k^\triangle) = -z_k^2 \frac{A_{Debye} \sqrt{I}}{ 1 + B_{Debye} a \sqrt{I}} * + \log(10) B^{dot}_k I - * \f] + * \f] * - * The value of a is determined at the beginning of the calculation, and not changed. + * The value of a is determined at the beginning of the calculation, and not changed. * * \f[ * \ln(a_o) = \frac{X_o - 1.0}{X_o} @@ -312,39 +304,40 @@ class PDSS_Water; * - \frac{\log(10)}{2} \tilde{M}_o I \sum_k{ B^{dot}_k m_k} * \f] * - *

Beta_IJ formulation

+ *

Beta_IJ formulation

* - * DHFORM_BETAIJ = 3 + * DHFORM_BETAIJ = 3 * - * This form assumes a linear expansion in a virial coefficient form. - * It is used extensively in the book by Newmann, "Electrochemistry Systems", - * and is the beginning of more complex treatments for stronger electrolytes, - * fom Pitzer and from Harvey, Moller, and Weire. + * This form assumes a linear expansion in a virial coefficient form. It is used + * extensively in the book by Newmann, "Electrochemistry Systems", and is the + * beginning of more complex treatments for stronger electrolytes, fom Pitzer + * and from Harvey, Moller, and Weire. * - * \f[ + * \f[ * \ln(\gamma_k^\triangle) = -z_k^2 \frac{A_{Debye} \sqrt{I}}{ 1 + B_{Debye} a \sqrt{I}} * + 2 \sum_j \beta_{j,k} m_j - * \f] + * \f] * - * In the current treatment the binary interaction coefficients, \f$ \beta_{j,k}\f$, are - * independent of temperature and pressure. + * In the current treatment the binary interaction coefficients, \f$ + * \beta_{j,k}\f$, are independent of temperature and pressure. * - * \f[ - * \ln(a_o) = \frac{X_o - 1.0}{X_o} - * + \frac{ 2 A_{Debye} \tilde{M}_o}{3} (I)^{3/2} \sigma( B_{Debye} a \sqrt{I} ) - * - \tilde{M}_o \sum_j \sum_k \beta_{j,k} m_j m_k - * \f] + * \f[ + * \ln(a_o) = \frac{X_o - 1.0}{X_o} + * + \frac{ 2 A_{Debye} \tilde{M}_o}{3} (I)^{3/2} \sigma( B_{Debye} a \sqrt{I} ) + * - \tilde{M}_o \sum_j \sum_k \beta_{j,k} m_j m_k + * \f] * - * In this formulation the ionic radius, \f$ a \f$, is a constant. This must be supplied to the - * model, in an ionicRadius XML block. + * In this formulation the ionic radius, \f$ a \f$, is a constant. This must be + * supplied to the model, in an ionicRadius XML block. * - * The \f$ \beta_{j,k} \f$ parameters are binary interaction parameters. They are supplied to - * the object in an DHBetaMatrix XML block. There are in principle \f$ N (N-1) /2 \f$ - * different, symmetric interaction parameters, where \f$ N \f$ are the number of solute species in the - * mechanism. - * An example is given below. + * The \f$ \beta_{j,k} \f$ parameters are binary interaction parameters. They + * are supplied to the object in an DHBetaMatrix XML block. There are + * in principle \f$ N (N-1) /2 \f$ different, symmetric interaction parameters, + * where \f$ N \f$ are the number of solute species in the mechanism. An example + * is given below. * - * An example activityCoefficients XML block for this formulation is supplied below + * An example activityCoefficients XML block for this formulation is + * supplied below * * @code * @@ -369,51 +362,49 @@ class PDSS_Water; * * @endcode * - *

Pitzer Beta_IJ formulation

+ *

Pitzer Beta_IJ formulation

* - * DHFORM_PITZER_BETAIJ = 4 + * DHFORM_PITZER_BETAIJ = 4 * - * This form assumes an activity coefficient formulation consistent - * with a truncated form of Pitzer's formulation. Pitzer's formulation is equivalent - * to the formulations above in the dilute limit, where rigorous theory may be applied. + * This form assumes an activity coefficient formulation consistent with a + * truncated form of Pitzer's formulation. Pitzer's formulation is equivalent to + * the formulations above in the dilute limit, where rigorous theory may be + * applied. * - * \f[ - * \ln(\gamma_k^\triangle) = -z_k^2 \frac{A_{Debye}}{3} \frac{\sqrt{I}}{ 1 + B_{Debye} a \sqrt{I}} + * \f[ + * \ln(\gamma_k^\triangle) = -z_k^2 \frac{A_{Debye}}{3} \frac{\sqrt{I}}{ 1 + B_{Debye} a \sqrt{I}} * -2 z_k^2 \frac{A_{Debye}}{3} \frac{\ln(1 + B_{Debye} a \sqrt{I})}{ B_{Debye} a} * + 2 \sum_j \beta_{j,k} m_j - * \f] - * - * - * \f[ + * \f] + * \f[ * \ln(a_o) = \frac{X_o - 1.0}{X_o} * + \frac{ 2 A_{Debye} \tilde{M}_o}{3} \frac{(I)^{3/2} }{1 + B_{Debye} a \sqrt{I} } * - \tilde{M}_o \sum_j \sum_k \beta_{j,k} m_j m_k - * \f] + * \f] * *

Specification of the Debye Huckel Constants

* - * In the equations above, the formulas for \f$ A_{Debye} \f$ and \f$ B_{Debye} \f$ - * are needed. The DebyeHuckel object uses two methods for specifying these quantities. - * The default method is to assume that \f$ A_{Debye} \f$ is a constant, given - * in the initialization process, and stored in the - * member double, m_A_Debye. Optionally, a full water treatment may be employed that makes - * \f$ A_{Debye} \f$ a full function of T and P. + * In the equations above, the formulas for \f$ A_{Debye} \f$ and \f$ + * B_{Debye} \f$ are needed. The DebyeHuckel object uses two methods for + * specifying these quantities. The default method is to assume that \f$ + * A_{Debye} \f$ is a constant, given in the initialization process, and stored + * in the member double, m_A_Debye. Optionally, a full water treatment may be + * employed that makes \f$ A_{Debye} \f$ a full function of T and + * P. * - * \f[ + * \f[ * A_{Debye} = \frac{F e B_{Debye}}{8 \pi \epsilon R T} {\left( C_o \tilde{M}_o \right)}^{1/2} - * \f] + * \f] * where - * * \f[ * B_{Debye} = \frac{F} {{(\frac{\epsilon R T}{2})}^{1/2}} * \f] - * Therefore: + * Therefore: * \f[ * A_{Debye} = \frac{1}{8 \pi} * {\left(\frac{2 N_a \rho_o}{1000}\right)}^{1/2} * {\left(\frac{N_a e^2}{\epsilon R T }\right)}^{3/2} * \f] - * * where * - \f$ N_a \f$ is Avogadro's number * - \f$ \rho_w \f$ is the density of water @@ -439,7 +430,6 @@ class PDSS_Water; * @endcode * * An example of a variable value implementation is given below. - * * @code * * @@ -448,60 +438,57 @@ class PDSS_Water; * * @endcode * - * Currently, \f$ B_{Debye} \f$ is a constant in the model, specified either by a default - * water value, or through the input file. This may have to be looked at, in the future. + * Currently, \f$ B_{Debye} \f$ is a constant in the model, specified either by + * a default water value, or through the input file. This may have to be looked + * at, in the future. * *
*

%Application within Kinetics Managers

*
* * For the time being, we have set the standard concentration for all species in - * this phase equal to the default concentration of the solvent at 298 K and 1 atm. - * This means that the - * kinetics operator essentially works on an activities basis, with units specified - * as if it were on a concentration basis. + * this phase equal to the default concentration of the solvent at 298 K and 1 + * atm. This means that the kinetics operator essentially works on an activities + * basis, with units specified as if it were on a concentration basis. * - * For example, a bulk-phase binary reaction between liquid species j and k, producing - * a new liquid species l would have the - * following equation for its rate of progress variable, \f$ R^1 \f$, which has - * units of kmol m-3 s-1. + * For example, a bulk-phase binary reaction between liquid species j and k, + * producing a new liquid species l would have the following equation for its + * rate of progress variable, \f$ R^1 \f$, which has units of kmol m-3 s-1. * - * \f[ + * \f[ * R^1 = k^1 C_j^a C_k^a = k^1 (C_o a_j) (C_o a_k) - * \f] + * \f] * where - * \f[ + * \f[ * C_j^a = C_o a_j \quad and \quad C_k^a = C_o a_k - * \f] + * \f] * - * \f$ C_j^a \f$ is the activity concentration of species j, and - * \f$ C_k^a \f$ is the activity concentration of species k. \f$ C_o \f$ - * is the concentration of water at 298 K and 1 atm. \f$ a_j \f$ is - * the activity of species j at the current temperature and pressure - * and concentration of the liquid phase. \f$k^1 \f$ has units of m3 kmol-1 s-1. + * \f$ C_j^a \f$ is the activity concentration of species j, and + * \f$ C_k^a \f$ is the activity concentration of species k. \f$ C_o \f$ + * is the concentration of water at 298 K and 1 atm. \f$ a_j \f$ is the activity + * of species j at the current temperature and pressure and concentration of the + * liquid phase. \f$k^1 \f$ has units of m3 kmol-1 s-1. * - * The reverse rate constant can then be obtained from the law of microscopic reversibility - * and the equilibrium expression for the system. + * The reverse rate constant can then be obtained from the law of microscopic + * reversibility and the equilibrium expression for the system. * - * \f[ - * \frac{a_j a_k}{ a_l} = K^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} ) - * \f] + * \f[ + * \frac{a_j a_k}{ a_l} = K^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} ) + * \f] * - * \f$ K^{o,1} \f$ is the dimensionless form of the equilibrium constant. + * \f$ K^{o,1} \f$ is the dimensionless form of the equilibrium constant. * - * \f[ + * \f[ * R^{-1} = k^{-1} C_l^a = k^{-1} (C_o a_l) - * \f] + * \f] + * where + * \f[ + * k^{-1} = k^1 K^{o,1} C_o + * \f] * - * where + * \f$k^{-1} \f$ has units of s-1. * - * \f[ - * k^{-1} = k^1 K^{o,1} C_o - * \f] - * - * \f$k^{-1} \f$ has units of s-1. - * - * Note, this treatment may be modified in the future, as events dictate. + * Note, this treatment may be modified in the future, as events dictate. * *
*

Instantiation of the Class

@@ -535,58 +522,57 @@ class PDSS_Water; *
* * The phase model name for this is called StoichSubstance. It must be supplied - * as the model attribute of the thermo XML element entry. - * Within the phase XML block, - * the density of the phase must be specified. An example of an XML file + * as the model attribute of the thermo XML element entry. Within the phase XML + * block, the density of the phase must be specified. An example of an XML file * this phase is given below. * - * @verbatim - - - H2O(L) Na+ Cl- H+ OH- NaCl(aq) NaOH(aq) - - - 300 - 101325.0 - - Na+:3.0 - Cl-:3.0 - H+:1.0499E-8 - OH-:1.3765E-6 - NaCl(aq):0.98492 - NaOH(aq):3.8836E-6 - - - - - - - - 1.172576 - - 3.28640E9 - - - - H+:Cl-:0.27 - Na+:Cl-:0.15 - Na+:OH-:0.06 - - - NaCl(aq):-1.0 - - - H+:chargedSpecies - NaCl(aq):weakAcidAssociated - - - H2O(L) - - O H Na Cl - -@endverbatim + * @code + * + * + * H2O(L) Na+ Cl- H+ OH- NaCl(aq) NaOH(aq) + * + * + * 300 + * 101325.0 + * + * Na+:3.0 + * Cl-:3.0 + * H+:1.0499E-8 + * OH-:1.3765E-6 + * NaCl(aq):0.98492 + * NaOH(aq):3.8836E-6 + * + * + * + * + * + * + * + * 1.172576 + * + * 3.28640E9 + * + * + * + * H+:Cl-:0.27 + * Na+:Cl-:0.15 + * Na+:OH-:0.06 + * + * + * NaCl(aq):-1.0 + * + * + * H+:chargedSpecies + * NaCl(aq):weakAcidAssociated + * + * + * H2O(L) + * + * O H Na Cl + * + * @endcode */ class DebyeHuckel : public MolalityVPSSTP { @@ -594,11 +580,10 @@ public: //! Default Constructor DebyeHuckel(); - //! Copy constructor DebyeHuckel(const DebyeHuckel&); - - //! Assignment operator DebyeHuckel& operator=(const DebyeHuckel&); + ThermoPhase* duplMyselfAsThermoPhase() const; + virtual ~DebyeHuckel(); //! Full constructor for creating the phase. /*! @@ -614,35 +599,15 @@ public: */ DebyeHuckel(XML_Node& phaseRef, const std::string& id = ""); - /// Destructor. - virtual ~DebyeHuckel(); - - //! Duplicator from the ThermoPhase parent class - /*! - * Given a pointer to a ThermoPhase object, this function will - * duplicate the ThermoPhase object and all underlying structures. - * This is basically a wrapper around the copy constructor. - * - * @return returns a pointer to a ThermoPhase - */ - ThermoPhase* duplMyselfAsThermoPhase() const; - //! @name Utilities //! @{ - /** - * Equation of state type flag. The base class returns - * zero. Subclasses should define this to return a unique - * non-zero value. Constants defined for this purpose are - * listed in mix_defs.h. - */ virtual int eosType() const; //! @} //! @name Molar Thermodynamic Properties of the Solution //! @{ - /// Molar enthalpy of the solution. Units: J/kmol. virtual doublereal enthalpy_mole() const; /// Molar entropy. Units: J/kmol/K. @@ -662,28 +627,18 @@ public: */ virtual doublereal entropy_mole() const; - /// Molar Gibbs function. Units: J/kmol. virtual doublereal gibbs_mole() const; - - /// Molar heat capacity at constant pressure. Units: J/kmol/K. virtual doublereal cp_mole() const; - - //! Molar heat capacity at constant volume. Units: J/kmol/K. - /* - * (HKM -> Bump up to Parent object) - */ virtual doublereal cv_mole() const; //@} /** @name Mechanical Equation of State Properties //@{ - * - * In this equation of state implementation, the density is a - * function only of the mole fractions. Therefore, it can't be - * an independent variable. Instead, the pressure is used as the - * independent variable. Functions which try to set the thermodynamic - * state by calling setDensity() may cause an exception to be - * thrown. + * In this equation of state implementation, the density is a function only + * of the mole fractions. Therefore, it can't be an independent variable. + * Instead, the pressure is used as the independent variable. Functions + * which try to set the thermodynamic state by calling setDensity() may + * cause an exception to be thrown. */ //! Return the thermodynamic pressure (Pa). @@ -693,12 +648,12 @@ public: */ virtual doublereal pressure() const; - //! Set the internally stored pressure (Pa) at constant - //! temperature and composition + //! Set the internally stored pressure (Pa) at constant temperature and + //! composition /*! - * This method sets the pressure within the object. - * The water model is a completely compressible model. - * Also, the dielectric constant is pressure dependent. + * This method sets the pressure within the object. The water model is a + * completely compressible model. Also, the dielectric constant is pressure + * dependent. * * @param p input Pressure (Pa) * @@ -707,46 +662,26 @@ public: virtual void setPressure(doublereal p); protected: - //! Calculate the density of the mixture using the partial - //! molar volumes and mole fractions as input - /*! - * The formula for this is - * - * \f[ - * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}} - * \f] - * - * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are - * the molecular weights, and \f$V_k\f$ are the pure species - * molar volumes. - * - * Note, the basis behind this formula is that in an ideal - * solution the partial molar volumes are equal to the pure - * species molar volumes. We have additionally specified - * in this class that the pure species molar volumes are - * independent of temperature and pressure. - */ virtual void calcDensity(); public: //! Set the internally stored density (gm/m^3) of the phase. /*! - * Overwritten setDensity() function is necessary because the - * density is not an independent variable. + * Overwritten setDensity() function is necessary because the density is not + * an independent variable. * * This function will now throw an error condition * - * @internal May have to adjust the strategy here to make - * the eos for these materials slightly compressible, in order - * to create a condition where the density is a function of - * the pressure. + * @internal May have to adjust the strategy here to make the eos for these + * materials slightly compressible, in order to create a condition where + * the density is a function of the pressure. * - * This function will now throw an error condition if the - * input isn't exactly equal to the current density. + * This function will now throw an error condition if the input isn't + * exactly equal to the current density. * - * @todo Now have a compressible ss equation for liquid water. - * Therefore, this phase is compressible. May still - * want to change the independent variable however. + * @todo Now have a compressible ss equation for liquid water. Therefore, + * this phase is compressible. May still want to change the + * independent variable however. * * @param rho Input density (kg/m^3). */ @@ -754,11 +689,11 @@ public: //! Set the internally stored molar density (kmol/m^3) of the phase. /** - * Overwritten setMolarDensity() function is necessary because the - * density is not an independent variable. + * Overwritten setMolarDensity() function is necessary because the density + * is not an independent variable. * - * This function will now throw an error condition if the input - * isn't exactly equal to the current molar density. + * This function will now throw an error condition if the input isn't + * exactly equal to the current molar density. * * @param conc Input molar density (kmol/m^3). */ @@ -766,100 +701,67 @@ public: //! Set the temperature (K) /*! - * This function sets the temperature, and makes sure that - * the value propagates to underlying objects, such as - * the water standard state model. + * This function sets the temperature, and makes sure that the value + * propagates to underlying objects, such as the water standard state model. * * @param temp Temperature in kelvin */ virtual void setTemperature(const doublereal temp); - //! Set the temperature (K) and pressure (Pa) - /*! - * Set the temperature and pressure. - * - * @param t Temperature (K) - * @param p Pressure (Pa) - */ virtual void setState_TP(doublereal t, doublereal p); /** * @} * @name Activities, Standard States, and Activity Concentrations * - * The activity \f$a_k\f$ of a species in solution is - * related to the chemical potential by \f[ \mu_k = \mu_k^0(T) - * + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is - * the chemical potential at unit activity, which depends only - * on temperature and the pressure. - * Activity is assumed to be molality-based here. + * The activity \f$a_k\f$ of a species in solution is related to the + * chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The + * quantity \f$\mu_k^0(T,P)\f$ is the chemical potential at unit activity, + * which depends only on temperature and the pressure. Activity is assumed + * to be molality-based here. * @{ */ - //! This method returns an array of generalized concentrations - /*! - * \f$ C_k\f$ that are defined such that - * \f$ a_k = C_k / C^0_k, \f$ where \f$ C^0_k \f$ - * is a standard concentration - * defined below. These generalized concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. - * - * @param c Array of generalized concentrations. The - * units depend upon the implementation of the - * reaction rate expressions within the phase. - */ virtual void getActivityConcentrations(doublereal* c) const; //! Return the standard concentration for the kth species /*! - * The standard concentration \f$ C^0_k \f$ used to normalize - * the activity (i.e., generalized) concentration in - * kinetics calculations. + * The standard concentration \f$ C^0_k \f$ used to normalize the activity + * (i.e., generalized) concentration in kinetics calculations. * - * 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 + * 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. + * @param k Optional parameter indicating the species. The default is to + * assume this refers to species 0. + * @return the standard Concentration in units of m3 + * kmol-1. */ virtual doublereal standardConcentration(size_t k=0) const; - //! Get the array of non-dimensional activities at - //! the current solution temperature, pressure, and solution concentration. + //! Get the array of non-dimensional activities at the current solution + //! temperature, pressure, and solution concentration. /*! - * - * 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 activity coefficient 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 + //! 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. + * note solvent is on molar scale. The solvent molar based activity + * coefficient is returned. * * Note, most of the work is done in an internal private routine * * @param acMolality Vector of Molality-based activity coefficients * Length: m_kk */ - virtual void - getMolalityActivityCoefficients(doublereal* acMolality) const; + virtual void getMolalityActivityCoefficients(doublereal* acMolality) const; //@} /// @name Partial Molar Properties of the Solution @@ -868,8 +770,8 @@ public: //! Get the species chemical potentials. Units: J/kmol. /*! * - * This function returns a vector of chemical potentials of the - * species in solution. + * This function returns a vector of chemical potentials of the species in + * solution. * * \f[ * \mu_k = \mu^{\triangle}_k(T,P) + R T ln(\gamma_k^{\triangle} m_k) @@ -908,25 +810,24 @@ public: /** * Maxwell's equations provide an insight in how to calculate this * (p.215 Smith and Van Ness) - * \f[ - * \frac{d\mu_i}{dT} = -\bar{s}_i - * \f] + * \f[ + * \frac{d\mu_i}{dT} = -\bar{s}_i + * \f] * - * For this phase, the partial molar entropies are equal to the - * SS species entropies plus the ideal solution contribution.following - * contribution: - * \f[ + * For this phase, the partial molar entropies are equal to the SS species + * entropies plus the ideal solution contribution: + * \f[ * \bar s_k(T,P) = \hat s^0_k(T) - R log(M0 * molality[k]) * \f] * \f[ - * \bar s_{solvent}(T,P) = \hat s^0_{solvent}(T) - * - R ((xmolSolvent - 1.0) / xmolSolvent) + * \bar s_{solvent}(T,P) = \hat s^0_{solvent}(T) + * - R ((xmolSolvent - 1.0) / xmolSolvent) * \f] * - * The reference-state pure-species entropies,\f$ \hat s^0_k(T) \f$, - * at the reference pressure, \f$ P_{ref} \f$, are computed by the - * species thermodynamic - * property manager. They are polynomial functions of temperature. + * The reference-state pure-species entropies,\f$ \hat s^0_k(T) \f$, at the + * reference pressure, \f$ P_{ref} \f$, are computed by the species + * thermodynamic property manager. They are polynomial functions of + * temperature. * @see SpeciesThermo * * @param sbar Output vector of species partial molar entropies. @@ -934,21 +835,14 @@ public: */ virtual void getPartialMolarEntropies(doublereal* sbar) const; - //! Return an array of partial molar heat capacities for the - //! species in the mixture. Units: J/kmol/K - /*! - * @param cpbar Output vector of species partial molar heat - * capacities at constant pressure. - * Length = m_kk. units are J/kmol/K. - */ virtual void getPartialMolarCp(doublereal* cpbar) const; - //! Return an array of partial molar volumes for the - //! species in the mixture. Units: m^3/kmol. + //! Return an array of partial molar volumes for the species in the mixture. + //! Units: m^3/kmol. /*! - * For this solution, the partial molar volumes are normally - * equal to theconstant species molar volumes, except - * when the activity coefficients depend on pressure. + * For this solution, the partial molar volumes are normally equal to the + * constant species molar volumes, except when the activity coefficients + * depend on pressure. * * The general relation is * @@ -968,18 +862,6 @@ public: * @{ */ - //!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) { throw NotImplementedError("DebyeHuckel::setToEquilState"); } @@ -990,49 +872,15 @@ public: * -------------- Utilities ------------------------------- */ - //! Initialize the object's internal lengths after species are set - /** - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase(). - * - * Cascading call sequence downwards starting with Parent. - * - * @internal - */ virtual void initThermo(); - - //! Process the XML file after species are set up. - /*! - * This gets called from importPhase(). It processes the XML file - * after the species are set up. This is the main routine for - * reading in activity coefficient parameters. - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); //! Return the Debye Huckel constant as a function of temperature //! and pressure (Units = sqrt(kg/gmol)) /*! - * The default is to assume that it is constant, given - * in the initialization process, and stored in the - * member double, m_A_Debye. Optionally, a full water treatment may be employed that makes + * The default is to assume that it is constant, given in the + * initialization process, and stored in the member double, m_A_Debye. + * Optionally, a full water treatment may be employed that makes * \f$ A_{Debye} \f$ a full function of T and P. * * \f[ @@ -1121,7 +969,7 @@ public: virtual double dA_DebyedP_TP(double temperature = -1.0, double pressure = -1.0) const; - //!Reports the ionic radius of the kth species + //! Reports the ionic radius of the kth species /*! * @param k species index. */ @@ -1138,26 +986,26 @@ public: } private: - //! Static function that implements the non-polar species - //! salt-out modifications. + //! Static function that implements the non-polar species salt-out + //! modifications. /*! - * Returns the calculated activity coefficients. + * Returns the calculated activity coefficients. * * @param IionicMolality Value of the ionic molality (sqrt(gmol/kg)) */ double _nonpolarActCoeff(double IionicMolality) const; - //! Formula for the osmotic coefficient that occurs in the GWB. + //! Formula for the osmotic coefficient that occurs in the GWB. /*! - * It is originally from Helgeson for a variable - * NaCl brine. It's to be used with extreme caution. + * It is originally from Helgeson for a variable NaCl brine. It's to be + * used with extreme caution. */ double _osmoticCoeffHelgesonFixedForm() const; - //! Formula for the log of the water activity that occurs in the GWB. + //! Formula for the log of the water activity that occurs in the GWB. /*! - * It is originally from Helgeson for a variable - * NaCl brine. It's to be used with extreme caution. + * It is originally from Helgeson for a variable NaCl brine. It's to be + * used with extreme caution. */ double _lnactivityWaterHelgesonFixedForm() const; //@} @@ -1194,17 +1042,16 @@ protected: * 2 X_k / V_N 1.0 / V_N * * - * The value and form of the generalized concentration will affect - * reaction rate constants involving species in this phase. + * The value and form of the generalized concentration will affect reaction + * rate constants involving species in this phase. * - * (HKM Note: Using option #1 may lead to spurious results and - * has been included only with warnings. The reason is that it - * molar volumes of electrolytes may often be negative. The - * molar volume of H+ is defined to be zero too. Either options - * 0 or 2 are the appropriate choice. Option 0 leads to - * bulk reaction rate constants which have units of s-1. - * Option 2 leads to bulk reaction rate constants for - * bimolecular rxns which have units of m-3 kmol-1 s-1.) + * (HKM Note: Using option #1 may lead to spurious results and has been + * included only with warnings. The reason is that it molar volumes of + * electrolytes may often be negative. The molar volume of H+ is defined to + * be zero too. Either options 0 or 2 are the appropriate choice. Option 0 + * leads to bulk reaction rate constants which have units of s-1. Option 2 + * leads to bulk reaction rate constants for bimolecular rxns which have + * units of m-3 kmol-1 s-1.) */ int m_formGC; @@ -1221,29 +1068,21 @@ protected: */ vector_int m_electrolyteSpeciesType; - /** - * a_k = Size of the ionic species in the DH formulation - * units = meters - */ + //! a_k = Size of the ionic species in the DH formulation. units = meters vector_fp m_Aionic; //! Current value of the ionic strength on the molality scale mutable double m_IionicMolality; - /** - * Maximum value of the ionic strength allowed in the - * calculation of the activity coefficients. - */ + //! Maximum value of the ionic strength allowed in the calculation of the + //! activity coefficients. double m_maxIionicStrength; public: - /** - * If true, then the fixed for of Helgeson's activity - * for water is used instead of the rigorous form - * obtained from Gibbs-Duhem relation. This should be - * used with caution, and is really only included as a - * validation exercise. - */ + //! If true, then the fixed for of Helgeson's activity for water is used + //! instead of the rigorous form obtained from Gibbs-Duhem relation. This + //! should be used with caution, and is really only included as a validation + //! exercise. bool m_useHelgesonFixedForm; protected: //! Stoichiometric ionic strength on the molality scale @@ -1271,10 +1110,9 @@ public: protected: //! Current value of the Debye Constant, A_Debye /** - * A_Debye -> this expression appears on the top of the - * ln actCoeff term in the general Debye-Huckel - * expression - * It depends on temperature and pressure. + * A_Debye -> this expression appears on the top of the ln actCoeff term in + * the general Debye-Huckel expression It depends on temperature + * and pressure. * * A_Debye = (F e B_Debye) / (8 Pi epsilon R T) * @@ -1293,10 +1131,9 @@ protected: //! Current value of the constant that appears in the denominator /** - * B_Debye -> this expression appears on the bottom of the - * ln actCoeff term in the general Debye-Huckel - * expression - * It depends on temperature + * B_Debye -> this expression appears on the bottom of the ln actCoeff term + * in the general Debye-Huckel expression It depends on + * temperature * * B_Bebye = F / sqrt( epsilon R T / 2 ) * @@ -1369,10 +1206,10 @@ protected: */ Array2D m_Beta_ij; - //! Logarithm of the activity coefficients on the molality scale. + //! Logarithm of the activity coefficients on the molality scale. /*! - * mutable because we change this if the composition - * or temperature or pressure changes. + * mutable because we change this if the composition or temperature or + * pressure changes. */ mutable vector_fp m_lnActCoeffMolal; @@ -1403,40 +1240,37 @@ private: //! Calculation of temperature derivative of activity coefficient /*! - * Using internally stored values, this function calculates - * the temperature derivative of the logarithm of the - * activity coefficient for all species in the mechanism. + * Using internally stored values, this function calculates the temperature + * derivative of the logarithm of the activity coefficient for all species + * in the mechanism. * - * We assume that the activity coefficients are current in this routine - * - * The solvent activity coefficient is on the molality scale. Its derivative is too. + * We assume that the activity coefficients are current in this routine. The + * solvent activity coefficient is on the molality scale. Its derivative is + * too. */ void s_update_dlnMolalityActCoeff_dT() const; //! Calculate the temperature 2nd derivative of the activity coefficient /*! - * Using internally stored values, this function calculates - * the temperature 2nd derivative of the logarithm of the - * activity coefficient for all species in the mechanism. + * Using internally stored values, this function calculates the temperature + * 2nd derivative of the logarithm of the activity coefficient for all + * species in the mechanism. * - * We assume that the activity coefficients are current in this routine - * - * solvent activity coefficient is on the molality - * scale. Its derivatives are too. + * We assume that the activity coefficients are current in this routine. + * Solvent activity coefficient is on the molality scale. Its derivatives + * are too. */ void s_update_d2lnMolalityActCoeff_dT2() const; //! Calculate the pressure derivative of the activity coefficient /*! - * Using internally stored values, this function calculates - * the pressure derivative of the logarithm of the - * activity coefficient for all species in the mechanism. + * Using internally stored values, this function calculates the pressure + * derivative of the logarithm of the activity coefficient for all species + * in the mechanism. * - * We assume that the activity coefficients, molalities, - * and A_Debye are current. - * - * solvent activity coefficient is on the molality - * scale. Its derivatives are too. + * We assume that the activity coefficients, molalities, and A_Debye are + * current. Solvent activity coefficient is on the molality scale. Its + * derivatives are too. */ void s_update_dlnMolalityActCoeff_dP() const; }; diff --git a/include/cantera/thermo/EdgePhase.h b/include/cantera/thermo/EdgePhase.h index d26b463a5..b85cb6086 100644 --- a/include/cantera/thermo/EdgePhase.h +++ b/include/cantera/thermo/EdgePhase.h @@ -35,19 +35,8 @@ public: */ EdgePhase(doublereal n0=1.0); - //! Copy Constructor - /*! - * @param right Object to be copied - */ EdgePhase(const EdgePhase& right); - - //! Assignment Operator - /*! - * @param right Object to be copied - */ EdgePhase& operator=(const EdgePhase& right); - - //! Duplicator from a ThermoPhase object ThermoPhase* duplMyselfAsThermoPhase() const; //! returns the equation of state type @@ -59,15 +48,13 @@ public: /*! * The Equation-of-State data consists of one item, the site density. * - * @param thermoData Reference to an XML_Node named thermo - * containing the equation-of-state data. The - * XML_Node is within the phase XML_Node describing - * the EdgePhase object. + * @param thermoData Reference to an XML_Node named thermo containing the + * equation-of-state data. The XML_Node is within the + * phase XML_Node describing the EdgePhase object. * - * An example of the contents of the thermoData XML_Node is provided - * below. The units attribute is used to supply the units of the - * site density in any convenient form. Internally it is changed - * into MKS form. + * An example of the contents of the thermoData XML_Node is provided below. + * The units attribute is used to supply the units of the site density in + * any convenient form. Internally it is changed into MKS form. * * @code * diff --git a/include/cantera/thermo/FixedChemPotSSTP.h b/include/cantera/thermo/FixedChemPotSSTP.h index d0eee8a94..91efe4cf1 100644 --- a/include/cantera/thermo/FixedChemPotSSTP.h +++ b/include/cantera/thermo/FixedChemPotSSTP.h @@ -19,67 +19,66 @@ namespace Cantera { -//! Class FixedChemPotSSTP represents a stoichiometric (fixed -//! composition) incompressible substance. +//! Class FixedChemPotSSTP represents a stoichiometric (fixed composition) +//! incompressible substance. /*! - * This class internally changes the independent degree of freedom from - * density to pressure. This is necessary because the phase is - * incompressible. It uses a zero volume approximation. + * This class internally changes the independent degree of freedom from density + * to pressure. This is necessary because the phase is incompressible. It uses a + * zero volume approximation. * * Specification of Species Standard State Properties * - * This class inherits from SingleSpeciesTP. - * It uses a single value for the chemical potential which is assumed to be constant - * with respect to temperature and pressure. + * This class inherits from SingleSpeciesTP. It uses a single value for the + * chemical potential which is assumed to be constant with respect to + * temperature and pressure. * - * The reference state thermodynamics is inherited from SingleSpeciesTP. However, - * it's only used to set the initial chemical potential to the value - * of the chemical potential at the starting conditions. Thereafter, - * it is ignored. + * The reference state thermodynamics is inherited from SingleSpeciesTP. + * However, it's only used to set the initial chemical potential to the value of + * the chemical potential at the starting conditions. Thereafter, it is ignored. * - * For a zero volume material, the internal energy and the enthalpy are - * equal to the chemical potential. The entropy, the heat capacity, and the molar volume - * are equal to zero. + * For a zero volume material, the internal energy and the enthalpy are equal to + * the chemical potential. The entropy, the heat capacity, and the molar volume + * are equal to zero. * * Specification of Solution Thermodynamic Properties * - * All solution properties are obtained from the standard state - * species functions, since there is only one species in the phase. + * All solution properties are obtained from the standard state species + * functions, since there is only one species in the phase. * * Application within Kinetics Managers * - * The standard concentration is equal to 1.0. This means that the - * kinetics operator works on an (activities basis). Since this - * is a stoichiometric substance, this means that the concentration - * of this phase drops out of kinetics expressions. + * The standard concentration is equal to 1.0. This means that the kinetics + * operator works on an (activities basis). Since this is a stoichiometric + * substance, this means that the concentration of this phase drops out of + * kinetics expressions. * - * An example of a reaction using this is a sticking coefficient - * reaction of a substance in an ideal gas phase on a surface with a bulk phase - * species in this phase. In this case, the rate of progress for this - * reaction, \f$ R_s \f$, may be expressed via the following equation: + * An example of a reaction using this is a sticking coefficient reaction of a + * substance in an ideal gas phase on a surface with a bulk phase species in + * this phase. In this case, the rate of progress for this reaction, \f$ R_s + * \f$, may be expressed via the following equation: * \f[ * R_s = k_s C_{gas} * \f] * where the units for \f$ R_s \f$ are kmol m-2 s-1. \f$ C_{gas} \f$ has units - * of kmol m-3. Therefore, the kinetic rate constant, \f$ k_s \f$, has - * units of m s-1. Nowhere does the concentration of the bulk phase - * appear in the rate constant expression, since it's a stoichiometric - * phase, and the activity is always equal to 1.0. + * of kmol m-3. Therefore, the kinetic rate constant, \f$ k_s \f$, has units of + * m s-1. Nowhere does the concentration of the bulk phase appear in the rate + * constant expression, since it's a stoichiometric phase, and the activity is + * always equal to 1.0. * * Instantiation of the Class * * This phase may be instantiated by calling the default ThermoFactory routine - * for %Cantera. This new FixedChemPotSSTP object must then have a standalone XML file - * description an example of which is given below. + * for %Cantera. This new FixedChemPotSSTP object must then have a standalone + * XML file description an example of which is given below. * - * It may also be created by the following code snippets. The code - * includes the special member function setChemicalPotential( chempot), which - * sets the chemical potential to a specific value in J / kmol. + * It may also be created by the following code snippets. The code includes the + * special member function setChemicalPotential( chempot), which sets the + * chemical potential to a specific value in J / kmol. * * @code * XML_Node *xm = get_XML_NameID("phase", iFile + "#Li(Fixed)", 0); * FixedChemPotSSTP *LiFixed = new FixedChemPotSSTP(*xm); - // Set the chemical potential to -2.3E7 J/kmol + * // Set the chemical potential to -2.3E7 J/kmol * LiFixed->setChemicalPotential(-2.3E7.) * @endcode * @@ -170,14 +169,9 @@ public: */ FixedChemPotSSTP(XML_Node& phaseRef, const std::string& id = ""); - //! Copy constructor - /*! - * @param right Object to be copied - */ - FixedChemPotSSTP(const FixedChemPotSSTP& right); - //! Special constructor for the FixecChemPotSSTP class setting an element chemical - //! potential directly + //! Special constructor for the FixecChemPotSSTP class setting an element + //! chemical potential directly /*! * This will create a FixedChemPotSSTP consisting of a single species with the * stoichiometry of one of the specified atom. It will have a chemical potential @@ -188,20 +182,8 @@ public: */ FixedChemPotSSTP(const std::string& Ename, doublereal chemPot); - //! Assignment operator - /*! - * @param right Object to be copied - */ + FixedChemPotSSTP(const FixedChemPotSSTP& right); FixedChemPotSSTP& operator=(const FixedChemPotSSTP& right); - - //! Duplication function - /*! - * This virtual function is used to create a duplicate of the - * current phase. It's used to duplicate the phase when given - * a ThermoPhase pointer to the phase. - * - * @return It returns a ThermoPhase pointer. - */ ThermoPhase* duplMyselfAsThermoPhase() const; /** @@ -217,39 +199,22 @@ public: //! Report the Pressure. Units: Pa. /*! - * For an incompressible substance, the density is independent - * of pressure. This method simply returns the stored - * pressure value. + * For an incompressible substance, the density is independent of pressure. + * This method simply returns the stored pressure value. */ virtual doublereal pressure() const; //! Set the pressure at constant temperature. Units: Pa. /*! - * For an incompressible substance, the density is - * independent of pressure. Therefore, this method only - * stores the specified pressure value. It does not - * modify the density. + * For an incompressible substance, the density is independent of pressure. + * Therefore, this method only stores the specified pressure value. It does + * not modify the density. * * @param p Pressure (units - Pa) */ virtual void setPressure(doublereal p); - //! Returns the isothermal compressibility. Units: 1/Pa. - /*! - * The isothermal compressibility is defined as - * \f[ - * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T - * \f] - */ virtual doublereal isothermalCompressibility() const; - - //! Return the volumetric thermal expansion coefficient. Units: 1/K. - /*! - * The thermal expansion coefficient is defined as - * \f[ - * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P - * \f] - */ virtual doublereal thermalExpansionCoeff() const; /** @@ -261,60 +226,41 @@ public: * @{ */ - //! This method returns an array of generalized concentrations - /*! - * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / - * C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration - * defined below and \f$ a_k \f$ are activities used in the - * thermodynamic functions. These activity (or generalized) - * concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. - * - * For a stoichiometric substance, there is - * only one species, and the generalized concentration is 1.0. - * - * @param c Output array of generalized concentrations. The - * units depend upon the implementation of the - * reaction rate expressions within the phase. + //! @copydoc ThermoPhase::getActivityConcentrations + /*! + * For a stoichiometric substance, there is only one species, and the + * generalized concentration is 1.0. */ virtual void getActivityConcentrations(doublereal* c) const; //! Return the standard concentration for the kth species /*! - * The standard concentration \f$ C^0_k \f$ used to normalize - * the activity (i.e., generalized) concentration. - * This phase assumes that the kinetics operator works on an - * dimensionless basis. Thus, the standard concentration is - * equal to 1.0. + * The standard concentration \f$ C^0_k \f$ used to normalize the activity + * (i.e., generalized) concentration. This phase assumes that the kinetics + * operator works on an dimensionless basis. Thus, the standard + * concentration is equal to 1.0. * - * @param k Optional parameter indicating the species. The default - * is to assume this refers to species 0. + * @param k Optional parameter indicating the species. The default is to + * assume this refers to species 0. * @return * Returns The standard Concentration as 1.0 */ virtual doublereal standardConcentration(size_t k=0) const; - - //! Natural logarithm of the standard concentration of the kth species. - /*! - * @param k index of the species (defaults to zero) - */ virtual doublereal logStandardConc(size_t k=0) const; - //! Get the array of chemical potentials at unit activity for the species - //! at their standard states at the current T and P of the solution. + //! Get the array of chemical potentials at unit activity for the species at + //! their standard states at the current T and P of the + //! solution. /*! - * For a stoichiometric substance, there is no activity term in - * the chemical potential expression, and therefore the - * standard chemical potential and the chemical potential - * are both equal to the molar Gibbs function. + * For a stoichiometric substance, there is no activity term in the chemical + * potential expression, and therefore the standard chemical potential and + * the chemical potential are both equal to the molar Gibbs function. * - * These are the standard state chemical potentials \f$ \mu^0_k(T,P) - * \f$. The values are evaluated at the current - * temperature and pressure of the solution + * These are the standard state chemical potentials \f$ \mu^0_k(T,P) \f$. + * The values are evaluated at the current temperature and pressure of the + * solution * - * @param mu0 Output vector of chemical potentials. - * Length: m_kk. + * @param mu0 Output vector of chemical potentials. Length: m_kk. */ virtual void getStandardChemPotentials(doublereal* mu0) const; @@ -338,58 +284,29 @@ public: /// @name Properties of the Standard State of the Species in the Solution //@{ - //! Get the nondimensional Enthalpy functions for the species - //! at their standard states at the current T and P of the solution. - /*! - * @param hrt Output vector of nondimensional standard state enthalpies. - * Length: m_kk. - */ virtual void getEnthalpy_RT(doublereal* hrt) const; - - //! Get the array of nondimensional Entropy functions for the - //! standard state species at the current T and P of the solution. - /*! - * @param sr Output vector of nondimensional standard state entropies. - * Length: m_kk. - */ virtual void getEntropy_R(doublereal* sr) const; - - //! Get the nondimensional Gibbs functions for the species - //! in their standard states at the current T and P of the solution. - /*! - * @param grt Output vector of nondimensional standard state Gibbs free energies - * Length: m_kk. - */ virtual void getGibbs_RT(doublereal* grt) const; - - //! Get the nondimensional Heat Capacities at constant - //! pressure for the species standard states - //! at the current T and P of the solution - /*! - * @param cpr Output vector of nondimensional standard state heat capacities - * Length: m_kk. - */ virtual void getCp_R(doublereal* cpr) const; - //! Returns the vector of nondimensional Internal Energies of the standard - //! state species at the current T and P of the solution + //! Returns the vector of nondimensional Internal Energies of the standard + //! state species at the current T and P of the solution /*! - * For an incompressible, - * stoichiometric substance, the molar internal energy is - * independent of pressure. Since the thermodynamic properties - * are specified by giving the standard-state enthalpy, the - * term \f$ P_{ref} \hat v\f$ is subtracted from the specified reference molar - * enthalpy to compute the standard state molar internal energy. + * For an incompressible, stoichiometric substance, the molar internal + * energy is independent of pressure. Since the thermodynamic properties are + * specified by giving the standard-state enthalpy, the term \f$ P_{ref} + * \hat v\f$ is subtracted from the specified reference molar enthalpy to + * compute the standard state molar internal energy. * * @param urt output vector of nondimensional standard state * internal energies of the species. Length: m_kk. */ virtual void getIntEnergy_RT(doublereal* urt) const; - //! Get the molar volumes of each species in their standard - //! states at the current T and P of the solution. + //! Get the molar volumes of each species in their standard states at the + //! current T and P of the solution. /* - * units = m^3 / kmol + * units = m^3 / kmol * * We set this to zero * @@ -402,81 +319,11 @@ public: /// @name Thermodynamic Values for the Species Reference States //@{ - //! Returns the vector of nondimensional - //! internal Energies of the reference state at the current temperature - //! of the solution and the reference pressure for each species. - /*! - * @param urt Output vector of nondimensional reference state internal - * energies of the species. Length: m_kk - */ virtual void getIntEnergy_RT_ref(doublereal* urt) const; - - /*! - * Returns the vector of nondimensional - * enthalpies of the reference state at the current temperature - * of the solution and the reference pressure for the species. - * - * This function is resolved in this class. It is assumed that the m_spthermo species thermo - * pointer is populated and yields the reference state. - * - * @param hrt Output vector containing the nondimensional reference state enthalpies - * Length: m_kk. - */ virtual void getEnthalpy_RT_ref(doublereal* hrt) const; - - /*! - * Returns the vector of nondimensional - * enthalpies of the reference state at the current temperature - * of the solution and the reference pressure for the species. - * - * This function is resolved in this class. It is assumed that the m_spthermo species thermo - * pointer is populated and yields the reference state. - * - * @param grt Output vector containing the nondimensional reference state - * Gibbs Free energies. Length: m_kk. - */ virtual void getGibbs_RT_ref(doublereal* grt) const; - - /*! - * Returns the vector of the - * Gibbs function of the reference state at the current temperature - * of the solution and the reference pressure for the species. - * units = J/kmol - * - * This function is resolved in this class. It is assumed that the m_spthermo species thermo - * pointer is populated and yields the reference state. - * - * @param g Output vector containing the reference state - * Gibbs Free energies. Length: m_kk. Units: J/kmol. - */ virtual void getGibbs_ref(doublereal* g) const; - - /*! - * Returns the vector of nondimensional - * entropies of the reference state at the current temperature - * of the solution and the reference pressure for each species. - * - * This function is resolved in this class. It is assumed that the m_spthermo species thermo - * pointer is populated and yields the reference state. - * - * @param er Output vector containing the nondimensional reference state - * entropies. Length: m_kk. - */ virtual void getEntropy_R_ref(doublereal* er) const; - - /*! - * Returns the vector of nondimensional - * constant pressure heat capacities of the reference state - * at the current temperature of the solution - * and reference pressure for each species. - * - * This function is resolved in this class. It is assumed that the m_spthermo species thermo - * pointer is populated and yields the reference state. - * - * @param cprt Output vector of nondimensional reference state - * heat capacities at constant pressure for the species. - * Length: m_kk - */ virtual void getCp_R_ref(doublereal* cprt) const; //@} @@ -509,11 +356,11 @@ public: /*! * This method is called by function importPhase() when processing a phase * definition in an input file. It should be overloaded in subclasses to set - * any parameters that are specific to that particular phase - * model. Note, this method is called before the phase is - * initialized with elements and/or species. + * any parameters that are specific to that particular phase model. Note, + * this method is called before the phase is initialized with elements + * and/or species. * - * For this phase, the chemical potential is set + * For this phase, the chemical potential is set. * * @param eosdata An XML_Node object corresponding to * the "thermo" entry for this phase in the input file. diff --git a/include/cantera/thermo/GibbsExcessVPSSTP.h b/include/cantera/thermo/GibbsExcessVPSSTP.h index 513fa26e5..b277c5535 100644 --- a/include/cantera/thermo/GibbsExcessVPSSTP.h +++ b/include/cantera/thermo/GibbsExcessVPSSTP.h @@ -4,12 +4,6 @@ * employ Gibbs excess free energy based formulations * (see \ref thermoprops * and class \link Cantera::GibbsExcessVPSSTP GibbsExcessVPSSTP\endlink). - * - * Header file for a derived class of ThermoPhase that handles - * variable pressure standard state methods for calculating - * thermodynamic properties that are further based upon activities - * based on the molality scale. These include most of the methods for - * calculating liquid electrolyte thermodynamics. */ /* * Copyright (2006) Sandia Corporation. Under the terms of @@ -25,19 +19,13 @@ namespace Cantera { -/** - * @ingroup thermoprops - */ - /*! - * GibbsExcessVPSSTP is a derived class of ThermoPhase that handles - * variable pressure standard state methods for calculating - * thermodynamic properties that are further based on - * expressing the Excess Gibbs free energy as a function of - * the mole fractions (or pseudo mole fractions) of constituents. - * This category is the workhorse for describing molten salts, - * solid-phase mixtures of semiconductors, and mixtures of miscible - * and semi-miscible compounds. + * GibbsExcessVPSSTP is a derived class of ThermoPhase that handles variable + * pressure standard state methods for calculating thermodynamic properties that + * are further based on expressing the Excess Gibbs free energy as a function of + * the mole fractions (or pseudo mole fractions) of constituents. This category + * is the workhorse for describing molten salts, solid-phase mixtures of + * semiconductors, and mixtures of miscible and semi-miscible compounds. * * It includes * - regular solutions @@ -46,88 +34,68 @@ namespace Cantera * - Wilson's equation * - UNIQUAC equation of state. * - * This class adds additional functions onto the ThermoPhase interface - * that handles the calculation of the excess Gibbs free energy. The ThermoPhase - * class includes a member function, ThermoPhase::activityConvention() - * that indicates which convention the activities are based on. The - * default is to assume activities are based on the molar convention. - * That default is used here. + * This class adds additional functions onto the ThermoPhase interface that + * handles the calculation of the excess Gibbs free energy. The ThermoPhase + * class includes a member function, ThermoPhase::activityConvention() that + * indicates which convention the activities are based on. The default is to + * assume activities are based on the molar convention. That default is used + * here. * * All of the Excess Gibbs free energy formulations in this area employ * symmetrical formulations. * - * Chemical potentials - * of species k, \f$ \mu_o \f$, has the following general format: + * Chemical potentials of species k, \f$ \mu_o \f$, has the following general + * format: * * \f[ * \mu_k = \mu^o_k(T,P) + R T ln( \gamma_k X_k ) * \f] * - * where \f$ \gamma_k^{\triangle} \f$ is a molar based activity coefficient for species - * \f$k\f$. + * where \f$ \gamma_k^{\triangle} \f$ is a molar based activity coefficient for + * species \f$k\f$. * - * GibbsExcessVPSSTP contains an internal vector with the current mole - * fraction vector. That's one of its primary usages. In order to keep the mole fraction + * GibbsExcessVPSSTP contains an internal vector with the current mole fraction + * vector. That's one of its primary usages. In order to keep the mole fraction * vector constant, all of the setState functions are redesigned at this layer. * - *

- * Activity Concentrations: Relationship of ThermoPhase to %Kinetics Expressions + *

+ * Activity Concentrations: Relationship of ThermoPhase to %Kinetics Expressions *

* - * As explained in a similar discussion in the ThermoPhase class, the actual units used - * in kinetics expressions must be specified in the ThermoPhase class for the corresponding - * species. These units vary with the field of study. %Cantera uses the concept of - * activity concentrations to represent this. Activity concentrations are used directly - * in the expressions for kinetics. Standard concentrations are used as the multiplicative - * constant that takes the activity of a species and turns it into an activity concentration. - * Standard concentrations must not depend on the concentration of the species in the phase. + * As explained in a similar discussion in the ThermoPhase class, the actual + * units used in kinetics expressions must be specified in the ThermoPhase class + * for the corresponding species. These units vary with the field of study. + * %Cantera uses the concept of activity concentrations to represent this. + * Activity concentrations are used directly in the expressions for kinetics. + * Standard concentrations are used as the multiplicative constant that takes + * the activity of a species and turns it into an activity concentration. + * Standard concentrations must not depend on the concentration of the species + * in the phase. * - * Here we set a standard for the specification of the standard concentrations for this class - * and all child classes underneath it. We specify here that the standard concentration is - * equal to 1 for all species. Therefore, the activities appear directly in kinetics expressions - * involving species in underlying GibbsExcessVPSSTP phases. + * Here we set a standard for the specification of the standard concentrations + * for this class and all child classes underneath it. We specify here that the + * standard concentration is equal to 1 for all species. Therefore, the + * activities appear directly in kinetics expressions involving species in + * underlying GibbsExcessVPSSTP phases. * - *

- * SetState Strategy + *

+ * SetState Strategy *

* - * All setState functions that set the internal state of the ThermoPhase object are - * overloaded at this level, so that a current mole fraction vector is maintained within - * the object. + * All setState functions that set the internal state of the ThermoPhase object + * are overloaded at this level, so that a current mole fraction vector is + * maintained within the object. */ class GibbsExcessVPSSTP : public VPStandardStateTP { public: //! @name Constructors //! @{ - /*! - * This doesn't do much more than initialize constants with - * default values for water at 25C. Water molecular weight - * comes from the default elements.xml file. It actually - * differs slightly from the IAPWS95 value of 18.015268. However, - * density conservation and therefore element conservation - * is the more important principle to follow. - */ + GibbsExcessVPSSTP() {} - //! Copy constructor - /*! - * @param b class to be copied - */ GibbsExcessVPSSTP(const GibbsExcessVPSSTP& b); - - /// Assignment operator - /*! - * @param b class to be copied. - */ GibbsExcessVPSSTP& operator=(const GibbsExcessVPSSTP& b); - - //! Duplication routine for objects which inherit from ThermoPhase. - /*! - * This virtual routine can be used to duplicate ThermoPhase objects - * inherited from ThermoPhase even if the application only has - * a pointer to ThermoPhase to work with. - */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; //! @} @@ -135,14 +103,14 @@ public: //! @name Mechanical Properties //! @{ - //! Set the internally stored pressure (Pa) at constant - //! temperature and composition + //! Set the internally stored pressure (Pa) at constant temperature and + //! composition /*! - * This method sets the pressure within the object. - * The water model is a completely compressible model. - * Also, the dielectric constant is pressure dependent. + * This method sets the pressure within the object. The water model is a + * completely compressible model. Also, the dielectric constant is pressure + * dependent. * - * @param p input Pressure (Pa) + * @param p input Pressure (Pa) * * @todo Implement a variable pressure capability */ @@ -150,8 +118,8 @@ public: protected: /** - * Calculate the density of the mixture using the partial - * molar volumes and mole fractions as input + * Calculate the density of the mixture using the partial molar volumes and + * mole fractions as input * * The formula for this is * @@ -159,18 +127,16 @@ protected: * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}} * \f] * - * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are - * the molecular weights, and \f$V_k\f$ are the pure species - * molar volumes. + * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular + * weights, and \f$V_k\f$ are the pure species molar volumes. * - * Note, the basis behind this formula is that in an ideal - * solution the partial molar volumes are equal to the pure - * species molar volumes. We have additionally specified - * in this class that the pure species molar volumes are - * independent of temperature and pressure. + * Note, the basis behind this formula is that in an ideal solution the + * partial molar volumes are equal to the pure species molar volumes. We + * have additionally specified in this class that the pure species molar + * volumes are independent of temperature and pressure. * - * NOTE: This is a non-virtual function, which is not a - * member of the ThermoPhase base class. + * NOTE: This is a non-virtual function, which is not a member of the + * ThermoPhase base class. */ void calcDensity(); @@ -179,42 +145,24 @@ public: * @} * @name Activities, Standard States, and Activity Concentrations * - * The activity \f$a_k\f$ of a species in solution is - * related to the chemical potential by \f[ \mu_k = \mu_k^0(T) - * + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is - * the chemical potential at unit activity, which depends only - * on temperature and pressure. + * The activity \f$a_k\f$ of a species in solution is related to the + * chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The + * quantity \f$\mu_k^0(T,P)\f$ is the chemical potential at unit activity, + * which depends only on temperature and pressure. * @{ */ - //! This method returns an array of generalized concentrations - /*! - * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / - * C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration - * defined below and \f$ a_k \f$ are activities used in the - * thermodynamic functions. These activity (or generalized) - * concentrations are used by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. Note that they may - * or may not have units of concentration --- they might be - * partial pressures, mole fractions, or surface coverages, - * for example. - * - * @param c Output array of generalized concentrations. The - * units depend upon the implementation of the - * reaction rate expressions within the phase. - */ virtual void getActivityConcentrations(doublereal* c) const; /** - * The standard concentration \f$ C^0_k \f$ used to normalize - * the generalized concentration. In many cases, this quantity - * will be the same for all species in a phase - for example, - * for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this - * reason, this method returns a single value, instead of an - * array. However, for phases in which the standard - * concentration is species-specific (e.g. surface species of - * different sizes), this method may be called with an - * optional parameter indicating the species. + * The standard concentration \f$ C^0_k \f$ used to normalize the + * generalized concentration. In many cases, this quantity will be the same + * for all species in a phase - for example, for an ideal gas + * \f$ C^0_k = P/\hat R T \f$. For this reason, this method returns a single + * value, instead of an array. However, for phases in which the standard + * concentration is species-specific (e.g. surface species of different + * sizes), this method may be called with an optional parameter indicating + * the species. * * The standard concentration for defaulted to 1. In other words * the activity concentration is assumed to be 1. @@ -222,18 +170,11 @@ public: * @param k species index. Defaults to zero. */ virtual doublereal standardConcentration(size_t k=0) const; - - /** - * Returns the natural logarithm of the standard - * concentration of the kth species - * - * @param k species index - */ virtual doublereal logStandardConc(size_t k=0) const; - //! Get the array of non-dimensional activities (molality - //! based for this class and classes that derive from it) at - //! the current solution temperature, pressure, and solution concentration. + //! Get the array of non-dimensional activities (molality based for this + //! class and classes that derive from it) at the current solution + //! temperature, pressure, and solution concentration. /*! * \f[ * a_i^\triangle = \gamma_k^{\triangle} \frac{m_k}{m^\triangle} @@ -245,19 +186,13 @@ public: */ virtual void getActivities(doublereal* ac) const; - //! Get the array of non-dimensional molar-based activity coefficients at - //! the current solution temperature, pressure, and solution concentration. - /*! - * @param ac Output vector of activity coefficients. Length: m_kk. - */ virtual void getActivityCoefficients(doublereal* ac) const; //! Get the array of temperature derivatives of the log activity coefficients /*! - * This function is a virtual class, but it first appears in GibbsExcessVPSSTP - * class and derived classes from GibbsExcessVPSSTP. + * This function is virtual, and first appears in GibbsExcessVPSSTP. * - * units = 1/Kelvin + * units = 1/Kelvin * * @param dlnActCoeffdT Output vector of temperature derivatives of the * log Activity Coefficients. length = m_kk @@ -266,42 +201,21 @@ public: throw NotImplementedError("GibbsExcessVPSSTP::getdlnActCoeffdT"); } - //! Get the array of derivatives of the log activity coefficients with respect to the log of the species mole numbers - /*! - * Implementations should take the derivative of the logarithm of the activity coefficient with respect to a - * species log mole number (with all other species mole numbers held constant). The default treatment in the - * ThermoPhase object is to set this vector to zero. - * - * units = 1 / kmol - * - * dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log act_coeff for the mth - * species with respect to the number of moles of the kth species. - * - * \f[ - * \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i} - * \f] - * - * @param ld Number of rows in the matrix - * @param dlnActCoeffdlnN Output vector of derivatives of the - * log Activity Coefficients. length = m_kk * m_kk - */ virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN) { throw NotImplementedError("GibbsExcessVPSSTP::getdlnActCoeffdlnN: " "nonzero and nonimplemented"); } - //! Get the array of log concentration-like derivatives of the - //! log activity coefficients + //! Get the array of log concentration-like derivatives of the log activity + //! coefficients /*! - * This function is a virtual method. For ideal mixtures - * (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the - * logarithm of the activity coefficient with respect to the - * logarithm of the concentration-like variable (i.e. number of moles in - * in a unit volume. ) that represents the standard state. - * This quantity is to be used in conjunction with derivatives of - * that concentration-like variable when the derivative of the chemical - * potential is taken. + * This function is a virtual method. For ideal mixtures (unity activity + * coefficients), this can return zero. Implementations should take the + * derivative of the logarithm of the activity coefficient with respect to + * the logarithm of the concentration-like variable (i.e. number of moles in + * in a unit volume. ) that represents the standard state. This quantity is + * to be used in conjunction with derivatives of that concentration-like + * variable when the derivative of the chemical potential is taken. * * units = dimensionless * @@ -316,17 +230,6 @@ public: /// @name Partial Molar Properties of the Solution //@{ - /** - * Get the species electrochemical potentials. - * These are partial molar quantities. - * This method adds a term \f$ Fz_k \phi_k \f$ to the - * to each chemical potential. - * - * Units: J/kmol - * - * @param mu output vector containing the species electrochemical potentials. - * Length: m_kk. - */ void getElectrochemPotentials(doublereal* mu) const; //! Return an array of partial molar volumes for the @@ -349,88 +252,14 @@ public: * @{ */ - //! Set the temperature (K) and pressure (Pa) - /*! - * Set the temperature and pressure. - * - * @param t Temperature (K) - * @param p Pressure (Pa) - */ virtual void setState_TP(doublereal t, doublereal p); - - /** - * Set the mass fractions to the specified values, and then - * normalize them so that they sum to 1.0. - * @param y Array of unnormalized mass fraction values (input). - * Must have a length greater than or equal to the number of - * species. - * - * @param y Input vector of mass fractions. - * Length is m_kk. - */ virtual void setMassFractions(const doublereal* const y); - - /** - * Set the mass fractions to the specified values without - * normalizing. This is useful when the normalization - * condition is being handled by some other means, for example - * by a constraint equation as part of a larger set of - * equations. - * - * @param y Input vector of mass fractions. - * Length is m_kk. - */ virtual void setMassFractions_NoNorm(const doublereal* const y); - - /** - * Set the mole fractions to the specified values, and then - * normalize them so that they sum to 1.0. - * @param x Array of unnormalized mole fraction values (input). - * Must have a length greater than or equal to the number of - * species. - * - * @param x Input vector of mole fractions. - * Length is m_kk. - */ virtual void setMoleFractions(const doublereal* const x); - - /** - * Set the mole fractions to the specified values without - * normalizing. This is useful when the normalization - * condition is being handled by some other means, for example - * by a constraint equation as part of a larger set of - * equations. - * - * @param x Input vector of mole fractions. - * Length is m_kk. - */ virtual void setMoleFractions_NoNorm(const doublereal* const x); - - /** - * Set the concentrations to the specified values within the - * phase. - * - * @param c The input vector to this routine is in dimensional - * units. For volumetric phases c[k] is the - * concentration of the kth species in kmol/m3. - * For surface phases, c[k] is the concentration - * in kmol/m2. The length of the vector is the number - * of species in the phase. - */ virtual void setConcentrations(const doublereal* const c); //@} - /*! - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase(). - */ virtual void initThermo(); private: @@ -459,30 +288,30 @@ protected: //! species mutable vector_fp lnActCoeff_Scaled_; - //! Storage for the current derivative values of the - //! gradients with respect to temperature of the - //! log of the activity coefficients of the species + //! Storage for the current derivative values of the gradients with respect + //! to temperature of the log of the activity coefficients of the species mutable vector_fp dlnActCoeffdT_Scaled_; - //! Storage for the current derivative values of the - //! gradients with respect to temperature of the - //! log of the activity coefficients of the species + //! Storage for the current derivative values of the gradients with respect + //! to temperature of the log of the activity coefficients of the species mutable vector_fp d2lnActCoeffdT2_Scaled_; - //! Storage for the current derivative values of the - //! gradients with respect to logarithm of the mole fraction of the - //! log of the activity coefficients of the species + //! Storage for the current derivative values of the gradients with respect + //! to logarithm of the mole fraction of the log of the activity + //! coefficients of the species mutable vector_fp dlnActCoeffdlnN_diag_; - //! Storage for the current derivative values of the - //! gradients with respect to logarithm of the mole fraction of the - //! log of the activity coefficients of the species + //! Storage for the current derivative values of the gradients with respect + //! to logarithm of the mole fraction of the log of the activity + //! coefficients of the species mutable vector_fp dlnActCoeffdlnX_diag_; - //! Storage for the current derivative values of the gradients with respect to logarithm of the species mole number of the - //! log of the activity coefficients of the species + //! Storage for the current derivative values of the gradients with respect + //! to logarithm of the species mole number of the log of the activity + //! coefficients of the species /*! - * dlnActCoeffdlnN_(k, m) is the derivative of ln(gamma_k) wrt ln mole number of species m + * dlnActCoeffdlnN_(k, m) is the derivative of ln(gamma_k) wrt ln mole + * number of species m */ mutable Array2D dlnActCoeffdlnN_; diff --git a/include/cantera/thermo/HMWSoln.h b/include/cantera/thermo/HMWSoln.h index 2dc4aefbf..8cf630238 100644 --- a/include/cantera/thermo/HMWSoln.h +++ b/include/cantera/thermo/HMWSoln.h @@ -24,30 +24,27 @@ namespace Cantera /** * Major Parameters: - * The form of the Pitzer expression refers to the - * form of the Gibbs free energy expression. The temperature - * dependence of the Pitzer coefficients are handled by - * another parameter. + * The form of the Pitzer expression refers to the form of the Gibbs free + * energy expression. The temperature dependence of the Pitzer coefficients + * are handled by another parameter. * * m_formPitzer = Form of the Pitzer expression * * PITZERFORM_BASE = 0 * - * Only one form is supported atm. This parameter is included for - * future expansion. + * Only one form is supported atm. This parameter is included for + * future expansion. */ #define PITZERFORM_BASE 0 /*! * @name Temperature Dependence of the Pitzer Coefficients * - * Note, the temperature dependence of the - * Gibbs free energy also depends on the temperature dependence - * of the standard state and the temperature dependence of the - * Debye-Huckel constant, which includes the dielectric constant - * and the density. Therefore, this expression defines only part - * of the temperature dependence for the mixture thermodynamic - * functions. + * Note, the temperature dependence of the Gibbs free energy also depends on the + * temperature dependence of the standard state and the temperature dependence + * of the Debye-Huckel constant, which includes the dielectric constant and the + * density. Therefore, this expression defines only part of the temperature + * dependence for the mixture thermodynamic functions. * * PITZER_TEMP_CONSTANT * All coefficients are considered constant wrt temperature @@ -69,9 +66,9 @@ namespace Cantera //@} /* - * @name ways to calculate the value of A_Debye + * @name ways to calculate the value of A_Debye * - * These defines determine the way A_Debye is calculated + * These defines determine the way A_Debye is calculated */ //@{ #define A_DEBYE_CONST 0 @@ -92,79 +89,71 @@ class WaterProps; *

Specification of Species Standard State Properties

*
* - * The solvent is assumed to be liquid water. A real model for liquid - * water (IAPWS 1995 formulation) is used as its standard state. - * All standard state properties for the solvent are based on - * this real model for water, and involve function calls - * to the object that handles the real water model, #Cantera::WaterPropsIAPWS. + * The solvent is assumed to be liquid water. A real model for liquid water + * (IAPWS 1995 formulation) is used as its standard state. All standard state + * properties for the solvent are based on this real model for water, and + * involve function calls to the object that handles the real water model, + * #Cantera::WaterPropsIAPWS. * - * The standard states for solutes are on the unit molality basis. - * Therefore, in the documentation below, the normal \f$ o \f$ - * superscript is replaced with + * The standard states for solutes 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$. + * \f$ \triangle, ref \f$. * - * It is assumed that the reference state thermodynamics may be - * obtained by a pointer to a populated species thermodynamic property - * manager class (see ThermoPhase::m_spthermo). How to relate pressure - * changes to the reference state thermodynamics is resolved at this level. + * It is assumed that the reference state thermodynamics may be obtained by a + * pointer to a populated species thermodynamic property manager class (see + * ThermoPhase::m_spthermo). How to relate pressure changes to the reference + * state thermodynamics is resolved at this level. * - * For solutes that rely on ThermoPhase::m_spthermo, are assumed to - * have an incompressible standard state mechanical property. - * In other words, the molar volumes are independent of temperature - * and pressure. + * For solutes that rely on ThermoPhase::m_spthermo, are assumed to have an + * incompressible standard state mechanical property. In other words, the molar + * volumes are independent of temperature and pressure. * - * For these incompressible, - * standard states, the molar internal energy is - * independent of pressure. Since the thermodynamic properties - * are specified by giving the standard-state enthalpy, the - * term \f$ P_0 \hat v\f$ is subtracted from the specified molar - * enthalpy to compute the molar internal energy. The entropy is - * assumed to be independent of the pressure. + * For these incompressible, standard states, the molar internal energy is + * independent of pressure. Since the thermodynamic properties are specified by + * giving the standard-state enthalpy, the term \f$ P_0 \hat v\f$ is subtracted + * from the specified molar enthalpy to compute the molar internal energy. The + * entropy is assumed to be independent of the pressure. * * The enthalpy function is given by the following relation. * - * \f[ - * h^\triangle_k(T,P) = h^{\triangle,ref}_k(T) - * + \tilde{v}_k \left( P - P_{ref} \right) - * \f] + * \f[ + * h^\triangle_k(T,P) = h^{\triangle,ref}_k(T) + * + \tilde{v}_k \left( P - P_{ref} \right) + * \f] * - * For an incompressible, - * stoichiometric substance, the molar internal energy is - * independent of pressure. Since the thermodynamic properties - * are specified by giving the standard-state enthalpy, the - * term \f$ P_{ref} \tilde v\f$ is subtracted from the specified reference molar - * enthalpy to compute the molar internal energy. + * For an incompressible, stoichiometric substance, the molar internal energy is + * independent of pressure. Since the thermodynamic properties are specified by + * giving the standard-state enthalpy, the term \f$ P_{ref} \tilde v\f$ is + * subtracted from the specified reference molar enthalpy to compute the molar + * internal energy. * - * \f[ - * u^\triangle_k(T,P) = h^{\triangle,ref}_k(T) - P_{ref} \tilde{v}_k - * \f] + * \f[ + * u^\triangle_k(T,P) = h^{\triangle,ref}_k(T) - P_{ref} \tilde{v}_k + * \f] * - * The solute standard state heat capacity and entropy are independent - * of pressure. The solute standard state Gibbs free energy is obtained - * from the enthalpy and entropy functions. + * The solute standard state heat capacity and entropy are independent of + * pressure. The solute standard state Gibbs free energy is obtained from the + * enthalpy and entropy functions. * - * The vector Phase::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 - * HMWSoln object and are then not touched. + * The vector Phase::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 HMWSoln 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. + * 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. * *
*

Specification of Solution Thermodynamic Properties

*
* - * 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: + * 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}) @@ -173,81 +162,81 @@ class WaterProps; * \mu_o = \mu^o_o(T,P) + RT ln(a_o) * \f] * - * where \f$ \gamma_k^{\triangle} \f$ is the molality based activity coefficient for species - * \f$k\f$. + * where \f$ \gamma_k^{\triangle} \f$ is the molality based activity coefficient + * for species \f$k\f$. * - * Individual activity coefficients of ions can not be independently measured. Instead, - * only binary pairs forming electroneutral solutions can be measured. This problem - * leads to a redundancy in the evaluation of species standard state properties. - * The redundancy issue is resolved by setting the standard state chemical potential - * enthalpy, entropy, and volume for the hydrogen ion, H+, to zero, for every temperature - * and pressure. After this convention is applied, all other standard state - * properties of ionic species contain meaningful information. + * Individual activity coefficients of ions can not be independently measured. + * Instead, only binary pairs forming electroneutral solutions can be measured. + * This problem leads to a redundancy in the evaluation of species standard + * state properties. The redundancy issue is resolved by setting the standard + * state chemical potential enthalpy, entropy, and volume for the hydrogen ion, + * H+, to zero, for every temperature and pressure. After this convention is + * applied, all other standard state properties of ionic species contain + * meaningful information. * - *

Ionic Strength

+ *

Ionic Strength

* - * Most of the parameterizations within the model use the ionic strength - * as a key variable. The ionic strength, \f$ I\f$ is defined as follows + * Most of the parameterizations within the model use the ionic strength as a + * key variable. The ionic strength, \f$ I\f$ is defined as follows * - * \f[ + * \f[ * I = \frac{1}{2} \sum_k{m_k z_k^2} - * \f] + * \f] * - * \f$ m_k \f$ is the molality of the kth species. \f$ z_k \f$ is the charge - * of the kth species. Note, the ionic strength is a defined units quantity. - * The molality has defined units of gmol kg-1, and therefore the ionic - * strength has units of sqrt( gmol kg-1). + * \f$ m_k \f$ is the molality of the kth species. \f$ z_k \f$ is the charge of + * the kth species. Note, the ionic strength is a defined units quantity. The + * molality has defined units of gmol kg-1, and therefore the ionic strength has + * units of sqrt( gmol kg-1). * - * In some instances, from some authors, a different - * formulation is used for the ionic strength in the equations below. The different - * formulation is due to the possibility of the existence of weak acids and how - * association wrt to the weak acid equilibrium relation affects the calculation - * of the activity coefficients via the assumed value of the ionic strength. + * In some instances, from some authors, a different formulation is used for the + * ionic strength in the equations below. The different formulation is due to + * the possibility of the existence of weak acids and how association wrt to the + * weak acid equilibrium relation affects the calculation of the activity + * coefficients via the assumed value of the ionic strength. * - * If we are to assume that the association reaction doesn't have an effect - * on the ionic strength, then we will want to consider the associated weak - * acid as in effect being fully dissociated, when we calculate an effective - * value for the ionic strength. We will call this calculated value, the - * stoichiometric ionic strength, \f$ I_s \f$, putting a subscript s to denote - * it from the more straightforward calculation of \f$ I \f$. + * If we are to assume that the association reaction doesn't have an effect on + * the ionic strength, then we will want to consider the associated weak acid as + * in effect being fully dissociated, when we calculate an effective value for + * the ionic strength. We will call this calculated value, the stoichiometric + * ionic strength, \f$ I_s \f$, putting a subscript s to denote it from the more + * straightforward calculation of \f$ I \f$. * - * \f[ + * \f[ * I_s = \frac{1}{2} \sum_k{m_k^s z_k^2} - * \f] + * \f] * - * Here, \f$ m_k^s \f$ is the value of the molalities calculated assuming that - * all weak acid-base pairs are in their fully dissociated states. This calculation may - * be simplified by considering that the weakly associated acid may be made up of two - * charged species, k1 and k2, each with their own charges, obeying the following relationship: + * Here, \f$ m_k^s \f$ is the value of the molalities calculated assuming that + * all weak acid-base pairs are in their fully dissociated states. This + * calculation may be simplified by considering that the weakly associated acid + * may be made up of two charged species, k1 and k2, each with their own + * charges, obeying the following relationship: * - * \f[ + * \f[ * z_k = z_{k1} + z_{k2} - * \f] - * Then, we may only need to specify one charge value, say, \f$ z_{k1}\f$, - * the cation charge number, - * in order to get both numbers, since we have already specified \f$ z_k \f$ - * in the definition of original species. - * Then, the stoichiometric ionic strength may be calculated via the following formula. + * \f] + * Then, we may only need to specify one charge value, say, \f$ z_{k1}\f$, the + * cation charge number, in order to get both numbers, since we have already + * specified \f$ z_k \f$ in the definition of original species. Then, the + * stoichiometric ionic strength may be calculated via the following formula. * - * \f[ + * \f[ * I_s = \frac{1}{2} \left(\sum_{k,ions}{m_k z_k^2}+ * \sum_{k,weak_assoc}(m_k z_{k1}^2 + m_k z_{k2}^2) \right) - * \f] + * \f] * - * The specification of which species are weakly associated acids is made in the input - * file via the - * stoichIsMods XML block, where the charge for k1 is also specified. - * An example is given below: + * The specification of which species are weakly associated acids is made in the + * input file via the stoichIsMods XML block, where the charge for k1 + * is also specified. An example is given below: * * @code - * - * NaCl(aq):-1.0 - * + * + * NaCl(aq):-1.0 + * * @endcode * - * Because we need the concept of a weakly associated acid in order to calculated - * \f$ I_s \f$ we need to - * catalog all species in the phase. This is done using the following categories: + * Because we need the concept of a weakly associated acid in order to calculated + * \f$ I_s \f$ we need to catalog all species in the phase. This is done using + * the following categories: * * - cEST_solvent : Solvent species (neutral) * - cEST_chargedSpecies Charged species (charged) @@ -261,56 +250,56 @@ class WaterProps; * - cEST_polarNeutral Polar neutral species * - cEST_nonpolarNeutral Non polar neutral species * - * Polar and non-polar neutral species are differentiated, because some additions - * to the activity - * coefficient expressions distinguish between these two types of solutes. - * This is the so-called salt-out effect. + * Polar and non-polar neutral species are differentiated, because some + * additions to the activity coefficient expressions distinguish between these + * two types of solutes. This is the so-called salt-out effect. * - * The type of species is specified in the electrolyteSpeciesType XML block. - * Note, this is not - * considered a part of the specification of the standard state for the species, - * at this time. Therefore, - * this information is put under the activityCoefficient XML block. An example - * is given below + * The type of species is specified in the electrolyteSpeciesType XML + * block. Note, this is not considered a part of the specification of the + * standard state for the species, at this time. Therefore, this information is + * put under the activityCoefficient XML block. An example is given + * below * * @code - * - * H2L(L):solvent - * H+:chargedSpecies - * NaOH(aq):weakAcidAssociated - * NaCl(aq):strongAcidAssociated - * NH3(aq):polarNeutral - * O2(aq):nonpolarNeutral - * + * + * H2L(L):solvent + * H+:chargedSpecies + * NaOH(aq):weakAcidAssociated + * NaCl(aq):strongAcidAssociated + * NH3(aq):polarNeutral + * O2(aq):nonpolarNeutral + * * @endcode * - * Much of the species electrolyte type information is inferred from other information in the - * input file. For example, as species which is charged is given the "chargedSpecies" default - * category. A neutral solute species is put into the "nonpolarNeutral" category by default. + * Much of the species electrolyte type information is inferred from other + * information in the input file. For example, as species which is charged is + * given the "chargedSpecies" default category. A neutral solute species is put + * into the "nonpolarNeutral" category by default. * - *

Specification of the Excess Gibbs Free Energy

+ *

Specification of the Excess Gibbs Free Energy

* - * Pitzer's formulation may best be represented as a specification of the excess Gibbs - * free energy, \f$ G^{ex} \f$, defined as the deviation of the total Gibbs free energy from - * that of an ideal molal solution. - * \f[ - * G = G^{id} + G^{ex} - * \f] + * Pitzer's formulation may best be represented as a specification of the excess + * Gibbs free energy, \f$ G^{ex} \f$, defined as the deviation of the total + * Gibbs free energy from that of an ideal molal solution. + * \f[ + * G = G^{id} + G^{ex} + * \f] * - * The ideal molal solution contribution, not equal to an ideal solution contribution - * and in fact containing a singularity at the zero solvent mole fraction limit, is - * given below. - * \f[ - * G^{id} = n_o \mu^o_o + \sum_{k\ne o} n_k \mu_k^{\triangle} - * + \tilde{M}_o n_o ( RT (\sum{m_i(\ln(m_i)-1)})) - * \f] + * The ideal molal solution contribution, not equal to an ideal solution + * contribution and in fact containing a singularity at the zero solvent mole + * fraction limit, is given below. + * \f[ + * G^{id} = n_o \mu^o_o + \sum_{k\ne o} n_k \mu_k^{\triangle} + * + \tilde{M}_o n_o ( RT (\sum{m_i(\ln(m_i)-1)})) + * \f] * - * From the excess Gibbs free energy formulation, the activity coefficient expression - * and the osmotic coefficient expression for the solvent may be defined, by - * taking the appropriate derivatives. Using this approach guarantees that the - * entire system will obey the Gibbs-Duhem relations. + * From the excess Gibbs free energy formulation, the activity coefficient + * expression and the osmotic coefficient expression for the solvent may be + * defined, by taking the appropriate derivatives. Using this approach + * guarantees that the entire system will obey the Gibbs-Duhem relations. * - * Pitzer employs the following general expression for the excess Gibbs free energy + * Pitzer employs the following general expression for the excess Gibbs free + * energy * * \f[ * \begin{array}{cclc} @@ -328,286 +317,283 @@ class WaterProps; * \end{array} * \f] * - * a is a subscript over all anions, c is a subscript extending over all - * cations, and i is a subscript that extends over all anions and cations. - * n is a subscript that extends only over neutral solute molecules. - * The second line contains cross terms where cations affect - * cations and/or cation/anion pairs, - * and anions affect anions or cation/anion pairs. Note part of the coefficients, - * \f$ \Phi_{c{c'}} \f$ and \f$ \Phi_{a{a'}} \f$ stem from the theory - * of unsymmetrical mixing of electrolytes with different charges. This - * theory depends on the total ionic strength of the solution, and therefore, - * \f$ \Phi_{c{c'}} \f$ and \f$ \Phi_{a{a'}} \f$ will depend on I, the - * ionic strength. \f$ B_{ca}\f$ is a strong function of the - * total ionic strength, I, - * of the electrolyte. The rest of the coefficients are assumed to be independent of the - * molalities or ionic strengths. However, all coefficients are potentially functions - * of the temperature and pressure of the solution. + * a is a subscript over all anions, c is a subscript extending + * over all cations, and i is a subscript that extends over all anions + * and cations. n is a subscript that extends only over neutral solute + * molecules. The second line contains cross terms where cations affect cations + * and/or cation/anion pairs, and anions affect anions or cation/anion pairs. + * Note part of the coefficients, \f$ \Phi_{c{c'}} \f$ and \f$ \Phi_{a{a'}} \f$ + * stem from the theory of unsymmetrical mixing of electrolytes with different + * charges. This theory depends on the total ionic strength of the solution, and + * therefore, \f$ \Phi_{c{c'}} \f$ and \f$ \Phi_{a{a'}} \f$ will depend on + * I, the ionic strength. \f$ B_{ca}\f$ is a strong function of the + * total ionic strength, I, of the electrolyte. The rest of the + * coefficients are assumed to be independent of the molalities or ionic + * strengths. However, all coefficients are potentially functions of the + * temperature and pressure of the solution. * - * A is the Debye-Huckel constant. Its specification is described in its own - * section below. + * A is the Debye-Huckel constant. Its specification is described in its + * own section below. * - * \f$ I\f$ is the ionic strength of the solution, and is given by: + * \f$ I\f$ is the ionic strength of the solution, and is given by: * - * \f[ - * I = \frac{1}{2} \sum_k{m_k z_k^2} - * \f] + * \f[ + * I = \frac{1}{2} \sum_k{m_k z_k^2} + * \f] * - * In contrast to several other Debye-Huckel implementations (see \ref DebyeHuckel), the - * parameter \f$ b\f$ in the above equation is a constant that - * does not vary with respect to ion identity. This is an important simplification - * as it avoids troubles with satisfaction of the Gibbs-Duhem analysis. + * In contrast to several other Debye-Huckel implementations (see \ref + * DebyeHuckel), the parameter \f$ b\f$ in the above equation is a constant that + * does not vary with respect to ion identity. This is an important + * simplification as it avoids troubles with satisfaction of the Gibbs-Duhem + * analysis. * - * The function \f$ Z \f$ is given by + * The function \f$ Z \f$ is given by * - * \f[ - * Z = \sum_i m_i \left| z_i \right| - * \f] + * \f[ + * Z = \sum_i m_i \left| z_i \right| + * \f] * - * The value of \f$ B_{ca}\f$ is given by the following function + * The value of \f$ B_{ca}\f$ is given by the following function * - * \f[ - * B_{ca} = \beta^{(0)}_{ca} + \beta^{(1)}_{ca} g(\alpha^{(1)}_{ca} \sqrt{I}) - * + \beta^{(2)}_{ca} g(\alpha^{(2)}_{ca} \sqrt{I}) - * \f] + * \f[ + * B_{ca} = \beta^{(0)}_{ca} + \beta^{(1)}_{ca} g(\alpha^{(1)}_{ca} \sqrt{I}) + * + \beta^{(2)}_{ca} g(\alpha^{(2)}_{ca} \sqrt{I}) + * \f] * - * where + * where * - * \f[ - * g(x) = 2 \frac{(1 - (1 + x)\exp[-x])}{x^2} - * \f] + * \f[ + * g(x) = 2 \frac{(1 - (1 + x)\exp[-x])}{x^2} + * \f] * - * The formulation for \f$ B_{ca}\f$ combined with the formulation of the - * Debye-Huckel term in the eqn. for the excess Gibbs free energy stems - * essentially from an empirical fit to the ionic strength dependent data - * based over a wide sampling of binary electrolyte systems. \f$ C_{ca} \f$, - * \f$ \lambda_{nc} \f$, \f$ \lambda_{na} \f$, \f$ \lambda_{nn} \f$, - * \f$ \Psi_{c{c'}a} \f$, \f$ \Psi_{a{a'}c} \f$ are experimentally derived - * coefficients that may have pressure and/or temperature dependencies. + * The formulation for \f$ B_{ca}\f$ combined with the formulation of the Debye- + * Huckel term in the eqn. for the excess Gibbs free energy stems essentially + * from an empirical fit to the ionic strength dependent data based over a wide + * sampling of binary electrolyte systems. \f$ C_{ca} \f$, \f$ \lambda_{nc} \f$, + * \f$ \lambda_{na} \f$, \f$ \lambda_{nn} \f$, \f$ \Psi_{c{c'}a} \f$, \f$ + * \Psi_{a{a'}c} \f$ are experimentally derived coefficients that may have + * pressure and/or temperature dependencies. * - * The \f$ \Phi_{c{c'}} \f$ and \f$ \Phi_{a{a'}} \f$ formulations are - * slightly more complicated. \f$ b \f$ is a universal - * constant defined to be equal to \f$ 1.2\ kg^{1/2}\ gmol^{-1/2} \f$. The exponential - * coefficient \f$ \alpha^{(1)}_{ca} \f$ is usually - * fixed at \f$ \alpha^{(1)}_{ca} = 2.0\ kg^{1/2} gmol^{-1/2}\f$ - * except for 2-2 electrolytes, while other parameters were fit to experimental - * data. For 2-2 electrolytes, \f$ \alpha^{(1)}_{ca} = 1.4\ kg^{1/2}\ gmol^{-1/2}\f$ - * is used in combination with either \f$ \alpha^{(2)}_{ca} = 12\ kg^{1/2}\ gmol^{-1/2}\f$ - * or \f$ \alpha^{(2)}_{ca} = k A_\psi \f$, where k is a constant. For electrolytes other - * than 2-2 electrolytes the \f$ \beta^{(2)}_{ca} g(\alpha^{(2)}_{ca} \sqrt{I}) \f$ term - * is not used in the fitting procedure; it is only used for divalent metal - * solfates and other high-valence electrolytes which exhibit significant - * association at low ionic strengths. + * The \f$ \Phi_{c{c'}} \f$ and \f$ \Phi_{a{a'}} \f$ formulations are slightly + * more complicated. \f$ b \f$ is a universal constant defined to be equal to + * \f$ 1.2\ kg^{1/2}\ gmol^{-1/2} \f$. The exponential coefficient \f$ + * \alpha^{(1)}_{ca} \f$ is usually fixed at \f$ \alpha^{(1)}_{ca} = 2.0\ + * kg^{1/2} gmol^{-1/2}\f$ except for 2-2 electrolytes, while other parameters + * were fit to experimental data. For 2-2 electrolytes, \f$ \alpha^{(1)}_{ca} = + * 1.4\ kg^{1/2}\ gmol^{-1/2}\f$ is used in combination with either \f$ + * \alpha^{(2)}_{ca} = 12\ kg^{1/2}\ gmol^{-1/2}\f$ or \f$ \alpha^{(2)}_{ca} = k + * A_\psi \f$, where k is a constant. For electrolytes other than 2-2 + * electrolytes the \f$ \beta^{(2)}_{ca} g(\alpha^{(2)}_{ca} \sqrt{I}) \f$ term + * is not used in the fitting procedure; it is only used for divalent metal + * solfates and other high-valence electrolytes which exhibit significant + * association at low ionic strengths. * - * The \f$ \beta^{(0)}_{ca} \f$, \f$ \beta^{(1)}_{ca}\f$, \f$ \beta^{(2)}_{ca} \f$, - * and \f$ C_{ca} \f$ binary coefficients are referred to as ion-interaction or - * Pitzer parameters. These Pitzer parameters may vary with temperature and pressure - * but they do not depend on the ionic strength. Their values and temperature - * derivatives of their values have been tabulated for a range of electrolytes + * The \f$ \beta^{(0)}_{ca} \f$, \f$ \beta^{(1)}_{ca}\f$, \f$ \beta^{(2)}_{ca} + * \f$, and \f$ C_{ca} \f$ binary coefficients are referred to as ion- + * interaction or Pitzer parameters. These Pitzer parameters may vary with + * temperature and pressure but they do not depend on the ionic strength. Their + * values and temperature derivatives of their values have been tabulated for a + * range of electrolytes * - * The \f$ \Phi_{c{c'}} \f$ and \f$ \Phi_{a{a'}} \f$ contributions, which - * capture cation-cation and anion-anion interactions, also have an - * ionic strength dependence. + * The \f$ \Phi_{c{c'}} \f$ and \f$ \Phi_{a{a'}} \f$ contributions, which + * capture cation-cation and anion-anion interactions, also have an ionic + * strength dependence. * - * Ternary contributions \f$ \Psi_{c{c'}a} \f$ and \f$ \Psi_{a{a'}c} \f$ - * have been measured also for some systems. The success of the Pitzer - * method lies in its ability to model nonlinear activity coefficients - * of complex multicomponent systems with just binary and minor - * ternary contributions, which can be independently measured in - * binary or ternary subsystems. + * Ternary contributions \f$ \Psi_{c{c'}a} \f$ and \f$ \Psi_{a{a'}c} \f$ have + * been measured also for some systems. The success of the Pitzer method lies in + * its ability to model nonlinear activity coefficients of complex + * multicomponent systems with just binary and minor ternary contributions, + * which can be independently measured in binary or ternary subsystems. * - *

Multicomponent Activity Coefficients for Solutes

+ *

Multicomponent Activity Coefficients for Solutes

* - * The formulas for activity coefficients of solutes may be obtained by taking the - * following derivative of the excess Gibbs Free Energy formulation described above: + * The formulas for activity coefficients of solutes may be obtained by taking + * the following derivative of the excess Gibbs Free Energy formulation + * described above: * - * \f[ - * \ln(\gamma_k^\triangle) = \frac{d\left( \frac{G^{ex}}{M_o n_o RT} \right)}{d(m_k)}\Bigg|_{n_i} - * \f] + * \f[ + * \ln(\gamma_k^\triangle) = \frac{d\left( \frac{G^{ex}}{M_o n_o RT} \right)}{d(m_k)}\Bigg|_{n_i} + * \f] * - * In the formulas below the following conventions are used. The subscript M refers - * to a particular cation. The subscript X refers to a particular anion, whose - * activity is being currently evaluated. the subscript a refers to a summation - * over all anions in the solution, while the subscript c refers to a summation - * over all cations in the solutions. + * In the formulas below the following conventions are used. The subscript + * M refers to a particular cation. The subscript X refers to a + * particular anion, whose activity is being currently evaluated. the subscript + * a refers to a summation over all anions in the solution, while the + * subscript c refers to a summation over all cations in the solutions. * - * The activity coefficient for a particular cation M is given by + * The activity coefficient for a particular cation M is given by * - * \f[ - * \ln(\gamma_M^\triangle) = -z_M^2(F) + \sum_a m_a \left( 2 B_{Ma} + Z C_{Ma} \right) - * + z_M \left( \sum_a \sum_c m_a m_c C_{ca} \right) - * + \sum_c m_c \left[ 2 \Phi_{Mc} + \sum_a m_a \Psi_{Mca} \right] - * + \sum_{a < a'} \sum m_a m_{a'} \Psi_{Ma{a'}} - * + 2 \sum_n m_n \lambda_{nM} - * \f] + * \f[ + * \ln(\gamma_M^\triangle) = -z_M^2(F) + \sum_a m_a \left( 2 B_{Ma} + Z C_{Ma} \right) + * + z_M \left( \sum_a \sum_c m_a m_c C_{ca} \right) + * + \sum_c m_c \left[ 2 \Phi_{Mc} + \sum_a m_a \Psi_{Mca} \right] + * + \sum_{a < a'} \sum m_a m_{a'} \Psi_{Ma{a'}} + * + 2 \sum_n m_n \lambda_{nM} + * \f] * - * The activity coefficient for a particular anion X is given by + * The activity coefficient for a particular anion X is given by * - * \f[ - * \ln(\gamma_X^\triangle) = -z_X^2(F) + \sum_a m_c \left( 2 B_{cX} + Z C_{cX} \right) - * + \left|z_X \right| \left( \sum_a \sum_c m_a m_c C_{ca} \right) - * + \sum_a m_a \left[ 2 \Phi_{Xa} + \sum_c m_c \Psi_{cXa} \right] - * + \sum_{c < c'} \sum m_c m_{c'} \Psi_{c{c'}X} - * + 2 \sum_n m_n \lambda_{nM} - * \f] - * where the function \f$ F \f$ is given by + * \f[ + * \ln(\gamma_X^\triangle) = -z_X^2(F) + \sum_a m_c \left( 2 B_{cX} + Z C_{cX} \right) + * + \left|z_X \right| \left( \sum_a \sum_c m_a m_c C_{ca} \right) + * + \sum_a m_a \left[ 2 \Phi_{Xa} + \sum_c m_c \Psi_{cXa} \right] + * + \sum_{c < c'} \sum m_c m_{c'} \Psi_{c{c'}X} + * + 2 \sum_n m_n \lambda_{nM} + * \f] + * where the function \f$ F \f$ is given by * - * \f[ - * F = - A_{\phi} \left[ \frac{\sqrt{I}}{1 + b \sqrt{I}} - * + \frac{2}{b} \ln{\left(1 + b\sqrt{I}\right)} \right] - * + \sum_a \sum_c m_a m_c B'_{ca} - * + \sum_{c < c'} \sum m_c m_{c'} \Phi'_{c{c'}} - * + \sum_{a < a'} \sum m_a m_{a'} \Phi'_{a{a'}} - * \f] + * \f[ + * F = - A_{\phi} \left[ \frac{\sqrt{I}}{1 + b \sqrt{I}} + * + \frac{2}{b} \ln{\left(1 + b\sqrt{I}\right)} \right] + * + \sum_a \sum_c m_a m_c B'_{ca} + * + \sum_{c < c'} \sum m_c m_{c'} \Phi'_{c{c'}} + * + \sum_{a < a'} \sum m_a m_{a'} \Phi'_{a{a'}} + * \f] * - * We have employed the definition of \f$ A_{\phi} \f$, also used by Pitzer - * which is equal to + * We have employed the definition of \f$ A_{\phi} \f$, also used by Pitzer + * which is equal to * - * \f[ - * A_{\phi} = \frac{A_{Debye}}{3} - * \f] + * \f[ + * A_{\phi} = \frac{A_{Debye}}{3} + * \f] * - * In the above formulas, \f$ \Phi'_{c{c'}} \f$ and \f$ \Phi'_{a{a'}} \f$ are the - * ionic strength derivatives of \f$ \Phi_{c{c'}} \f$ and \f$ \Phi_{a{a'}} \f$, - * respectively. + * In the above formulas, \f$ \Phi'_{c{c'}} \f$ and \f$ \Phi'_{a{a'}} \f$ are the + * ionic strength derivatives of \f$ \Phi_{c{c'}} \f$ and \f$ \Phi_{a{a'}} \f$, + * respectively. * - * The function \f$ B'_{MX} \f$ is defined as: + * The function \f$ B'_{MX} \f$ is defined as: * - * \f[ - * B'_{MX} = \left( \frac{\beta^{(1)}_{MX} h(\alpha^{(1)}_{MX} \sqrt{I})}{I} \right) - * \left( \frac{\beta^{(2)}_{MX} h(\alpha^{(2)}_{MX} \sqrt{I})}{I} \right) - * \f] + * \f[ + * B'_{MX} = \left( \frac{\beta^{(1)}_{MX} h(\alpha^{(1)}_{MX} \sqrt{I})}{I} \right) + * \left( \frac{\beta^{(2)}_{MX} h(\alpha^{(2)}_{MX} \sqrt{I})}{I} \right) + * \f] * - * where \f$ h(x) \f$ is defined as + * where \f$ h(x) \f$ is defined as * - * \f[ - * h(x) = g'(x) \frac{x}{2} = - * \frac{2\left(1 - \left(1 + x + \frac{x^2}{2} \right)\exp(-x) \right)}{x^2} - * \f] + * \f[ + * h(x) = g'(x) \frac{x}{2} = + * \frac{2\left(1 - \left(1 + x + \frac{x^2}{2} \right)\exp(-x) \right)}{x^2} + * \f] * - * The activity coefficient for neutral species N is given by + * The activity coefficient for neutral species N is given by * - * \f[ - * \ln(\gamma_N^\triangle) = 2 \left( \sum_i m_i \lambda_{iN}\right) - * \f] + * \f[ + * \ln(\gamma_N^\triangle) = 2 \left( \sum_i m_i \lambda_{iN}\right) + * \f] * - *

Activity of the Water Solvent

+ *

Activity of the Water Solvent

* - * The activity for the solvent water,\f$ a_o \f$, is not independent and must be - * determined either from the Gibbs-Duhem relation or from taking the appropriate derivative - * of the same excess Gibbs free energy function as was used to formulate - * the solvent activity coefficients. Pitzer's description follows the later approach to - * derive a formula for the osmotic coefficient, \f$ \phi \f$. + * The activity for the solvent water,\f$ a_o \f$, is not independent and must + * be determined either from the Gibbs-Duhem relation or from taking the + * appropriate derivative of the same excess Gibbs free energy function as was + * used to formulate the solvent activity coefficients. Pitzer's description + * follows the later approach to derive a formula for the osmotic coefficient, + * \f$ \phi \f$. * - * \f[ - * \phi - 1 = - \left( \frac{d\left(\frac{G^{ex}}{RT} \right)}{d(\tilde{M}_o n_o)} \right) - * \frac{1}{\sum_{i \ne 0} m_i} - * \f] + * \f[ + * \phi - 1 = - \left( \frac{d\left(\frac{G^{ex}}{RT} \right)}{d(\tilde{M}_o n_o)} \right) + * \frac{1}{\sum_{i \ne 0} m_i} + * \f] * - * The osmotic coefficient may be related to the water activity by the following relation: + * The osmotic coefficient may be related to the water activity by the following relation: * - * \f[ - * \phi = - \frac{1}{\tilde{M}_o \sum_{i \neq o} m_i} \ln(a_o) - * = - \frac{n_o}{\sum_{i \neq o}n_i} \ln(a_o) - * \f] + * \f[ + * \phi = - \frac{1}{\tilde{M}_o \sum_{i \neq o} m_i} \ln(a_o) + * = - \frac{n_o}{\sum_{i \neq o}n_i} \ln(a_o) + * \f] * - * The result is the following + * The result is the following * - * \f[ - * \begin{array}{ccclc} - * \phi - 1 &= & - * \frac{2}{\sum_{i \ne 0} m_i} - * \bigg[ & - * - A_{\phi} \frac{I^{3/2}}{1 + b \sqrt{I}} - * + \sum_c \sum_a m_c m_a \left( B^{\phi}_{ca} + Z C_{ca}\right) - * \\&&& - * + \sum_{c < c'} \sum m_c m_{c'} \left[ \Phi^{\phi}_{c{c'}} + \sum_a m_a \Psi_{c{c'}a} \right] - * + \sum_{a < a'} \sum m_a m_{a'} \left[ \Phi^{\phi}_{a{a'}} + \sum_c m_c \Psi_{a{a'}c} \right] - * \\&&& - * + \sum_n \sum_c m_n m_c \lambda_{nc} + \sum_n \sum_a m_n m_a \lambda_{na} - * + \sum_{n < n'} \sum m_n m_{n'} \lambda_{n{n'}} - * + \frac{1}{2} \left( \sum_n m^2_n \lambda_{nn}\right) - * \bigg] - * \end{array} - * \f] + * \f[ + * \begin{array}{ccclc} + * \phi - 1 &= & + * \frac{2}{\sum_{i \ne 0} m_i} + * \bigg[ & + * - A_{\phi} \frac{I^{3/2}}{1 + b \sqrt{I}} + * + \sum_c \sum_a m_c m_a \left( B^{\phi}_{ca} + Z C_{ca}\right) + * \\&&& + * + \sum_{c < c'} \sum m_c m_{c'} \left[ \Phi^{\phi}_{c{c'}} + \sum_a m_a \Psi_{c{c'}a} \right] + * + \sum_{a < a'} \sum m_a m_{a'} \left[ \Phi^{\phi}_{a{a'}} + \sum_c m_c \Psi_{a{a'}c} \right] + * \\&&& + * + \sum_n \sum_c m_n m_c \lambda_{nc} + \sum_n \sum_a m_n m_a \lambda_{na} + * + \sum_{n < n'} \sum m_n m_{n'} \lambda_{n{n'}} + * + \frac{1}{2} \left( \sum_n m^2_n \lambda_{nn}\right) + * \bigg] + * \end{array} + * \f] * - * It can be shown that the expression + * It can be shown that the expression * - * \f[ - * B^{\phi}_{ca} = \beta^{(0)}_{ca} + \beta^{(1)}_{ca} \exp{(- \alpha^{(1)}_{ca} \sqrt{I})} - * + \beta^{(2)}_{ca} \exp{(- \alpha^{(2)}_{ca} \sqrt{I} )} - * \f] + * \f[ + * B^{\phi}_{ca} = \beta^{(0)}_{ca} + \beta^{(1)}_{ca} \exp{(- \alpha^{(1)}_{ca} \sqrt{I})} + * + \beta^{(2)}_{ca} \exp{(- \alpha^{(2)}_{ca} \sqrt{I} )} + * \f] * - * is consistent with the expression \f$ B_{ca} \f$ in the \f$ G^{ex} \f$ expression - * after carrying out the derivative wrt \f$ m_M \f$. + * is consistent with the expression \f$ B_{ca} \f$ in the \f$ G^{ex} \f$ + * expression after carrying out the derivative wrt \f$ m_M \f$. * - * Also taking into account that \f$ {\Phi}_{c{c'}} \f$ and - * \f$ {\Phi}_{a{a'}} \f$ has an ionic strength dependence. + * Also taking into account that \f$ {\Phi}_{c{c'}} \f$ and + * \f$ {\Phi}_{a{a'}} \f$ has an ionic strength dependence. * - * \f[ - * \Phi^{\phi}_{c{c'}} = {\Phi}_{c{c'}} + I \frac{d{\Phi}_{c{c'}}}{dI} - * \f] + * \f[ + * \Phi^{\phi}_{c{c'}} = {\Phi}_{c{c'}} + I \frac{d{\Phi}_{c{c'}}}{dI} + * \f] * - * \f[ - * \Phi^{\phi}_{a{a'}} = \Phi_{a{a'}} + I \frac{d\Phi_{a{a'}}}{dI} - * \f] + * \f[ + * \Phi^{\phi}_{a{a'}} = \Phi_{a{a'}} + I \frac{d\Phi_{a{a'}}}{dI} + * \f] * - *

Temperature and Pressure Dependence of the Pitzer Parameters

+ *

Temperature and Pressure Dependence of the Pitzer Parameters

* - * In general most of the coefficients introduced in the previous section may - * have a temperature and pressure dependence. The temperature and pressure - * dependence of these coefficients strongly influence the value of the - * excess Enthalpy and excess Volumes of Pitzer solutions. Therefore, these - * are readily measurable quantities. - * HMWSoln provides several - * different methods for putting these dependencies into the coefficients. - * HMWSoln has an implementation described by Silverter and Pitzer (1977), - * which was used to fit experimental data for NaCl over an extensive range, - * below the critical temperature of water. - * They found a temperature functional form for fitting the 3 following - * coefficients that describe the Pitzer parameterization for a single salt - * to be adequate to describe how the excess Gibbs free energy values for - * the binary salt changes with respect to temperature. - * The following functional form - * was used to fit the temperature dependence of the Pitzer Coefficients - * for each cation - anion pair, M X. + * In general most of the coefficients introduced in the previous section may + * have a temperature and pressure dependence. The temperature and pressure + * dependence of these coefficients strongly influence the value of the excess + * Enthalpy and excess Volumes of Pitzer solutions. Therefore, these are readily + * measurable quantities. HMWSoln provides several different methods for putting + * these dependencies into the coefficients. HMWSoln has an implementation + * described by Silverter and Pitzer (1977), which was used to fit experimental + * data for NaCl over an extensive range, below the critical temperature of + * water. They found a temperature functional form for fitting the 3 following + * coefficients that describe the Pitzer parameterization for a single salt to + * be adequate to describe how the excess Gibbs free energy values for the + * binary salt changes with respect to temperature. The following functional + * form was used to fit the temperature dependence of the Pitzer Coefficients + * for each cation - anion pair, M X. * - * \f[ - * \beta^{(0)}_{MX} = q^{b0}_0 - * + q^{b0}_1 \left( T - T_r \right) - * + q^{b0}_2 \left( T^2 - T_r^2 \right) - * + q^{b0}_3 \left( \frac{1}{T} - \frac{1}{T_r}\right) - * + q^{b0}_4 \ln \left( \frac{T}{T_r} \right) - * \f] - * \f[ - * \beta^{(1)}_{MX} = q^{b1}_0 + q^{b1}_1 \left( T - T_r \right) - * + q^{b1}_{2} \left( T^2 - T_r^2 \right) - * \f] - * \f[ - * C^{\phi}_{MX} = q^{Cphi}_0 - * + q^{Cphi}_1 \left( T - T_r \right) - * + q^{Cphi}_2 \left( T^2 - T_r^2 \right) - * + q^{Cphi}_3 \left( \frac{1}{T} - \frac{1}{T_r}\right) - * + q^{Cphi}_4 \ln \left( \frac{T}{T_r} \right) - * \f] + * \f[ + * \beta^{(0)}_{MX} = q^{b0}_0 + * + q^{b0}_1 \left( T - T_r \right) + * + q^{b0}_2 \left( T^2 - T_r^2 \right) + * + q^{b0}_3 \left( \frac{1}{T} - \frac{1}{T_r}\right) + * + q^{b0}_4 \ln \left( \frac{T}{T_r} \right) + * \f] + * \f[ + * \beta^{(1)}_{MX} = q^{b1}_0 + q^{b1}_1 \left( T - T_r \right) + * + q^{b1}_{2} \left( T^2 - T_r^2 \right) + * \f] + * \f[ + * C^{\phi}_{MX} = q^{Cphi}_0 + * + q^{Cphi}_1 \left( T - T_r \right) + * + q^{Cphi}_2 \left( T^2 - T_r^2 \right) + * + q^{Cphi}_3 \left( \frac{1}{T} - \frac{1}{T_r}\right) + * + q^{Cphi}_4 \ln \left( \frac{T}{T_r} \right) + * \f] * - * where + * where * - * \f[ - * C^{\phi}_{MX} = 2 {\left| z_M z_X \right|}^{1/2} C_{MX} - * \f] + * \f[ + * C^{\phi}_{MX} = 2 {\left| z_M z_X \right|}^{1/2} C_{MX} + * \f] * - * In later papers, Pitzer has added additional temperature dependencies - * to all of the other remaining second and third order virial coefficients. - * Some of these dependencies are justified and motivated by theory. - * Therefore, - * a formalism wherein all of the coefficients in the base theory have - * temperature dependencies associated with them has been implemented - * within the HMWSoln object. Much of the formalism, however, - * has been unexercised. + * In later papers, Pitzer has added additional temperature dependencies to all + * of the other remaining second and third order virial coefficients. Some of + * these dependencies are justified and motivated by theory. Therefore, a + * formalism wherein all of the coefficients in the base theory have temperature + * dependencies associated with them has been implemented within the HMWSoln + * object. Much of the formalism, however, has been unexercised. * - * In the HMWSoln object, the temperature dependence of the Pitzer - * parameters are specified in the following way. + * In the HMWSoln object, the temperature dependence of the Pitzer parameters + * are specified in the following way. * * - PIZTER_TEMP_CONSTANT - string name "CONSTANT" * - Assumes that all coefficients are independent of temperature @@ -623,268 +609,249 @@ class WaterProps; * and \f$ C^{\phi}_{MX} \f$ coefficients described above. * There are 2 coefficients for each term. * - * The temperature dependence is specified in an attributes field - * in the activityCoefficients XML block, - * called TempModel . Permissible values for that - * attribute are CONSTANT, COMPLEX1, and LINEAR. + * The temperature dependence is specified in an attributes field in the + * activityCoefficients XML block, called TempModel . + * Permissible values for that attribute are CONSTANT, COMPLEX1, and + * LINEAR. * - * The specification of the binary interaction between a cation and - * an anion is given by the coefficients, \f$ B_{MX}\f$ and - * \f$ C_{MX}\f$ - * The specification of \f$ B_{MX}\f$ is a function of - * \f$\beta^{(0)}_{MX} \f$, \f$\beta^{(1)}_{MX} \f$, - * \f$\beta^{(2)}_{MX} \f$, \f$\alpha^{(1)}_{MX} \f$, and - * \f$\alpha^{(2)}_{MX} \f$. - * \f$ C_{MX}\f$ is calculated from \f$C^{\phi}_{MX} \f$ - * from the formula above. - * All of the underlying coefficients are specified in the - * XML element block binarySaltParameters , which - * has the attribute cation and anion - * to identify the interaction. XML elements named - * beta0, beta1, beta2, Cphi, Alpha1, Alpha2 - * within each binarySaltParameters block - * specify the parameters. Within each of these blocks - * multiple parameters describing temperature or pressure - * dependence are serially listed in the order that they - * appear in the equation in this document. An example of - * the beta0 block that fits the COMPLEX1 temperature - * dependence given above is + * The specification of the binary interaction between a cation and an anion is + * given by the coefficients, \f$ B_{MX}\f$ and \f$ C_{MX}\f$ The specification + * of \f$ B_{MX}\f$ is a function of \f$\beta^{(0)}_{MX} \f$, + * \f$\beta^{(1)}_{MX} \f$, \f$\beta^{(2)}_{MX} \f$, \f$\alpha^{(1)}_{MX} \f$, + * and \f$\alpha^{(2)}_{MX} \f$. \f$ C_{MX}\f$ is calculated from + * \f$C^{\phi}_{MX} \f$ from the formula above. All of the underlying + * coefficients are specified in the XML element block binarySaltParameters + * , which has the attribute cation and anion to + * identify the interaction. XML elements named beta0, beta1, beta2, Cphi, + * Alpha1, Alpha2 within each binarySaltParameters block + * specify the parameters. Within each of these blocks multiple parameters + * describing temperature or pressure dependence are serially listed in the + * order that they appear in the equation in this document. An example of the + * beta0 block that fits the COMPLEX1 temperature + * dependence given above is * * @code - - q0, q1, q2, q3, q4 - - @endcode + * + * q0, q1, q2, q3, q4 + * + * @endcode * - * The parameters for \f$ \beta^{(0)}\f$ fit the following equation: + * The parameters for \f$ \beta^{(0)}\f$ fit the following equation: + * + * \f[ + * \beta^{(0)} = q_0^{{\beta}0} + q_1^{{\beta}0} \left( T - T_r \right) + * + q_2^{{\beta}0} \left( T^2 - T_r^2 \right) + * + q_3^{{\beta}0} \left( \frac{1}{T} - \frac{1}{T_r} \right) + * + q_4^{{\beta}0} \ln \left( \frac{T}{T_r} \right) + * \f] + * + * This same COMPLEX1 temperature + * dependence given above is used for the following parameters: + * \f$ \beta^{(0)}_{MX} \f$, \f$ \beta^{(1)}_{MX} \f$, + * \f$ \beta^{(2)}_{MX} \f$, \f$ \Theta_{cc'} \f$, \f$\Theta_{aa'} \f$, + * \f$ \Psi_{c{c'}a} \f$ and \f$ \Psi_{ca{a'}} \f$. + * + *

Like-Charged Binary Ion Parameters and the Mixing Parameters

+ * + * The previous section contained the functions, \f$ \Phi_{c{c'}} \f$, + * \f$ \Phi_{a{a'}} \f$ and their derivatives wrt the ionic strength, \f$ + * \Phi'_{c{c'}} \f$ and \f$ \Phi'_{a{a'}} \f$. Part of these terms come from + * theory. + * + * Since like charged ions repel each other and are generally not near each + * other, the virial coefficients for same-charged ions are small. However, + * Pitzer doesn't ignore these in his formulation. Relatively larger and longer + * range terms between like-charged ions exist however, which appear only for + * unsymmetrical mixing of same-sign charged ions with different charges. \f$ + * \Phi_{ij} \f$, where \f$ ij \f$ is either \f$ a{a'} \f$ or \f$ c{c'} \f$ is + * given by + * + * \f[ + * {\Phi}_{ij} = \Theta_{ij} + \,^E \Theta_{ij}(I) + * \f] + * + * \f$ \Theta_{ij} \f$ is the small virial coefficient expansion term. Dependent + * in general on temperature and pressure, its ionic strength dependence is + * ignored in Pitzer's approach. \f$ \,^E\Theta_{ij}(I) \f$ accounts for the + * electrostatic unsymmetrical mixing effects and is dependent only on the + * charges of the ions i, j, the total ionic strength and on the dielectric + * constant and density of the solvent. This seems to be a relatively well- + * documented part of the theory. They theory below comes from Pitzer summation + * (Pitzer) in the appendix. It's also mentioned in Bethke's book (Bethke), and + * the equations are summarized in Harvie & Weare (1980). Within the code, \f$ + * \,^E\Theta_{ij}(I) \f$ is evaluated according to the algorithm described in + * Appendix B [Pitzer] as + * + * \f[ + * \,^E\Theta_{ij}(I) = \left( \frac{z_i z_j}{4I} \right) + * \left( J(x_{ij}) - \frac{1}{2} J(x_{ii}) + * - \frac{1}{2} J(x_{jj}) \right) + * \f] + * + * where \f$ x_{ij} = 6 z_i z_j A_{\phi} \sqrt{I} \f$ and * * \f[ - * \beta^{(0)} = q_0^{{\beta}0} + q_1^{{\beta}0} \left( T - T_r \right) - * + q_2^{{\beta}0} \left( T^2 - T_r^2 \right) - * + q_3^{{\beta}0} \left( \frac{1}{T} - \frac{1}{T_r} \right) - * + q_4^{{\beta}0} \ln \left( \frac{T}{T_r} \right) + * J(x) = \frac{1}{x} \int_0^{\infty}{\left( 1 + q + + * \frac{1}{2} q^2 - e^q \right) y^2 dy} * \f] * - * This same COMPLEX1 temperature - * dependence given above is used for the following parameters: - * \f$ \beta^{(0)}_{MX} \f$, \f$ \beta^{(1)}_{MX} \f$, - * \f$ \beta^{(2)}_{MX} \f$, \f$ \Theta_{cc'} \f$, \f$\Theta_{aa'} \f$, - * \f$ \Psi_{c{c'}a} \f$ and \f$ \Psi_{ca{a'}} \f$. + * and \f$ q = - (\frac{x}{y}) e^{-y} \f$. \f$ J(x) \f$ is evaluated by + * numerical integration. * - *

Like-Charged Binary Ion Parameters and the Mixing Parameters

- * - * The previous section contained the functions, \f$ \Phi_{c{c'}} \f$, - * \f$ \Phi_{a{a'}} \f$ and their derivatives wrt the - * ionic strength, \f$ \Phi'_{c{c'}} \f$ and \f$ \Phi'_{a{a'}} \f$. - * Part of these terms come from theory. - * - * Since like charged ions repel each other and are generally - * not near each other, the virial coefficients for same-charged ions - * are small. However, Pitzer doesn't ignore these in his - * formulation. Relatively larger and longer range terms between - * like-charged ions exist however, which appear only for - * unsymmetrical mixing of same-sign charged ions with different - * charges. \f$ \Phi_{ij} \f$, where \f$ ij \f$ is either \f$ a{a'} \f$ - * or \f$ c{c'} \f$ is given by - * - * \f[ - * {\Phi}_{ij} = \Theta_{ij} + \,^E \Theta_{ij}(I) - * \f] - * - * \f$ \Theta_{ij} \f$ is the small virial coefficient expansion term. - * Dependent in general on temperature and pressure, its ionic - * strength dependence is ignored in Pitzer's approach. - * \f$ \,^E\Theta_{ij}(I) \f$ accounts for the electrostatic - * unsymmetrical mixing effects and is dependent only on the - * charges of the ions i, j, the total ionic strength and on - * the dielectric constant and density of the solvent. - * This seems to be a relatively well-documented part of the theory. - * They theory below comes from Pitzer summation (Pitzer) in the - * appendix. It's also mentioned in Bethke's book (Bethke), and - * the equations are summarized in Harvie & Weare (1980). - * Within the code, \f$ \,^E\Theta_{ij}(I) \f$ is evaluated according - * to the algorithm described in Appendix B [Pitzer] as - * - * \f[ - * \,^E\Theta_{ij}(I) = \left( \frac{z_i z_j}{4I} \right) - * \left( J(x_{ij}) - \frac{1}{2} J(x_{ii}) - * - \frac{1}{2} J(x_{jj}) \right) - * \f] - * - * where \f$ x_{ij} = 6 z_i z_j A_{\phi} \sqrt{I} \f$ and - * - * \f[ - * J(x) = \frac{1}{x} \int_0^{\infty}{\left( 1 + q + - * \frac{1}{2} q^2 - e^q \right) y^2 dy} - * \f] - * - * and \f$ q = - (\frac{x}{y}) e^{-y} \f$. \f$ J(x) \f$ is evaluated by - * numerical integration. - * - * The \f$ \Theta_{ij} \f$ term is a constant that is specified - * by the XML element thetaCation and - * thetaAnion , which - * has the attribute cation1 , cation2 and - * anion1 , anion2 respectively - * to identify the interaction. No temperature or - * pressure dependence of this parameter is currently allowed. - * An example of the block is presented below. + * The \f$ \Theta_{ij} \f$ term is a constant that is specified by the XML + * element thetaCation and thetaAnion , which has the + * attribute cation1 , cation2 and anion1 , + * anion2 respectively to identify the interaction. No temperature or + * pressure dependence of this parameter is currently allowed. An example of the + * block is presented below. * * @code - - 0.036 - - @endcode + * + * 0.036 + * + * @endcode * - *

Ternary Pitzer Parameters

+ *

Ternary Pitzer Parameters

* - * The \f$ \Psi_{c{c'}a} \f$ and \f$ \Psi_{ca{a'}} \f$ terms - * represent ternary interactions between two cations and - * an anion and two anions and a cation, respectively. - * In Pitzer's implementation these terms are usually small - * in absolute size. Currently these parameters do not have - * any dependence on temperature, pressure, or ionic strength. + * The \f$ \Psi_{c{c'}a} \f$ and \f$ \Psi_{ca{a'}} \f$ terms represent ternary + * interactions between two cations and an anion and two anions and a cation, + * respectively. In Pitzer's implementation these terms are usually small in + * absolute size. Currently these parameters do not have any dependence on + * temperature, pressure, or ionic strength. * - * Their values are input using the XML element - * psiCommonCation and psiCommonAnion . - * The species id's are specified in attribute fields in - * the XML element. The fields cation, - * anion1, and anion2 - * are used for psiCommonCation. The fields anion, - * cation1 and cation2 are used for - * psiCommonAnion. An example block is given below. - * The Theta field below is a duplicate of the - * thetaAnion field mentioned above. The two fields - * are input into the same block for convenience, and because - * their data are highly correlated, in practice. - * It is an error for the - * two blocks to specify different information about - * thetaAnion (or thetaCation) in different blocks. It's - * ok to specify duplicate but consistent information - * in multiple blocks. + * Their values are input using the XML element psiCommonCation and + * psiCommonAnion . The species id's are specified in attribute fields + * in the XML element. The fields cation, anion1, and + * anion2 are used for psiCommonCation. The fields + * anion, cation1 and cation2 are used for + * psiCommonAnion. An example block is given below. The Theta + * field below is a duplicate of the thetaAnion field mentioned + * above. The two fields are input into the same block for convenience, and + * because their data are highly correlated, in practice. It is an error for the + * two blocks to specify different information about thetaAnion (or thetaCation) + * in different blocks. It's ok to specify duplicate but consistent information + * in multiple blocks. * * @code - - -0.05 - -0.006 - - @endcode + * + * -0.05 + * -0.006 + * + * @endcode * - *

Treatment of Neutral Species

+ *

Treatment of Neutral Species

* - * Binary virial-coefficient-like interactions between two neutral - * species may be specified in the \f$ \lambda_{mn} \f$ terms - * that appear in the formulas above. - * Currently these interactions are independent of temperature, - * pressure, and ionic strength. Also, currently, the neutrality - * of the species are not checked. Therefore, this interaction - * may involve charged species in the solution as well. - * The identity of the species is specified by the - * species1 and species2 attributes to the XML - * lambdaNeutral node. These terms are symmetrical; - * species1 and species2 may be reversed and - * the term will be the same. An example is given below. + * Binary virial-coefficient-like interactions between two neutral species may + * be specified in the \f$ \lambda_{mn} \f$ terms that appear in the formulas + * above. Currently these interactions are independent of temperature, pressure, + * and ionic strength. Also, currently, the neutrality of the species are not + * checked. Therefore, this interaction may involve charged species in the + * solution as well. The identity of the species is specified by the + * species1 and species2 attributes to the XML + * lambdaNeutral node. These terms are symmetrical; species1 + * and species2 may be reversed and the term will be the same. An + * example is given below. * * @code - - 0.05 - - @endcode + * + * 0.05 + * + * @endcode * - *

Example of the Specification of Parameters for the Activity + *

Example of the Specification of Parameters for the Activity * Coefficients

* * An example is given below. * - * An example activityCoefficients XML block for this - * formulation is supplied below + * An example activityCoefficients XML block for this formulation is + * supplied below * - * @verbatim - - - - - - - 0.0765, 0.008946, -3.3158E-6, - -777.03, -4.4706 - - 0.2664, 6.1608E-5, 1.0715E-6, 0.0, 0.0 - 0.0, 0.0, 0.0, 0.0, 0.0 - 0.00127, -4.655E-5, 0.0, - 33.317, 0.09421 - - 2.0 - - - - 0.1775, 0.0, 0.0, 0.0, 0.0 - 0.2945, 0.0, 0.0, 0.0, 0.0 - 0.0, 0.0, 0.0, 0.0, 0.0 - 0.0008, 0.0, 0.0, 0.0, 0.0 - 2.0 - - - - 0.0864, 0.0, 0.0, 0.0, 0.0 - 0.253, 0.0, 0.0 0.0, 0.0 - 0.0 0.0, 0.0, 0.0, 0.0 - 0.0044, 0.0, 0.0, 0.0, 0.0 - 2.0 - - - - -0.05, 0.0, 0.0, 0.0, 0.0 - - - - -0.05, 0.0, 0.0, 0.0, 0.0 - -0.006 - - - - 0.036, 0.0, 0.0, 0.0, 0.0 - - - - 0.036, 0.0, 0.0, 0.0, 0.0 - -0.004 - - - - @endverbatim + * @code + * + * + * + * + * + * + * 0.0765, 0.008946, -3.3158E-6, + * -777.03, -4.4706 + * + * 0.2664, 6.1608E-5, 1.0715E-6, 0.0, 0.0 + * 0.0, 0.0, 0.0, 0.0, 0.0 + * 0.00127, -4.655E-5, 0.0, + * 33.317, 0.09421 + * + * 2.0 + * + * + * + * 0.1775, 0.0, 0.0, 0.0, 0.0 + * 0.2945, 0.0, 0.0, 0.0, 0.0 + * 0.0, 0.0, 0.0, 0.0, 0.0 + * 0.0008, 0.0, 0.0, 0.0, 0.0 + * 2.0 + * + * + * + * 0.0864, 0.0, 0.0, 0.0, 0.0 + * 0.253, 0.0, 0.0 0.0, 0.0 + * 0.0 0.0, 0.0, 0.0, 0.0 + * 0.0044, 0.0, 0.0, 0.0, 0.0 + * 2.0 + * + * + * + * -0.05, 0.0, 0.0, 0.0, 0.0 + * + * + * + * -0.05, 0.0, 0.0, 0.0, 0.0 + * -0.006 + * + * + * + * 0.036, 0.0, 0.0, 0.0, 0.0 + * + * + * + * 0.036, 0.0, 0.0, 0.0, 0.0 + * -0.004 + * + * + * @endcode * *

Specification of the Debye-Huckel Constant

* - * In the equations above, the formula for \f$ A_{Debye} \f$ - * is needed. The HMWSoln object uses two methods for specifying these quantities. - * The default method is to assume that \f$ A_{Debye} \f$ is a constant, given - * in the initialization process, and stored in the - * member double, m_A_Debye. Optionally, a full water treatment may be employed that makes - * \f$ A_{Debye} \f$ a full function of T and P and creates nontrivial entries for - * the excess heat capacity, enthalpy, and excess volumes of solution. + * In the equations above, the formula for \f$ A_{Debye} \f$ is needed. The + * HMWSoln object uses two methods for specifying these quantities. The default + * method is to assume that \f$ A_{Debye} \f$ is a constant, given in the + * initialization process, and stored in the member double, m_A_Debye. + * Optionally, a full water treatment may be employed that makes + * \f$ A_{Debye} \f$ a full function of T and P and creates + * nontrivial entries for the excess heat capacity, enthalpy, and excess volumes + * of solution. * - * \f[ - * A_{Debye} = \frac{F e B_{Debye}}{8 \pi \epsilon R T} {\left( C_o \tilde{M}_o \right)}^{1/2} - * \f] - * where + * \f[ + * A_{Debye} = \frac{F e B_{Debye}}{8 \pi \epsilon R T} {\left( C_o \tilde{M}_o \right)}^{1/2} + * \f] + * where * - * \f[ - * B_{Debye} = \frac{F} {{(\frac{\epsilon R T}{2})}^{1/2}} - * \f] - * Therefore: - * \f[ - * A_{Debye} = \frac{1}{8 \pi} - * {\left(\frac{2 N_a \rho_o}{1000}\right)}^{1/2} - * {\left(\frac{N_a e^2}{\epsilon R T }\right)}^{3/2} - * \f] + * \f[ + * B_{Debye} = \frac{F} {{(\frac{\epsilon R T}{2})}^{1/2}} + * \f] + * Therefore: + * \f[ + * A_{Debye} = \frac{1}{8 \pi} + * {\left(\frac{2 N_a \rho_o}{1000}\right)}^{1/2} + * {\left(\frac{N_a e^2}{\epsilon R T }\right)}^{3/2} + * \f] * - * Units = sqrt(kg/gmol) + * Units = sqrt(kg/gmol) * - * where + * where * - \f$ N_a \f$ is Avogadro's number * - \f$ \rho_w \f$ is the density of water * - \f$ e \f$ is the electronic charge @@ -893,13 +860,13 @@ class WaterProps; * - \f$ \epsilon_o \f$ is the permittivity of free space. * - \f$ \rho_o \f$ is the density of the solvent in its standard state. * - * Nominal value at 298 K and 1 atm = 1.172576 (kg/gmol)1/2 - * based on: + * Nominal value at 298 K and 1 atm = 1.172576 (kg/gmol)1/2 + * based on: * - \f$ \epsilon / \epsilon_0 \f$ = 78.54 (water at 25C) * - T = 298.15 K * - B_Debye = 3.28640E9 (kg/gmol)1/2 m-1 * - * An example of a fixed value implementation is given below. + * An example of a fixed value implementation is given below. * @code * * @@ -908,8 +875,8 @@ class WaterProps; * * @endcode * - * An example of a variable value implementation within the HMWSoln object is given below. - * The model attribute, "water", triggers the full implementation. + * An example of a variable value implementation within the HMWSoln object is + * given below. The model attribute, "water", triggers the full implementation. * * @code * @@ -919,29 +886,29 @@ class WaterProps; * * @endcode * - *

Temperature and Pressure Dependence of the Activity Coefficients

+ *

Temperature and Pressure Dependence of the Activity Coefficients

* - * Temperature dependence of the activity coefficients leads to nonzero terms - * for the excess enthalpy and entropy of solution. This means that the - * partial molar enthalpies, entropies, and heat capacities are all - * non-trivial to compute. The following formulas are used. + * Temperature dependence of the activity coefficients leads to nonzero terms + * for the excess enthalpy and entropy of solution. This means that the partial + * molar enthalpies, entropies, and heat capacities are all non-trivial to + * compute. The following formulas are used. * - * The partial molar enthalpy, \f$ \bar s_k(T,P) \f$: + * The partial molar enthalpy, \f$ \bar s_k(T,P) \f$: * - * \f[ + * \f[ * \bar h_k(T,P) = h^{\triangle}_k(T,P) * - R T^2 \frac{d \ln(\gamma_k^\triangle)}{dT} * \f] * The solvent partial molar enthalpy is equal to - * \f[ + * \f[ * \bar h_o(T,P) = h^{o}_o(T,P) - R T^2 \frac{d \ln(a_o)}{dT} * = h^{o}_o(T,P) * + R T^2 (\sum_{k \neq o} m_k) \tilde{M_o} (\frac{d \phi}{dT}) * \f] * - * The partial molar entropy, \f$ \bar s_k(T,P) \f$: + * The partial molar entropy, \f$ \bar s_k(T,P) \f$: * - * \f[ + * \f[ * \bar s_k(T,P) = s^{\triangle}_k(T,P) * - R \ln( \gamma^{\triangle}_k \frac{m_k}{m^{\triangle}})) * - R T \frac{d \ln(\gamma^{\triangle}_k) }{dT} @@ -953,7 +920,7 @@ class WaterProps; * * The partial molar heat capacity, \f$ C_{p,k}(T,P)\f$: * - * \f[ + * \f[ * \bar C_{p,k}(T,P) = C^{\triangle}_{p,k}(T,P) * - 2 R T \frac{d \ln( \gamma^{\triangle}_k)}{dT} * - R T^2 \frac{d^2 \ln(\gamma^{\triangle}_k) }{{dT}^2} @@ -964,10 +931,9 @@ class WaterProps; * - R T^2 \frac{d^2 \ln(a_o)}{{dT}^2} * \f] * - * The pressure dependence of the activity coefficients leads to non-zero terms - * for the excess Volume of the solution. - * Therefore, the partial molar volumes are functions - * of the pressure derivatives of the activity coefficients. + * The pressure dependence of the activity coefficients leads to non-zero terms + * for the excess Volume of the solution. Therefore, the partial molar volumes + * are functions of the pressure derivatives of the activity coefficients. * \f[ * \bar V_k(T,P) = V^{\triangle}_k(T,P) * + R T \frac{d \ln(\gamma^{\triangle}_k) }{dP} @@ -977,59 +943,55 @@ class WaterProps; * + R T \frac{d \ln(a_o)}{dP} * \f] * - * The majority of work for these functions take place in the internal - * routines that calculate the first and second derivatives of the log - * of the activity coefficients wrt temperature, - * s_update_dlnMolalityActCoeff_dT(), s_update_d2lnMolalityActCoeff_dT2(), - * and the first - * derivative of the log activity coefficients wrt pressure, - * s_update_dlnMolalityActCoeff_dP(). + * The majority of work for these functions take place in the internal routines + * that calculate the first and second derivatives of the log of the activity + * coefficients wrt temperature, s_update_dlnMolalityActCoeff_dT(), + * s_update_d2lnMolalityActCoeff_dT2(), and the first derivative of the log + * activity coefficients wrt pressure, s_update_dlnMolalityActCoeff_dP(). * *
*

%Application within Kinetics Managers

*
* * For the time being, we have set the standard concentration for all solute - * species in - * this phase equal to the default concentration of the solvent at the system temperature - * and pressure multiplied by Mnaught (kg solvent / gmol solvent). The solvent - * standard concentration is just equal to its standard state concentration. + * species in this phase equal to the default concentration of the solvent at + * the system temperature and pressure multiplied by Mnaught (kg solvent / gmol + * solvent). The solvent standard concentration is just equal to its standard + * state concentration. * - * This means that the - * kinetics operator essentially works on an generalized concentration basis (kmol / m3), - * with units for the kinetic rate constant specified - * as if all reactants (solvent or solute) are on a concentration basis (kmol /m3). - * The concentration will be modified by the activity coefficients. + * This means that the kinetics operator essentially works on an generalized + * concentration basis (kmol / m3), with units for the kinetic rate constant + * specified as if all reactants (solvent or solute) are on a concentration + * basis (kmol /m3). The concentration will be modified by the activity + * coefficients. * * For example, a bulk-phase binary reaction between liquid solute species - * j and k, producing - * a new liquid solute species l would have the - * following equation for its rate of progress variable, \f$ R^1 \f$, which has - * units of kmol m-3 s-1. + * j and k, producing a new liquid solute species l would + * have the following equation for its rate of progress variable, \f$ R^1 \f$, + * which has units of kmol m-3 s-1. * - * \f[ + * \f[ * R^1 = k^1 C_j^a C_k^a = k^1 (C^o_o \tilde{M}_o a_j) (C^o_o \tilde{M}_o a_k) - * \f] + * \f] * * where * - * \f[ - * C_j^a = C^o_o \tilde{M}_o a_j \quad and \quad C_k^a = C^o_o \tilde{M}_o a_k - * \f] + * \f[ + * C_j^a = C^o_o \tilde{M}_o a_j \quad and \quad C_k^a = C^o_o \tilde{M}_o a_k + * \f] * - * \f$ C_j^a \f$ is the activity concentration of species j, and - * \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^o_o \f$ - * is the concentration of water at 298 K and 1 atm. \f$ \tilde{M}_o \f$ - * has units of kg solvent per gmol solvent and is equal to + * \f$ C_j^a \f$ is the activity concentration of species j, and + * \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^o_o \f$ + * is the concentration of water at 298 K and 1 atm. \f$ \tilde{M}_o \f$ has + * units of kg solvent per gmol solvent and is equal to * * \f[ * \tilde{M}_o = \frac{M_o}{1000} * \f] * - * \f$ a_j \f$ is - * the activity of species j at the current temperature and pressure - * and concentration of the liquid phase is given by the molality based - * activity coefficient multiplied by the molality of the jth species. + * \f$ a_j \f$ is the activity of species j at the current temperature + * and pressure and concentration of the liquid phase is given by the molality + * based activity coefficient multiplied by the molality of the jth species. * * \f[ * a_j = \gamma_j^\triangle m_j = \gamma_j^\triangle \frac{n_j}{\tilde{M}_o n_o} @@ -1037,40 +999,40 @@ class WaterProps; * * \f$k^1 \f$ has units of m3 kmol-1 s-1. * - * Therefore the generalized activity concentration of a solute species has the following form + * Therefore the generalized activity concentration of a solute species has the following form * - * \f[ + * \f[ * C_j^a = C^o_o \frac{\gamma_j^\triangle n_j}{n_o} - * \f] + * \f] * - * The generalized activity concentration of the solvent has the same units, but it's a simpler form + * The generalized activity concentration of the solvent has the same units, but it's a simpler form * - * \f[ + * \f[ * C_o^a = C^o_o a_o - * \f] + * \f] * - * The reverse rate constant can then be obtained from the law of microscopic reversibility - * and the equilibrium expression for the system. + * The reverse rate constant can then be obtained from the law of microscopic reversibility + * and the equilibrium expression for the system. * - * \f[ + * \f[ * \frac{a_j a_k}{ a_l} = K^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} ) - * \f] + * \f] * - * \f$ K^{o,1} \f$ is the dimensionless form of the equilibrium constant. + * \f$ K^{o,1} \f$ is the dimensionless form of the equilibrium constant. * - * \f[ + * \f[ * R^{-1} = k^{-1} C_l^a = k^{-1} (C_o \tilde{M}_o a_l) - * \f] + * \f] * - * where + * where * - * \f[ + * \f[ * k^{-1} = k^1 K^{o,1} C_o \tilde{M}_o - * \f] + * \f] * - * \f$ k^{-1} \f$ has units of s-1. + * \f$ k^{-1} \f$ has units of s-1. * - * Note, this treatment may be modified in the future, as events dictate. + * Note, this treatment may be modified in the future, as events dictate. * *
*

Instantiation of the Class

@@ -1110,94 +1072,93 @@ class WaterProps; *
* * The phase model name for this is called StoichSubstance. It must be supplied - * as the model attribute of the thermo XML element entry. - * Within the phase XML block, - * the density of the phase must be specified. An example of an XML file + * as the model attribute of the thermo XML element entry. Within the phase XML + * block, the density of the phase must be specified. An example of an XML file * this phase is given below. * - * @verbatim - - - H2O(L) Na+ Cl- H+ OH- - - - 300 - 101325.0 - - Na+:3.0 - Cl-:3.0 - H+:1.0499E-8 - OH-:1.3765E-6 - - - - - - - - - - - - 0.0765, 0.008946, -3.3158E-6, - -777.03, -4.4706 - - 0.2664, 6.1608E-5, 1.0715E-6 - 0.0 - 0.00127, -4.655E-5, 0.0, - 33.317, 0.09421 - - 2.0 - - - - 0.1775, 0.0, 0.0, 0.0, 0.0 - 0.2945, 0.0, 0.0 - 0.0 - 0.0008, 0.0, 0.0, 0.0, 0.0 - 2.0 - - - - 0.0864, 0.0, 0.0, 0.0, 0.0 - 0.253, 0.0, 0.0 - 0.0 - 0.0044, 0.0, 0.0, 0.0, 0.0 - 2.0 - - - - -0.05 - - - - -0.05 - -0.006 - - - - 0.036 - - - - 0.036 - -0.004 - - - - - H2O(L) - - O H Na Cl - - - -@endverbatim + * @code + * + * + * H2O(L) Na+ Cl- H+ OH- + * + * + * 300 + * 101325.0 + * + * Na+:3.0 + * Cl-:3.0 + * H+:1.0499E-8 + * OH-:1.3765E-6 + * + * + * + * + * + * + * + * + * + * + * + * 0.0765, 0.008946, -3.3158E-6, + * -777.03, -4.4706 + * + * 0.2664, 6.1608E-5, 1.0715E-6 + * 0.0 + * 0.00127, -4.655E-5, 0.0, + * 33.317, 0.09421 + * + * 2.0 + * + * + * + * 0.1775, 0.0, 0.0, 0.0, 0.0 + * 0.2945, 0.0, 0.0 + * 0.0 + * 0.0008, 0.0, 0.0, 0.0, 0.0 + * 2.0 + * + * + * + * 0.0864, 0.0, 0.0, 0.0, 0.0 + * 0.253, 0.0, 0.0 + * 0.0 + * 0.0044, 0.0, 0.0, 0.0, 0.0 + * 2.0 + * + * + * + * -0.05 + * + * + * + * -0.05 + * -0.006 + * + * + * + * 0.036 + * + * + * + * 0.036 + * -0.004 + * + * + * + * + * H2O(L) + * + * O H Na Cl + * + * + * + * @endcode * @ingroup thermoprops */ class HMWSoln : public MolalityVPSSTP @@ -1228,38 +1189,9 @@ public: */ HMWSoln(XML_Node& phaseRef, const std::string& id = ""); - //! Copy Constructor - /*! - * Copy constructor for the object. Constructed - * object will be a clone of this object, but will - * also own all of its data. - * This is a wrapper around the assignment operator - * - * @param right Object to be copied. - */ HMWSoln(const HMWSoln& right); - - //! Assignment operator - /*! - * Assignment operator for the object. Constructed - * object will be a clone of this object, but will - * also own all of its data. - * - * @param right Object to be copied. - */ HMWSoln& operator=(const HMWSoln& right); - - //! Destructor. virtual ~HMWSoln(); - - //! Duplicator from the ThermoPhase parent class - /*! - * Given a pointer to a ThermoPhase object, this function will - * duplicate the ThermoPhase object and all underlying structures. - * This is basically a wrapper around the copy constructor. - * - * @return returns a pointer to a ThermoPhase - */ ThermoPhase* duplMyselfAsThermoPhase() const; //! Import, construct, and initialize a HMWSoln phase @@ -1286,15 +1218,13 @@ public: * Then, we read the species molar volumes from the XML tree to finish the * initialization. * - * @param phaseNode This object must be the phase node of a complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. + * @param phaseNode This object must be the phase node of a complete XML + * tree description of the phase, including all of the species + * data. In other words while "phase" must point to an XML phase + * object, it must have sibling nodes "speciesData" that + * describe the species in the phase. + * @param id ID of the phase. If nonnull, a check is done to see if + * phaseNode is pointing to the phase with the correct id. */ void constructPhaseXML(XML_Node& phaseNode, std::string id); @@ -1333,18 +1263,17 @@ public: /// Molar entropy. Units: J/kmol/K. /** - * Molar entropy of the solution. Units: J/kmol/K. - * For an ideal, constant partial molar volume solution mixture with - * pure species phases which exhibit zero volume expansivity: + * Molar entropy of the solution. Units: J/kmol/K. For an ideal, constant + * partial molar volume solution mixture with pure species phases which + * exhibit zero volume expansivity: * \f[ * \hat s(T, P, X_k) = \sum_k X_k \hat s^0_k(T) * - \hat R \sum_k X_k log(X_k) * \f] - * The reference-state pure-species entropies - * \f$ \hat s^0_k(T,p_{ref}) \f$ are computed by the - * species thermodynamic - * property manager. The pure species entropies are independent of - * temperature since the volume expansivities are equal to zero. + * The reference-state pure-species entropies \f$ \hat s^0_k(T,p_{ref}) \f$ + * are computed by the species thermodynamic property manager. The pure + * species entropies are independent of temperature since the volume + * expansivities are equal to zero. * @see SpeciesThermo * * (HKM -> Bump up to Parent object) @@ -1357,7 +1286,6 @@ public: */ virtual doublereal gibbs_mole() const; - /// Molar heat capacity at constant pressure. Units: J/kmol/K. virtual doublereal cp_mole() const; /// Molar heat capacity at constant volume. Units: J/kmol/K. @@ -1384,12 +1312,12 @@ public: */ virtual doublereal pressure() const; - //! Set the internally stored pressure (Pa) at constant - //! temperature and composition + //! Set the internally stored pressure (Pa) at constant temperature and + //! composition /*! - * This method sets the pressure within the object. - * The water model is a completely compressible model. - * Also, the dielectric constant is pressure dependent. + * This method sets the pressure within the object. The water model is a + * completely compressible model. Also, the dielectric constant is pressure + * dependent. * * @param p input Pressure (Pa) * @@ -1408,46 +1336,39 @@ protected: * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}} * \f] * - * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are - * the molecular weights, and \f$V_k\f$ are the pure species - * molar volumes. + * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular + * weights, and \f$V_k\f$ are the pure species molar volumes. * - * Note, the basis behind this formula is that in an ideal - * solution the partial molar volumes are equal to the pure - * species molar volumes. We have additionally specified - * in this class that the pure species molar volumes are - * independent of temperature and pressure. + * Note, the basis behind this formula is that in an ideal solution the + * partial molar volumes are equal to the pure species molar volumes. We + * have additionally specified in this class that the pure species molar + * volumes are independent of temperature and pressure. * - * NOTE: This is a non-virtual function, which is not a - * member of the ThermoPhase base class. + * NOTE: This is a non-virtual function, which is not a member of the + * ThermoPhase base class. */ void calcDensity(); public: - //! Returns the current value of the density - /*! - * @return value of the density. Units: kg/m^3 - */ virtual doublereal density() const; //! Set the internally stored density (kg/m^3) of the phase. /*! - * Overwritten setDensity() function is necessary because the - * density is not an independent variable. + * Overwritten setDensity() function is necessary because the density is not + * an independent variable. * * This function will now throw an error condition. * * Note, in general, setting the phase density is now a nonlinear - * calculation. P and T are the fundamental variables. This - * routine should be revamped to do the nonlinear problem. + * calculation. P and T are the fundamental variables. This routine should + * be revamped to do the nonlinear problem. * - * @todo May have to adjust the strategy here to make - * the eos for these materials slightly compressible, in order - * to create a condition where the density is a function of - * the pressure. - * @todo Now have a compressible ss equation for liquid water. - * Therefore, this phase is compressible. May still - * want to change the independent variable however. + * @todo May have to adjust the strategy here to make the eos for these + * materials slightly compressible, in order to create a condition where + * the density is a function of the pressure. + * @todo Now have a compressible ss equation for liquid water. Therefore, + * this phase is compressible. May still want to change the + * independent variable however. * * @param rho Input density (kg/m^3). */ @@ -1458,8 +1379,8 @@ public: * Overwritten setMolarDensity() function is necessary because of the * underlying water model. * - * This function will now throw an error condition if the input - * isn't exactly equal to the current molar density. + * This function will now throw an error condition if the input isn't + * exactly equal to the current molar density. * * @param conc Input molar density (kmol/m^3). */ @@ -1467,65 +1388,44 @@ public: //! Set the temperature (K) /*! - * This function sets the temperature, and makes sure that - * the value propagates to underlying objects, such as - * the water standard state model. - * - * @todo Make Phase::setTemperature a virtual function + * This function sets the temperature, and makes sure that the value + * propagates to underlying objects, such as the water standard state model. * * @param temp Temperature in kelvin */ virtual void setTemperature(const doublereal temp); - //! Set the temperature (K) and pressure (Pa) - /*! - * Set the temperature and pressure. - * - * @param t Temperature (K) - * @param p Pressure (Pa) - */ virtual void setState_TP(doublereal t, doublereal p); - /** - * @} - * @name Potential Energy - * - * Species may have an additional potential energy due to the - * presence of external gravitation or electric fields. These - * methods allow specifying a potential energy for individual - * species. - * @{ - */ - /** * @} * @name Activities, Standard States, and Activity Concentrations * - * The activity \f$a_k\f$ of a species in solution is - * related to the chemical potential by \f[ \mu_k = \mu_k^0(T) - * + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is - * the chemical potential at unit activity, which depends only - * on temperature and the pressure. - * Activity is assumed to be molality-based here. + * The activity \f$a_k\f$ of a species in solution is related to the + * chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The + * quantity \f$\mu_k^0(T,P)\f$ is the chemical potential at unit activity, + * which depends only on temperature and the pressure. Activity is assumed + * to be molality-based here. * @{ */ //! This method returns an array of generalized activity concentrations /*! - * The generalized activity concentrations, \f$ C_k^a\f$, are defined such that - * \f$ a_k = C^a_k / C^0_k, \f$ where \f$ C^0_k \f$ - * is a standard concentration - * defined below. These generalized concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. + * The generalized activity concentrations, \f$ C_k^a\f$, are defined such + * that \f$ a_k = C^a_k / C^0_k, \f$ where \f$ C^0_k \f$ is a standard + * concentration defined below. These generalized concentrations are used + * by kinetics manager classes to compute the forward and reverse rates of + * elementary reactions. * - * The generalized activity concentration of a solute species has the following form + * The generalized activity concentration of a solute species has the + * following form * * \f[ * C_j^a = C^o_o \frac{\gamma_j^\triangle n_j}{n_o} * \f] * - * The generalized activity concentration of the solvent has the same units, but it's a simpler form + * The generalized activity concentration of the solvent has the same units, + * but it's a simpler form * * \f[ * C_o^a = C^o_o a_o @@ -1538,43 +1438,44 @@ public: //! Return the standard concentration for the kth species /*! - * The standard concentration \f$ C^0_k \f$ used to normalize - * the activity (i.e., generalized) concentration for use + * The standard concentration \f$ C^0_k \f$ used to normalize the activity + * (i.e., generalized) concentration for use * - * We have set the standard concentration for all solute species in - * this phase equal to the default concentration of the solvent at the system temperature - * and pressure multiplied by Mnaught (kg solvent / gmol solvent). The solvent - * standard concentration is just equal to its standard state concentration. + * We have set the standard concentration for all solute species in this + * phase equal to the default concentration of the solvent at the system + * temperature and pressure multiplied by Mnaught (kg solvent / gmol + * solvent). The solvent standard concentration is just equal to its + * standard state concentration. * * \f[ * C_j^0 = C^o_o \tilde{M}_o \quad and C_o^0 = C^o_o * \f] * - * The consequence of this is that the standard concentrations have unequal units - * between the solvent and the solute. However, both the solvent and the solute - * activity concentrations will have the same units of kmol kg-3. + * The consequence of this is that the standard concentrations have unequal + * units between the solvent and the solute. However, both the solvent and + * the solute activity concentrations will have the same units of kmol + * kg-3. * - * This means that the - * kinetics operator essentially works on an generalized concentration basis (kmol / m3), - * with units for the kinetic rate constant specified - * as if all reactants (solvent or solute) are on a concentration basis (kmol /m3). - * The concentration will be modified by the activity coefficients. + * This means that the kinetics operator essentially works on an generalized + * concentration basis (kmol / m3), with units for the kinetic rate constant + * specified as if all reactants (solvent or solute) are on a concentration + * basis (kmol /m3). The concentration will be modified by the activity + * coefficients. * * For example, a bulk-phase binary reaction between liquid solute species - * j and k, producing - * a new liquid solute species l would have the - * following equation for its rate of progress variable, \f$ R^1 \f$, which has - * units of kmol m-3 s-1. + * j and k, producing a new liquid solute species l + * would have the following equation for its rate of progress variable, \f$ + * R^1 \f$, which has units of kmol m-3 s-1. * - * \f[ + * \f[ * R^1 = k^1 C_j^a C_k^a = k^1 (C^o_o \tilde{M}_o a_j) (C^o_o \tilde{M}_o a_k) - * \f] + * \f] * * where * - * \f[ + * \f[ * C_j^a = C^o_o \tilde{M}_o a_j \quad and \quad C_k^a = C^o_o \tilde{M}_o a_k - * \f] + * \f] * * \f$ C_j^a \f$ is the activity concentration of species j, and * \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^o_o \f$ @@ -1596,36 +1497,36 @@ public: * * \f$k^1 \f$ has units of m3 kmol-1 s-1. * - * Therefore the generalized activity concentration of a solute species has the following form + * Therefore the generalized activity concentration of a solute species has + * the following form * - * \f[ - * C_j^a = C^o_o \frac{\gamma_j^\triangle n_j}{n_o} - * \f] + * \f[ + * C_j^a = C^o_o \frac{\gamma_j^\triangle n_j}{n_o} + * \f] * - * The generalized activity concentration of the solvent has the same units, but it's a simpler form + * The generalized activity concentration of the solvent has the same units, + * but it's a simpler form * - * \f[ - * C_o^a = C^o_o a_o - * \f] + * \f[ + * C_o^a = C^o_o a_o + * \f] * - * @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. + * @param k Optional parameter indicating the species. The default is to + * assume this refers to species 0. + * @returns the standard Concentration in units of m3 + * kmol-1. * * @param k Species index */ virtual doublereal standardConcentration(size_t k=0) const; - //! Get the array of non-dimensional activities at - //! the current solution temperature, pressure, and solution concentration. + //! Get the array of non-dimensional activities at the current solution + //! temperature, pressure, and solution concentration. /*! * - * We resolve this function at this level by calling - * on the activityConcentration function. However, - * derived classes may want to override this default - * implementation. + * 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). * @@ -1655,9 +1556,9 @@ public: //! Returns an array of partial molar enthalpies for the species //! in the mixture. Units (J/kmol) /*! - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * molality-based activity coefficient wrt temperature + * For this phase, the partial molar enthalpies are equal to the standard + * state enthalpies modified by the derivative of the molality-based + * activity coefficient wrt temperature * * \f[ * \bar h_k(T,P) = h^{\triangle}_k(T,P) @@ -1683,10 +1584,9 @@ public: * * d(chemPot_i)/dT = -sbar_i * - * For this phase, the partial molar entropies are equal to the - * SS species entropies plus the ideal solution contribution - * plus complicated functions of the - * temperature derivative of the activity coefficients. + * For this phase, the partial molar entropies are equal to the SS species + * entropies plus the ideal solution contribution plus complicated functions + * of the temperature derivative of the activity coefficients. * * \f[ * \bar s_k(T,P) = s^{\triangle}_k(T,P) @@ -1703,13 +1603,13 @@ public: */ virtual void getPartialMolarEntropies(doublereal* sbar) const; - //! Return an array of partial molar volumes for the - //! species in the mixture. Units: m^3/kmol. + //! Return an array of partial molar volumes for the species in the mixture. + //! Units: m^3/kmol. /*! - * For this solution, the partial molar volumes are functions - * of the pressure derivatives of the activity coefficients. + * For this solution, the partial molar volumes are functions of the + * pressure derivatives of the activity coefficients. * - * \f[ + * \f[ * \bar V_k(T,P) = V^{\triangle}_k(T,P) * + R T \frac{d \ln(\gamma^{\triangle}_k) }{dP} * \f] @@ -1718,17 +1618,17 @@ public: * + R T \frac{d \ln(a_o)}{dP} * \f] * - * @param vbar Output vector of species partial molar volumes. - * Length = m_kk. units are m^3/kmol. + * @param vbar Output vector of species partial molar volumes. + * Length = m_kk. units are m^3/kmol. */ virtual void getPartialMolarVolumes(doublereal* vbar) const; - //! Return an array of partial molar heat capacities for the - //! species in the mixture. Units: J/kmol/K + //! Return an array of partial molar heat capacities for the species in the + //! mixture. Units: J/kmol/K /*! - * The following formulas are implemented within the code. + * The following formulas are implemented within the code. * - * \f[ + * \f[ * \bar C_{p,k}(T,P) = C^{\triangle}_{p,k}(T,P) * - 2 R T \frac{d \ln( \gamma^{\triangle}_k)}{dT} * - R T^2 \frac{d^2 \ln(\gamma^{\triangle}_k) }{{dT}^2} @@ -1739,9 +1639,8 @@ public: * - R T^2 \frac{d^2 \ln(a_o)}{{dT}^2} * \f] * - * @param cpbar Output vector of species partial molar heat - * capacities at constant pressure. - * Length = m_kk. units are 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; @@ -1750,18 +1649,6 @@ public: //! @name Chemical Equilibrium //! @{ - //!This method is used by the ChemEquil equilibrium solver. - /*! - * It sets the state such that the chemical potentials satisfy - * \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m} - * \left(\frac{\lambda_m} {\hat R T}\right) \f] where - * \f$ \lambda_m \f$ is the element potential of element m. The - * temperature is unchanged. Any phase (ideal or not) that - * implements this method can be equilibrated by ChemEquil. - * - * @param lambda_RT Input vector of dimensionless element potentials - * The length is equal to nElements(). - */ virtual void setToEquilState(const doublereal* lambda_RT) { updateStandardStateThermo(); throw NotImplementedError("HMWSoln::setToEquilState"); @@ -1772,15 +1659,14 @@ public: //! Get the saturation pressure for a given temperature. /*! * Note the limitations of this function. Stability considerations - * concerning multiphase equilibrium are ignored in this - * calculation. Therefore, the call is made directly to the SS of - * water underneath. The object is put back into its original - * state at the end of the call. + * concerning multiphase equilibrium are ignored in this calculation. + * Therefore, the call is made directly to the SS of water underneath. The + * object is put back into its original state at the end of the call. * - * @todo This is probably not implemented correctly. The stability - * of the salt should be added into this calculation. The - * underlying water model may be called to get the stability - * of the pure water solution, if needed. + * @todo This is probably not implemented correctly. The stability of the + * salt should be added into this calculation. The underlying water + * model may be called to get the stability of the pure water + * solution, if needed. * * @param T Temperature (kelvin) */ @@ -1790,37 +1676,21 @@ public: * -------------- Utilities ------------------------------- */ - //! Internal initialization required after all species have - //! been added - /*! - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase(). - */ virtual void initThermo(); //! Initialize the phase parameters from an XML file. /*! - * This gets called from importPhase(). It processes the XML file - * after the species are set up. This is the main routine for - * reading in activity coefficient parameters. + * This gets called from importPhase(). It processes the XML file after the + * species are set up. This is the main routine for reading in activity + * coefficient parameters. * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. + * @param phaseNode This object must be the phase node of a complete XML + * tree description of the phase, including all of the species + * data. In other words while "phase" must point to an XML phase + * object, it must have sibling nodes "speciesData" that + * describe the species in the phase. + * @param id ID of the phase. If nonnull, a check is done to see if + * phaseNode is pointing to the phase with the correct id. */ virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); @@ -1839,9 +1709,8 @@ public: virtual double A_Debye_TP(double temperature = -1.0, double pressure = -1.0) const; - //! Value of the derivative of the Debye Huckel constant with - //! respect to temperature as a function of temperature - //! and pressure. + //! Value of the derivative of the Debye Huckel constant with respect to + //! temperature as a function of temperature and pressure. /*! * A_Debye = (F e B_Debye) / (8 Pi epsilon R T) * @@ -1856,9 +1725,8 @@ public: double pressure = -1.0) const; /** - * Value of the derivative of the Debye Huckel constant with - * respect to pressure, as a function of temperature - * and pressure. + * Value of the derivative of the Debye Huckel constant with respect to + * pressure, as a function of temperature and pressure. * * A_Debye = (F e B_Debye) / (8 Pi epsilon R T) * @@ -1891,9 +1759,8 @@ public: double pressure = -1.0) const; /** - * Return Pitzer's definition of A_J. This is basically the - * temperature derivative of A_L, and the second derivative - * of A_phi + * Return Pitzer's definition of A_J. This is basically the temperature + * derivative of A_L, and the second derivative of A_phi * * A_Debye = (F e B_Debye) / (8 Pi epsilon R T) * dA_phidT = d(A_Debye)/dT / 3.0 @@ -1910,8 +1777,8 @@ public: double pressure = -1.0) const; /** - * Return Pitzer's definition of A_V. This is the - * derivative wrt pressure of A_phi multiplied by - 4 R T + * Return Pitzer's definition of A_V. This is the derivative wrt pressure of + * A_phi multiplied by - 4 R T * * A_Debye = (F e B_Debye) / (8 Pi epsilon R T) * dA_phidT = d(A_Debye)/dP / 3.0 @@ -1927,9 +1794,8 @@ public: double ADebye_V(double temperature = -1.0, double pressure = -1.0) const; - //! Value of the 2nd derivative of the Debye Huckel constant with - //! respect to temperature as a function of temperature - //! and pressure. + //! Value of the 2nd derivative of the Debye Huckel constant with respect to + //! temperature as a function of temperature and pressure. /*! * A_Debye = (F e B_Debye) / (8 Pi epsilon R T) * @@ -1965,10 +1831,10 @@ public: //! activity coefficients at the current solution temperature, //! pressure, and solution concentration. /*! - * See Denbigh p. 278 for a thorough discussion. This class must be overwritten in - * classes which derive from MolalityVPSSTP. This function takes over from the - * molar-based activity coefficient calculation, getActivityCoefficients(), in - * derived classes. + * See Denbigh p. 278 for a thorough discussion. This class must be + * overwritten in classes which derive from MolalityVPSSTP. This function + * takes over from the molar-based activity coefficient calculation, + * getActivityCoefficients(), in derived classes. * * @param acMolality Output vector containing the molality based activity coefficients. * length: m_kk. @@ -1982,48 +1848,48 @@ private: */ void s_updateScaling_pHScaling() const; - //! Apply the current phScale to a set of derivatives of the activity Coefficients - //! wrt temperature + //! Apply the current phScale to a set of derivatives of the activity + //! Coefficients wrt temperature /*! * See the Eq3/6 Manual for a thorough discussion of the need */ void s_updateScaling_pHScaling_dT() const; - //! Apply the current phScale to a set of 2nd derivatives of the activity Coefficients - //! wrt temperature + //! Apply the current phScale to a set of 2nd derivatives of the activity + //! Coefficients wrt temperature /*! * See the Eq3/6 Manual for a thorough discussion of the need */ void s_updateScaling_pHScaling_dT2() const; - //! Apply the current phScale to a set of derivatives of the activity Coefficients - //! wrt pressure + //! Apply the current phScale to a set of derivatives of the activity + //! Coefficients wrt pressure /*! * See the Eq3/6 Manual for a thorough discussion of the need */ void s_updateScaling_pHScaling_dP() const; - //! Calculate the Chlorine activity coefficient on the NBS scale + //! Calculate the Chlorine activity coefficient on the NBS scale /*! * We assume here that the m_IionicMolality variable is up to date. */ doublereal s_NBS_CLM_lnMolalityActCoeff() const; - //! Calculate the temperature derivative of the Chlorine activity coefficient - //! on the NBS scale + //! Calculate the temperature derivative of the Chlorine activity + //! coefficient on the NBS scale /*! * We assume here that the m_IionicMolality variable is up to date. */ doublereal s_NBS_CLM_dlnMolalityActCoeff_dT() const; - //! Calculate the second temperature derivative of the Chlorine activity coefficient - //! on the NBS scale + //! Calculate the second temperature derivative of the Chlorine activity + //! coefficient on the NBS scale /*! * We assume here that the m_IionicMolality variable is up to date. */ doublereal s_NBS_CLM_d2lnMolalityActCoeff_dT2() const; - //! Calculate the pressure derivative of the Chlorine activity coefficient + //! Calculate the pressure derivative of the Chlorine activity coefficient /*! * We assume here that the m_IionicMolality variable is up to date. */ @@ -2033,19 +1899,17 @@ private: private: /** - * This is the form of the Pitzer parameterization - * used in this model. - * The options are described at the top of this document, - * and in the general documentation. - * The list is repeated here: + * This is the form of the Pitzer parameterization used in this model. The + * options are described at the top of this document, and in the general + * documentation. The list is repeated here: * * PITZERFORM_BASE = 0 (only one supported atm) */ int m_formPitzer; /** - * This is the form of the temperature dependence of Pitzer - * parameterization used in the model. + * This is the form of the temperature dependence of Pitzer parameterization + * used in the model. * * PITZER_TEMP_CONSTANT 0 * PITZER_TEMP_LINEAR 1 @@ -2070,17 +1934,16 @@ private: * 2 X_k / V_N 1.0 / V_N * * - * The value and form of the generalized concentration will affect - * reaction rate constants involving species in this phase. + * The value and form of the generalized concentration will affect reaction + * rate constants involving species in this phase. * - * (HKM Note: Using option #1 may lead to spurious results and - * has been included only with warnings. The reason is that it - * molar volumes of electrolytes may often be negative. The - * molar volume of H+ is defined to be zero too. Either options - * 0 or 2 are the appropriate choice. Option 0 leads to - * bulk reaction rate constants which have units of s-1. - * Option 2 leads to bulk reaction rate constants for - * bimolecular rxns which have units of m-3 kmol-1 s-1.) + * (HKM Note: Using option #1 may lead to spurious results and has been + * included only with warnings. The reason is that it molar volumes of + * electrolytes may often be negative. The molar volume of H+ is defined to + * be zero too. Either options 0 or 2 are the appropriate choice. Option 0 + * leads to bulk reaction rate constants which have units of s-1. Option 2 + * leads to bulk reaction rate constants for bimolecular rxns which have + * units of m-3 kmol-1 s-1.) */ int m_formGC; @@ -2092,95 +1955,80 @@ private: * - weakAcidAssociated * - strongAcidAssociated * - polarNeutral - * - nonpolarNeutral . + * - nonpolarNeutral */ vector_int m_electrolyteSpeciesType; - /** - * a_k = Size of the ionic species in the DH formulation - * units = meters - */ + //! a_k = Size of the ionic species in the DH formulation. units = meters vector_fp m_Aionic; - /** - * Current value of the ionic strength on the molality scale - * Associated Salts, if present in the mechanism, - * don't contribute to the value of the ionic strength - * in this version of the Ionic strength. - */ + //! Current value of the ionic strength on the molality scale Associated + //! Salts, if present in the mechanism, don't contribute to the value of the + //! ionic strength in this version of the Ionic strength. mutable double m_IionicMolality; - /** - * Maximum value of the ionic strength allowed in the - * calculation of the activity coefficients. - */ + //! Maximum value of the ionic strength allowed in the calculation of the + //! activity coefficients. double m_maxIionicStrength; //! Reference Temperature for the Pitzer formulations. double m_TempPitzerRef; - /** - * Stoichiometric ionic strength on the molality scale. - * This differs from m_IionicMolality in the sense that - * associated salts are treated as unassociated salts, - * when calculating the Ionic strength by this method. - */ + //! Stoichiometric ionic strength on the molality scale. This differs from + //! m_IionicMolality in the sense that associated salts are treated as + //! unassociated salts, when calculating the Ionic strength by this method. mutable double m_IionicMolalityStoich; public: /** - * Form of the constant outside the Debye-Huckel term - * called A. It's normally a function of temperature - * and pressure. However, it can be set from the - * input file in order to aid in numerical comparisons. - * Acceptable forms: + * Form of the constant outside the Debye-Huckel term called A. It's + * normally a function of temperature and pressure. However, it can be set + * from the input file in order to aid in numerical comparisons. Acceptable + * forms: * * A_DEBYE_CONST 0 * A_DEBYE_WATER 1 * - * The A_DEBYE_WATER form may be used for water solvents - * with needs to cover varying temperatures and pressures. - * Note, the dielectric constant of water is a relatively - * strong function of T, and its variability must be + * The A_DEBYE_WATER form may be used for water solvents with needs to cover + * varying temperatures and pressures. Note, the dielectric constant of + * water is a relatively strong function of T, and its variability must be * accounted for, */ int m_form_A_Debye; private: /** - * A_Debye -> this expression appears on the top of the - * ln actCoeff term in the general Debye-Huckel - * expression - * It depends on temperature. And, therefore, - * most be recalculated whenever T or P changes. - * This variable is a local copy of the calculation. + * A_Debye: this expression appears on the top of the ln actCoeff term in + * the general Debye-Huckel expression It depends on temperature. + * And, therefore, most be recalculated whenever T or P changes. + * This variable is a local copy of the calculation. * - * A_Debye = (F e B_Debye) / (8 Pi epsilon R T) + * A_Debye = (F e B_Debye) / (8 Pi epsilon R T) * - * where B_Debye = F / sqrt(epsilon R T/2) - * (dw/1000)^(1/2) + * where B_Debye = F / sqrt(epsilon R T/2) + * (dw/1000)^(1/2) * - * A_Debye = (1/ (8 Pi)) (2 Na * dw/1000)^(1/2) - * (e * e / (epsilon * kb * T))^(3/2) + * A_Debye = (1/ (8 Pi)) (2 Na * dw/1000)^(1/2) + * (e * e / (epsilon * kb * T))^(3/2) * - * Units = sqrt(kg/gmol) + * Units = sqrt(kg/gmol) * - * Nominal value = 1.172576 sqrt(kg/gmol) - * based on: - * epsilon/epsilon_0 = 78.54 - * (water at 25C) - * epsilon_0 = 8.854187817E-12 C2 N-1 m-2 - * e = 1.60217653 E-19 C - * F = 9.6485309E7 C kmol-1 - * R = 8.314472E3 kg m2 s-2 kmol-1 K-1 - * T = 298.15 K - * B_Debye = 3.28640E9 sqrt(kg/gmol)/m - * dw = C_0 * M_0 (density of water) (kg/m3) - * = 1.0E3 at 25C + * Nominal value = 1.172576 sqrt(kg/gmol) + * based on: + * epsilon/epsilon_0 = 78.54 + * (water at 25C) + * epsilon_0 = 8.854187817E-12 C2 N-1 m-2 + * e = 1.60217653 E-19 C + * F = 9.6485309E7 C kmol-1 + * R = 8.314472E3 kg m2 s-2 kmol-1 K-1 + * T = 298.15 K + * B_Debye = 3.28640E9 sqrt(kg/gmol)/m + * dw = C_0 * M_0 (density of water) (kg/m3) + * = 1.0E3 at 25C */ mutable double m_A_Debye; - //! Water standard state calculator + //! Water standard state calculator /*! * derived from the equation of state for water. */ @@ -2202,235 +2050,163 @@ private: mutable vector_fp m_tmpV; /** - * Stoichiometric species charge -> This is for calculations - * of the ionic strength which ignore ion-ion pairing into - * neutral molecules. The Stoichiometric species charge is the - * charge of one of the ion that would occur if the species broke - * into two charged ion pairs. + * Stoichiometric species charge -> This is for calculations of the ionic + * strength which ignore ion-ion pairing into neutral molecules. The + * Stoichiometric species charge is the charge of one of the ion that would + * occur if the species broke into two charged ion pairs. + * * NaCl -> m_speciesCharge_Stoich = -1; * HSO4- -> H+ + SO42- = -2 * -> The other charge is calculated. - * For species that aren't ion pairs, its equal to the - * m_speciesCharge[] value. + * + * For species that aren't ion pairs, its equal to the m_speciesCharge[] + * value. */ vector_fp m_speciesCharge_Stoich; /** - * Array of 2D data used in the Pitzer/HMW formulation. - * Beta0_ij[i][j] is the value of the Beta0 coefficient - * for the ij salt. It will be nonzero iff i and j are - * both charged and have opposite sign. The array is also - * symmetric. - * counterIJ where counterIJ = m_counterIJ[i][j] - * is used to access this array. + * Array of 2D data used in the Pitzer/HMW formulation. Beta0_ij[i][j] is + * the value of the Beta0 coefficient for the ij salt. It will be nonzero + * iff i and j are both charged and have opposite sign. The array is also + * symmetric. counterIJ where counterIJ = m_counterIJ[i][j] is used to + * access this array. */ mutable vector_fp m_Beta0MX_ij; - //! Derivative of Beta0_ij[i][j] wrt T - /*! - * vector index is counterIJ - */ + //! Derivative of Beta0_ij[i][j] wrt T. Vector index is counterIJ mutable vector_fp m_Beta0MX_ij_L; - //! Derivative of Beta0_ij[i][j] wrt TT - /*! - * vector index is counterIJ - */ + //! Derivative of Beta0_ij[i][j] wrt TT. Vector index is counterIJ mutable vector_fp m_Beta0MX_ij_LL; - //! Derivative of Beta0_ij[i][j] wrt P - /*! - * vector index is counterIJ - */ + //! Derivative of Beta0_ij[i][j] wrt P. Vector index is counterIJ mutable vector_fp m_Beta0MX_ij_P; //! Array of coefficients for Beta0, a variable in Pitzer's papers /*! - * column index is counterIJ - * m_Beta0MX_ij_coeff.ptrColumn(counterIJ) is a double* containing - * the vector of coefficients for the counterIJ interaction. + * Column index is counterIJ. m_Beta0MX_ij_coeff.ptrColumn(counterIJ) is a + * double* containing the vector of coefficients for the counterIJ + * interaction. */ mutable Array2D m_Beta0MX_ij_coeff; - /*! - * Array of 2D data used in the Pitzer/HMW formulation. - * Beta1_ij[i][j] is the value of the Beta1 coefficient - * for the ij salt. It will be nonzero iff i and j are - * both charged and have opposite sign. The array is also - * symmetric. - * counterIJ where counterIJ = m_counterIJ[i][j] - * is used to access this array. - */ + //! Array of 2D data used in the Pitzer/HMW formulation. Beta1_ij[i][j] is + //! the value of the Beta1 coefficient for the ij salt. It will be nonzero + //! iff i and j are both charged and have opposite sign. The array is also + //! symmetric. counterIJ where counterIJ = m_counterIJ[i][j] is used to + //! access this array. mutable vector_fp m_Beta1MX_ij; - //! Derivative of Beta1_ij[i][j] wrt T - /*! - * vector index is counterIJ - */ + //! Derivative of Beta1_ij[i][j] wrt T. Vector index is counterIJ mutable vector_fp m_Beta1MX_ij_L; - //! Derivative of Beta1_ij[i][j] wrt TT - /*! - * vector index is counterIJ - */ + //! Derivative of Beta1_ij[i][j] wrt TT. Vector index is counterIJ mutable vector_fp m_Beta1MX_ij_LL; - //! Derivative of Beta1_ij[i][j] wrt P - /*! - * vector index is counterIJ - */ + //! Derivative of Beta1_ij[i][j] wrt P. Vector index is counterIJ mutable vector_fp m_Beta1MX_ij_P; //! Array of coefficients for Beta1, a variable in Pitzer's papers /*! - * column index is counterIJ - * m_Beta1MX_ij_coeff.ptrColumn(counterIJ) is a double* containing - * the vector of coefficients for the counterIJ interaction. + * Column index is counterIJ. m_Beta1MX_ij_coeff.ptrColumn(counterIJ) is a + * double* containing the vector of coefficients for the counterIJ + * interaction. */ mutable Array2D m_Beta1MX_ij_coeff; - /** - * Array of 2D data used in the Pitzer/HMW formulation. - * Beta2_ij[i][j] is the value of the Beta2 coefficient - * for the ij salt. It will be nonzero iff i and j are - * both charged and have opposite sign, and i and j - * both have charges of 2 or more. The array is also - * symmetric. - * counterIJ where counterIJ = m_counterIJ[i][j] - * is used to access this array. - */ + //! Array of 2D data used in the Pitzer/HMW formulation. Beta2_ij[i][j] is + //! the value of the Beta2 coefficient for the ij salt. It will be nonzero + //! iff i and j are both charged and have opposite sign, and i and j both + //! have charges of 2 or more. The array is also symmetric. counterIJ where + //! counterIJ = m_counterIJ[i][j] is used to access this array. mutable vector_fp m_Beta2MX_ij; - //! Derivative of Beta2_ij[i][j] wrt T - /*! - * vector index is counterIJ - */ + //! Derivative of Beta2_ij[i][j] wrt T. Vector index is counterIJ mutable vector_fp m_Beta2MX_ij_L; - //! Derivative of Beta2_ij[i][j] wrt TT - /*! - * vector index is counterIJ - */ + //! Derivative of Beta2_ij[i][j] wrt TT. Vector index is counterIJ mutable vector_fp m_Beta2MX_ij_LL; - //! Derivative of Beta2_ij[i][j] wrt P - /*! - * vector index is counterIJ - */ + //! Derivative of Beta2_ij[i][j] wrt P. Vector index is counterIJ mutable vector_fp m_Beta2MX_ij_P; //! Array of coefficients for Beta2, a variable in Pitzer's papers /*! - * column index is counterIJ - * m_Beta2MX_ij_coeff.ptrColumn(counterIJ) is a double* containing - * the vector of coefficients for the counterIJ interaction. - * This was added for the YMP database version of the code since it - * contains temperature-dependent parameters for some 2-2 electrolytes. + * column index is counterIJ. m_Beta2MX_ij_coeff.ptrColumn(counterIJ) is a + * double* containing the vector of coefficients for the counterIJ + * interaction. This was added for the YMP database version of the code + * since it contains temperature-dependent parameters for some 2-2 + * electrolytes. */ mutable Array2D m_Beta2MX_ij_coeff; - /** - * Array of 2D data used in the Pitzer/HMW formulation. - * Alpha1MX_ij[i][j] is the value of the alpha1 coefficient - * for the ij interaction. It will be nonzero iff i and j are - * both charged and have opposite sign. - * It is symmetric wrt i, j. - * counterIJ where counterIJ = m_counterIJ[i][j] - * is used to access this array. - */ + // Array of 2D data used in the Pitzer/HMW formulation. Alpha1MX_ij[i][j] is + // the value of the alpha1 coefficient for the ij interaction. It will be + // nonzero iff i and j are both charged and have opposite sign. It is + // symmetric wrt i, j. counterIJ where counterIJ = m_counterIJ[i][j] is used + // to access this array. vector_fp m_Alpha1MX_ij; - /** - * Array of 2D data used in the Pitzer/HMW formulation. - * Alpha2MX_ij[i][j] is the value of the alpha2 coefficient - * for the ij interaction. It will be nonzero iff i and j are - * both charged and have opposite sign, and i and j - * both have charges of 2 or more, usually. - * It is symmetric wrt i, j. - * counterIJ, where counterIJ = m_counterIJ[i][j], - * is used to access this array. - */ + //! Array of 2D data used in the Pitzer/HMW formulation. Alpha2MX_ij[i][j] + //! is the value of the alpha2 coefficient for the ij interaction. It will + //! be nonzero iff i and j are both charged and have opposite sign, and i + //! and j both have charges of 2 or more, usually. It is symmetric wrt i, j. + //! counterIJ, where counterIJ = m_counterIJ[i][j], is used to access this + //! array. vector_fp m_Alpha2MX_ij; - /** - * Array of 2D data used in the Pitzer/HMW formulation. - * CphiMX_ij[i][j] is the value of the Cphi coefficient - * for the ij interaction. It will be nonzero iff i and j are - * both charged and have opposite sign, and i and j - * both have charges of 2 or more. The array is also - * symmetric. - * counterIJ where counterIJ = m_counterIJ[i][j] - * is used to access this array. - */ + //! Array of 2D data used in the Pitzer/HMW formulation. CphiMX_ij[i][j] is + //! the value of the Cphi coefficient for the ij interaction. It will be + //! nonzero iff i and j are both charged and have opposite sign, and i and j + //! both have charges of 2 or more. The array is also symmetric. counterIJ + //! where counterIJ = m_counterIJ[i][j] is used to access this array. mutable vector_fp m_CphiMX_ij; - //! Derivative of Cphi_ij[i][j] wrt T - /*! - * vector index is counterIJ - */ + //! Derivative of Cphi_ij[i][j] wrt T. Vector index is counterIJ mutable vector_fp m_CphiMX_ij_L; - //! Derivative of Cphi_ij[i][j] wrt TT - /*! - * vector index is counterIJ - */ + //! Derivative of Cphi_ij[i][j] wrt TT. Vector index is counterIJ mutable vector_fp m_CphiMX_ij_LL; - //! Derivative of Cphi_ij[i][j] wrt P - /*! - * vector index is counterIJ - */ + //! Derivative of Cphi_ij[i][j] wrt P. Vector index is counterIJ mutable vector_fp m_CphiMX_ij_P; //! Array of coefficients for CphiMX, a parameter in the activity //! coefficient formulation /*! - * Column index is counterIJ - * m_CphiMX_ij_coeff.ptrColumn(counterIJ) is a double* containing - * the vector of coefficients for the counterIJ interaction. + * Column index is counterIJ. m_CphiMX_ij_coeff.ptrColumn(counterIJ) is a + * double* containing the vector of coefficients for the counterIJ + * interaction. */ mutable Array2D m_CphiMX_ij_coeff; //! Array of 2D data for Theta_ij[i][j] in the Pitzer/HMW formulation. /*! - * Array of 2D data used in the Pitzer/HMW formulation. - * Theta_ij[i][j] is the value of the theta coefficient - * for the ij interaction. It will be nonzero for charged - * ions with the same sign. It is symmetric. - * counterIJ where counterIJ = m_counterIJ[i][j] - * is used to access this array. + * Array of 2D data used in the Pitzer/HMW formulation. Theta_ij[i][j] is + * the value of the theta coefficient for the ij interaction. It will be + * nonzero for charged ions with the same sign. It is symmetric. counterIJ + * where counterIJ = m_counterIJ[i][j] is used to access this array. * - * HKM Recent Pitzer papers have used a functional form - * for Theta_ij, which depends on the ionic strength. + * HKM Recent Pitzer papers have used a functional form for Theta_ij, which + * depends on the ionic strength. */ mutable vector_fp m_Theta_ij; - //! Derivative of Theta_ij[i][j] wrt T - /*! - * vector index is counterIJ - */ + //! Derivative of Theta_ij[i][j] wrt T. Vector index is counterIJ mutable vector_fp m_Theta_ij_L; - //! Derivative of Theta_ij[i][j] wrt TT - /*! - * vector index is counterIJ - */ + //! Derivative of Theta_ij[i][j] wrt TT. Vector index is counterIJ mutable vector_fp m_Theta_ij_LL; - //! Derivative of Theta_ij[i][j] wrt P - /*! - * vector index is counterIJ - */ + //! Derivative of Theta_ij[i][j] wrt P. Vector index is counterIJ mutable vector_fp m_Theta_ij_P; //! Array of coefficients for Theta_ij[i][j] in the Pitzer/HMW formulation. /*! - * Theta_ij[i][j] is the value of the theta coefficient - * for the ij interaction. It will be nonzero for charged - * ions with the same sign. It is symmetric. - * Column index is counterIJ. - * counterIJ where counterIJ = m_counterIJ[i][j] - * is used to access this array. + * Theta_ij[i][j] is the value of the theta coefficient for the ij + * interaction. It will be nonzero for charged ions with the same sign. It + * is symmetric. Column index is counterIJ. counterIJ where counterIJ = + * m_counterIJ[i][j] is used to access this array. * * m_Theta_ij_coeff.ptrColumn(counterIJ) is a double* containing * the vector of coefficients for the counterIJ interaction. @@ -2444,28 +2220,22 @@ private: * * n = k + j * m_kk + i * m_kk * m_kk; * - * It is potentially nonzero everywhere. - * The first two coordinates are symmetric wrt cations, - * and the last two coordinates are symmetric wrt anions. + * It is potentially nonzero everywhere. The first two coordinates are + * symmetric wrt cations, and the last two coordinates are symmetric wrt + * anions. */ mutable vector_fp m_Psi_ijk; - //! Derivative of Psi_ijk[n] wrt T - /*! - * see m_Psi_ijk for reference on the indexing into this variable. - */ + //! Derivative of Psi_ijk[n] wrt T. See m_Psi_ijk for reference on the + //! indexing into this variable. mutable vector_fp m_Psi_ijk_L; - //! Derivative of Psi_ijk[n] wrt TT - /*! - * see m_Psi_ijk for reference on the indexing into this variable. - */ + //! Derivative of Psi_ijk[n] wrt TT. See m_Psi_ijk for reference on the + //! indexing into this variable. mutable vector_fp m_Psi_ijk_LL; - //! Derivative of Psi_ijk[n] wrt P - /*! - * see m_Psi_ijk for reference on the indexing into this variable. - */ + //! Derivative of Psi_ijk[n] wrt P. See m_Psi_ijk for reference on the + //! indexing into this variable. mutable vector_fp m_Psi_ijk_P; //! Array of coefficients for Psi_ijk[n] in the Pitzer/HMW formulation. @@ -2475,24 +2245,22 @@ private: * * n = k + j * m_kk + i * m_kk * m_kk; * - * It is potentially nonzero everywhere. - * The first two coordinates are symmetric wrt cations, - * and the last two coordinates are symmetric wrt anions. + * It is potentially nonzero everywhere. The first two coordinates are + * symmetric wrt cations, and the last two coordinates are symmetric wrt + * anions. * - * - * m_Psi_ijk_coeff.ptrColumn(n) is a double* containing - * the vector of coefficients for the n interaction. + * m_Psi_ijk_coeff.ptrColumn(n) is a double* containing the vector of + * coefficients for the n interaction. */ Array2D m_Psi_ijk_coeff; //! Lambda coefficient for the ij interaction /*! - * Array of 2D data used in the Pitzer/HMW formulation. - * Lambda_nj[n][j] represents the lambda coefficient for the - * ij interaction. This is a general interaction representing - * neutral species. The neutral species occupy the first - * index, i.e., n. The charged species occupy the j coordinate. - * neutral, neutral interactions are also included here. + * Array of 2D data used in the Pitzer/HMW formulation. Lambda_nj[n][j] + * represents the lambda coefficient for the ij interaction. This is a + * general interaction representing neutral species. The neutral species + * occupy the first index, i.e., n. The charged species occupy the j + * coordinate. neutral, neutral interactions are also included here. */ mutable Array2D m_Lambda_nj; @@ -2507,126 +2275,99 @@ private: //! Array of coefficients for Lambda_nj[i][j] in the Pitzer/HMW formulation. /*! - * Lambda_ij[i][j] is the value of the theta coefficient - * for the ij interaction. - * Array of 2D data used in the Pitzer/HMW formulation. - * Lambda_ij[i][j] represents the lambda coefficient for the - * ij interaction. This is a general interaction representing - * neutral species. The neutral species occupy the first - * index, i.e., i. The charged species occupy the j coordinate. - * Neutral, neutral interactions are also included here. + * Array of 2D data used in the Pitzer/HMW formulation. Lambda_ij[i][j] + * represents the lambda coefficient for the ij interaction. This is a + * general interaction representing neutral species. The neutral species + * occupy the first index, i.e., i. The charged species occupy the j + * coordinate. Neutral, neutral interactions are also included here. * * n = j + m_kk * i * - * m_Lambda_ij_coeff.ptrColumn(n) is a double* containing - * the vector of coefficients for the (i,j) interaction. + * m_Lambda_ij_coeff.ptrColumn(n) is a double* containing the vector of + * coefficients for the (i,j) interaction. */ Array2D m_Lambda_nj_coeff; //! Mu coefficient for the self-ternary neutral coefficient /*! - * Array of 2D data used in the Pitzer/HMW formulation. - * Mu_nnn[i] represents the Mu coefficient for the - * nnn interaction. This is a general interaction representing - * neutral species interacting with itself. + * Array of 2D data used in the Pitzer/HMW formulation. Mu_nnn[i] represents + * the Mu coefficient for the nnn interaction. This is a general interaction + * representing neutral species interacting with itself. */ mutable vector_fp m_Mu_nnn; - //! Mu coefficient temperature derivative for the self-ternary neutral coefficient + //! Mu coefficient temperature derivative for the self-ternary neutral + //! coefficient /*! - * Array of 2D data used in the Pitzer/HMW formulation. - * Mu_nnn_L[i] represents the Mu coefficient temperature derivative for the - * nnn interaction. This is a general interaction representing - * neutral species interacting with itself. + * Array of 2D data used in the Pitzer/HMW formulation. Mu_nnn_L[i] + * represents the Mu coefficient temperature derivative for the nnn + * interaction. This is a general interaction representing neutral species + * interacting with itself. */ mutable vector_fp m_Mu_nnn_L; - //! Mu coefficient 2nd temperature derivative for the self-ternary neutral coefficient + //! Mu coefficient 2nd temperature derivative for the self-ternary neutral + //! coefficient /*! - * Array of 2D data used in the Pitzer/HMW formulation. - * Mu_nnn_L[i] represents the Mu coefficient 2nd temperature derivative for the - * nnn interaction. This is a general interaction representing - * neutral species interacting with itself. + * Array of 2D data used in the Pitzer/HMW formulation. Mu_nnn_L[i] + * represents the Mu coefficient 2nd temperature derivative for the nnn + * interaction. This is a general interaction representing neutral species + * interacting with itself. */ mutable vector_fp m_Mu_nnn_LL; - //! Mu coefficient pressure derivative for the self-ternary neutral coefficient + //! Mu coefficient pressure derivative for the self-ternary neutral + //! coefficient /*! - * Array of 2D data used in the Pitzer/HMW formulation. - * Mu_nnn_L[i] represents the Mu coefficient pressure derivative for the - * nnn interaction. This is a general interaction representing - * neutral species interacting with itself. + * Array of 2D data used in the Pitzer/HMW formulation. Mu_nnn_L[i] + * represents the Mu coefficient pressure derivative for the nnn + * interaction. This is a general interaction representing neutral species + * interacting with itself. */ mutable vector_fp m_Mu_nnn_P; //! Array of coefficients form_Mu_nnn term Array2D m_Mu_nnn_coeff; - //! Logarithm of the activity coefficients on the molality - //! scale. + //! Logarithm of the activity coefficients on the molality scale. /*! - * mutable because we change this if the composition - * or temperature or pressure changes. - * - * index is the species index + * mutable because we change this if the composition or temperature or + * pressure changes. Index is the species index */ mutable vector_fp m_lnActCoeffMolal_Scaled; - //! Logarithm of the activity coefficients on the molality - //! scale. + //! Logarithm of the activity coefficients on the molality scale. /*! - * mutable because we change this if the composition - * or temperature or pressure changes. - * - * index is the species index + * mutable because we change this if the composition or temperature or + * pressure changes. Index is the species index */ mutable vector_fp m_lnActCoeffMolal_Unscaled; - //! Derivative of the Logarithm of the activity coefficients on the molality - //! scale wrt T - /*! - * index is the species index - */ + //! Derivative of the Logarithm of the activity coefficients on the molality + //! scale wrt T. Index is the species index mutable vector_fp m_dlnActCoeffMolaldT_Scaled; - //! Derivative of the Logarithm of the activity coefficients on the molality - //! scale wrt T - /*! - * index is the species index - */ + //! Derivative of the Logarithm of the activity coefficients on the molality + //! scale wrt T. Index is the species index mutable vector_fp m_dlnActCoeffMolaldT_Unscaled; - //! Derivative of the Logarithm of the activity coefficients on the molality - //! scale wrt TT - /*! - * index is the species index - */ + //! Derivative of the Logarithm of the activity coefficients on the molality + //! scale wrt TT. Index is the species index. mutable vector_fp m_d2lnActCoeffMolaldT2_Scaled; - //! Derivative of the Logarithm of the activity coefficients on the molality - //! scale wrt TT - /*! - * index is the species index - */ + //! Derivative of the Logarithm of the activity coefficients on the molality + //! scale wrt TT. Index is the species index mutable vector_fp m_d2lnActCoeffMolaldT2_Unscaled; - //! Derivative of the Logarithm of the activity coefficients on the - //! molality scale wrt P - /*! - * index is the species index - */ + //! Derivative of the Logarithm of the activity coefficients on the + //! molality scale wrt P. Index is the species index mutable vector_fp m_dlnActCoeffMolaldP_Scaled; - //! Derivative of the Logarithm of the activity coefficients on the - //! molality scale wrt P - /*! - * index is the species index - */ + //! Derivative of the Logarithm of the activity coefficients on the + //! molality scale wrt P. Index is the species index mutable vector_fp m_dlnActCoeffMolaldP_Unscaled; - /* - * -------- Temporary Variables Used in the Activity Coeff Calc - */ + // -------- Temporary Variables Used in the Activity Coeff Calc //! Cropped and modified values of the molalities used in activity //! coefficient calculations @@ -2650,199 +2391,113 @@ private: mutable double elambda1[17]; /** - * Various temporary arrays used in the calculation of - * the Pitzer activity coefficients. - * The subscript, L, denotes the same quantity's derivative + * Various temporary arrays used in the calculation of the Pitzer activity + * coefficients. The subscript, L, denotes the same quantity's derivative * wrt temperature */ - //! This is the value of g(x) in Pitzer's papers - /*! - * vector index is counterIJ - */ + //! This is the value of g(x) in Pitzer's papers. Vector index is counterIJ mutable vector_fp m_gfunc_IJ; - //! This is the value of g2(x2) in Pitzer's papers - /*! - * vector index is counterIJ - */ + //! This is the value of g2(x2) in Pitzer's papers. Vector index is counterIJ mutable vector_fp m_g2func_IJ; - //! hfunc, was called gprime in Pitzer's paper. However, - //! it's not the derivative of gfunc(x), so I renamed it. - /*! - * vector index is counterIJ - */ + //! hfunc, was called gprime in Pitzer's paper. However, it's not the + //! derivative of gfunc(x), so I renamed it. Vector index is counterIJ mutable vector_fp m_hfunc_IJ; - //! hfunc2, was called gprime in Pitzer's paper. However, - //! it's not the derivative of gfunc(x), so I renamed it. - /*! - * vector index is counterIJ - */ + //! hfunc2, was called gprime in Pitzer's paper. However, it's not the + //! derivative of gfunc(x), so I renamed it. Vector index is counterIJ mutable vector_fp m_h2func_IJ; - //! Intermediate variable called BMX in Pitzer's paper - //! This is the basic cation - anion interaction - /*! - * vector index is counterIJ - */ + //! Intermediate variable called BMX in Pitzer's paper. This is the basic + //! cation - anion interaction. Vector index is counterIJ mutable vector_fp m_BMX_IJ; - //! Derivative of BMX_IJ wrt T - /*! - * vector index is counterIJ - */ + //! Derivative of BMX_IJ wrt T. Vector index is counterIJ mutable vector_fp m_BMX_IJ_L; - //! Derivative of BMX_IJ wrt TT - /*! - * vector index is counterIJ - */ + //! Derivative of BMX_IJ wrt TT. Vector index is counterIJ mutable vector_fp m_BMX_IJ_LL; - //! Derivative of BMX_IJ wrt P - /*! - * vector index is counterIJ - */ + //! Derivative of BMX_IJ wrt P. Vector index is counterIJ mutable vector_fp m_BMX_IJ_P; - //! Intermediate variable called BprimeMX in Pitzer's paper - /*! - * vector index is counterIJ - */ + //! Intermediate variable called BprimeMX in Pitzer's paper. Vector index is + //! counterIJ mutable vector_fp m_BprimeMX_IJ; - //! Derivative of BprimeMX wrt T - /*! - * vector index is counterIJ - */ + //! Derivative of BprimeMX wrt T. Vector index is counterIJ mutable vector_fp m_BprimeMX_IJ_L; - //! Derivative of BprimeMX wrt TT - /*! - * vector index is counterIJ - */ + //! Derivative of BprimeMX wrt TT. Vector index is counterIJ mutable vector_fp m_BprimeMX_IJ_LL; - //! Derivative of BprimeMX wrt P - /*! - * vector index is counterIJ - */ + //! Derivative of BprimeMX wrt P. Vector index is counterIJ mutable vector_fp m_BprimeMX_IJ_P; - //! Intermediate variable called BphiMX in Pitzer's paper - /*! - * vector index is counterIJ - */ + //! Intermediate variable called BphiMX in Pitzer's paper. Vector index is + //! counterIJ mutable vector_fp m_BphiMX_IJ; - //! Derivative of BphiMX_IJ wrt T - /*! - * vector index is counterIJ - */ + //! Derivative of BphiMX_IJ wrt T. Vector index is counterIJ mutable vector_fp m_BphiMX_IJ_L; - //! Derivative of BphiMX_IJ wrt TT - /*! - * vector index is counterIJ - */ + //! Derivative of BphiMX_IJ wrt TT. Vector index is counterIJ mutable vector_fp m_BphiMX_IJ_LL; - //! Derivative of BphiMX_IJ wrt P - /*! - * vector index is counterIJ - */ + //! Derivative of BphiMX_IJ wrt P. Vector index is counterIJ mutable vector_fp m_BphiMX_IJ_P; - //! Intermediate variable called Phi in Pitzer's paper - /*! - * vector index is counterIJ - */ + //! Intermediate variable called Phi in Pitzer's paper. Vector index is + //! counterIJ mutable vector_fp m_Phi_IJ; - //! Derivative of m_Phi_IJ wrt T - /*! - * vector index is counterIJ - */ + //! Derivative of m_Phi_IJ wrt T. Vector index is counterIJ mutable vector_fp m_Phi_IJ_L; - //! Derivative of m_Phi_IJ wrt TT - /*! - * vector index is counterIJ - */ + //! Derivative of m_Phi_IJ wrt TT. Vector index is counterIJ mutable vector_fp m_Phi_IJ_LL; - //! Derivative of m_Phi_IJ wrt P - /*! - * vector index is counterIJ - */ + //! Derivative of m_Phi_IJ wrt P. Vector index is counterIJ mutable vector_fp m_Phi_IJ_P; - //! Intermediate variable called Phiprime in Pitzer's paper - /*! - * vector index is counterIJ - */ + //! Intermediate variable called Phiprime in Pitzer's paper. Vector index is + //! counterIJ mutable vector_fp m_Phiprime_IJ; - //! Intermediate variable called PhiPhi in Pitzer's paper - /*! - * vector index is counterIJ - */ + //! Intermediate variable called PhiPhi in Pitzer's paper. Vector index is + //! counterIJ mutable vector_fp m_PhiPhi_IJ; - //! Derivative of m_PhiPhi_IJ wrt T - /*! - * vector index is counterIJ - */ + //! Derivative of m_PhiPhi_IJ wrt T. Vector index is counterIJ mutable vector_fp m_PhiPhi_IJ_L; - //! Derivative of m_PhiPhi_IJ wrt TT - /*! - * vector index is counterIJ - */ + //! Derivative of m_PhiPhi_IJ wrt TT. Vector index is counterIJ mutable vector_fp m_PhiPhi_IJ_LL; - //! Derivative of m_PhiPhi_IJ wrt P - /*! - * vector index is counterIJ - */ + //! Derivative of m_PhiPhi_IJ wrt P. Vector index is counterIJ mutable vector_fp m_PhiPhi_IJ_P; - //! Intermediate variable called CMX in Pitzer's paper - /*! - * vector index is counterIJ - */ + //! Intermediate variable called CMX in Pitzer's paper. Vector index is + //! counterIJ mutable vector_fp m_CMX_IJ; - //! Derivative of m_CMX_IJ wrt T - /*! - * vector index is counterIJ - */ + //! Derivative of m_CMX_IJ wrt T. Vector index is counterIJ mutable vector_fp m_CMX_IJ_L; - //! Derivative of m_CMX_IJ wrt TT - /*! - * vector index is counterIJ - */ + //! Derivative of m_CMX_IJ wrt TT. Vector index is counterIJ mutable vector_fp m_CMX_IJ_LL; - //! Derivative of m_CMX_IJ wrt P - /*! - * vector index is counterIJ - */ + //! Derivative of m_CMX_IJ wrt P. Vector index is counterIJ mutable vector_fp m_CMX_IJ_P; - //! Intermediate storage of the activity coefficient itself - /*! - * vector index is the species index - */ + //! Intermediate storage of the activity coefficient itself. Vector index is + //! the species index mutable vector_fp m_gamma_tmp; - //! Logarithm of the molal activity coefficients - /*! - * Normally these are all one. However, stability schemes will change that - */ + //! Logarithm of the molal activity coefficients. Normally these are all + //! one. However, stability schemes will change that mutable vector_fp IMS_lnActCoeffMolal_; //! IMS Cutoff type @@ -2954,9 +2609,8 @@ private: void s_update_dlnMolalityActCoeff_dT() const; /** - * This function calculates the temperature second derivative - * of the natural logarithm of the molality activity - * coefficients. + * This function calculates the temperature second derivative of the natural + * logarithm of the molality activity coefficients. */ void s_update_d2lnMolalityActCoeff_dT2() const; @@ -2983,14 +2637,13 @@ private: private: //! Calculate the Pitzer portion of the activity coefficients. /** - * This is the main routine in the whole module. It calculates the - * molality based activity coefficients for the solutes, and - * the activity of water. + * This is the main routine in the whole module. It calculates the molality + * based activity coefficients for the solutes, and the activity of water. */ void s_updatePitzer_lnMolalityActCoeff() const; - //! Calculates the temperature derivative of the - //! natural logarithm of the molality activity coefficients. + //! Calculates the temperature derivative of the natural logarithm of the + //! molality activity coefficients. /*! * Public function makes sure that all dependent data is * up to date, before calling a private function @@ -3006,8 +2659,8 @@ private: */ void s_updatePitzer_d2lnMolalityActCoeff_dT2() const; - //! Calculates the Pressure derivative of the - //! natural logarithm of the molality activity coefficients. + //! Calculates the Pressure derivative of the natural logarithm of the + //! molality activity coefficients. /*! * It is assumed that the Pitzer activity coefficient and first derivative * routine are called immediately preceding the calling of this routine. @@ -3016,22 +2669,18 @@ private: //! Calculates the Pitzer coefficients' dependence on the temperature. /*! - * It will also calculate the temperature - * derivatives of the coefficients, as they are important - * in the calculation of the latent heats and the - * heat capacities of the mixtures. + * It will also calculate the temperature derivatives of the coefficients, + * as they are important in the calculation of the latent heats and the heat + * capacities of the mixtures. * - * @param doDerivs If >= 1, then the routine will calculate - * the first derivative. If >= 2, the - * routine will calculate the first and second - * temperature derivative. - * default = 2 + * @param doDerivs If >= 1, then the routine will calculate the first + * derivative. If >= 2, the routine will calculate the first + * and second temperature derivative. default = 2 */ void s_updatePitzer_CoeffWRTemp(int doDerivs = 2) const; //! Calculate the lambda interactions. /*! - * * Calculate E-lambda terms for charge combinations of like sign, using * method of Pitzer (1975). This implementation is based on Bethke, * Appendix 2. @@ -3042,25 +2691,21 @@ private: mutable doublereal m_last_is; /** - * Calculate etheta and etheta_prime + * Calculate etheta and etheta_prime * - * This interaction accounts for the mixing effects of like-signed ions - * with different charges. This interaction will be nonzero for species - * with the same charge. this routine is not to be called for neutral - * species; it core dumps or error exits. + * This interaction accounts for the mixing effects of like-signed ions with + * different charges. This interaction will be nonzero for species with the + * same charge. this routine is not to be called for neutral species; it + * core dumps or error exits. * * MEC implementation routine. * - * @param z1 charge of the first molecule - * @param z2 charge of the second molecule - * @param etheta return pointer containing etheta - * @param etheta_prime Return pointer containing etheta_prime. - * - * This routine uses the internal variables, - * elambda[] and elambda1[]. - * - * There is no prohibition against calling + * @param z1 charge of the first molecule + * @param z2 charge of the second molecule + * @param etheta return pointer containing etheta + * @param etheta_prime Return pointer containing etheta_prime. * + * This routine uses the internal variables, elambda[] and elambda1[]. */ void calc_thetas(int z1, int z2, double* etheta, double* etheta_prime) const; @@ -3078,43 +2723,39 @@ private: //! Calculate the cropped molalities /*! - * This is an internal routine that calculates values - * of m_molalitiesCropped from m_molalities + * This is an internal routine that calculates values of m_molalitiesCropped + * from m_molalities */ void calcMolalitiesCropped() const; //! Process an XML node called "binarySaltParameters" /*! - * This node contains all of the parameters necessary to describe - * the Pitzer model for that particular binary salt. - * This function reads the XML file and writes the coefficients - * it finds to an internal data structures. + * This node contains all of the parameters necessary to describe the Pitzer + * model for that particular binary salt. This function reads the XML file + * and writes the coefficients it finds to an internal data structures. * * @param BinSalt reference to the XML_Node named binarySaltParameters - * containing the - * anion - cation interaction + * containing the anion - cation interaction */ void readXMLBinarySalt(XML_Node& BinSalt); //! Process an XML node called "thetaAnion" /*! - * This node contains all of the parameters necessary to describe - * the binary interactions between two anions. + * This node contains all of the parameters necessary to describe the binary + * interactions between two anions. * - * @param BinSalt reference to the XML_Node named thetaAnion - * containing the + * @param BinSalt reference to the XML_Node named thetaAnion containing the * anion - anion interaction */ void readXMLThetaAnion(XML_Node& BinSalt); //! Process an XML node called "thetaCation" /*! - * This node contains all of the parameters necessary to describe - * the binary interactions between two cations. + * This node contains all of the parameters necessary to describe the binary + * interactions between two cations. * - * @param BinSalt reference to the XML_Node named thetaCation - * containing the - * cation - cation interaction + * @param BinSalt reference to the XML_Node named thetaCation containing + * the cation - cation interaction */ void readXMLThetaCation(XML_Node& BinSalt); @@ -3123,9 +2764,8 @@ private: * This node contains all of the parameters necessary to describe * the ternary interactions between one anion and two cations. * - * @param BinSalt reference to the XML_Node named psiCommonAnion - * containing the - * anion - cation1 - cation2 interaction + * @param BinSalt reference to the XML_Node named psiCommonAnion containing + * the anion - cation1 - cation2 interaction */ void readXMLPsiCommonAnion(XML_Node& BinSalt); @@ -3135,20 +2775,18 @@ private: * the ternary interactions between one cation and two anions. * * @param BinSalt reference to the XML_Node named psiCommonCation - * containing the - * cation - anion1 - anion2 interaction + * containing the cation - anion1 - anion2 interaction */ void readXMLPsiCommonCation(XML_Node& BinSalt); //! Process an XML node called "lambdaNeutral" /*! - * This node contains all of the parameters necessary to describe - * the binary interactions between one neutral species and - * any other species (neutral or otherwise) in the mechanism. + * This node contains all of the parameters necessary to describe the binary + * interactions between one neutral species and any other species (neutral + * or otherwise) in the mechanism. * - * @param BinSalt reference to the XML_Node named lambdaNeutral - * containing multiple - * Neutral - species interactions + * @param BinSalt reference to the XML_Node named lambdaNeutral containing + * multiple Neutral - species interactions */ void readXMLLambdaNeutral(XML_Node& BinSalt); @@ -3157,8 +2795,8 @@ private: * This node contains all of the parameters necessary to describe * the self-ternary interactions for one neutral species. * - * @param BinSalt reference to the XML_Node named Munnn - * containing the self-ternary interaction + * @param BinSalt reference to the XML_Node named Munnn containing the + * self-ternary interaction */ void readXMLMunnnNeutral(XML_Node& BinSalt); @@ -3168,13 +2806,12 @@ private: * the ternary interactions between one neutral, one cation, and one anion. * * @param BinSalt reference to the XML_Node named psiCommonCation - * containing the - * neutral - cation - anion interaction + * containing the neutral - cation - anion interaction */ void readXMLZetaCation(const XML_Node& BinSalt); - //! Process an XML node called "croppingCoefficients" - //! for the cropping coefficients values + //! Process an XML node called "croppingCoefficients" for the cropping + //! coefficients values /*! * @param acNode Activity Coefficient XML Node */ @@ -3186,8 +2823,8 @@ private: //! Calculate molality cut-off parameters void calcMCCutoffParams_(); - //! Utility function to assign an integer value from a string - //! for the ElectrolyteSpeciesType field. + //! Utility function to assign an integer value from a string for the + //! ElectrolyteSpeciesType field. /*! * @param estString string name of the electrolyte species type */ diff --git a/include/cantera/thermo/IdealGasPhase.h b/include/cantera/thermo/IdealGasPhase.h index ebce52665..645bcfc65 100644 --- a/include/cantera/thermo/IdealGasPhase.h +++ b/include/cantera/thermo/IdealGasPhase.h @@ -15,246 +15,242 @@ namespace Cantera { -//! Class IdealGasPhase represents low-density gases that obey the -//! ideal gas equation of state. +//! Class IdealGasPhase represents low-density gases that obey the ideal gas +//! equation of state. /*! * - * IdealGasPhase derives from class ThermoPhase, - * and overloads the virtual methods defined there with ones that - * use expressions appropriate for ideal gas mixtures. + * IdealGasPhase derives from class ThermoPhase, and overloads the virtual + * methods defined there with ones that use expressions appropriate for ideal + * gas mixtures. * - * The independent unknowns are density, mass fraction, and temperature. - * the #setPressure() function will calculate the density consistent with - * the current mass fraction vector and temperature and the desired pressure, - * and then set the density. + * The independent unknowns are density, mass fraction, and temperature. the + * #setPressure() function will calculate the density consistent with the + * current mass fraction vector and temperature and the desired pressure, and + * then set the density. * *
*

Specification of Species Standard State Properties

*
* - * It is assumed that the reference state thermodynamics may be - * obtained by a pointer to a populated species thermodynamic property - * manager class in the base class, ThermoPhase::m_spthermo - * (see the base class \link Cantera#SpeciesThermo SpeciesThermo \endlink for a - * description of the specification of reference state species thermodynamics functions). - * The reference state, - * where the pressure is fixed at a single pressure, - * is a key species property calculation for the Ideal Gas Equation - * of state. + * It is assumed that the reference state thermodynamics may be obtained by a + * pointer to a populated species thermodynamic property manager class in the + * base class, ThermoPhase::m_spthermo (see the base class \link + * Cantera#SpeciesThermo SpeciesThermo \endlink for a description of the + * specification of reference state species thermodynamics functions). The + * reference state, where the pressure is fixed at a single pressure, is a key + * species property calculation for the Ideal Gas Equation of state. * - * This class is optimized for speed of execution. All calls to thermodynamic functions - * first call internal routines (aka #enthalpy_RT_ref()) which return references - * the reference state thermodynamics functions. Within these internal reference - * state functions, the function #_updateThermo() is called, that first checks to see - * whether the temperature has changed. If it has, it updates the internal reference - * state thermo functions by calling the SpeciesThermo object. + * This class is optimized for speed of execution. All calls to thermodynamic + * functions first call internal routines (aka #enthalpy_RT_ref()) which return + * references the reference state thermodynamics functions. Within these + * internal reference state functions, the function #_updateThermo() is called, + * that first checks to see whether the temperature has changed. If it has, it + * updates the internal reference state thermo functions by calling the + * SpeciesThermo object. * - * Functions for the calculation of standard state properties for species - * at arbitrary pressure are provided in IdealGasPhase. However, they - * are all derived from their reference state counterparts. + * Functions for the calculation of standard state properties for species at + * arbitrary pressure are provided in IdealGasPhase. However, they are all + * derived from their reference state counterparts. * - * The standard state enthalpy is independent of pressure: + * The standard state enthalpy is independent of pressure: * - * \f[ - * h^o_k(T,P) = h^{ref}_k(T) - * \f] + * \f[ + * h^o_k(T,P) = h^{ref}_k(T) + * \f] * - * The standard state constant-pressure heat capacity is independent of pressure: + * The standard state constant-pressure heat capacity is independent of pressure: * - * \f[ - * Cp^o_k(T,P) = Cp^{ref}_k(T) - * \f] + * \f[ + * Cp^o_k(T,P) = Cp^{ref}_k(T) + * \f] * - * The standard state entropy depends in the following fashion on pressure: + * The standard state entropy depends in the following fashion on pressure: * - * \f[ - * S^o_k(T,P) = S^{ref}_k(T) - R \ln(\frac{P}{P_{ref}}) - * \f] - * The standard state Gibbs free energy is obtained from the enthalpy and entropy - * functions: + * \f[ + * S^o_k(T,P) = S^{ref}_k(T) - R \ln(\frac{P}{P_{ref}}) + * \f] + * The standard state Gibbs free energy is obtained from the enthalpy and entropy + * functions: * - * \f[ - * \mu^o_k(T,P) = h^o_k(T,P) - S^o_k(T,P) T - * \f] + * \f[ + * \mu^o_k(T,P) = h^o_k(T,P) - S^o_k(T,P) T + * \f] * - * \f[ - * \mu^o_k(T,P) = \mu^{ref}_k(T) + R T \ln( \frac{P}{P_{ref}}) - * \f] + * \f[ + * \mu^o_k(T,P) = \mu^{ref}_k(T) + R T \ln( \frac{P}{P_{ref}}) + * \f] * * where - * \f[ - * \mu^{ref}_k(T) = h^{ref}_k(T) - T S^{ref}_k(T) - * \f] + * \f[ + * \mu^{ref}_k(T) = h^{ref}_k(T) - T S^{ref}_k(T) + * \f] * - * The standard state internal energy is obtained from the enthalpy function also + * The standard state internal energy is obtained from the enthalpy function also * - * \f[ - * u^o_k(T,P) = h^o_k(T) - R T - * \f] + * \f[ + * u^o_k(T,P) = h^o_k(T) - R T + * \f] * - * The molar volume of a species is given by the ideal gas law + * The molar volume of a species is given by the ideal gas law * - * \f[ - * V^o_k(T,P) = \frac{R T}{P} - * \f] + * \f[ + * V^o_k(T,P) = \frac{R T}{P} + * \f] * - * where R is the molar gas constant. For a complete list of physical constants - * used within %Cantera, see \ref physConstants . + * where R is the molar gas constant. For a complete list of physical constants + * used within %Cantera, see \ref physConstants . * *
*

Specification of Solution Thermodynamic Properties

*
* * The activity of a species defined in the phase is given by the ideal gas law: - * \f[ - * a_k = X_k - * \f] - * where \f$ X_k \f$ is the mole fraction of species k. - * The chemical potential for species k is equal to + * \f[ + * a_k = X_k + * \f] + * where \f$ X_k \f$ is the mole fraction of species k. The chemical + * potential for species k is equal to * - * \f[ - * \mu_k(T,P) = \mu^o_k(T, P) + R T \log(X_k) - * \f] + * \f[ + * \mu_k(T,P) = \mu^o_k(T, P) + R T \log(X_k) + * \f] * * In terms of the reference state, the above can be rewritten * - * \f[ - * \mu_k(T,P) = \mu^{ref}_k(T, P) + R T \log(\frac{P X_k}{P_{ref}}) - * \f] + * \f[ + * \mu_k(T,P) = \mu^{ref}_k(T, P) + R T \log(\frac{P X_k}{P_{ref}}) + * \f] * * The partial molar entropy for species k is given by the following relation, * - * \f[ - * \tilde{s}_k(T,P) = s^o_k(T,P) - R \log(X_k) = s^{ref}_k(T) - R \log(\frac{P X_k}{P_{ref}}) - * \f] + * \f[ + * \tilde{s}_k(T,P) = s^o_k(T,P) - R \log(X_k) = s^{ref}_k(T) - R \log(\frac{P X_k}{P_{ref}}) + * \f] * * The partial molar enthalpy for species k is * - * \f[ - * \tilde{h}_k(T,P) = h^o_k(T,P) = h^{ref}_k(T) - * \f] + * \f[ + * \tilde{h}_k(T,P) = h^o_k(T,P) = h^{ref}_k(T) + * \f] * * The partial molar Internal Energy for species k is * - * \f[ - * \tilde{u}_k(T,P) = u^o_k(T,P) = u^{ref}_k(T) - * \f] + * \f[ + * \tilde{u}_k(T,P) = u^o_k(T,P) = u^{ref}_k(T) + * \f] * * The partial molar Heat Capacity for species k is * - * \f[ - * \tilde{Cp}_k(T,P) = Cp^o_k(T,P) = Cp^{ref}_k(T) - * \f] + * \f[ + * \tilde{Cp}_k(T,P) = Cp^o_k(T,P) = Cp^{ref}_k(T) + * \f] * *
*

%Application within Kinetics Managers

*
* - * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / - * C^s_k, \f$ where \f$ C^s_k \f$ is a standard concentration - * defined below and \f$ a_k \f$ are activities used in the - * thermodynamic functions. These activity (or generalized) - * concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. - * The activity concentration,\f$ C^a_k \f$,is given by the following expression. + * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / C^s_k, \f$ where \f$ + * C^s_k \f$ is a standard concentration defined below and \f$ a_k \f$ are + * activities used in the thermodynamic functions. These activity (or + * generalized) concentrations are used by kinetics manager classes to compute + * the forward and reverse rates of elementary reactions. The activity + * concentration,\f$ C^a_k \f$,is given by the following expression. * - * \f[ - * C^a_k = C^s_k X_k = \frac{P}{R T} X_k - * \f] + * \f[ + * C^a_k = C^s_k X_k = \frac{P}{R T} X_k + * \f] * - * The standard concentration for species k is independent of k and equal to + * The standard concentration for species k is independent of k + * and equal to * - * \f[ - * C^s_k = C^s = \frac{P}{R T} - * \f] + * \f[ + * C^s_k = C^s = \frac{P}{R T} + * \f] * - * For example, a bulk-phase binary gas reaction between species j and k, producing - * a new gas species l would have the - * following equation for its rate of progress variable, \f$ R^1 \f$, which has - * units of kmol m-3 s-1. + * For example, a bulk-phase binary gas reaction between species j and k, + * producing a new gas species l would have the following equation for its rate + * of progress variable, \f$ R^1 \f$, which has units of kmol m-3 s-1. * - * \f[ + * \f[ * R^1 = k^1 C_j^a C_k^a = k^1 (C^s a_j) (C^s a_k) - * \f] - * where - * \f[ - * C_j^a = C^s a_j \quad \mbox{and} \quad C_k^a = C^s a_k - * \f] + * \f] + * where + * \f[ + * C_j^a = C^s a_j \quad \mbox{and} \quad C_k^a = C^s a_k + * \f] * - * \f$ C_j^a \f$ is the activity concentration of species j, and - * \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^s \f$ - * is the standard concentration. \f$ a_j \f$ is - * the activity of species j which is equal to the mole fraction of j. + * \f$ C_j^a \f$ is the activity concentration of species j, and + * \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^s \f$ is the + * standard concentration. \f$ a_j \f$ is the activity of species j which is + * equal to the mole fraction of j. * - * The reverse rate constant can then be obtained from the law of microscopic reversibility - * and the equilibrium expression for the system. + * The reverse rate constant can then be obtained from the law of microscopic + * reversibility and the equilibrium expression for the system. * - * \f[ - * \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} ) - * \f] + * \f[ + * \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} ) + * \f] * - * \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, associated with - * the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ and their associated activities, - * \f$ a_l \f$, repeated here: + * \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, + * associated with the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ + * and their associated activities, \f$ a_l \f$, repeated here: * - * \f[ - * \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l) - * \f] + * \f[ + * \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l) + * \f] * - * We can switch over to expressing the equilibrium constant in terms of the reference - * state chemical potentials + * We can switch over to expressing the equilibrium constant in terms of the + * reference state chemical potentials * - * \f[ - * K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P} - * \f] + * \f[ + * K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P} + * \f] * - * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over - * to activity concentrations. When this is done: + * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by + * changing over to activity concentrations. When this is done: * - * \f[ - * \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 = - * \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT} - * \f] + * \f[ + * \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 = + * \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT} + * \f] * - * %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$, - * using the second and third part of the above expression as a definition for the concentration - * equilibrium constant. + * %Kinetics managers will calculate the concentration equilibrium constant, + * \f$ K_c \f$, using the second and third part of the above expression as a + * definition for the concentration equilibrium constant. * - * For completeness, the pressure equilibrium constant may be obtained as well + * For completeness, the pressure equilibrium constant may be obtained as well * - * \f[ - * \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = - \exp\left(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} \right) - * \f] + * \f[ + * \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = + * \exp\left(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} \right) + * \f] * - * \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. However, it isn't - * necessarily the simplest form of the equilibrium constant for other types of phases; \f$ K_c \f$ is - * used instead because it is completely general. + * \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. + * However, it isn't necessarily the simplest form of the equilibrium constant + * for other types of phases; \f$ K_c \f$ is used instead because it is + * completely general. * - * The reverse rate of progress may be written down as - * \f[ + * The reverse rate of progress may be written down as + * \f[ * R^{-1} = k^{-1} C_l^a = k^{-1} (C^o a_l) - * \f] + * \f] * - * where we can use the concept of microscopic reversibility to - * write the reverse rate constant in terms of the - * forward rate constant and the concentration equilibrium - * constant, \f$ K_c \f$. + * where we can use the concept of microscopic reversibility to write the + * reverse rate constant in terms of the forward rate constant and the + * concentration equilibrium constant, \f$ K_c \f$. * - * \f[ - * k^{-1} = k^1 K^1_c - * \f] + * \f[ + * k^{-1} = k^1 K^1_c + * \f] * - * \f$k^{-1} \f$ has units of s-1. + * \f$k^{-1} \f$ has units of s-1. * *
*

Instantiation of the Class

*
* - * The constructor for this phase is located in the default ThermoFactory - * for %Cantera. A new IdealGasPhase may be created by the following code - * snippet: + * The constructor for this phase is located in the default ThermoFactory for + * %Cantera. A new IdealGasPhase may be created by the following code snippet: * * @code * XML_Node *xc = get_XML_File("silane.xml"); @@ -292,8 +288,8 @@ namespace Cantera * * @endcode * - * The model attribute "IdealGas" of the thermo XML element identifies the phase as - * being of the type handled by the IdealGasPhase object. + * The model attribute "IdealGas" of the thermo XML element identifies the phase + * as being of the type handled by the IdealGasPhase object. * * @ingroup thermoprops */ @@ -322,41 +318,13 @@ public: */ IdealGasPhase(XML_Node& phaseRef, const std::string& id = ""); - //! Copy Constructor - /*! - * Copy constructor for the object. Constructed - * object will be a clone of this object, but will - * also own all of its data. - * This is a wrapper around the assignment operator - * - * @param right Object to be copied. - */ IdealGasPhase(const IdealGasPhase& right); - - //! Assignment operator - /*! - * Assignment operator for the object. Constructed - * object will be a clone of this object, but will - * also own all of its data. - * - * @param right Object to be copied. - */ IdealGasPhase& operator=(const IdealGasPhase& right); - - //! Duplicator from the ThermoPhase parent class - /*! - * Given a pointer to a ThermoPhase object, this function will - * duplicate the ThermoPhase object and all underlying structures. - * This is basically a wrapper around the inherited copy constructor. - * - * @return returns a pointer to a ThermoPhase object, containing - * a copy of the current object - */ ThermoPhase* duplMyselfAsThermoPhase() const; //! Equation of state flag. /*! - * Returns the value cIdealGas, defined in mix_defs.h. + * Returns the value cIdealGas, defined in mix_defs.h. */ virtual int eosType() const { return cIdealGas; @@ -371,10 +339,9 @@ public: * \f[ * \hat h(T) = \sum_k X_k \hat h^0_k(T), * \f] - * and is a function only of temperature. - * The standard-state pure-species enthalpies - * \f$ \hat h^0_k(T) \f$ are computed by the species thermodynamic - * property manager. + * and is a function only of temperature. The standard-state pure-species + * enthalpies \f$ \hat h^0_k(T) \f$ are computed by the species + * thermodynamic property manager. * * \see SpeciesThermo */ @@ -388,9 +355,8 @@ public: * \f[ * \hat s(T, P) = \sum_k X_k \hat s^0_k(T) - \hat R \log (P/P^0). * \f] - * The reference-state pure-species entropies - * \f$ \hat s^0_k(T) \f$ are computed by the species thermodynamic - * property manager. + * The reference-state pure-species entropies \f$ \hat s^0_k(T) \f$ are + * computed by the species thermodynamic property manager. * @see SpeciesThermo */ virtual doublereal entropy_mole() const; @@ -401,9 +367,8 @@ public: * \f[ * \hat c_p(t) = \sum_k \hat c^0_{p,k}(T). * \f] - * The reference-state pure-species heat capacities - * \f$ \hat c^0_{p,k}(T) \f$ are computed by the species thermodynamic - * property manager. + * The reference-state pure-species heat capacities \f$ \hat c^0_{p,k}(T) \f$ + * are computed by the species thermodynamic property manager. * @see SpeciesThermo */ virtual doublereal cp_mole() const; @@ -430,8 +395,8 @@ public: //! Set the pressure at constant temperature and composition. /*! - * Units: Pa. - * This method is implemented by setting the mass density to + * Units: Pa. + * This method is implemented by setting the mass density to * \f[ * \rho = \frac{P \overline W}{\hat R T }. * \f] @@ -444,9 +409,9 @@ public: //! Set the density and pressure at constant composition. /*! - * Units: kg/m^3, Pa - * This method is implemented by setting the density to the input - * value and setting the temperature to + * Units: kg/m^3, Pa. + * This method is implemented by setting the density to the input value and + * setting the temperature to * \f[ * T = \frac{P \overline W}{\hat R \rho}. * \f] @@ -499,28 +464,25 @@ public: * \mu_k(T,P,X_k) = \mu_k^0(T,P) * + \hat R T \log a_k. * \f] - * The quantity \f$\mu_k^0(T,P)\f$ is - * the standard state chemical potential at unit activity. - * It may depend on the pressure and the temperature. However, - * it may not depend on the mole fractions of the species - * in the solution. + * The quantity \f$\mu_k^0(T,P)\f$ is the standard state chemical potential + * at unit activity. It may depend on the pressure and the temperature. + * However, it may not depend on the mole fractions of the species in the + * solution. * - * The activities are related to the generalized - * concentrations, \f$\tilde C_k\f$, and standard - * concentrations, \f$C^0_k\f$, by the following formula: + * The activities are related to the generalized concentrations, \f$\tilde + * C_k\f$, and standard concentrations, \f$C^0_k\f$, by the following + * formula: * * \f[ * a_k = \frac{\tilde C_k}{C^0_k} * \f] - * The generalized concentrations are used in the kinetics classes - * to describe the rates of progress of reactions involving the - * species. Their formulation depends upon the specification - * of the rate constants for reaction, especially the units used - * in specifying the rate constants. The bridge between the - * thermodynamic equilibrium expressions that use a_k and the - * kinetics expressions which use the generalized concentrations - * is provided by the multiplicative factor of the - * standard concentrations. + * The generalized concentrations are used in the kinetics classes to + * describe the rates of progress of reactions involving the species. Their + * formulation depends upon the specification of the rate constants for + * reaction, especially the units used in specifying the rate constants. The + * bridge between the thermodynamic equilibrium expressions that use a_k and + * the kinetics expressions which use the generalized concentrations is + * provided by the multiplicative factor of the standard concentrations. * @{ */ @@ -528,22 +490,22 @@ public: /*! * For an ideal gas mixture, these are simply the actual concentrations. * - * @param c Output array of generalized concentrations. The - * units depend upon the implementation of the - * reaction rate expressions within the phase. + * @param c Output array of generalized concentrations. The units depend + * upon the implementation of the reaction rate expressions within + * the phase. */ virtual void getActivityConcentrations(doublereal* c) const { getConcentrations(c); } - //! Returns the standard concentration \f$ C^0_k \f$, which is used to normalize - //! the generalized concentration. + //! Returns the standard concentration \f$ C^0_k \f$, which is used to + //! normalize the generalized concentration. /*! * This is defined as the concentration by which the generalized - * concentration is normalized to produce the activity. - * In many cases, this quantity will be the same for all species in a phase. - * Since the activity for an ideal gas mixture is - * simply the mole fraction, for an ideal gas \f$ C^0_k = P/\hat R T \f$. + * concentration is normalized to produce the activity. In many cases, this + * quantity will be the same for all species in a phase. Since the activity + * for an ideal gas mixture is simply the mole fraction, for an ideal gas + * \f$ C^0_k = P/\hat R T \f$. * * @param k Optional parameter indicating the species. The default * is to assume this refers to species 0. @@ -552,8 +514,8 @@ public: */ virtual doublereal standardConcentration(size_t k = 0) const; - //! Get the array of non-dimensional activity coefficients at - //! the current solution temperature, pressure, and solution concentration. + //! Get the array of non-dimensional activity coefficients at the current + //! solution temperature, pressure, and solution concentration. /*! * For ideal gases, the activity coefficients are all equal to one. * @@ -565,199 +527,36 @@ public: /// @name Partial Molar Properties of the Solution //@{ - //! Get the species chemical potentials. Units: J/kmol. - /*! - * This function returns a vector of chemical potentials of the - * species in solution at the current temperature, pressure - * and mole fraction of the solution. - * - * @param mu Output vector of species chemical - * potentials. Length: m_kk. Units: J/kmol - */ virtual void getChemPotentials(doublereal* mu) const; - - //! Get the species partial molar enthalpies. Units: J/kmol. - /*! - * @param hbar Output vector of species partial molar enthalpies. - * Length: m_kk. units are J/kmol. - */ virtual void getPartialMolarEnthalpies(doublereal* hbar) const; - - //! Get the species partial molar entropies. Units: J/kmol/K. - /*! - * @param sbar Output vector of species partial molar entropies. - * Length = m_kk. units are J/kmol/K. - */ virtual void getPartialMolarEntropies(doublereal* sbar) const; - - //! Get the species partial molar enthalpies. Units: J/kmol. - /*! - * @param ubar Output vector of species partial molar internal energies. - * Length = m_kk. units are J/kmol. - */ virtual void getPartialMolarIntEnergies(doublereal* ubar) const; - - //! Get the partial molar heat capacities Units: J/kmol/K - /*! - * @param cpbar Output vector of species partial molar heat capacities at constant pressure. - * Length = m_kk. units are J/kmol/K. - */ virtual void getPartialMolarCp(doublereal* cpbar) const; - - //! Get the species partial molar volumes. Units: m^3/kmol. - /*! - * @param vbar Output vector of species partial molar volumes. - * Length = m_kk. units are m^3/kmol. - */ virtual void getPartialMolarVolumes(doublereal* vbar) const; //@} /// @name Properties of the Standard State of the Species in the Solution //@{ - //! Get the array of chemical potentials at unit activity for the - //! species standard states at the current T and P of the solution. - /*! - * These are the standard state chemical potentials \f$ \mu^0_k(T,P) - * \f$. The values are evaluated at the current - * temperature and pressure of the solution - * - * @param mu Output vector of chemical potentials. - * Length: m_kk. - */ virtual void getStandardChemPotentials(doublereal* mu) const; - - //! Get the nondimensional Enthalpy functions for the species standard states - //! at their standard states at the current T and P of the solution. - /*! - * @param hrt Output vector of nondimensional standard state enthalpies. - * Length: m_kk. - */ virtual void getEnthalpy_RT(doublereal* hrt) const; - - //! Get the array of nondimensional Entropy functions for the - //! species standard states at the current T and P of the solution. - /*! - * @param sr Output vector of nondimensional standard state entropies. - * Length: m_kk. - */ virtual void getEntropy_R(doublereal* sr) const; - - //! Get the nondimensional Gibbs functions for the species - //! standard states at the current T and P of the solution. - /*! - * @param grt Output vector of nondimensional standard state Gibbs free energies - * Length: m_kk. - */ virtual void getGibbs_RT(doublereal* grt) const; - - //! Get the Gibbs functions for the standard - //! state of the species at the current T and P of the solution - /*! - * Units are Joules/kmol - * @param gpure Output vector of standard state Gibbs free energies - * Length: m_kk. - */ virtual void getPureGibbs(doublereal* gpure) const; - - //! Returns the vector of nondimensional Internal Energies of the standard - //! state species at the current T and P of the solution - /*! - * @param urt output vector of nondimensional standard state internal energies - * of the species. Length: m_kk. - */ virtual void getIntEnergy_RT(doublereal* urt) const; - - //! Get the nondimensional Heat Capacities at constant - //! pressure for the species standard states - //! at the current T and P of the solution - /*! - * @param cpr Output vector of nondimensional standard state heat capacities - * Length: m_kk. - */ virtual void getCp_R(doublereal* cpr) const; - - //! Get the molar volumes of the species standard states at the current - //! T and P of the solution. - /*! - * units = m^3 / kmol - * - * @param vol Output vector containing the standard state volumes. - * Length: m_kk. - */ virtual void getStandardVolumes(doublereal* vol) const; //@} /// @name Thermodynamic Values for the Species Reference States //@{ - //! Returns the vector of nondimensional - //! enthalpies of the reference state at the current temperature - //! of the solution and the reference pressure for the species. - /*! - * @param hrt Output vector containing the nondimensional reference state - * enthalpies. Length: m_kk. - */ virtual void getEnthalpy_RT_ref(doublereal* hrt) const; - - //! Returns the vector of nondimensional - //! Gibbs Free Energies of the reference state at the current temperature - //! of the solution and the reference pressure for the species. - /*! - * @param grt Output vector containing the nondimensional reference state - * Gibbs Free energies. Length: m_kk. - */ virtual void getGibbs_RT_ref(doublereal* grt) const; - - //! Returns the vector of the - //! Gibbs function of the reference state at the current temperature - //! of the solution and the reference pressure for the species. - /*! - * units = J/kmol - * - * @param g Output vector containing the reference state - * Gibbs Free energies. Length: m_kk. Units: J/kmol. - */ virtual void getGibbs_ref(doublereal* g) const; - - //! Returns the vector of nondimensional - //! entropies of the reference state at the current temperature - //! of the solution and the reference pressure for each species. - /*! - * @param er Output vector containing the nondimensional reference state - * entropies. Length: m_kk. - */ virtual void getEntropy_R_ref(doublereal* er) const; - - //! Returns the vector of nondimensional - //! internal Energies of the reference state at the current temperature - //! of the solution and the reference pressure for each species. - /*! - * @param urt Output vector of nondimensional reference state - * internal energies of the species. - * Length: m_kk - */ virtual void getIntEnergy_RT_ref(doublereal* urt) const; - - //! Returns the vector of nondimensional - //! constant pressure heat capacities of the reference state - //! at the current temperature of the solution - //! and reference pressure for each species. - /*! - * @param cprt Output vector of nondimensional reference state - * heat capacities at constant pressure for the species. - * Length: m_kk - */ virtual void getCp_R_ref(doublereal* cprt) const; - - //! Get the molar volumes of the species standard states at the current - //! T and P_ref of the solution. - /*! - * units = m^3 / kmol - * - * @param vol Output vector containing the standard state volumes. - * Length: m_kk. - */ virtual void getStandardVolumes_ref(doublereal* vol) const; //@} @@ -806,36 +605,7 @@ public: //@} - //! Initialize the ThermoPhase object after all species have been set up - /*! - * @internal Initialize. - * - * This method performs any initialization required after all - * species have been added. For example, it is used to - * resize internal work arrays that must have an entry for - * each species. - * This method is called from ThermoPhase::initThermoXML(), - * which is called from importPhase(), - * just prior to returning from the function, importPhase(). - */ virtual void initThermo(); - - //! Method used by the ChemEquil equilibrium solver. - /*! - * @internal - * - * Set mixture to an equilibrium state consistent with specified - * element potentials and temperature. - * It sets the state such that the chemical potentials satisfy - * \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m} - * \left(\frac{\lambda_m} {\hat R T}\right) \f] where - * \f$ \lambda_m \f$ is the element potential of element m. The - * temperature is unchanged. Any phase (ideal or not) that - * implements this method can be equilibrated by ChemEquil. - * - * @param lambda_RT vector of non-dimensional element potentials - * \f[ \lambda_m/RT \f]. - */ virtual void setToEquilState(const doublereal* lambda_RT); protected: diff --git a/include/cantera/thermo/IdealMolalSoln.h b/include/cantera/thermo/IdealMolalSoln.h index e65ecd3a8..9f0673395 100644 --- a/include/cantera/thermo/IdealMolalSoln.h +++ b/include/cantera/thermo/IdealMolalSoln.h @@ -4,14 +4,12 @@ * state (see \ref thermoprops * and class \link Cantera::IdealMolalSoln IdealMolalSoln\endlink). * - * Header file for a derived class of ThermoPhase that handles - * variable pressure standard state methods for calculating - * thermodynamic properties that are further based upon - * activities on the molality scale. The Ideal molal - * solution assumes that all molality-based activity - * coefficients are equal to one. This turns out to be highly - * nonlinear in the limit of the solvent mole fraction going - * to zero. + * Header file for a derived class of ThermoPhase that handles variable pressure + * standard state methods for calculating thermodynamic properties that are + * further based upon activities on the molality scale. The Ideal molal solution + * assumes that all molality-based activity coefficients are equal to one. This + * turns out to be highly nonlinear in the limit of the solvent mole fraction + * going to zero. */ /* * Copyright (2006) Sandia Corporation. Under the terms of @@ -27,38 +25,31 @@ namespace Cantera { /** - * This phase is based upon the mixing-rule assumption that - * all molality-based activity coefficients are equal - * to one. + * This phase is based upon the mixing-rule assumption that all molality-based + * activity coefficients are equal to one. * - * This is a full instantiation of a ThermoPhase object. - * The assumption is that the molality-based activity - * coefficient is equal to one. This also implies that - * the osmotic coefficient is equal to one. + * This is a full instantiation of a ThermoPhase object. The assumption is that + * the molality-based activity coefficient is equal to one. This also implies + * that the osmotic coefficient is equal to one. * - * Note, this does not mean that the solution is an - * ideal solution. In fact, there is a singularity in - * the formulation as - * the solvent concentration goes to zero. + * Note, this does not mean that the solution is an ideal solution. In fact, + * there is a singularity in the formulation as the solvent concentration goes + * to zero. * - * The mechanical equation of state is currently assumed to - * be that of an incompressible solution. This may change - * in the future. Each species has its own molar volume. - * The molar volume is a constant. + * The mechanical equation of state is currently assumed to be that of an + * incompressible solution. This may change in the future. Each species has its + * own molar volume. The molar volume is a constant. * - * Class IdealMolalSoln represents a condensed phase. - * The phase and the pure species phases which - * comprise the standard states of the species are assumed to have - * zero volume expansivity and zero isothermal compressibility. - * Each species does, however, have constant but distinct partial - * molar volumes equal to their pure species molar volumes. - * The class derives from class ThermoPhase, - * and overloads the virtual methods defined there with ones that + * Class IdealMolalSoln represents a condensed phase. The phase and the pure + * species phases which comprise the standard states of the species are assumed + * to have zero volume expansivity and zero isothermal compressibility. Each + * species does, however, have constant but distinct partial molar volumes equal + * to their pure species molar volumes. The class derives from class + * ThermoPhase, and overloads the virtual methods defined there with ones that * use expressions appropriate for incompressible mixtures. * - * The standard concentrations can have three different forms - * depending on the value of the member attribute m_formGC, which - * is supplied in the XML file. + * The standard concentrations can have three different forms depending on the + * value of the member attribute m_formGC, which is supplied in the XML file. * * * @@ -67,13 +58,13 @@ namespace Cantera * *
m_formGC ActivityConc StandardConc
2 \f$ m_k / (m^{\Delta} V^0_0)\f$ \f$ 1.0 / V^0_0\f$
* - * \f$ V^0_0 \f$ is the solvent standard molar volume. \f$ m^{\Delta} \f$ is a constant equal to a - * molality of \f$ 1.0 \quad\mbox{gm kmol}^{-1} \f$. + * \f$ V^0_0 \f$ is the solvent standard molar volume. \f$ m^{\Delta} \f$ is a + * constant equal to a molality of \f$ 1.0 \quad\mbox{gm kmol}^{-1} \f$. * * The current default is to have mformGC = 2. * - * The value and form of the activity concentration will affect - * reaction rate constants involving species in this phase. + * The value and form of the activity concentration will affect reaction rate + * constants involving species in this phase. * * * @@ -98,18 +89,17 @@ public: /// Constructor IdealMolalSoln(); - //! Copy Constructor IdealMolalSoln(const IdealMolalSoln&); - - //! Assignment operator IdealMolalSoln& operator=(const IdealMolalSoln&); + ThermoPhase* duplMyselfAsThermoPhase() const; //! Constructor for phase initialization /*! * This constructor will initialize a phase, by reading the required * information from an input file. * - * @param inputFile Name of the Input file that contains information about the phase + * @param inputFile Name of the Input file that contains information + * about the phase * @param id id of the phase within the input file */ IdealMolalSoln(const std::string& inputFile, const std::string& id = ""); @@ -125,24 +115,14 @@ public: */ IdealMolalSoln(XML_Node& phaseRef, const std::string& id = ""); - //! Duplication function - /*! - * This virtual function is used to create a duplicate of the - * current phase. It's used to duplicate the phase when given - * a ThermoPhase pointer to the phase. - * - * @return It returns a ThermoPhase pointer. - */ - ThermoPhase* duplMyselfAsThermoPhase() const; - //! @} //! @name Molar Thermodynamic Properties of the Solution //! @{ //! Molar enthalpy of the solution. Units: J/kmol. /*! - * Returns the amount of enthalpy per mole of solution. - * For an ideal molal solution, + * Returns the amount of enthalpy per mole of solution. For an ideal molal + * solution, * \f[ * \bar{h}(T, P, X_k) = \sum_k X_k \bar{h}_k(T) * \f] @@ -157,8 +137,8 @@ public: //! Molar internal energy of the solution: Units: J/kmol. /*! - * Returns the amount of internal energy per mole of solution. - * For an ideal molal solution, + * Returns the amount of internal energy per mole of solution. For an ideal + * molal solution, * \f[ * \bar{u}(T, P, X_k) = \sum_k X_k \bar{u}_k(T) * \f] @@ -169,8 +149,8 @@ public: //! Molar entropy of the solution. Units: J/kmol/K. /*! - * Returns the amount of entropy per mole of solution. - * For an ideal molal solution, + * Returns the amount of entropy per mole of solution. For an ideal molal + * solution, * \f[ * \bar{s}(T, P, X_k) = \sum_k X_k \bar{s}_k(T) * \f] @@ -214,19 +194,18 @@ public: //@} /** @name Mechanical Equation of State Properties * - * In this equation of state implementation, the density is a - * function only of the mole fractions. Therefore, it can't be - * an independent variable. Instead, the pressure is used as the - * independent variable. Functions which try to set the thermodynamic - * state by calling setDensity() may cause an exception to be - * thrown. + * In this equation of state implementation, the density is a function only + * of the mole fractions. Therefore, it can't be an independent variable. + * Instead, the pressure is used as the independent variable. Functions + * which try to set the thermodynamic state by calling setDensity() may + * cause an exception to be thrown. */ //@{ /** - * Set the pressure at constant temperature. Units: Pa. - * This method sets a constant within the object. - * The mass density is not a function of pressure. + * Set the pressure at constant temperature. Units: Pa. This method sets a + * constant within the object. The mass density is not a function of + * pressure. * * @param p Input Pressure */ @@ -234,8 +213,8 @@ public: protected: /** - * Calculate the density of the mixture using the partial - * molar volumes and mole fractions as input + * Calculate the density of the mixture using the partial molar volumes and + * mole fractions as input * * The formula for this is * @@ -243,39 +222,34 @@ protected: * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}} * \f] * - * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are - * the molecular weights, and \f$V_k\f$ are the pure species - * molar volumes. + * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular + * weights, and \f$V_k\f$ are the pure species molar volumes. * - * Note, the basis behind this formula is that in an ideal - * solution the partial molar volumes are equal to the pure - * species molar volumes. We have additionally specified - * in this class that the pure species molar volumes are - * independent of temperature and pressure. + * Note, the basis behind this formula is that in an ideal solution the + * partial molar volumes are equal to the pure species molar volumes. We + * have additionally specified in this class that the pure species molar + * volumes are independent of temperature and pressure. */ void calcDensity(); public: /** - * Overwritten setDensity() function is necessary because the - * density is not an independent variable. + * Overwritten setDensity() function is necessary because the density is not + * an independent variable. * * This function will now throw an error condition * - * @internal May have to adjust the strategy here to make - * the eos for these materials slightly compressible, in order - * to create a condition where the density is a function of - * the pressure. - * - * This function will now throw an error condition. + * @internal May have to adjust the strategy here to make the eos for these + * materials slightly compressible, in order to create a condition where + * the density is a function of the pressure. * * @param rho Input Density */ void setDensity(const doublereal rho); /** - * Overwritten setMolarDensity() function is necessary because the - * density is not an independent variable. + * Overwritten setMolarDensity() function is necessary because the density + * is not an independent variable. * * This function will now throw an error condition. * @@ -283,13 +257,6 @@ public: */ void setMolarDensity(const doublereal rho); - //! Set the temperature (K) and pressure (Pa) - /*! - * Set the temperature and pressure. - * - * @param t Temperature (K) - * @param p Pressure (Pa) - */ virtual void setState_TP(doublereal t, doublereal p); //! The isothermal compressibility. Units: 1/Pa. @@ -299,12 +266,12 @@ public: * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T * \f] * - * It's equal to zero for this model, since the molar volume - * doesn't change with pressure or temperature. + * It's equal to zero for this model, since the molar volume doesn't change + * with pressure or temperature. */ virtual doublereal isothermalCompressibility() const; - //! The thermal expansion coefficient. Units: 1/K. + //! The thermal expansion coefficient. Units: 1/K. /*! * The thermal expansion coefficient is defined as * @@ -312,8 +279,8 @@ public: * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P * \f] * - * It's equal to zero for this model, since the molar volume - * doesn't change with pressure or temperature. + * It's equal to zero for this model, since the molar volume doesn't change + * with pressure or temperature. */ virtual doublereal thermalExpansionCoeff() const; @@ -321,61 +288,29 @@ public: * @} * @name Activities and Activity Concentrations * - * The activity \f$a_k\f$ of a species in solution is - * related to the chemical potential by \f[ \mu_k = \mu_k^0(T) - * + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T)\f$ is - * the chemical potential at unit activity, which depends only - * on temperature and the pressure. + * The activity \f$a_k\f$ of a species in solution is related to the + * chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The + * quantity \f$\mu_k^0(T)\f$ is the chemical potential at unit activity, + * which depends only on temperature and the pressure. * @{ */ - /*! - * This method returns an array of generalized concentrations - * \f$ C_k\f$ that are defined such that - * \f$ a_k = C_k / C^0_k, \f$ where \f$ C^0_k \f$ - * is a standard concentration - * defined below. These generalized concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. - * - * @param c Array of generalized concentrations. The - * units depend upon the implementation of the - * reaction rate expressions within the phase. - */ virtual void getActivityConcentrations(doublereal* c) const; - - /** - * The standard concentration \f$ C^0_k \f$ used to normalize - * the generalized concentration. In many cases, this quantity - * will be the same for all species in a phase - for example, - * for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this - * reason, this method returns a single value, instead of an - * array. However, for phases in which the standard - * concentration is species-specific (e.g. surface species of - * different sizes), this method may be called with an - * optional parameter indicating the species. - * - * @param k Species index - */ virtual doublereal standardConcentration(size_t k=0) const; /*! - * Get the array of non-dimensional activities at - * the current solution temperature, pressure, and - * solution concentration. + * Get the array of non-dimensional activities at the current solution + * temperature, pressure, and solution concentration. * * (note solvent is on molar scale) * - * @param ac Output activity coefficients. - * Length: m_kk. + * @param ac Output activity coefficients. Length: m_kk. */ virtual void getActivities(doublereal* ac) const; /*! - * Get the array of non-dimensional molality-based - * activity coefficients at the current solution temperature, - * pressure, and solution concentration. - * + * Get the array of non-dimensional molality-based activity coefficients at + * the current solution temperature, pressure, and solution concentration. * * (note solvent is on molar scale. The solvent molar * based activity coefficient is returned). @@ -391,8 +326,8 @@ public: //!Get the species chemical potentials: Units: J/kmol. /*! - * This function returns a vector of chemical potentials of the - * species in solution. + * This function returns a vector of chemical potentials of the species in + * solution. * * \f[ * \mu_k = \mu^{o}_k(T,P) + R T \ln(\frac{m_k}{m^\Delta}) @@ -409,23 +344,22 @@ public: * * Units: J/kmol. * - * @param mu Output vector of species chemical potentials. - * Length: m_kk. + * @param mu Output vector of species chemical potentials. Length: m_kk. */ virtual void getChemPotentials(doublereal* mu) const; - //! Returns an array of partial molar enthalpies for the species in the mixture. + //! Returns an array of partial molar enthalpies for the species in the + //! mixture. /*! - * Units (J/kmol) - * For this phase, the partial molar enthalpies are equal to the - * species standard state enthalpies. + * Units (J/kmol). For this phase, the partial molar enthalpies are equal to + * the species standard state enthalpies. * \f[ * \bar h_k(T,P) = \hat h^{ref}_k(T) + (P - P_{ref}) \hat V^0_k * \f] * The reference-state pure-species enthalpies, \f$ \hat h^{ref}_k(T) \f$, - * at the reference pressure,\f$ P_{ref} \f$, - * are computed by the species thermodynamic - * property manager. They are polynomial functions of temperature. + * at the reference pressure,\f$ P_{ref} \f$, are computed by the species + * thermodynamic property manager. They are polynomial functions of + * temperature. * @see SpeciesThermo * * @param hbar Output vector of partial molar enthalpies. @@ -433,16 +367,16 @@ public: */ virtual void getPartialMolarEnthalpies(doublereal* hbar) const; - //! Returns an array of partial molar entropies of the species in the solution. Units: J/kmol. + //! Returns an array of partial molar entropies of the species in the + //! solution. Units: J/kmol. /*! - * * Maxwell's equations provide an insight in how to calculate this * (p.215 Smith and Van Ness) * \f[ * \frac{d(\mu_k)}{dT} = -\bar{s}_i * \f] - * For this phase, the partial molar entropies are equal to the - * standard state species entropies plus the ideal molal solution contribution. + * For this phase, the partial molar entropies are equal to the standard + * state species entropies plus the ideal molal solution contribution. * * \f[ * \bar{s}_k(T,P) = s^0_k(T) - R \ln( \frac{m_k}{m^{\triangle}} ) @@ -451,12 +385,11 @@ public: * \bar{s}_w(T,P) = s^0_w(T) - R ((X_w - 1.0) / X_w) * \f] * - * The subscript, w, refers to the solvent species. \f$ X_w \f$ is - * the mole fraction of solvent. - * The reference-state pure-species entropies,\f$ s^0_k(T) \f$, - * at the reference pressure, \f$ P_{ref} \f$, are computed by the - * species thermodynamic - * property manager. They are polynomial functions of temperature. + * The subscript, w, refers to the solvent species. \f$ X_w \f$ is the mole + * fraction of solvent. The reference-state pure-species entropies,\f$ + * s^0_k(T) \f$, at the reference pressure, \f$ P_{ref} \f$, are computed by + * the species thermodynamic property manager. They are polynomial functions + * of temperature. * @see SpeciesThermo * * @param sbar Output vector of partial molar entropies. @@ -466,8 +399,8 @@ public: // partial molar volumes of the species Units: m^3 kmol-1. /*! - * For this solution, the partial molar volumes are equal to the - * constant species molar volumes. + * For this solution, the partial molar volumes are equal to the constant + * species molar volumes. * * Units: m^3 kmol-1. * @param vbar Output vector of partial molar volumes. @@ -476,18 +409,16 @@ public: //! Partial molar heat capacity of the solution:. UnitsL J/kmol/K /*! - * The kth partial molar heat capacity is equal to - * the temperature derivative of the partial molar - * enthalpy of the kth species in the solution at constant - * P and composition (p. 220 Smith and Van Ness). - * \f[ + * The kth partial molar heat capacity is equal to the temperature + * derivative of the partial molar enthalpy of the kth species in the + * solution at constant P and composition (p. 220 Smith and Van Ness). + * \f[ * \bar{Cp}_k(T,P) = {Cp}^0_k(T) - * \f] + * \f] * - * For this solution, this is equal to the reference state - * heat capacities. + * For this solution, this is equal to the reference state heat capacities. * - * Units: J/kmol/K + * Units: J/kmol/K * * @param cpbar Output vector of partial molar heat capacities. * Length: m_kk. @@ -498,55 +429,16 @@ public: //! @name Chemical Equilibrium //! @{ - /** - * This method is used by the ChemEquil equilibrium solver. - * It sets the state such that the chemical potentials satisfy - * \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m} - * \left(\frac{\lambda_m} {\hat R T}\right) \f] where - * \f$ \lambda_m \f$ is the element potential of element m. The - * temperature is unchanged. Any phase (ideal or not) that - * implements this method can be equilibrated by ChemEquil. - * - * Not implemented. - * - * @param lambda_RT vector of Nondimensional element potentials. - */ virtual void setToEquilState(const doublereal* lambda_RT) { throw NotImplementedError("IdealMolalSoln::setToEquilState"); } //@} - /* - * -------------- Utilities ------------------------------- - */ + // -------------- Utilities ------------------------------- - //! Initialization routine for an IdealMolalSoln phase. - /*! - * This internal routine is responsible for setting up - * the internal storage. This is reimplemented from the ThermoPhase - * class. - */ virtual void initThermo(); - //! Import and initialize an IdealMolalSoln phase - //! specification in an XML tree into the current object. - /*! - * This routine is called from importPhase() to finish - * up the initialization of the thermo object. It reads in the - * species molar volumes. - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ virtual void initThermoXML(XML_Node& phaseNode, const std::string& id=""); //! Report the molar volume of species k @@ -567,15 +459,13 @@ public: //@} protected: - /** - * Species molar volume \f$ m^3 kmol^{-1} \f$ - */ + //! Species molar volume \f$ m^3 kmol^{-1} \f$ vector_fp m_speciesMolarVolume; /** - * The standard concentrations can have three different forms - * depending on the value of the member attribute m_formGC, which - * is supplied in the XML file. + * The standard concentrations can have three different forms depending on + * the value of the member attribute m_formGC, which is supplied in the XML + * file. * * * @@ -591,14 +481,10 @@ public: int IMS_typeCutoff_; private: - /** - * Temporary array used in equilibrium calculations - */ + //! Temporary array used in equilibrium calculations mutable vector_fp m_pp; - /** - * vector of size m_kk, used as a temporary holding area. - */ + //! vector of size m_kk, used as a temporary holding area. mutable vector_fp m_tmpV; //! Logarithm of the molal activity coefficients @@ -617,21 +503,16 @@ public: //! gamma_k minimum for the cutoff process at the zero solvent point doublereal IMS_gamma_k_min_; - //! Parameter in the polyExp cutoff treatment - /*! - * This is the slope of the f function at the zero solvent point - * Default value is 0.6 - */ + //! Parameter in the polyExp cutoff treatment. This is the slope of the f + //! function at the zero solvent point. Default value is 0.6 doublereal IMS_slopefCut_; - //! Parameter in the polyExp cutoff treatment - /*! - * This is the slope of the g function at the zero solvent point - * Default value is 0.0 - */ + //! Parameter in the polyExp cutoff treatment. This is the slope of the g + //! function at the zero solvent point. Default value is 0.0 doublereal IMS_slopegCut_; - //! @name Parameters in the polyExp cutoff treatment having to do with rate of exp decay + //! @name Parameters in the polyExp cutoff treatment having to do with rate + //! of exp decay //! @{ doublereal IMS_cCut_; doublereal IMS_dfCut_; @@ -665,8 +546,8 @@ private: //! Calculate parameters for cutoff treatments of activity coefficients /*! - * Some cutoff treatments for the activity coefficients - * actually require some calculations to create a consistent treatment. + * Some cutoff treatments for the activity coefficients actually require + * some calculations to create a consistent treatment. * * This routine is called during the setup to calculate these parameters */ diff --git a/include/cantera/thermo/IdealSolidSolnPhase.h b/include/cantera/thermo/IdealSolidSolnPhase.h index fb302b381..b6dbb659f 100644 --- a/include/cantera/thermo/IdealSolidSolnPhase.h +++ b/include/cantera/thermo/IdealSolidSolnPhase.h @@ -30,21 +30,20 @@ const int cIdealSolidSolnPhase2 = 5012; //@} /** - * Class IdealSolidSolnPhase represents a condensed phase ideal - * solution compound. The phase and the pure species phases which - * comprise the standard states of the species are assumed to have - * zero volume expansivity and zero isothermal compressibility. - * Each species does, however, have constant but distinct partial - * molar volumes equal to their pure species molar volumes. - * The class derives from class ThermoPhase, - * and overloads the virtual methods defined there with ones that - * use expressions appropriate for ideal solution mixtures. + * Class IdealSolidSolnPhase represents a condensed phase ideal solution + * compound. The phase and the pure species phases which comprise the standard + * states of the species are assumed to have zero volume expansivity and zero + * isothermal compressibility. Each species does, however, have constant but + * distinct partial molar volumes equal to their pure species molar volumes. The + * class derives from class ThermoPhase, and overloads the virtual methods + * defined there with ones that use expressions appropriate for ideal solution + * mixtures. * - * The generalized concentrations can have three different forms - * depending on the value of the member attribute #m_formGC, which - * is supplied in the constructor and in the XML file. - * The value and form of the generalized concentration will affect - * reaction rate constants involving species in this phase. + * The generalized concentrations can have three different forms depending on + * the value of the member attribute #m_formGC, which is supplied in the + * constructor and in the XML file. The value and form of the generalized + * concentration will affect reaction rate constants involving species in this + * phase. * * @ingroup thermoprops */ @@ -93,17 +92,8 @@ public: */ IdealSolidSolnPhase(XML_Node& root, const std::string& id="", int formCG=0); - //! Copy Constructor IdealSolidSolnPhase(const IdealSolidSolnPhase&); - - //! Assignment operator IdealSolidSolnPhase& operator=(const IdealSolidSolnPhase&); - - /*! - * Base Class Duplication Function - * - * Given a pointer to ThermoPhase, this function can duplicate the object. - */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; /** @@ -116,10 +106,9 @@ public: //! @{ /** - * Molar enthalpy of the solution. Units: J/kmol. - * For an ideal, constant partial molar volume solution mixture with - * pure species phases which exhibit zero volume expansivity and - * zero isothermal compressibility: + * Molar enthalpy of the solution. Units: J/kmol. For an ideal, constant + * partial molar volume solution mixture with pure species phases which + * exhibit zero volume expansivity and zero isothermal compressibility: * \f[ * \hat h(T,P) = \sum_k X_k \hat h^0_k(T) + (P - P_{ref}) (\sum_k X_k \hat V^0_k) * \f] @@ -131,9 +120,9 @@ public: virtual doublereal enthalpy_mole() const; /** - * Molar entropy of the solution. Units: J/kmol/K. - * For an ideal, constant partial molar volume solution mixture with - * pure species phases which exhibit zero volume expansivity: + * Molar entropy of the solution. Units: J/kmol/K. For an ideal, constant + * partial molar volume solution mixture with pure species phases which + * exhibit zero volume expansivity: * \f[ * \hat s(T, P, X_k) = \sum_k X_k \hat s^0_k(T) - \hat R \sum_k X_k log(X_k) * \f] @@ -146,9 +135,9 @@ public: virtual doublereal entropy_mole() const; /** - * Molar Gibbs free energy of the solution. Units: J/kmol. - * For an ideal, constant partial molar volume solution mixture with - * pure species phases which exhibit zero volume expansivity: + * Molar Gibbs free energy of the solution. Units: J/kmol. For an ideal, + * constant partial molar volume solution mixture with pure species phases + * which exhibit zero volume expansivity: * \f[ * \hat g(T, P) = \sum_k X_k \hat g^0_k(T,P) + \hat R T \sum_k X_k log(X_k) * \f] @@ -168,19 +157,17 @@ public: * \f[ * \hat c_p(T,P) = \sum_k X_k \hat c^0_{p,k}(T) . * \f] - * The heat capacity is independent of pressure. - * The reference-state pure-species heat capacities - * \f$ \hat c^0_{p,k}(T) \f$ are computed by the species thermodynamic - * property manager. + * The heat capacity is independent of pressure. The reference-state pure- + * species heat capacities \f$ \hat c^0_{p,k}(T) \f$ are computed by the + * species thermodynamic property manager. * @see SpeciesThermo */ virtual doublereal cp_mole() const; /** - * Molar heat capacity at constant volume of the solution. - * Units: J/kmol/K. - * For an ideal, constant partial molar volume solution mixture with - * pure species phases which exhibit zero volume expansivity: + * Molar heat capacity at constant volume of the solution. Units: J/kmol/K. + * For an ideal, constant partial molar volume solution mixture with pure + * species phases which exhibit zero volume expansivity: * \f[ \hat c_v(T,P) = \hat c_p(T,P) \f] * The two heat capacities are equal. */ @@ -191,36 +178,34 @@ public: //@} /** @name Mechanical Equation of State Properties * - * In this equation of state implementation, the density is a - * function only of the mole fractions. Therefore, it can't be - * an independent variable. Instead, the pressure is used as the - * independent variable. Functions which try to set the thermodynamic - * state by calling setDensity() may cause an exception to be - * thrown. + * In this equation of state implementation, the density is a function only + * of the mole fractions. Therefore, it can't be an independent variable. + * Instead, the pressure is used as the independent variable. Functions + * which try to set the thermodynamic state by calling setDensity() may + * cause an exception to be thrown. */ //@{ /** - * Pressure. Units: Pa. - * For this incompressible system, we return the internally stored - * independent value of the pressure. + * Pressure. Units: Pa. For this incompressible system, we return the + * internally stored independent value of the pressure. */ virtual doublereal pressure() const { return m_Pcurrent; } /** - * Set the pressure at constant temperature. Units: Pa. - * This method sets a constant within the object. - * The mass density is not a function of pressure. + * Set the pressure at constant temperature. Units: Pa. This method sets a + * constant within the object. The mass density is not a function of + * pressure. * * @param p Input Pressure (Pa) */ virtual void setPressure(doublereal p); /** - * Calculate the density of the mixture using the partial - * molar volumes and mole fractions as input + * Calculate the density of the mixture using the partial molar volumes and + * mole fractions as input * * The formula for this is * @@ -228,36 +213,33 @@ public: * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}} * \f] * - * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are - * the molecular weights, and \f$V_k\f$ are the pure species - * molar volumes. + * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular + * weights, and \f$V_k\f$ are the pure species molar volumes. * - * Note, the basis behind this formula is that in an ideal - * solution the partial molar volumes are equal to the pure - * species molar volumes. We have additionally specified - * in this class that the pure species molar volumes are - * independent of temperature and pressure. + * Note, the basis behind this formula is that in an ideal solution the + * partial molar volumes are equal to the pure species molar volumes. We + * have additionally specified in this class that the pure species molar + * volumes are independent of temperature and pressure. */ void calcDensity(); /** - * Overwritten setDensity() function is necessary because the - * density is not an independent variable. + * Overwritten setDensity() function is necessary because the density is not + * an independent variable. * * This function will now throw an error condition * - * @internal May have to adjust the strategy here to make - * the eos for these materials slightly compressible, in order - * to create a condition where the density is a function of - * the pressure. + * @internal May have to adjust the strategy here to make the eos for these + * materials slightly compressible, in order to create a condition where + * the density is a function of the pressure. * * @param rho Input density */ virtual void setDensity(const doublereal rho); /** - * Overwritten setMolarDensity() function is necessary because the - * density is not an independent variable. + * Overwritten setMolarDensity() function is necessary because the density + * is not an independent variable. * * This function will now throw an error condition. * @@ -265,39 +247,10 @@ public: */ virtual void setMolarDensity(const doublereal rho); - //! Set the mole fractions - /*! - * @param x Input vector of mole fractions. - * Length: m_kk. - */ virtual void setMoleFractions(const doublereal* const x); - - //! Set the mole fractions, but don't normalize them to one. - /*! - * @param x Input vector of mole fractions. - * Length: m_kk. - */ virtual void setMoleFractions_NoNorm(const doublereal* const x); - - //! Set the mass fractions, and normalize them to one. - /*! - * @param y Input vector of mass fractions. - * Length: m_kk. - */ virtual void setMassFractions(const doublereal* const y); - - //! Set the mass fractions, but don't normalize them to one - /*! - * @param y Input vector of mass fractions. - * Length: m_kk. - */ virtual void setMassFractions_NoNorm(const doublereal* const y); - - //! Set the concentration, - /*! - * @param c Input vector of concentrations. - * Length: m_kk. - */ virtual void setConcentrations(const doublereal* const c); //@} @@ -305,71 +258,65 @@ public: /** * @name Chemical Potentials and Activities * - * The activity \f$a_k\f$ of a species in solution is - * related to the chemical potential by + * The activity \f$a_k\f$ of a species in solution is related to the + * chemical potential by * \f[ * \mu_k(T,P,X_k) = \mu_k^0(T,P) * + \hat R T \log a_k. * \f] - * The quantity \f$\mu_k^0(T,P)\f$ is - * the standard state chemical potential at unit activity. - * It may depend on the pressure and the temperature. However, - * it may not depend on the mole fractions of the species - * in the solid solution. + * The quantity \f$\mu_k^0(T,P)\f$ is the standard state chemical potential + * at unit activity. It may depend on the pressure and the temperature. + * However, it may not depend on the mole fractions of the species in the + * solid solution. * - * The activities are related to the generalized - * concentrations, \f$\tilde C_k\f$, and standard - * concentrations, \f$C^0_k\f$, by the following formula: + * The activities are related to the generalized concentrations, \f$\tilde + * C_k\f$, and standard concentrations, \f$C^0_k\f$, by the following + * formula: * * \f[ * a_k = \frac{\tilde C_k}{C^0_k} * \f] - * The generalized concentrations are used in the kinetics classes - * to describe the rates of progress of reactions involving the - * species. Their formulation depends upon the specification - * of the rate constants for reaction, especially the units used - * in specifying the rate constants. The bridge between the - * thermodynamic equilibrium expressions that use a_k and the - * kinetics expressions which use the generalized concentrations - * is provided by the multiplicative factor of the - * standard concentrations. + * The generalized concentrations are used in the kinetics classes to + * describe the rates of progress of reactions involving the species. Their + * formulation depends upon the specification of the rate constants for + * reaction, especially the units used in specifying the rate constants. The + * bridge between the thermodynamic equilibrium expressions that use a_k and + * the kinetics expressions which use the generalized concentrations is + * provided by the multiplicative factor of the standard concentrations. * @{ */ /** - * This method returns the array of generalized - * concentrations. The generalized concentrations are used - * in the evaluation of the rates of progress for reactions - * involving species in this phase. The generalized - * concentration divided by the standard concentration is also - * equal to the activity of species. + * This method returns the array of generalized concentrations. The + * generalized concentrations are used in the evaluation of the rates of + * progress for reactions involving species in this phase. The generalized + * concentration divided by the standard concentration is also equal to the + * activity of species. * - * For this implementation the activity is defined to be the - * mole fraction of the species. The generalized concentration - * is defined to be equal to the mole fraction divided by - * the partial molar volume. The generalized concentrations - * for species in this phase therefore have units of - * kmol m-3. Rate constants must reflect this fact. + * For this implementation the activity is defined to be the mole fraction + * of the species. The generalized concentration is defined to be equal to + * the mole fraction divided by the partial molar volume. The generalized + * concentrations for species in this phase therefore have units of kmol + * m-3. Rate constants must reflect this fact. * - * On a general note, the following must be true. - * For an ideal solution, the generalized concentration must consist - * of the mole fraction multiplied by a constant. The constant may be - * fairly arbitrarily chosen, with differences adsorbed into the - * reaction rate expression. 1/V_N, 1/V_k, or 1 are equally good, - * as long as the standard concentration is adjusted accordingly. - * However, it must be a constant (and not the concentration, btw, - * which is a function of the mole fractions) in order for the - * ideal solution properties to hold at the same time having the - * standard concentration to be independent of the mole fractions. + * On a general note, the following must be true. For an ideal solution, the + * generalized concentration must consist of the mole fraction multiplied by + * a constant. The constant may be fairly arbitrarily chosen, with + * differences adsorbed into the reaction rate expression. 1/V_N, 1/V_k, or + * 1 are equally good, as long as the standard concentration is adjusted + * accordingly. However, it must be a constant (and not the concentration, + * btw, which is a function of the mole fractions) in order for the ideal + * solution properties to hold at the same time having the standard + * concentration to be independent of the mole fractions. * * In this implementation the form of the generalized concentrations * depend upon the member attribute, #m_formGC. * * HKM Note: We have absorbed the pressure dependence of the pure species - * state into the thermodynamics functions. Therefore the - * standard state on which the activities are based depend - * on both temperature and pressure. If we hadn't, it would have - * appeared in this function in a very awkward exp[] format. + * state into the thermodynamics functions. Therefore the standard + * state on which the activities are based depend on both temperature + * and pressure. If we hadn't, it would have appeared in this + * function in a very awkward exp[] format. * * @param c Pointer to array of doubles of length m_kk, which on exit * will contain the generalized concentrations. @@ -384,20 +331,18 @@ public: * species molar volume. Units for the standard concentration are kmol * m-3. * - * @param k Species number: this is a require parameter, - * a change from the ThermoPhase base class, where it was - * an optional parameter. + * @param k Species number: this is a require parameter, a change from the + * ThermoPhase base class, where it was an optional parameter. */ virtual doublereal standardConcentration(size_t k) const; /** * The reference (ie standard) concentration \f$ C^0_k \f$ used to normalize - * the generalized concentration. In many cases, this quantity - * will be the same for all species in a phase. - * However, for this case, we will return a distinct concentration - * for each species. (clone of the standard concentration -> - * suggest changing the name). This is the inverse of the species molar - * volume. + * the generalized concentration. In many cases, this quantity will be the + * same for all species in a phase. However, for this case, we will return a + * distinct concentration for each species. (clone of the standard + * concentration -> suggest changing the name). This is the inverse of the + * species molar volume. * * @param k Species index. */ @@ -447,7 +392,8 @@ public: * \f$ \mu^{ref}_k(T)\f$ is the chemical potential of pure * species k at the reference pressure, \f$P_{ref}\f$. * - * @param mu Output vector of dimensionless chemical potentials. Length = m_kk. + * @param mu Output vector of dimensionless chemical potentials. + * Length = m_kk. */ virtual void getChemPotentials_RT(doublereal* mu) const; @@ -455,18 +401,18 @@ public: /// @name Partial Molar Properties of the Solution //@{ - //! Returns an array of partial molar enthalpies for the species in the mixture. + //! Returns an array of partial molar enthalpies for the species in the + //! mixture. /*! - * Units (J/kmol) - * For this phase, the partial molar enthalpies are equal to the - * pure species enthalpies + * Units (J/kmol). For this phase, the partial molar enthalpies are equal to + * the pure species enthalpies * \f[ * \bar h_k(T,P) = \hat h^{ref}_k(T) + (P - P_{ref}) \hat V^0_k * \f] * The reference-state pure-species enthalpies, \f$ \hat h^{ref}_k(T) \f$, - * at the reference pressure,\f$ P_{ref} \f$, - * are computed by the species thermodynamic - * property manager. They are polynomial functions of temperature. + * at the reference pressure,\f$ P_{ref} \f$, are computed by the species + * thermodynamic property manager. They are polynomial functions of + * temperature. * @see SpeciesThermo * * @param hbar Output vector containing partial molar enthalpies. @@ -476,16 +422,16 @@ public: /** * Returns an array of partial molar entropies of the species in the - * solution. Units: J/kmol/K. - * For this phase, the partial molar entropies are equal to the - * pure species entropies plus the ideal solution contribution. + * solution. Units: J/kmol/K. For this phase, the partial molar entropies + * are equal to the pure species entropies plus the ideal solution + * contribution. * \f[ * \bar s_k(T,P) = \hat s^0_k(T) - R log(X_k) * \f] - * The reference-state pure-species entropies,\f$ \hat s^{ref}_k(T) \f$, - * at the reference pressure, \f$ P_{ref} \f$, are computed by the - * species thermodynamic - * property manager. They are polynomial functions of temperature. + * The reference-state pure-species entropies,\f$ \hat s^{ref}_k(T) \f$, at + * the reference pressure, \f$ P_{ref} \f$, are computed by the species + * thermodynamic property manager. They are polynomial functions of + * temperature. * @see SpeciesThermo * * @param sbar Output vector containing partial molar entropies. @@ -494,11 +440,9 @@ public: virtual void getPartialMolarEntropies(doublereal* sbar) const; /** - * Returns an array of partial molar Heat Capacities at constant - * pressure of the species in the - * solution. Units: J/kmol/K. - * For this phase, the partial molar heat capacities are equal - * to the standard state heat capacities. + * Returns an array of partial molar Heat Capacities at constant pressure of + * the species in the solution. Units: J/kmol/K. For this phase, the partial + * molar heat capacities are equal to the standard state heat capacities. * * @param cpbar Output vector of partial heat capacities. Length: m_kk. */ @@ -520,14 +464,12 @@ public: //@{ /** - * Get the standard state chemical potentials of the species. - * This is the array of chemical potentials at unit activity - * \f$ \mu^0_k(T,P) \f$. - * We define these here as the chemical potentials of the pure - * species at the temperature and pressure of the solution. - * This function is used in the evaluation of the - * equilibrium constant Kc. Therefore, Kc will also depend - * on T and P. This is the norm for liquid and solid systems. + * Get the standard state chemical potentials of the species. This is the + * array of chemical potentials at unit activity \f$ \mu^0_k(T,P) \f$. We + * define these here as the chemical potentials of the pure species at the + * temperature and pressure of the solution. This function is used in the + * evaluation of the equilibrium constant Kc. Therefore, Kc will also depend + * on T and P. This is the norm for liquid and solid systems. * * units = J / kmol * @@ -538,78 +480,64 @@ public: getPureGibbs(mu0); } - //! Get the array of nondimensional Enthalpy functions for the standard state species - //! at the current T and P of the solution. + //! Get the array of nondimensional Enthalpy functions for the standard + //! state species at the current T and P of the solution. /*! - * We assume an incompressible constant partial molar - * volume here: + * We assume an incompressible constant partial molar volume here: * \f[ * h^0_k(T,P) = h^{ref}_k(T) + (P - P_{ref}) * V_k * \f] * where \f$V_k\f$ is the molar volume of pure species k. - * \f$ h^{ref}_k(T)\f$ is the enthalpy of the pure - * species k at the reference pressure, \f$P_{ref}\f$. + * \f$ h^{ref}_k(T)\f$ is the enthalpy of the pure species k at the + * reference pressure, \f$P_{ref}\f$. * - * @param hrt Vector of length m_kk, which on return hrt[k] - * will contain the nondimensional - * standard state enthalpy of species k. + * @param hrt Vector of length m_kk, which on return hrt[k] will contain the + * nondimensional standard state enthalpy of species k. */ void getEnthalpy_RT(doublereal* hrt) const; - //! Get the nondimensional Entropies for the species - //! standard states at the current T and P of the solution. + //! Get the nondimensional Entropies for the species standard states at the + //! current T and P of the solution. /*! - * Note, this is equal to the reference state entropies - * due to the zero volume expansivity: - * i.e., (dS/dP)_T = (dV/dT)_P = 0.0 + * Note, this is equal to the reference state entropies due to the zero + * volume expansivity: i.e., (dS/dP)_T = (dV/dT)_P = 0.0 * - * @param sr Vector of length m_kk, which on return sr[k] - * will contain the nondimensional - * standard state entropy for species k. + * @param sr Vector of length m_kk, which on return sr[k] will contain the + * nondimensional standard state entropy for species k. */ void getEntropy_R(doublereal* sr) const; /** - * Get the nondimensional Gibbs function for the species - * standard states at the current T and P of the solution. + * Get the nondimensional Gibbs function for the species standard states at + * the current T and P of the solution. * - * \f[ - * \mu^0_k(T,P) = \mu^{ref}_k(T) + (P - P_{ref}) * V_k - * \f] - * where \f$V_k\f$ is the molar volume of pure species k. - * \f$ \mu^{ref}_k(T)\f$ is the chemical potential of pure - * species k at the reference pressure, \f$P_{ref}\f$. - * - * @param grt Vector of length m_kk, which on return sr[k] - * will contain the nondimensional - * standard state Gibbs function for species k. - */ - virtual void getGibbs_RT(doublereal* grt) const; - - /** - * Get the Gibbs functions for the pure species - * at the current T and P of the solution. - * We assume an incompressible constant partial molar - * volume here: * \f[ * \mu^0_k(T,P) = \mu^{ref}_k(T) + (P - P_{ref}) * V_k * \f] * where \f$V_k\f$ is the molar volume of pure species k. - * \f$ \mu^{ref}_k(T)\f$ is the chemical potential of pure - * species k at the reference pressure, \f$P_{ref}\f$. + * \f$ \mu^{ref}_k(T)\f$ is the chemical potential of pure species k + * at the reference pressure, \f$P_{ref}\f$. * - * @param gpure Output vector of Gibbs functions for species - * Length: m_kk. + * @param grt Vector of length m_kk, which on return sr[k] will contain the + * nondimensional standard state Gibbs function for species k. + */ + virtual void getGibbs_RT(doublereal* grt) const; + + /** + * Get the Gibbs functions for the pure species at the current T and + * P of the solution. We assume an incompressible constant partial + * molar volume here: + * \f[ + * \mu^0_k(T,P) = \mu^{ref}_k(T) + (P - P_{ref}) * V_k + * \f] + * where \f$V_k\f$ is the molar volume of pure species k. + * \f$ \mu^{ref}_k(T)\f$ is the chemical potential of pure species k + * at the reference pressure, \f$P_{ref}\f$. + * + * @param gpure Output vector of Gibbs functions for species. Length: m_kk. */ virtual void getPureGibbs(doublereal* gpure) const; - //! Returns the vector of nondimensional - //! internal Energies of the standard state at the current - //! temperature and pressure of the solution for each species. - /*! - * @param urt Output vector of standard state nondimensional internal energies. - * Length: m_kk. - */ virtual void getIntEnergy_RT(doublereal* urt) const; /** @@ -619,106 +547,40 @@ public: * Cp^0_k(T,P) = Cp^{ref}_k(T) * \f] * where \f$V_k\f$ is the molar volume of pure species k. - * \f$ Cp^{ref}_k(T)\f$ is the constant pressure heat capacity - * of species k at the reference pressure, \f$p_{ref}\f$. + * \f$ Cp^{ref}_k(T)\f$ is the constant pressure heat capacity of species + * k at the reference pressure, \f$p_{ref}\f$. * - * @param cpr Vector of length m_kk, which on return cpr[k] - * will contain the nondimensional - * constant pressure heat capacity for species k. + * @param cpr Vector of length m_kk, which on return cpr[k] will contain the + * nondimensional constant pressure heat capacity for species k. */ void getCp_R(doublereal* cpr) const; - /** - * Get the molar volumes of each species in their standard - * states at the current T and P of the solution. - * units = m^3 / kmol - * - * @param vol Output vector of standard state volumes. - * Length: m_kk. - */ virtual void getStandardVolumes(doublereal* vol) const; //@} /// @name Thermodynamic Values for the Species Reference States //@{ - /** - * Returns the vector of nondimensional - * enthalpies of the reference state at the current temperature - * of the solution and the reference pressure for the species. - * - * @param hrt Output vector containing reference nondimensional enthalpies. - * Length: m_kk. - */ virtual void getEnthalpy_RT_ref(doublereal* hrt) const; - - /** - * Returns the vector of nondimensional - * enthalpies of the reference state at the current temperature - * of the solution and the reference pressure for the species. - * - * @param grt Output vector containing reference nondimensional Gibbs free energies. - * Length: m_kk. - */ virtual void getGibbs_RT_ref(doublereal* grt) const; - - /** - * Returns the vector of the - * Gibbs function of the reference state at the current temperature - * of the solution and the reference pressure for the species. - * units = J/kmol - * - * @param g Output vector containing reference Gibbs free energies. - * Length: m_kk. - */ virtual void getGibbs_ref(doublereal* g) const; - - /** - * Returns the vector of nondimensional - * entropies of the reference state at the current temperature - * of the solution and the reference pressure for the species. - * - * @param er Output vector containing reference nondimensional entropies. - * Length: m_kk. - */ virtual void getEntropy_R_ref(doublereal* er) const; - - /** - * Returns the vector of nondimensional - * internal Energies of the reference state at the current temperature - * of the solution and the reference pressure for each species. - * - * @param urt Output vector containing reference nondimensional internal energies. - * Length: m_kk. - */ virtual void getIntEnergy_RT_ref(doublereal* urt) const; - - /** - * Returns the vector of nondimensional - * constant pressure heat capacities of the reference state - * at the current temperature of the solution - * and reference pressure for the species. - * - * @param cprt Output vector containing reference nondimensional heat capacities. - * Length: m_kk. - */ virtual void getCp_R_ref(doublereal* cprt) const; /** - * Returns a reference to the vector of nondimensional - * enthalpies of the reference state at the current temperature. - * Real reason for its existence is that it also checks - * to see if a recalculation of the reference thermodynamics - * functions needs to be done. + * Returns a reference to the vector of nondimensional enthalpies of the + * reference state at the current temperature. Real reason for its existence + * is that it also checks to see if a recalculation of the reference + * thermodynamics functions needs to be done. */ const vector_fp& enthalpy_RT_ref() const; /** - * Returns a reference to the vector of nondimensional - * enthalpies of the reference state at the current temperature. - * Real reason for its existence is that it also checks - * to see if a recalculation of the reference thermodynamics - * functions needs to be done. + * Returns a reference to the vector of nondimensional enthalpies of the + * reference state at the current temperature. Real reason for its existence + * is that it also checks to see if a recalculation of the reference + * thermodynamics functions needs to be done. */ const vector_fp& gibbs_RT_ref() const { _updateThermo(); @@ -726,20 +588,18 @@ public: } /** - * Returns a reference to the vector of nondimensional - * enthalpies of the reference state at the current temperature. - * Real reason for its existence is that it also checks - * to see if a recalculation of the reference thermodynamics - * functions needs to be done. + * Returns a reference to the vector of nondimensional enthalpies of the + * reference state at the current temperature. Real reason for its existence + * is that it also checks to see if a recalculation of the reference + * thermodynamics functions needs to be done. */ const vector_fp& entropy_R_ref() const; /** - * Returns a reference to the vector of nondimensional - * enthalpies of the reference state at the current temperature. - * Real reason for its existence is that it also checks - * to see if a recalculation of the reference thermodynamics - * functions needs to be done. + * Returns a reference to the vector of nondimensional enthalpies of the + * reference state at the current temperature. Real reason for its existence + * is that it also checks to see if a recalculation of the reference + * thermodynamics functions needs to be done. */ const vector_fp& cp_R_ref() const { _updateThermo(); @@ -759,33 +619,8 @@ public: /// @name Utility Functions //@{ - /** - * @internal Import and initialize a ThermoPhase object using an XML - * tree. Here we read extra information about the XML description of a - * phase. Regular information about elements and species and their - * reference state thermodynamic information have already been read at - * this point. For example, we do not need to call this function for - * ideal gas equations of state. This function is called from - * importPhase() after the elements and the species are initialized - * with default ideal solution level data. - * - * @param phaseNode This object must be the phase node of a complete XML - * tree description of the phase, including all of the - * species data. In other words while "phase" must point to - * an XML phase object, it must have sibling nodes - * "speciesData" that describe the species in the phase. - * @param id ID of the phase. If nonnull, a check is done to see if - * phaseNode is pointing to the phase with the correct id. - */ virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); - /** - * Set mixture to an equilibrium state consistent with specified - * element potentials and the temperature. - * - * @param lambda_RT vector of non-dimensional element potentials - * \f$ \lambda_m/RT \f$. - */ virtual void setToEquilState(const doublereal* lambda_RT); /** @@ -826,10 +661,10 @@ protected: int m_formGC; /** - * Value of the reference pressure for all species in this phase. - * The T dependent polynomials are evaluated at the reference - * pressure. Note, because this is a single value, all species - * are required to have the same reference pressure. + * Value of the reference pressure for all species in this phase. The T + * dependent polynomials are evaluated at the reference pressure. Note, + * because this is a single value, all species are required to have the same + * reference pressure. */ doublereal m_Pref; @@ -851,22 +686,18 @@ protected: //! Vector containing the species reference enthalpies at T = m_tlast mutable vector_fp m_h0_RT; - /** - * Vector containing the species reference constant pressure - * heat capacities at T = m_tlast - */ + //! Vector containing the species reference constant pressure heat + //! capacities at T = m_tlast mutable vector_fp m_cp0_R; - //! Vector containing the species reference Gibbs functions at T = m_tlast + //! Vector containing the species reference Gibbs functions at T = m_tlast mutable vector_fp m_g0_RT; //! Vector containing the species reference entropies at T = m_tlast mutable vector_fp m_s0_R; - /** - * Vector containing the species reference exp(-G/RT) functions - * at T = m_tlast - */ + //! Vector containing the species reference exp(-G/RT) functions at + //! T = m_tlast mutable vector_fp m_expg0_RT; //! Vector of potential energies for the species. @@ -879,12 +710,11 @@ private: /// @name Utility Functions //@{ /** - * This function gets called for every call to functions in this - * class. It checks to see whether the temperature has changed and - * thus the reference thermodynamics functions for all of the species - * must be recalculated. - * If the temperature has changed, the species thermo manager is called - * to recalculate G, Cp, H, and S at the current temperature. + * This function gets called for every call to functions in this class. It + * checks to see whether the temperature has changed and thus the reference + * thermodynamics functions for all of the species must be recalculated. If + * the temperature has changed, the species thermo manager is called to + * recalculate G, Cp, H, and S at the current temperature. */ void _updateThermo() const; diff --git a/include/cantera/thermo/IdealSolnGasVPSS.h b/include/cantera/thermo/IdealSolnGasVPSS.h index 2a5cf7acc..65ea43401 100644 --- a/include/cantera/thermo/IdealSolnGasVPSS.h +++ b/include/cantera/thermo/IdealSolnGasVPSS.h @@ -42,119 +42,69 @@ public: */ //! @{ - /// Constructor. IdealSolnGasVPSS(); /// Create an object from an XML input file IdealSolnGasVPSS(const std::string& infile, std::string id=""); - /// Copy Constructor. IdealSolnGasVPSS(const IdealSolnGasVPSS&); - - /// Assignment operator IdealSolnGasVPSS& operator=(const IdealSolnGasVPSS&); - - //! Duplication routine virtual ThermoPhase* duplMyselfAsThermoPhase() const; //@} //! @name Utilities (IdealSolnGasVPSS) //@{ - /** - * Equation of state type flag. The base class returns - * zero. Subclasses should define this to return a unique - * non-zero value. Constants defined for this purpose are - * listed in mix_defs.h. - */ + virtual int eosType() const; //! @} //! @name Molar Thermodynamic Properties //! @{ - /// Molar enthalpy. Units: J/kmol. doublereal enthalpy_mole() const; - - /// Molar entropy. Units: J/kmol/K. doublereal entropy_mole() const; - - /// Molar heat capacity at constant pressure. Units: J/kmol/K. doublereal cp_mole() const; - - /// Molar heat capacity at constant volume. Units: J/kmol/K. doublereal cv_mole() const; //! @} //! @name Mechanical Properties //! @{ - //! Set the pressure in the fluid - /*! - * @param p pressure in pascals. - */ void setPressure(doublereal p); - //! Returns the isothermal compressibility. Units: 1/Pa. - /*! - * The isothermal compressibility is defined as - * \f[ - * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T - * \f] - */ virtual doublereal isothermalCompressibility() const; protected: /** - * Calculate the density of the mixture using the partial - * molar volumes and mole fractions as input - * - * The formula for this is + * Calculate the density of the mixture using the partial molar volumes and + * mole fractions as input. The formula for this is * * \f[ * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}} * \f] * - * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are - * the molecular weights, and \f$V_k\f$ are the pure species - * molar volumes. + * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular + * weights, and \f$V_k\f$ are the pure species molar volumes. * - * Note, the basis behind this formula is that in an ideal - * solution the partial molar volumes are equal to the - * species standard state molar volumes. - * The species molar volumes may be functions - * of temperature and pressure. + * Note, the basis behind this formula is that in an ideal solution the + * partial molar volumes are equal to the species standard state molar + * volumes. The species molar volumes may be functions of temperature and + * pressure. */ virtual void calcDensity(); //! @} public: - //! This method returns an array of generalized concentrations - /*! - * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / - * C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration - * defined below and \f$ a_k \f$ are activities used in the - * thermodynamic functions. These activity (or generalized) - * concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. Note that they may - * or may not have units of concentration --- they might be - * partial pressures, mole fractions, or surface coverages, - * for example. - * - * @param c Output array of generalized concentrations. The - * units depend upon the implementation of the - * reaction rate expressions within the phase. - */ virtual void getActivityConcentrations(doublereal* c) const; - //! Returns the standard concentration \f$ C^0_k \f$, which is used to normalize - //! the generalized concentration. + //! Returns the standard concentration \f$ C^0_k \f$, which is used to + //! normalize the generalized concentration. /*! * This is defined as the concentration by which the generalized - * concentration is normalized to produce the activity. - * In many cases, this quantity will be the same for all species in a phase. - * Since the activity for an ideal gas mixture is - * simply the mole fraction, for an ideal gas \f$ C^0_k = P/\hat R T \f$. + * concentration is normalized to produce the activity. In many cases, this + * quantity will be the same for all species in a phase. Since the activity + * for an ideal gas mixture is simply the mole fraction, for an ideal gas + * \f$ C^0_k = P/\hat R T \f$. * * @param k Optional parameter indicating the species. The default * is to assume this refers to species 0. @@ -163,8 +113,8 @@ public: */ virtual doublereal standardConcentration(size_t k=0) const; - //! Get the array of non-dimensional activity coefficients at - //! the current solution temperature, pressure, and solution concentration. + //! Get the array of non-dimensional activity coefficients at the current + //! solution temperature, pressure, and solution concentration. /*! * For ideal gases, the activity coefficients are all equal to one. * @@ -176,144 +126,29 @@ public: /// @name Partial Molar Properties of the Solution //@{ - //! Get the array of non-dimensional species chemical potentials - //! These are partial molar Gibbs free energies. - /*! - * \f$ \mu_k / \hat R T \f$. - * Units: unitless - * - * We close the loop on this function, here, calling - * getChemPotentials() and then dividing by RT. No need for child - * classes to handle. - * - * @param mu Output vector of non-dimensional species chemical potentials - * Length: m_kk. - */ void getChemPotentials_RT(doublereal* mu) const; - //! Get the species chemical potentials. Units: J/kmol. - /*! - * This function returns a vector of chemical potentials of the - * species in solution at the current temperature, pressure - * and mole fraction of the solution. - * - * @param mu Output vector of species chemical - * potentials. Length: m_kk. Units: J/kmol - */ virtual void getChemPotentials(doublereal* mu) const; - - //! Get the species partial molar enthalpies. Units: J/kmol. - /*! - * @param hbar Output vector of species partial molar enthalpies. - * Length: m_kk. units are J/kmol. - */ virtual void getPartialMolarEnthalpies(doublereal* hbar) const; - - //! Get the species partial molar entropies. Units: J/kmol/K. - /*! - * @param sbar Output vector of species partial molar entropies. - * Length = m_kk. units are J/kmol/K. - */ virtual void getPartialMolarEntropies(doublereal* sbar) const; - - //! Get the species partial molar enthalpies. Units: J/kmol. - /*! - * @param ubar Output vector of species partial molar internal energies. - * Length = m_kk. units are J/kmol. - */ virtual void getPartialMolarIntEnergies(doublereal* ubar) const; - - //! Get the partial molar heat capacities Units: J/kmol/K - /*! - * @param cpbar Output vector of species partial molar heat capacities - * at constant pressure. - * Length = m_kk. units are J/kmol/K. - */ virtual void getPartialMolarCp(doublereal* cpbar) const; - - //! Get the species partial molar volumes. Units: m^3/kmol. - /*! - * @param vbar Output vector of species partial molar volumes. - * Length = m_kk. units are m^3/kmol. - */ virtual void getPartialMolarVolumes(doublereal* vbar) const; //@} public: //! @name Initialization Methods - For Internal use /*! - * The following methods are used in the process of constructing - * the phase and setting its parameters from a specification in an - * input file. They are not normally used in application programs. - * To see how they are used, see importPhase(). + * The following methods are used in the process of constructing the phase + * and setting its parameters from a specification in an input file. They + * are not normally used in application programs. To see how they are used, + * see importPhase(). */ //@{ - //! Set equation of state parameter values from XML entries. - /*! - * This method is called by function importPhase() when processing a phase - * definition in an input file. It should be overloaded in subclasses to - * set any parameters that are specific to that particular phase model. - * - * @param thermoNode An XML_Node object corresponding to - * the "thermo" entry for this phase in the input file. - */ virtual void setParametersFromXML(const XML_Node& thermoNode); - - //! @internal Initialize the object - /*! - * This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase(). - */ virtual void initThermo(); - - //!This method is used by the ChemEquil equilibrium solver. - /*! - * It sets the state such that the chemical potentials satisfy - * \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m} - * \left(\frac{\lambda_m} {\hat R T}\right) \f] where - * \f$ \lambda_m \f$ is the element potential of element m. The - * temperature is unchanged. Any phase (ideal or not) that - * implements this method can be equilibrated by ChemEquil. - * - * @param lambda_RT Input vector of dimensionless element potentials - * The length is equal to nElements(). - */ void setToEquilState(const doublereal* lambda_RT); - - //! Initialize a ThermoPhase object, potentially reading activity - //! coefficient information from an XML database. - /*! - * This routine initializes the lengths in the current object and - * then calls the parent routine. - * This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase(). - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); private: diff --git a/include/cantera/thermo/IonsFromNeutralVPSSTP.h b/include/cantera/thermo/IonsFromNeutralVPSSTP.h index 5c75b0611..b83da4bd4 100644 --- a/include/cantera/thermo/IonsFromNeutralVPSSTP.h +++ b/include/cantera/thermo/IonsFromNeutralVPSSTP.h @@ -1,15 +1,8 @@ /** - * @file IonsFromNeutralVPSSTP.h - * Header for intermediate ThermoPhase object for phases which - * consist of ions whose thermodynamics is calculated from neutral molecule thermodynamics. - * (see \ref thermoprops - * and class \link Cantera::IonsFromNeutralVPSSTP IonsFromNeutralVPSSTP\endlink). - * - * Header file for a derived class of ThermoPhase that handles - * variable pressure standard state methods for calculating - * thermodynamic properties that are further based upon activities - * based on the molality scale. These include most of the methods for - * calculating liquid electrolyte thermodynamics. + * @file IonsFromNeutralVPSSTP.h Header for intermediate ThermoPhase object for + * phases which consist of ions whose thermodynamics is calculated from + * neutral molecule thermodynamics. (see \ref thermoprops and class \link + * Cantera::IonsFromNeutralVPSSTP IonsFromNeutralVPSSTP\endlink). */ /* * Copyright (2006) Sandia Corporation. Under the terms of @@ -26,9 +19,9 @@ namespace Cantera //! enums for molten salt ion solution types /*! - * Types identify how complicated the solution is. If there - * is just mixing on one of the sublattices but not the other, - * then the math is considerably simpler. + * Types identify how complicated the solution is. If there is just mixing on + * one of the sublattices but not the other, then the math is considerably + * simpler. */ enum IonSolnType_enumType { cIonSolnType_PASSTHROUGH = 2000 , @@ -38,36 +31,31 @@ enum IonSolnType_enumType { }; /*! - * The IonsFromNeutralVPSSTP is a derived class of ThermoPhase - * that handles the specification of the chemical potentials for - * ionic species, given a specification of the chemical potentials - * for the same phase expressed in terms of combinations of the - * ionic species that represent neutral molecules. It's expected - * that the neutral molecules will be represented in terms of - * an excess Gibbs free energy approximation that is a derivative - * of the GbbsExcessVPSSTP object. All of the e Excess Gibbs free - * energy formulations in this area employ - * symmetrical formulations. + * The IonsFromNeutralVPSSTP is a derived class of ThermoPhase that handles the + * specification of the chemical potentials for ionic species, given a + * specification of the chemical potentials for the same phase expressed in + * terms of combinations of the ionic species that represent neutral molecules. + * It's expected that the neutral molecules will be represented in terms of an + * excess Gibbs free energy approximation that is a derivative of the + * GibbsExcessVPSSTP object. All of the excess Gibbs free energy formulations in + * this area employ symmetrical formulations. * - * This class is used for molten salts. + * This class is used for molten salts. * - * This object actually employs 4 different mole fraction types. + * This object actually employs 4 different mole fraction types. * - * 1. There is a mole fraction associated the the cations and - * anions and neutrals from this ThermoPhase object. This - * is the normal mole fraction vector for this object. - * Note, however, it isn't the appropriate mole fraction - * vector to use even for obtaining the correct ideal - * free energies of mixing. - * 2. There is a mole fraction vector associated with the - * neutral molecule ThermoPhase object. - * 3. There is a mole fraction vector associated with the - * cation lattice. - * 4. There is a mole fraction vector associated with the - * anion lattice + * 1. There is a mole fraction associated the the cations and anions and + * neutrals from this ThermoPhase object. This is the normal mole fraction + * vector for this object. Note, however, it isn't the appropriate mole + * fraction vector to use even for obtaining the correct ideal free energies + * of mixing. + * 2. There is a mole fraction vector associated with the neutral molecule + * ThermoPhase object. + * 3. There is a mole fraction vector associated with the cation lattice. + * 4. There is a mole fraction vector associated with the anion lattice * - * This object can translate between any of the four mole - * fraction representations. + * This object can translate between any of the four mole fraction + * representations. */ class IonsFromNeutralVPSSTP : public GibbsExcessVPSSTP { @@ -80,26 +68,23 @@ public: */ IonsFromNeutralVPSSTP(); - //! Construct and initialize an IonsFromNeutralVPSSTP object - //! directly from an ASCII input file + //! Construct and initialize an IonsFromNeutralVPSSTP object directly from + //! an ASCII input file /*! - * This constructor is a shell around the routine initThermo(), with a - * reference to the XML database to get the info for the phase. + * This constructor is a shell around the routine initThermo(), with a + * reference to the XML database to get the info for the phase. * * @param inputFile Name of the input file containing the phase XML data - * to set up the object + * to set up the object * @param id ID of the phase in the input file. Defaults to the - * empty string. - * @param neutralPhase The object takes a neutralPhase ThermoPhase - * object as input. It can either take a pointer - * to an existing object in the parameter list, - * in which case it does not own the object, or - * it can construct a neutral Phase as a slave - * object, in which case, it does own the slave - * object, for purposes of who gets to destroy - * the object. - * If this parameter is zero, then a slave - * neutral phase object is created and used. + * empty string. + * @param neutralPhase The object takes a neutralPhase ThermoPhase object + * as input. It can either take a pointer to an existing object in the + * parameter list, in which case it does not own the object, or it can + * construct a neutral Phase as a slave object, in which case, it does + * own the slave object, for purposes of who gets to destroy the object. + * If this parameter is zero, then a slave neutral phase object is + * created and used. */ IonsFromNeutralVPSSTP(const std::string& inputFile, const std::string& id = "", @@ -108,44 +93,23 @@ public: //! Construct and initialize an IonsFromNeutralVPSSTP object //! directly from an XML database /*! - * @param phaseRoot XML phase node containing the description of the phase - * @param id id attribute containing the name of the phase. - * (default is the empty string) - * @param neutralPhase The object takes a neutralPhase ThermoPhase - * object as input. It can either take a pointer - * to an existing object in the parameter list, - * in which case it does not own the object, or - * it can construct a neutral Phase as a slave - * object, in which case, it does own the slave - * object, for purposes of who gets to destroy - * the object. - * If this parameter is zero, then a slave - * neutral phase object is created and used. + * @param phaseRoot XML phase node containing the description of the phase + * @param id id attribute containing the name of the phase. + * (default is the empty string) + * @param neutralPhase The object takes a neutralPhase ThermoPhase object + * as input. It can either take a pointer to an existing object in the + * parameter list, in which case it does not own the object, or it can + * construct a neutral Phase as a slave object, in which case, it does + * own the slave object, for purposes of who gets to destroy the object. + * If this parameter is zero, then a slave neutral phase object is + * created and used. */ IonsFromNeutralVPSSTP(XML_Node& phaseRoot, const std::string& id = "", ThermoPhase* neutralPhase = 0); - //! Copy constructor - /*! - * @param b class to be copied - */ IonsFromNeutralVPSSTP(const IonsFromNeutralVPSSTP& b); - - /// Assignment operator - /*! - * @param b class to be copied. - */ IonsFromNeutralVPSSTP& operator=(const IonsFromNeutralVPSSTP& b); - - /// Destructor. virtual ~IonsFromNeutralVPSSTP(); - - //! Duplication routine for objects which inherit from ThermoPhase. - /*! - * This virtual routine can be used to duplicate ThermoPhase objects - * inherited from ThermoPhase even if the application only has - * a pointer to ThermoPhase to work with. - */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; // @} @@ -156,52 +120,39 @@ public: //! Initialization of an IonsFromNeutralVPSSTP phase using an XML file /*! - * This routine is a precursor to initThermo(XML_Node*) - * routine, which does most of the work. + * This routine is a precursor to initThermo(XML_Node*) routine, which does + * most of the work. * * @param inputFile XML file containing the description of the phase - * @param id Optional parameter identifying the name of the - * phase. If none is given, the first XML - * phase element will be used. + * @param id Optional parameter identifying the name of the phase. If none + * is given, the first XML phase element will be used. */ void constructPhaseFile(std::string inputFile, std::string id); - //! Import and initialize an IonsFromNeutralVPSSTP phase - //! specification in an XML tree into the current object. + //! Import and initialize an IonsFromNeutralVPSSTP phase specification in an + //! XML tree into the current object. /*! - * Here we read an XML description of the phase. - * We import descriptions of the elements that make up the - * species in a phase. - * We import information about the species, including their - * reference state thermodynamic polynomials. We then freeze - * the state of the species. + * Here we read an XML description of the phase. We import descriptions of + * the elements that make up the species in a phase. We import information + * about the species, including their reference state thermodynamic + * polynomials. We then freeze the state of the species. * - * Then, we read the species molar volumes from the XML - * tree to finish the initialization. + * Then, we read the species molar volumes from the XML tree to finish the + * initialization. * - * @param phaseNode This object must be the phase node of a complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. + * @param phaseNode This object must be the phase node of a complete XML + * tree description of the phase, including all of the species + * data. In other words while "phase" must point to an XML phase + * object, it must have sibling nodes "speciesData" that + * describe the species in the phase. + * @param id ID of the phase. If nonnull, a check is done to see if + * phaseNode is pointing to the phase with the correct id. */ void constructPhaseXML(XML_Node& phaseNode, std::string id); //! @name Utilities //! @{ - //! Equation of state type flag. - /*! - * The ThermoPhase base class returns - * zero. Subclasses should define this to return a unique - * non-zero value. Known constants defined for this purpose are - * listed in mix_defs.h. The MolalityVPSSTP class also returns - * zero, as it is a non-complete class. - */ virtual int eosType() const; //! @} @@ -214,16 +165,9 @@ public: */ virtual doublereal enthalpy_mole() const; - //! Molar entropy. Units: J/kmol/K. virtual doublereal entropy_mole() const; - - //! Molar Gibbs free Energy for an ideal gas. Units = J/kmol. virtual doublereal gibbs_mole() const; - - //! Molar heat capacity at constant pressure. Units: J/kmol/K. virtual doublereal cp_mole() const; - - //! Molar heat capacity at constant volume. Units: J/kmol/K. virtual doublereal cv_mole() const; /** @@ -238,36 +182,22 @@ public: * @{ */ - //! Get the array of non-dimensional molar-based activity coefficients at - //! the current solution temperature, pressure, and solution concentration. - /*! - * @param ac Output vector of activity coefficients. Length: m_kk. - */ virtual void getActivityCoefficients(doublereal* ac) const; //@} /// @name Partial Molar Properties of the Solution //@{ - //! Get the species chemical potentials. Units: J/kmol. - /*! - * This function returns a vector of chemical potentials of the - * species in solution at the current temperature, pressure - * and mole fraction of the solution. - * - * @param mu Output vector of species chemical - * potentials. Length: m_kk. Units: J/kmol - */ virtual void getChemPotentials(doublereal* mu) const; - //! Returns an array of partial molar enthalpies for the species - //! in the mixture. + //! Returns an array of partial molar enthalpies for the species in the + //! mixture. /*! * Units (J/kmol) * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * molality-based activity coefficient wrt temperature + * For this phase, the partial molar enthalpies are equal to the standard + * state enthalpies modified by the derivative of the molality-based + * activity coefficient wrt temperature * * \f[ * \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} @@ -278,14 +208,14 @@ public: */ virtual void getPartialMolarEnthalpies(doublereal* hbar) const; - //! Returns an array of partial molar entropies for the species - //! in the mixture. + //! Returns an array of partial molar entropies for the species in the + //! mixture. /*! * Units (J/kmol) * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature + * For this phase, the partial molar enthalpies are equal to the standard + * state enthalpies modified by the derivative of the activity coefficient + * wrt temperature * * \f[ * \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} @@ -298,87 +228,30 @@ public: */ virtual void getPartialMolarEntropies(doublereal* sbar) const; - //! Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along - //! a line in parameter space or along a line in physical space - /*! - * @param dTds Input of temperature change along the path - * @param dXds Input vector of changes in mole fraction along the path. length = m_kk - * Along the path length it must be the case that the mole fractions sum to one. - * @param dlnActCoeffds Output vector of the directional derivatives of the - * log Activity Coefficients along the path. length = m_kk - */ virtual void getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const; - - //! Get the array of log concentration-like derivatives of the - //! log activity coefficients - diagonal component - /*! - * For ideal mixtures (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the logarithm of the - * activity coefficient with respect to the logarithm of the mole - * fraction. This quantity is to be used in conjunction with derivatives - * of that concentration-like variable when the derivative of the chemical - * potential is taken. - * - * units = dimensionless - * - * @param dlnActCoeffdlnX_diag Output vector of log(mole fraction) - * derivatives of the log Activity Coefficients. - * length = m_kk - */ virtual void getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const; - - //! Get the array of log concentration-like derivatives of the - //! log activity coefficients - diagonal components - /*! - * For ideal mixtures (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the logarithm of the - * activity coefficient with respect to the logarithm of the species mole - * numbe. This routine just does the diagonal entries. - * - * units = dimensionless - * - * @param dlnActCoeffdlnN_diag Output vector of diagonal components of the log(mole fraction) - * derivatives of the log Activity Coefficients. - * length = m_kk - */ virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const; - - //! Get the array of derivatives of the ln activity coefficients with respect to the ln species mole numbers - /*! - * Implementations should take the derivative of the logarithm of the activity coefficient with respect to a - * log of a species mole number (with all other species mole numbers held constant) - * - * units = 1 / kmol - * - * dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log act_coeff for the mth - * species with respect to the number of moles of the kth species. - * - * \f[ - * \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i} - * \f] - * - * @param ld Number of rows in the matrix - * @param dlnActCoeffdlnN Output vector of derivatives of the - * log Activity Coefficients. length = m_kk * m_kk - */ virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN); //! @} - //! Get the Salt Dissociation Coefficients + //! Get the Salt Dissociation Coefficients. //! Returns the vector of dissociation coefficients and vector of charges /*! - * @param fm_neutralMolec_ions Returns the formula matrix for the composition of neutral molecules - * in terms of the ions. - * @param charges Returns a vector containing the charges of all species in this phase - * @param neutMolIndex Returns the vector fm_invert_ionForNeutral - * This is the mapping between ion species and neutral molecule for quick invert. + * @param fm_neutralMolec_ions Returns the formula matrix for the + * composition of neutral molecules in terms of the ions. + * @param charges Returns a vector containing the charges of + * all species in this phase + * @param neutMolIndex Returns the vector fm_invert_ionForNeutral + * This is the mapping between ion species and neutral molecule for + * quick invert. */ void getDissociationCoeffs(vector_fp& fm_neutralMolec_ions, vector_fp& charges, std::vector& neutMolIndex) const; //! Return the current value of the neutral mole fraction vector /*! - * @param neutralMoleculeMoleFractions Vector of neutral molecule mole fractions. + * @param neutralMoleculeMoleFractions Vector of neutral molecule mole + * fractions. */ void getNeutralMolecMoleFractions(vector_fp& neutralMoleculeMoleFractions) const { neutralMoleculeMoleFractions = NeutralMolecMoleFractions_; @@ -386,20 +259,18 @@ public: //! Calculate neutral molecule mole fractions /*! - * This routine calculates the neutral molecule mole - * fraction given the vector of ion mole fractions, - * i.e., the mole fractions from this ThermoPhase. - * Note, this routine basically assumes that there - * is charge neutrality. If there isn't, then it wouldn't - * make much sense. + * This routine calculates the neutral molecule mole fraction given the + * vector of ion mole fractions, i.e., the mole fractions from this + * ThermoPhase. Note, this routine basically assumes that there is charge + * neutrality. If there isn't, then it wouldn't make much sense. * - * for the case of cIonSolnType_SINGLEANION, some slough - * in the charge neutrality is allowed. The cation number - * is followed, while the difference in charge neutrality - * is dumped into the anion mole number to fix the imbalance. + * for the case of cIonSolnType_SINGLEANION, some slough in the charge + * neutrality is allowed. The cation number is followed, while the + * difference in charge neutrality is dumped into the anion mole number to + * fix the imbalance. * - * @param dx input vector of ion mole fraction gradients - * @param dy output Vector of neutral molecule mole fraction gradients + * @param dx input vector of ion mole fraction gradients + * @param dy output Vector of neutral molecule mole fraction gradients */ void getNeutralMoleculeMoleGrads(const doublereal* const dx, doublereal* const dy) const; @@ -427,17 +298,8 @@ public: virtual void setTemperature(const doublereal t); virtual void setPressure(doublereal p); - - //! Set the temperature (K) and pressure (Pa) - /*! - * Setting the pressure may involve the solution of a nonlinear equation. - * - * @param t Temperature (K) - * @param p Pressure (Pa) - */ virtual void setState_TP(doublereal t, doublereal p); - //! Calculate ion mole fractions from neutral molecule mole fractions. /*! * @param mf Dump the mole fractions into this vector. @@ -446,109 +308,27 @@ public: //! Calculate neutral molecule mole fractions /*! - * This routine calculates the neutral molecule mole - * fraction given the vector of ion mole fractions, - * i.e., the mole fractions from this ThermoPhase. - * Note, this routine basically assumes that there - * is charge neutrality. If there isn't, then it wouldn't - * make much sense. + * This routine calculates the neutral molecule mole fraction given the + * vector of ion mole fractions, i.e., the mole fractions from this + * ThermoPhase. Note, this routine basically assumes that there is charge + * neutrality. If there isn't, then it wouldn't make much sense. * - * for the case of cIonSolnType_SINGLEANION, some slough - * in the charge neutrality is allowed. The cation number - * is followed, while the difference in charge neutrality - * is dumped into the anion mole number to fix the imbalance. + * for the case of cIonSolnType_SINGLEANION, some slough in the charge + * neutrality is allowed. The cation number is followed, while the + * difference in charge neutrality is dumped into the anion mole number to + * fix the imbalance. */ virtual void calcNeutralMoleculeMoleFractions() const; - /** - * Set the mass fractions to the specified values, and then - * normalize them so that they sum to 1.0. - * @param y Array of unnormalized mass fraction values (input). - * Must have a length greater than or equal to the number of - * species. - * - * @param y Input vector of mass fractions. - * Length is m_kk. - */ virtual void setMassFractions(const doublereal* const y); - - /** - * Set the mass fractions to the specified values without - * normalizing. This is useful when the normalization - * condition is being handled by some other means, for example - * by a constraint equation as part of a larger set of - * equations. - * - * @param y Input vector of mass fractions. - * Length is m_kk. - */ virtual void setMassFractions_NoNorm(const doublereal* const y); - - /** - * Set the mole fractions to the specified values, and then - * normalize them so that they sum to 1.0. - * @param x Array of unnormalized mole fraction values (input). - * Must have a length greater than or equal to the number of - * species. - * - * @param x Input vector of mole fractions. - * Length is m_kk. - */ virtual void setMoleFractions(const doublereal* const x); - - /** - * Set the mole fractions to the specified values without - * normalizing. This is useful when the normalization - * condition is being handled by some other means, for example - * by a constraint equation as part of a larger set of - * equations. - * - * @param x Input vector of mole fractions. - * Length is m_kk. - */ virtual void setMoleFractions_NoNorm(const doublereal* const x); - - /** - * Set the concentrations to the specified values within the phase. - * - * @param c The input vector to this routine is in dimensional - * units. For volumetric phases c[k] is the - * concentration of the kth species in kmol/m3. - * For surface phases, c[k] is the concentration - * in kmol/m2. The length of the vector is the number - * of species in the phase. - */ virtual void setConcentrations(const doublereal* const c); //@} - /*! - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase(). - */ virtual void initThermo(); - - /** - * Import and initialize a ThermoPhase object - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ void initThermoXML(XML_Node& phaseNode, const std::string& id); private: @@ -558,28 +338,28 @@ private: //! Update the activity coefficients /*! - * This function will be called to update the internally stored - * natural logarithm of the activity coefficients + * This function will be called to update the internally stored natural + * logarithm of the activity coefficients */ void s_update_lnActCoeff() const; //! Update the temperature derivative of the ln activity coefficients /*! - * This function will be called to update the internally stored - * temperature derivative of the natural logarithm of the activity coefficients + * This function will be called to update the internally stored temperature + * derivative of the natural logarithm of the activity coefficients */ void s_update_dlnActCoeffdT() const; //! Update the change in the ln activity coefficients /*! - * This function will be called to update the internally stored - * change of the natural logarithm of the activity coefficients - * w.r.t a change in state (temp, mole fraction, etc) + * This function will be called to update the internally stored change of + * the natural logarithm of the activity coefficients w.r.t a change in + * state (temp, mole fraction, etc) */ void s_update_dlnActCoeff() const; - //! Update the derivative of the log of the activity coefficients - //! wrt log(mole fraction) + //! Update the derivative of the log of the activity coefficients wrt + //! log(mole fraction) /*! * This function will be called to update the internally stored * derivative of the natural logarithm of the activity coefficients @@ -587,29 +367,29 @@ private: */ void s_update_dlnActCoeff_dlnX_diag() const; - //! Update the derivative of the log of the activity coefficients - //! wrt log(number of moles) - diagonal components + //! Update the derivative of the log of the activity coefficients wrt + //! log(number of moles) - diagonal components /*! - * This function will be called to update the internally stored - * derivative of the natural logarithm of the activity coefficients - * wrt logarithm of the number of moles of given species. + * This function will be called to update the internally stored derivative + * of the natural logarithm of the activity coefficients wrt logarithm of + * the number of moles of given species. */ void s_update_dlnActCoeff_dlnN_diag() const; //! Update the derivative of the log of the activity coefficients - //! wrt log(number of moles) - diagonal components + //! wrt log(number of moles) - diagonal components /*! - * This function will be called to update the internally stored - * derivative of the natural logarithm of the activity coefficients - * wrt logarithm of the number of moles of given species. + * This function will be called to update the internally stored derivative + * of the natural logarithm of the activity coefficients wrt logarithm of + * the number of moles of given species. */ void s_update_dlnActCoeff_dlnN() const; protected: //! Ion solution type /*! - * There is either mixing on the anion, cation, or both lattices. - * There is also a passthrough option + * There is either mixing on the anion, cation, or both lattices. + * There is also a passthrough option * * Defaults to cIonSolnType_SINGLEANION, so that LiKCl can be hardwired */ @@ -617,8 +397,8 @@ protected: //! Number of neutral molecule species /*! - * This is equal to the number of species in the - * neutralMoleculePhase_ ThermoPhase. + * This is equal to the number of species in the neutralMoleculePhase_ + * ThermoPhase. */ size_t numNeutralMoleculeSpecies_; @@ -633,36 +413,33 @@ protected: /*! * fm_neutralMolec_ions[ i + jNeut * m_kk ] * - * This is the number of ions of type i in the neutral - * molecule jNeut. + * This is the number of ions of type i in the neutral molecule jNeut. */ vector_fp fm_neutralMolec_ions_; //! Mapping between ion species and neutral molecule for quick invert. /*! - * fm_invert_ionForNeutral returns vector of int. Each element represents - * an ionic species and stores the value of the corresponding neutral - * molecule + * fm_invert_ionForNeutral returns vector of int. Each element represents an + * ionic species and stores the value of the corresponding neutral molecule * - * For the case of fm_invert_simple_ = true, we assume that there - * is a quick way to invert the formula matrix so that we can - * quickly calculate the neutral molecule mole fraction - * given the ion mole fraction vector. + * For the case of fm_invert_simple_ = true, we assume that there is a quick + * way to invert the formula matrix so that we can quickly calculate the + * neutral molecule mole fraction given the ion mole fraction vector. * - * We assume that for a selected set of ion species, that that - * ion is only in the neutral molecule, jNeut. + * We assume that for a selected set of ion species, that that ion is only + * in the neutral molecule, jNeut. * - * therefore, + * therefore, * - * NeutralMolecMoleFractions_[jNeut] += moleFractions_[i_ion] / fmij; + * NeutralMolecMoleFractions_[jNeut] += moleFractions_[i_ion] / fmij; * - * where fmij is the number of ions in neutral molecule jNeut. + * where fmij is the number of ions in neutral molecule jNeut. * - * Thus, we formulate the neutral molecule mole fraction NeutralMolecMoleFractions_[] - * vector from this association. We further assume that there are - * no other associations. If fm_invert_simple_ is not true, - * then we need to do a formal inversion which takes a great - * deal of time and is not currently implemented. + * Thus, we formulate the neutral molecule mole fraction + * NeutralMolecMoleFractions_[] vector from this association. We further + * assume that there are no other associations. If fm_invert_simple_ is not + * true, then we need to do a formal inversion which takes a great deal of + * time and is not currently implemented. */ std::vector fm_invert_ionForNeutral; @@ -675,11 +452,8 @@ protected: //! List of the species in this ThermoPhase which are anion species std::vector anionList_; - //! List of the species in this ThermoPhase which are passed - //! through to the neutralMoleculePhase ThermoPhase. - /*! - * These have neutral charges. - */ + //! List of the species in this ThermoPhase which are passed through to the + //! neutralMoleculePhase ThermoPhase. These have neutral charges. std::vector passThroughList_; public: @@ -692,7 +466,8 @@ public: private: GibbsExcessVPSSTP* geThermo; - // Temporary vectors that I don't want to allocate every time the function is called + // Temporary vectors that I don't want to allocate every time the function + // is called mutable vector_fp y_; mutable vector_fp dlnActCoeff_NeutralMolecule_; mutable vector_fp dX_NeutralMolecule_; @@ -709,8 +484,8 @@ private: //! Storage vector for the neutral molecule chemical potentials /*! - * This vector is used as a temporary storage area when calculating the ion chemical - * potentials. + * This vector is used as a temporary storage area when calculating the ion + * chemical potentials. * * - Units = Joules/kmol * - Length = numNeutralMoleculeSpecies_ @@ -719,8 +494,8 @@ private: //! Storage vector for the neutral molecule ln activity coefficients /*! - * This vector is used as a temporary storage area when calculating the ion chemical - * potentials and activity coefficients + * This vector is used as a temporary storage area when calculating the ion + * chemical potentials and activity coefficients * * - Units = none * - Length = numNeutralMoleculeSpecies_ @@ -729,25 +504,30 @@ private: //! Storage vector for the neutral molecule d ln activity coefficients dT /*! - * This vector is used as a temporary storage area when calculating the ion derivatives + * This vector is used as a temporary storage area when calculating the ion + * derivatives * * - Units = 1/Kelvin * - Length = numNeutralMoleculeSpecies_ */ mutable vector_fp dlnActCoeffdT_NeutralMolecule_; - //! Storage vector for the neutral molecule d ln activity coefficients dX - diagonal component + //! Storage vector for the neutral molecule d ln activity coefficients dX - + //! diagonal component /*! - * This vector is used as a temporary storage area when calculating the ion derivatives + * This vector is used as a temporary storage area when calculating the ion + * derivatives * * - Units = none * - Length = numNeutralMoleculeSpecies_ */ mutable vector_fp dlnActCoeffdlnX_diag_NeutralMolecule_; - //! Storage vector for the neutral molecule d ln activity coefficients dlnN - diagonal component + //! Storage vector for the neutral molecule d ln activity coefficients dlnN + //! - diagonal component /*! - * This vector is used as a temporary storage area when calculating the ion derivatives + * This vector is used as a temporary storage area when calculating the ion + * derivatives * * - Units = none * - Length = numNeutralMoleculeSpecies_ @@ -756,7 +536,8 @@ private: //! Storage vector for the neutral molecule d ln activity coefficients dlnN /*! - * This vector is used as a temporary storage area when calculating the ion derivatives + * This vector is used as a temporary storage area when calculating the ion + * derivatives * * - Units = none * - Length = numNeutralMoleculeSpecies_ diff --git a/include/cantera/thermo/LatticePhase.h b/include/cantera/thermo/LatticePhase.h index ecd02b918..15383ee75 100644 --- a/include/cantera/thermo/LatticePhase.h +++ b/include/cantera/thermo/LatticePhase.h @@ -1,8 +1,8 @@ /** - * @file LatticePhase.h - * Header for a simple thermodynamics model of a bulk phase derived from ThermoPhase, - * assuming a lattice of solid atoms - * (see \ref thermoprops and class \link Cantera::LatticePhase LatticePhase\endlink). + * @file LatticePhase.h Header for a simple thermodynamics model of a bulk + * phase derived from ThermoPhase, assuming a lattice of solid atoms (see + * \ref thermoprops and class \link Cantera::LatticePhase + * LatticePhase\endlink). */ // Copyright 2005 California Institute of Technology @@ -16,180 +16,180 @@ namespace Cantera { -//! A simple thermodynamic model for a bulk phase, -//! assuming a lattice of solid atoms +//! A simple thermodynamic model for a bulk phase, assuming a lattice of solid +//! atoms /*! - * The bulk consists of a matrix of equivalent sites whose molar density - * does not vary with temperature or pressure. The thermodynamics - * obeys the ideal solution laws. The phase and the pure species phases which - * comprise the standard states of the species are assumed to have - * zero volume expansivity and zero isothermal compressibility. + * The bulk consists of a matrix of equivalent sites whose molar density does + * not vary with temperature or pressure. The thermodynamics obeys the ideal + * solution laws. The phase and the pure species phases which comprise the + * standard states of the species are assumed to have zero volume expansivity + * and zero isothermal compressibility. * - * The density of matrix sites is given by the variable \f$ C_o \f$, - * which has SI units of kmol m-3. + * The density of matrix sites is given by the variable \f$ C_o \f$, which has + * SI units of kmol m-3. * * Specification of Species Standard State Properties * - * It is assumed that the reference state thermodynamics may be - * obtained by a pointer to a populated species thermodynamic property - * manager class (see ThermoPhase::m_spthermo). However, how to relate pressure - * changes to the reference state thermodynamics is within this class. + * It is assumed that the reference state thermodynamics may be obtained by a + * pointer to a populated species thermodynamic property manager class (see + * ThermoPhase::m_spthermo). However, how to relate pressure changes to the + * reference state thermodynamics is within this class. * - * Pressure is defined as an independent variable in this phase. However, it has - * no effect on any quantities, as the molar concentration is a constant. + * Pressure is defined as an independent variable in this phase. However, it has + * no effect on any quantities, as the molar concentration is a constant. * * The standard state enthalpy function is given by the following relation, * which has a weak dependence on the system pressure, \f$P\f$. * - * \f[ - * h^o_k(T,P) = - * h^{ref}_k(T) + \left( \frac{P - P_{ref}}{C_o} \right) - * \f] + * \f[ + * h^o_k(T,P) = + * h^{ref}_k(T) + \left( \frac{P - P_{ref}}{C_o} \right) + * \f] * - * For an incompressible substance, the molar internal energy is - * independent of pressure. Since the thermodynamic properties - * are specified by giving the standard-state enthalpy, the - * term \f$ \frac{P_{ref}}{C_o} \f$ is subtracted from the specified reference molar - * enthalpy to compute the standard state molar internal energy: + * For an incompressible substance, the molar internal energy is independent of + * pressure. Since the thermodynamic properties are specified by giving the + * standard-state enthalpy, the term \f$ \frac{P_{ref}}{C_o} \f$ is subtracted + * from the specified reference molar enthalpy to compute the standard state + * molar internal energy: * - * \f[ - * u^o_k(T,P) = h^{ref}_k(T) - \frac{P_{ref}}{C_o} - * \f] + * \f[ + * u^o_k(T,P) = h^{ref}_k(T) - \frac{P_{ref}}{C_o} + * \f] * - * The standard state heat capacity, internal energy, and entropy are independent - * of pressure. The standard state Gibbs free energy is obtained + * The standard state heat capacity, internal energy, and entropy are + * independent of pressure. The standard state Gibbs free energy is obtained * from the enthalpy and entropy functions. * - * The standard state molar volume is independent of temperature, pressure, - * and species identity: + * The standard state molar volume is independent of temperature, pressure, and + * species identity: * - * \f[ - * V^o_k(T,P) = \frac{1.0}{C_o} - * \f] + * \f[ + * V^o_k(T,P) = \frac{1.0}{C_o} + * \f] * *
*

Specification of Solution Thermodynamic Properties

*
* - * The activity of species \f$ k \f$ defined in the phase, \f$ a_k \f$, is - * given by the ideal solution law: + * The activity of species \f$ k \f$ defined in the phase, \f$ a_k \f$, is given + * by the ideal solution law: * - * \f[ - * a_k = X_k , - * \f] + * \f[ + * a_k = X_k , + * \f] * - * where \f$ X_k \f$ is the mole fraction of species k. - * The chemical potential for species k is equal to + * where \f$ X_k \f$ is the mole fraction of species k. The chemical + * potential for species k is equal to * - * \f[ - * \mu_k(T,P) = \mu^o_k(T, P) + R T \log(X_k) - * \f] + * \f[ + * \mu_k(T,P) = \mu^o_k(T, P) + R T \log(X_k) + * \f] * - * The partial molar entropy for species k is given by the following relation, + * The partial molar entropy for species k is given by the following + * relation, * - * \f[ - * \tilde{s}_k(T,P) = s^o_k(T,P) - R \log(X_k) = s^{ref}_k(T) - R \log(X_k) - * \f] + * \f[ + * \tilde{s}_k(T,P) = s^o_k(T,P) - R \log(X_k) = s^{ref}_k(T) - R \log(X_k) + * \f] * * The partial molar enthalpy for species k is * - * \f[ - * \tilde{h}_k(T,P) = h^o_k(T,P) = h^{ref}_k(T) + \left( \frac{P - P_{ref}}{C_o} \right) - * \f] + * \f[ + * \tilde{h}_k(T,P) = h^o_k(T,P) = h^{ref}_k(T) + \left( \frac{P - P_{ref}}{C_o} \right) + * \f] * * The partial molar Internal Energy for species k is * - * \f[ - * \tilde{u}_k(T,P) = u^o_k(T,P) = u^{ref}_k(T) - * \f] + * \f[ + * \tilde{u}_k(T,P) = u^o_k(T,P) = u^{ref}_k(T) + * \f] * * The partial molar Heat Capacity for species k is * - * \f[ - * \tilde{Cp}_k(T,P) = Cp^o_k(T,P) = Cp^{ref}_k(T) - * \f] + * \f[ + * \tilde{Cp}_k(T,P) = Cp^o_k(T,P) = Cp^{ref}_k(T) + * \f] * - * The partial molar volume is independent of temperature, pressure, - * and species identity: + * The partial molar volume is independent of temperature, pressure, and species + * identity: * - * \f[ - * \tilde{V}_k(T,P) = V^o_k(T,P) = \frac{1.0}{C_o} - * \f] + * \f[ + * \tilde{V}_k(T,P) = V^o_k(T,P) = \frac{1.0}{C_o} + * \f] * - * It is assumed that the reference state thermodynamics may be - * obtained by a pointer to a populated species thermodynamic property - * manager class (see ThermoPhase::m_spthermo). How to relate pressure - * changes to the reference state thermodynamics is resolved at this level. + * It is assumed that the reference state thermodynamics may be obtained by a + * pointer to a populated species thermodynamic property manager class (see + * ThermoPhase::m_spthermo). How to relate pressure changes to the reference + * state thermodynamics is resolved at this level. * - * Pressure is defined as an independent variable in this phase. However, it only - * has a weak dependence on the enthalpy, and doesn't effect the molar - * concentration. + * Pressure is defined as an independent variable in this phase. However, it + * only has a weak dependence on the enthalpy, and doesn't effect the molar + * concentration. * *
*

%Application within Kinetics Managers

*
* - * \f$ C^a_k\f$ are defined such that \f$ C^a_k = a_k = X_k \f$ - * \f$ C^s_k \f$, the standard concentration, is - * defined to be equal to one. \f$ a_k \f$ are activities used in the - * thermodynamic functions. These activity (or generalized) - * concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. - * The activity concentration,\f$ C^a_k \f$, is given by the following expression. + * \f$ C^a_k\f$ are defined such that \f$ C^a_k = a_k = X_k \f$. \f$ C^s_k \f$, + * the standard concentration, is defined to be equal to one. \f$ a_k \f$ are + * activities used in the thermodynamic functions. These activity (or + * generalized) concentrations are used by kinetics manager classes to compute + * the forward and reverse rates of elementary reactions. The activity + * concentration,\f$ C^a_k \f$, is given by the following expression. * - * \f[ - * C^a_k = C^s_k X_k = X_k - * \f] + * \f[ + * C^a_k = C^s_k X_k = X_k + * \f] * * The standard concentration for species k is identically one * - * \f[ - * C^s_k = C^s = 1.0 - * \f] + * \f[ + * C^s_k = C^s = 1.0 + * \f] * - * For example, a bulk-phase binary gas reaction between species j and k, producing - * a new species l would have the - * following equation for its rate of progress variable, \f$ R^1 \f$, which has - * units of kmol m-3 s-1. + * For example, a bulk-phase binary gas reaction between species j and k, + * producing a new species l would have the following equation for its rate of + * progress variable, \f$ R^1 \f$, which has units of kmol m-3 s-1. * - * \f[ + * \f[ * R^1 = k^1 C_j^a C_k^a = k^1 X_j X_k - * \f] + * \f] * - * The reverse rate constant can then be obtained from the law of microscopic reversibility - * and the equilibrium expression for the system. + * The reverse rate constant can then be obtained from the law of microscopic + * reversibility and the equilibrium expression for the system. * - * \f[ - * \frac{X_j X_k}{ X_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} ) - * \f] + * \f[ + * \frac{X_j X_k}{ X_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} ) + * \f] * - * \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, associated with - * the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ and their associated activities, - * \f$ a_l \f$, repeated here: + * \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, + * associated with the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ + * and their associated activities, + * \f$ a_l \f$, repeated here: * - * \f[ - * \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l) - * \f] + * \f[ + * \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l) + * \f] * - * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over - * to activity concentrations. When this is done: + * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by + * changing over to activity concentrations. When this is done: * * \f[ * \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 = * \exp(\frac{\mu^{o}_l - \mu^{o}_j - \mu^{o}_k}{R T} ) * \f] * - * %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$, - * using the second and third part of the above expression as a definition for the concentration - * equilibrium constant. + * %Kinetics managers will calculate the concentration equilibrium constant, \f$ + * K_c \f$, using the second and third part of the above expression as a + * definition for the concentration equilibrium constant. * *
*

Instantiation of the Class

*
* - * The constructor for this phase is located in the default ThermoFactory - * for %Cantera. A new LatticePhase object may be created by the following code snippet: + * The constructor for this phase is located in the default ThermoFactory for + * %Cantera. A new LatticePhase object may be created by the following code + * snippet: * * @code * XML_Node *xc = get_XML_File("O_lattice_SiO2.xml"); @@ -206,14 +206,14 @@ namespace Cantera * LatticePhase *o_lattice = new LatticePhase(*xs); * @endcode * - * The XML file used in this example is listed in the next section + * The XML file used in this example is listed in the next section * *
*

XML Example

*
* - * An example of an XML Element named phase setting up a LatticePhase object named "O_lattice_SiO2" - * is given below. + * An example of an XML Element named phase setting up a LatticePhase object + * named "O_lattice_SiO2" is given below. * * @code * @@ -232,8 +232,8 @@ namespace Cantera * * @endcode * - * The model attribute "Lattice" of the thermo XML element identifies the phase as - * being of the type handled by the LatticePhase object. + * The model attribute "Lattice" of the thermo XML element identifies the phase + * as being of the type handled by the LatticePhase object. * * @ingroup thermoprops */ @@ -243,17 +243,9 @@ public: //! Base Empty constructor LatticePhase(); - //! Copy Constructor - /*! - * @param right Object to be copied - */ LatticePhase(const LatticePhase& right); - - //! Assignment operator - /*! - * @param right Object to be copied - */ LatticePhase& operator=(const LatticePhase& right); + ThermoPhase* duplMyselfAsThermoPhase() const; //! Full constructor for a lattice phase /*! @@ -269,14 +261,6 @@ public: */ LatticePhase(XML_Node& phaseRef, const std::string& id = ""); - //! Duplication function - /*! - * This virtual function is used to create a duplicate of the - * current phase. It's used to duplicate the phase when given - * a ThermoPhase pointer to the phase. - */ - ThermoPhase* duplMyselfAsThermoPhase() const; - //! Equation of state flag. Returns the value cLattice virtual int eosType() const { return cLattice; @@ -293,10 +277,9 @@ public: * \hat h(T,P) = \sum_k X_k \hat h^0_k(T,P), * \f] * - * The standard-state pure-species Enthalpies - * \f$ \hat h^0_k(T,P) \f$ are computed first by the species reference - * state thermodynamic property manager and then a small pressure dependent term is - * added in. + * The standard-state pure-species Enthalpies \f$ \hat h^0_k(T,P) \f$ are + * computed first by the species reference state thermodynamic property + * manager and then a small pressure dependent term is added in. * * \see SpeciesThermo */ @@ -309,10 +292,10 @@ public: * \f[ * \hat s(T, P, X_k) = \sum_k X_k \hat s^0_k(T) - \hat R \sum_k X_k log(X_k) * \f] - * The reference-state pure-species entropies - * \f$ \hat s^0_k(T,p_{ref}) \f$ are computed by the species thermodynamic - * property manager. The pure species entropies are independent of - * pressure since the volume expansivities are equal to zero. + * The reference-state pure-species entropies \f$ \hat s^0_k(T,p_{ref}) \f$ + * are computed by the species thermodynamic property manager. The pure + * species entropies are independent of pressure since the volume + * expansivities are equal to zero. * * Units: J/kmol/K. * @@ -328,10 +311,9 @@ public: * \f[ * \hat c_p(T,P) = \sum_k X_k \hat c^0_{p,k}(T) . * \f] - * The heat capacity is independent of pressure. - * The reference-state pure-species heat capacities - * \f$ \hat c^0_{p,k}(T) \f$ are computed by the species thermodynamic - * property manager. + * The heat capacity is independent of pressure. The reference-state pure- + * species heat capacities \f$ \hat c^0_{p,k}(T) \f$ are computed by the + * species thermodynamic property manager. * * @see SpeciesThermo */ @@ -353,12 +335,11 @@ public: //@} /// @name Mechanical Equation of State Properties /** - * In this equation of state implementation, the density is a - * function only of the mole fractions. Therefore, it can't be - * an independent variable. Instead, the pressure is used as the - * independent variable. Functions which try to set the thermodynamic - * state by calling setDensity() may cause an exception to be - * thrown. + * In this equation of state implementation, the density is a function only + * of the mole fractions. Therefore, it can't be an independent variable. + * Instead, the pressure is used as the independent variable. Functions + * which try to set the thermodynamic state by calling setDensity() may + * cause an exception to be thrown. */ //@{ @@ -371,18 +352,18 @@ public: return m_Pcurrent; } - //! Set the internally stored pressure (Pa) at constant - //! temperature and composition + //! Set the internally stored pressure (Pa) at constant temperature and + //! composition /*! - * This method sets the pressure within the object. - * The mass density is not a function of pressure. + * This method sets the pressure within the object. The mass density is not + * a function of pressure. * * @param p Input Pressure (Pa) */ virtual void setPressure(doublereal p); - //! Calculate the density of the mixture using the partial - //! molar volumes and mole fractions as input + //! Calculate the density of the mixture using the partial molar volumes and + //! mole fractions as input /*! * The formula for this is * @@ -390,78 +371,33 @@ public: * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}} * \f] * - * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are - * the molecular weights, and \f$V_k\f$ are the pure species - * molar volumes. + * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular + * weights, and \f$V_k\f$ are the pure species molar volumes. * - * Note, the basis behind this formula is that in an ideal - * solution the partial molar volumes are equal to the pure - * species molar volumes. We have additionally specified - * in this class that the pure species molar volumes are - * independent of temperature and pressure. + * Note, the basis behind this formula is that in an ideal solution the + * partial molar volumes are equal to the pure species molar volumes. We + * have additionally specified in this class that the pure species molar + * volumes are independent of temperature and pressure. */ doublereal calcDensity(); - //! Set the mole fractions - /*! - * @param x Input vector of mole fractions. - * Length: m_kk. - */ virtual void setMoleFractions(const doublereal* const x); - - //! Set the mole fractions, but don't normalize them to one. - /*! - * @param x Input vector of mole fractions. - * Length: m_kk. - */ virtual void setMoleFractions_NoNorm(const doublereal* const x); - - //! Set the mass fractions, and normalize them to one. - /*! - * @param y Input vector of mass fractions. - * Length: m_kk. - */ virtual void setMassFractions(const doublereal* const y); - - //! Set the mass fractions, but don't normalize them to one - /*! - * @param y Input vector of mass fractions. - * Length: m_kk. - */ virtual void setMassFractions_NoNorm(const doublereal* const y); - - //! Set the concentration, - /*! - * @param c Input vector of concentrations. - * Length: m_kk. - */ virtual void setConcentrations(const doublereal* const c); //@} /// @name Activities, Standard States, and Activity Concentrations /** - * The activity \f$a_k\f$ of a species in solution is - * related to the chemical potential by \f[ \mu_k = \mu_k^0(T) - * + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is - * the chemical potential at unit activity, which depends only - * on temperature and the pressure. - * Activity is assumed to be molality-based here. + * The activity \f$a_k\f$ of a species in solution is related to the + * chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The + * quantity \f$\mu_k^0(T,P)\f$ is the chemical potential at unit activity, + * which depends only on temperature and the pressure. Activity is assumed + * to be molality-based here. */ //@{ - /** - * This method returns an array of generalized concentrations - * \f$ C_k\f$ that are defined such that - * \f$ a_k = C_k / C^0_k, \f$ where \f$ C^0_k \f$ - * is a standard concentration - * defined below. These generalized concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. - * - * @param c Array of generalized concentrations. The - * units depend upon the implementation of the - * reaction rate expressions within the phase. - */ virtual void getActivityConcentrations(doublereal* c) const; //! Return the standard concentration for the kth species @@ -469,14 +405,13 @@ public: * The standard concentration \f$ C^0_k \f$ used to normalize * the activity (i.e., generalized) concentration for use * - * For the time being, we will use the concentration of pure - * solvent for the the standard concentration of all species. - * This has the effect of making mass-action reaction rates - * based on the molality of species proportional to the - * molality of the species. + * For the time being, we will use the concentration of pure solvent for the + * the standard concentration of all species. This has the effect of making + * mass-action reaction rates based on the molality of species proportional + * to the molality of the species. * - * @param k Optional parameter indicating the species. The default - * is to assume this refers to species 0. + * @param k Optional parameter indicating the species. The default is to + * assume this refers to species 0. * @return * Returns the standard Concentration in units of * m3 kmol-1. @@ -484,12 +419,6 @@ public: * @param k Species index */ virtual doublereal standardConcentration(size_t k=0) const; - - //! Returns the natural logarithm of the standard - //! concentration of the kth species - /*! - * @param k Species index - */ virtual doublereal logStandardConc(size_t k=0) const; //! Get the array of non-dimensional activity coefficients at @@ -507,9 +436,9 @@ public: //! Get the species chemical potentials. Units: J/kmol. /*! - * This function returns a vector of chemical potentials of the - * species in solid solution at the current temperature, pressure - * and mole fraction of the solid solution. + * This function returns a vector of chemical potentials of the species in + * solid solution at the current temperature, pressure and mole fraction of + * the solid solution. * * @param mu Output vector of species chemical * potentials. Length: m_kk. Units: J/kmol @@ -521,18 +450,16 @@ public: //@{ /** - * Returns an array of partial molar enthalpies for the species - * in the mixture. - * Units (J/kmol) - * For this phase, the partial molar enthalpies are equal to the - * pure species enthalpies - * \f[ + * Returns an array of partial molar enthalpies for the species in the + * mixture. Units (J/kmol). For this phase, the partial molar enthalpies are + * equal to the pure species enthalpies + * \f[ * \bar h_k(T,P) = \hat h^{ref}_k(T) + (P - P_{ref}) \hat V^0_k * \f] * The reference-state pure-species enthalpies, \f$ \hat h^{ref}_k(T) \f$, - * at the reference pressure,\f$ P_{ref} \f$, - * are computed by the species thermodynamic - * property manager. They are polynomial functions of temperature. + * at the reference pressure,\f$ P_{ref} \f$, are computed by the species + * thermodynamic property manager. They are polynomial functions of + * temperature. * @see SpeciesThermo * * @param hbar Output vector containing partial molar enthalpies. @@ -542,16 +469,16 @@ public: /** * Returns an array of partial molar entropies of the species in the - * solution. Units: J/kmol/K. - * For this phase, the partial molar entropies are equal to the - * pure species entropies plus the ideal solution contribution. - * \f[ + * solution. Units: J/kmol/K. For this phase, the partial molar entropies + * are equal to the pure species entropies plus the ideal solution + * contribution. + * \f[ * \bar s_k(T,P) = \hat s^0_k(T) - R log(X_k) * \f] - * The reference-state pure-species entropies,\f$ \hat s^{ref}_k(T) \f$, - * at the reference pressure, \f$ P_{ref} \f$, are computed by the - * species thermodynamic - * property manager. They are polynomial functions of temperature. + * The reference-state pure-species entropies,\f$ \hat s^{ref}_k(T) \f$, at + * the reference pressure, \f$ P_{ref} \f$, are computed by the species + * thermodynamic property manager. They are polynomial functions of + * temperature. * @see SpeciesThermo * * @param sbar Output vector containing partial molar entropies. @@ -560,126 +487,100 @@ public: virtual void getPartialMolarEntropies(doublereal* sbar) const; /** - * Returns an array of partial molar Heat Capacities at constant - * pressure of the species in the - * solution. Units: J/kmol/K. - * For this phase, the partial molar heat capacities are equal - * to the standard state heat capacities. + * Returns an array of partial molar Heat Capacities at constant pressure of + * the species in the solution. Units: J/kmol/K. For this phase, the partial + * molar heat capacities are equal to the standard state heat capacities. * * @param cpbar Output vector of partial heat capacities. Length: m_kk. */ virtual void getPartialMolarCp(doublereal* cpbar) const; - //! Return an array of partial molar volumes for the - //! species in the mixture. Units: m^3/kmol. - /*! - * @param vbar Output vector of species partial molar volumes. - * Length = m_kk. units are m^3/kmol. - */ virtual void getPartialMolarVolumes(doublereal* vbar) const; - - //! Get the array of chemical potentials at unit activity for the - //! species standard states at the current T and P of the solution. - /*! - * These are the standard state chemical potentials \f$ \mu^0_k(T,P) - * \f$. The values are evaluated at the current - * temperature and pressure of the solution - * - * @param mu Output vector of chemical potentials. - * Length: m_kk. - */ virtual void getStandardChemPotentials(doublereal* mu) const; - - //! Get the Gibbs functions for the standard - //! state of the species at the current T and P of the solution - /*! - * Units are Joules/kmol - * @param gpure Output vector of standard state Gibbs free energies - * Length: m_kk. - */ virtual void getPureGibbs(doublereal* gpure) const; //@} /// @name Properties of the Standard State of the Species in the Solution //@{ - //! Get the nondimensional Enthalpy functions for the species standard states - //! at their standard states at the current T and P of the solution. + //! Get the nondimensional Enthalpy functions for the species standard + //! states at their standard states at the current T and P of + //! the solution. /*! - * A small pressure dependent term is added onto the reference state enthalpy - * to get the pressure dependence of this term. + * A small pressure dependent term is added onto the reference state enthalpy + * to get the pressure dependence of this term. * - * \f[ - * h^o_k(T,P) = h^{ref}_k(T) + \left( \frac{P - P_{ref}}{C_o} \right) - * \f] + * \f[ + * h^o_k(T,P) = h^{ref}_k(T) + \left( \frac{P - P_{ref}}{C_o} \right) + * \f] * - * The reference state thermodynamics is - * obtained by a pointer to a populated species thermodynamic property - * manager class (see ThermoPhase::m_spthermo). How to relate pressure - * changes to the reference state thermodynamics is resolved at this level. + * The reference state thermodynamics is obtained by a pointer to a + * populated species thermodynamic property manager class (see + * ThermoPhase::m_spthermo). How to relate pressure changes to the reference + * state thermodynamics is resolved at this level. * * @param hrt Output vector of nondimensional standard state enthalpies. * Length: m_kk. */ virtual void getEnthalpy_RT(doublereal* hrt) const; - //! Get the array of nondimensional Entropy functions for the - //! species standard states at the current T and P of the solution. + //! Get the array of nondimensional Entropy functions for the species + //! standard states at the current T and P of the solution. /*! - * The entropy of the standard state is defined as independent of - * pressure here. + * The entropy of the standard state is defined as independent of + * pressure here. * - * \f[ - * s^o_k(T,P) = s^{ref}_k(T) - * \f] + * \f[ + * s^o_k(T,P) = s^{ref}_k(T) + * \f] * - * The reference state thermodynamics is - * obtained by a pointer to a populated species thermodynamic property - * manager class (see ThermoPhase::m_spthermo). How to relate pressure - * changes to the reference state thermodynamics is resolved at this level. + * The reference state thermodynamics is obtained by a pointer to a + * populated species thermodynamic property manager class (see + * ThermoPhase::m_spthermo). How to relate pressure changes to the reference + * state thermodynamics is resolved at this level. * * @param sr Output vector of nondimensional standard state entropies. * Length: m_kk. */ virtual void getEntropy_R(doublereal* sr) const; - //! Get the nondimensional Gibbs functions for the species - //! standard states at the current T and P of the solution. + //! Get the nondimensional Gibbs functions for the species standard states + //! at the current T and P of the solution. /*! - * The standard Gibbs free energies are obtained from the enthalpy - * and entropy formulation. + * The standard Gibbs free energies are obtained from the enthalpy and + * entropy formulation. * - * \f[ - * g^o_k(T,P) = h^{o}_k(T,P) - T s^{o}_k(T,P) - * \f] + * \f[ + * g^o_k(T,P) = h^{o}_k(T,P) - T s^{o}_k(T,P) + * \f] * - * @param grt Output vector of nondimensional standard state Gibbs free energies - * Length: m_kk. + * @param grt Output vector of nondimensional standard state Gibbs free + * energies. Length: m_kk. */ virtual void getGibbs_RT(doublereal* grt) const; - //! Get the nondimensional Heat Capacities at constant - //! pressure for the species standard states - //! at the current T and P of the solution + //! Get the nondimensional Heat Capacities at constant pressure for the + //! species standard states at the current T and P of the + //! solution /*! - * The heat capacity of the standard state is independent of pressure + * The heat capacity of the standard state is independent of pressure * - * \f[ - * Cp^o_k(T,P) = Cp^{ref}_k(T) - * \f] + * \f[ + * Cp^o_k(T,P) = Cp^{ref}_k(T) + * \f] * - * The reference state thermodynamics is - * obtained by a pointer to a populated species thermodynamic property - * manager class (see ThermoPhase::m_spthermo). How to relate pressure - * changes to the reference state thermodynamics is resolved at this level. + * The reference state thermodynamics is obtained by a pointer to a + * populated species thermodynamic property manager class (see + * ThermoPhase::m_spthermo). How to relate pressure changes to the reference + * state thermodynamics is resolved at this level. * - * @param cpr Output vector of nondimensional standard state heat capacities - * Length: m_kk. + * @param cpr Output vector of nondimensional standard state heat + * capacities. Length: m_kk. */ virtual void getCp_R(doublereal* cpr) const; - //! Get the molar volumes of the species standard states at the current - //! T and P of the solution. + //! Get the molar volumes of the species standard states at the current + //! T and P of the solution. /*! * units = m^3 / kmol * @@ -692,40 +593,17 @@ public: /// @name Thermodynamic Values for the Species Reference States //@{ - //! Returns the vector of nondimensional - //! Enthalpies of the reference state at the current temperature - //! of the solution and the reference pressure for the phase. - /*! - * @return Output vector of nondimensional reference state - * Enthalpies of the species. - * Length: m_kk - */ const vector_fp& enthalpy_RT_ref() const; - //! Returns a reference to the dimensionless reference state Gibbs free energy vector. + //! Returns a reference to the dimensionless reference state Gibbs free + //! energy vector. /*! * This function is part of the layer that checks/recalculates the reference * state thermo functions. */ const vector_fp& gibbs_RT_ref() const; - //! Returns the vector of nondimensional - //! Gibbs Free Energies of the reference state at the current temperature - //! of the solution and the reference pressure for the species. - /*! - * @param grt Output vector containing the nondimensional reference state - * Gibbs Free energies. Length: m_kk. - */ virtual void getGibbs_RT_ref(doublereal* grt) const; - - //! Returns the vector of the Gibbs function of the reference state at the current temperature - //! of the solution and the reference pressure for the species. - /*! - * units = J/kmol - * - * @param g Output vector containing the reference state - * Gibbs Free energies. Length: m_kk. Units: J/kmol. - */ virtual void getGibbs_ref(doublereal* g) const; //! Returns a reference to the dimensionless reference state Entropy vector. @@ -735,7 +613,8 @@ public: */ const vector_fp& entropy_R_ref() const; - //! Returns a reference to the dimensionless reference state Heat Capacity vector. + //! Returns a reference to the dimensionless reference state Heat Capacity + //! vector. /*! * This function is part of the layer that checks/recalculates the reference * state thermo functions. @@ -746,44 +625,7 @@ public: /// @name Utilities for Initialization of the Object //@{ - //! Initialize the ThermoPhase object after all species have been set up - /*! - * @internal Initialize. - * - * This method performs any initialization required after all - * species have been added. For example, it is used to - * resize internal work arrays that must have an entry for - * each species. - * This method is called from ThermoPhase::initThermoXML(), - * which is called from importPhase(), - * just prior to returning from the function, importPhase(). - */ virtual void initThermo(); - - //! Import and initialize a ThermoPhase object using an XML tree. - /*! - * Here we read extra information about the XML description - * of a phase. Regular information about elements and species - * and their reference state thermodynamic information - * have already been read at this point. - * For example, we do not need to call this function for - * ideal gas equations of state. - * This function is called from importPhase() - * after the elements and the - * species are initialized with default ideal solution - * level data. - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); //! Set the equation of state parameters from the argument list @@ -818,8 +660,8 @@ public: * model. Note, this method is called before the phase is * initialized with elements and/or species. * - * For this phase, the molar density of the phase is specified in this block, - * and is a required parameter. + * For this phase, the molar density of the phase is specified in this + * block, and is a required parameter. * * @param eosdata An XML_Node object corresponding to * the "thermo" entry for this phase in the input file. @@ -844,10 +686,10 @@ protected: //! The current pressure /*! - * Since the density isn't a function of pressure, but only of the - * mole fractions, we need to independently specify the pressure. - * The density variable which is inherited as part of the State class, - * m_dens, is always kept current whenever T, P, or X[] change. + * Since the density isn't a function of pressure, but only of the mole + * fractions, we need to independently specify the pressure. The density + * variable which is inherited as part of the State class, m_dens, is always + * kept current whenever T, P, or X[] change. */ doublereal m_Pcurrent; @@ -860,7 +702,8 @@ protected: //! Temporary storage for the reference state Gibbs energies mutable vector_fp m_g0_RT; - //! Temporary storage for the reference state entropies at the current temperature + //! Temporary storage for the reference state entropies at the current + //! temperature mutable vector_fp m_s0_R; //! String name for the species which represents a vacancy in the lattice @@ -886,8 +729,8 @@ protected: private: //! Update the species reference state thermodynamic functions /*! - * The polynomials for the standard state functions are only - * reevaluated if the temperature has changed. + * The polynomials for the standard state functions are only reevaluated if + * the temperature has changed. */ void _updateThermo() const; }; diff --git a/include/cantera/thermo/LatticeSolidPhase.h b/include/cantera/thermo/LatticeSolidPhase.h index 9659d6218..41e354296 100644 --- a/include/cantera/thermo/LatticeSolidPhase.h +++ b/include/cantera/thermo/LatticeSolidPhase.h @@ -1,9 +1,8 @@ /** - * @file LatticeSolidPhase.h - * Header for a simple thermodynamics model of a bulk solid phase - * derived from ThermoPhase, - * assuming an ideal solution model based on a lattice of solid atoms - * (see \ref thermoprops and class \link Cantera::LatticeSolidPhase LatticeSolidPhase\endlink). + * @file LatticeSolidPhase.h Header for a simple thermodynamics model of a bulk + * solid phase derived from ThermoPhase, assuming an ideal solution model + * based on a lattice of solid atoms (see \ref thermoprops and class \link + * Cantera::LatticeSolidPhase LatticeSolidPhase\endlink). */ // Copyright 2005 California Institute of Technology @@ -17,85 +16,96 @@ namespace Cantera { -//! A phase that is comprised of a fixed additive combination of other lattice phases +//! A phase that is comprised of a fixed additive combination of other lattice +//! phases /*! - * This is the main way %Cantera describes semiconductors and other solid phases. - * This ThermoPhase object calculates its properties as a sum over other LatticePhase objects. Each of the LatticePhase - * objects is a ThermoPhase object by itself. + * This is the main way %Cantera describes semiconductors and other solid + * phases. This ThermoPhase object calculates its properties as a sum over other + * LatticePhase objects. Each of the LatticePhase objects is a ThermoPhase + * object by itself. * - * The results from this LatticeSolidPhase model reduces to the LatticePhase model when there is one - * lattice phase and the molar densities of the sublattice and the molar density within the LatticeSolidPhase - * have the same values. + * The results from this LatticeSolidPhase model reduces to the LatticePhase + * model when there is one lattice phase and the molar densities of the + * sublattice and the molar density within the LatticeSolidPhase have the same + * values. * - * The mole fraction vector is redefined witin the the LatticeSolidPhase object. Each of the mole - * fractions sum to one on each of the sublattices. The routine getMoleFraction() and setMoleFraction() - * have been redefined to use this convention. + * The mole fraction vector is redefined witin the the LatticeSolidPhase object. + * Each of the mole fractions sum to one on each of the sublattices. The + * routine getMoleFraction() and setMoleFraction() have been redefined to use + * this convention. * *
*

Specification of Species Standard State Properties

*
* - * The standard state properties are calculated in the normal way for each of the sublattices. The normal way - * here means that a thermodynamic polynomial in temperature is developed. Also, a constant volume approximation - * for the pressure dependence is assumed. All of these properties are on a Joules per kmol of sublattice - * constituent basis. + * The standard state properties are calculated in the normal way for each of + * the sublattices. The normal way here means that a thermodynamic polynomial in + * temperature is developed. Also, a constant volume approximation for the + * pressure dependence is assumed. All of these properties are on a Joules per + * kmol of sublattice constituent basis. * *
*

Specification of Solution Thermodynamic Properties

*
- - * The sum over the LatticePhase objects is carried out by weighting each LatticePhase object - * value with the molar density (kmol m-3) of its LatticePhase. Then the resulting quantity is divided by - * the molar density of the total compound. The LatticeSolidPhase object therefore only contains a - * listing of the number of LatticePhase object - * that comprises the solid, and it contains a value for the molar density of the entire mixture. - * This is the same thing as saying that * - * \f[ - * L_i = L^{solid} \theta_i - * \f] + * The sum over the LatticePhase objects is carried out by weighting each + * LatticePhase object value with the molar density (kmol m-3) of its + * LatticePhase. Then the resulting quantity is divided by the molar density of + * the total compound. The LatticeSolidPhase object therefore only contains a + * listing of the number of LatticePhase object that comprises the solid, and it + * contains a value for the molar density of the entire mixture. This is the + * same thing as saying that * - * \f$ L_i \f$ is the molar volume of the ith lattice. \f$ L^{solid} \f$ is the molar volume of the entire - * solid. \f$ \theta_i \f$ is a fixed weighting factor for the ith lattice representing the lattice - * stoichiometric coefficient. For this object the \f$ \theta_i \f$ values are fixed. + * \f[ + * L_i = L^{solid} \theta_i + * \f] * - * Let's take FeS2 as an example, which may be thought of as a combination of two lattices: Fe and S lattice. - * The Fe sublattice has a molar density of 1 gmol cm-3. The S sublattice has a molar density of 2 gmol cm-3. - * We then define the LatticeSolidPhase object as having a nominal composition of FeS2, and having a - * molar density of 1 gmol cm-3. All quantities pertaining to the FeS2 compound will be have weights - * associated with the sublattices. The Fe sublattice will have a weight of 1.0 associated with it. The - * S sublattice will have a weight of 2.0 associated with it. + * \f$ L_i \f$ is the molar volume of the ith lattice. \f$ L^{solid} \f$ is the + * molar volume of the entire solid. \f$ \theta_i \f$ is a fixed weighting + * factor for the ith lattice representing the lattice stoichiometric + * coefficient. For this object the \f$ \theta_i \f$ values are fixed. + * + * Let's take FeS2 as an example, which may be thought of as a combination of + * two lattices: Fe and S lattice. The Fe sublattice has a molar density of 1 + * gmol cm-3. The S sublattice has a molar density of 2 gmol cm-3. We then + * define the LatticeSolidPhase object as having a nominal composition of FeS2, + * and having a molar density of 1 gmol cm-3. All quantities pertaining to the + * FeS2 compound will be have weights associated with the sublattices. The Fe + * sublattice will have a weight of 1.0 associated with it. The S sublattice + * will have a weight of 2.0 associated with it. * *
*

Specification of Solution Density Properties

*
* - * Currently, molar density is not a constant within the object, even though the species molar volumes are a - * constant. The basic idea is that a swelling of one of the sublattices will result in a swelling of - * of all of the lattices. Therefore, the molar volumes of the individual lattices are not independent of - * one another. + * Currently, molar density is not a constant within the object, even though the + * species molar volumes are a constant. The basic idea is that a swelling of + * one of the sublattices will result in a swelling of of all of the lattices. + * Therefore, the molar volumes of the individual lattices are not independent + * of one another. * - * The molar volume of the Lattice solid is calculated from the following formula + * The molar volume of the Lattice solid is calculated from the following + * formula * * \f[ * V = \sum_i{ \theta_i V_i^{lattice}} * \f] * - * where \f$ V_i^{lattice} \f$ is the molar volume of the ith sublattice. This is calculated from the - * following standard formula. + * where \f$ V_i^{lattice} \f$ is the molar volume of the ith sublattice. This + * is calculated from the following standard formula. * + * \f[ + * V_i = \sum_k{ X_k V_k} + * \f] * - * \f[ - * V_i = \sum_k{ X_k V_k} - * \f] + * where k is a species in the ith sublattice. * - * where k is a species in the ith sublattice. + * The mole fraction vector is redefined witin the the LatticeSolidPhase object. + * Each of the mole fractions sum to one on each of the sublattices. The + * routine getMoleFraction() and setMoleFraction() have been redefined to use + * this convention. * - * The mole fraction vector is redefined witin the the LatticeSolidPhase object. Each of the mole - * fractions sum to one on each of the sublattices. The routine getMoleFraction() and setMoleFraction() - * have been redefined to use this convention. - * - * (This object is still under construction) + * (This object is still under construction) */ class LatticeSolidPhase : public ThermoPhase { @@ -103,29 +113,9 @@ public: //! Base empty constructor LatticeSolidPhase(); - //! Copy Constructor - /*! - * @param right Object to be copied - */ LatticeSolidPhase(const LatticeSolidPhase& right); - - //! Assignment operator - /*! - * @param right Object to be copied - */ LatticeSolidPhase& operator=(const LatticeSolidPhase& right); - - //! Destructor virtual ~LatticeSolidPhase(); - - //! Duplication function - /*! - * This virtual function is used to create a duplicate of the - * current phase. It's used to duplicate the phase when given - * a ThermoPhase pointer to the phase. - * - * @return It returns a ThermoPhase pointer. - */ ThermoPhase* duplMyselfAsThermoPhase() const; //! Equation of state type flag. @@ -136,41 +126,13 @@ public: return cLatticeSolid; } - //! Minimum temperature for which the thermodynamic data for the species - //! or phase are valid. - /*! - * If no argument is supplied, the - * value returned will be the lowest temperature at which the - * data for \e all species are valid. Otherwise, the value - * will be only for species \a k. This function is a wrapper - * that calls the species thermo minTemp function. - * - * @param k index of the species. Default is -1, which will return the max of the min value - * over all species. - */ virtual doublereal minTemp(size_t k = npos) const; - - //! Maximum temperature for which the thermodynamic data for the species - //! are valid. - /*! - * If no argument is supplied, the - * value returned will be the highest temperature at which the - * data for \e all species are valid. Otherwise, the value - * will be only for species \a k. This function is a wrapper - * that calls the species thermo maxTemp function. - * - * @param k index of the species. Default is -1, which will return the min of the max value - * over all species. - */ virtual doublereal maxTemp(size_t k = npos) const; - - //! Returns the reference pressure in Pa. This function is a wrapper - //! that calls the species thermo refPressure function. virtual doublereal refPressure() const; - //! This method returns the convention used in specification - //! of the standard state, of which there are currently two, - //! temperature based, and variable pressure based. + //! This method returns the convention used in specification of the standard + //! state, of which there are currently two, temperature based, and variable + //! pressure based. /*! * All of the thermo is determined by slave ThermoPhase routines. */ @@ -180,8 +142,8 @@ public: //! Return the Molar Enthalpy. Units: J/kmol. /*! - * The molar enthalpy is determined by the following formula, where \f$ \theta_n \f$ is the - * lattice stoichiometric coefficient of the nth lattice + * The molar enthalpy is determined by the following formula, where \f$ + * \theta_n \f$ is the lattice stoichiometric coefficient of the nth lattice * * \f[ * \tilde h(T,P) = {\sum_n \theta_n \tilde h_n(T,P) } @@ -195,14 +157,15 @@ public: //! Return the Molar Internal Energy. Units: J/kmol. /*! - * The molar enthalpy is determined by the following formula, where \f$ \theta_n \f$ is the - * lattice stoichiometric coefficient of the nth lattice + * The molar enthalpy is determined by the following formula, where \f$ + * \theta_n \f$ is the lattice stoichiometric coefficient of the nth lattice * * \f[ * \tilde u(T,P) = {\sum_n \theta_n \tilde u_n(T,P) } * \f] * - * \f$ \tilde u_n(T,P) \f$ is the internal energy of the nth lattice. + * \f$ \tilde u_n(T,P) \f$ is the internal energy of the nth + * lattice. * * units J/kmol */ @@ -210,8 +173,8 @@ public: //! Return the Molar Entropy. Units: J/kmol/K. /*! - * The molar enthalpy is determined by the following formula, where \f$ \theta_n \f$ is the - * lattice stoichiometric coefficient of the nth lattice + * The molar enthalpy is determined by the following formula, where \f$ + * \theta_n \f$ is the lattice stoichiometric coefficient of the nth lattice * * \f[ * \tilde s(T,P) = \sum_n \theta_n \tilde s_n(T,P) @@ -225,8 +188,9 @@ public: //! Return the Molar Gibbs energy. Units: J/kmol. /*! - * The molar Gibbs free energy is determined by the following formula, where \f$ \theta_n \f$ is the - * lattice stoichiometric coefficient of the nth lattice + * The molar Gibbs free energy is determined by the following formula, where + * \f$ \theta_n \f$ is the lattice stoichiometric coefficient of the nth + * lattice * * \f[ * \tilde h(T,P) = {\sum_n \theta_n \tilde h_n(T,P) } @@ -240,9 +204,9 @@ public: //! Return the constant pressure heat capacity. Units: J/kmol/K /*! - * The molar constant pressure heat capacity is determined by the following formula, where \f$ C_n \f$ is the - * lattice molar density of the nth lattice, and \f$ C_T \f$ is the molar density - * of the solid compound. + * The molar constant pressure heat capacity is determined by the following + * formula, where \f$ C_n \f$ is the lattice molar density of the nth + * lattice, and \f$ C_T \f$ is the molar density of the solid compound. * * \f[ * \tilde c_{p,n}(T,P) = \frac{\sum_n C_n \tilde c_{p,n}(T,P) }{C_T}, @@ -256,9 +220,9 @@ public: //! Return the constant volume heat capacity. Units: J/kmol/K /*! - * The molar constant volume heat capacity is determined by the following formula, where \f$ C_n \f$ is the - * lattice molar density of the nth lattice, and \f$ C_T \f$ is the molar density - * of the solid compound. + * The molar constant volume heat capacity is determined by the following + * formula, where \f$ C_n \f$ is the lattice molar density of the nth + * lattice, and \f$ C_T \f$ is the molar density of the solid compound. * * \f[ * \tilde c_{v,n}(T,P) = \frac{\sum_n C_n \tilde c_{v,n}(T,P) }{C_T}, @@ -282,7 +246,6 @@ public: //! Set the pressure at constant temperature. Units: Pa. /*! - * * @param p Pressure (units - Pa) */ virtual void setPressure(doublereal p); @@ -299,86 +262,47 @@ public: */ doublereal calcDensity(); - //! Set the mole fractions to the specified values, and then - //! normalize them so that they sum to 1.0 for each of the subphases + //! Set the mole fractions to the specified values, and then normalize them + //! so that they sum to 1.0 for each of the subphases /*! - * On input, the mole fraction vector is assumed to sum to one for each of the sublattices. The sublattices - * are updated with this mole fraction vector. The mole fractions are also stored within this object, after - * they are normalized to one by dividing by the number of sublattices. + * On input, the mole fraction vector is assumed to sum to one for each of + * the sublattices. The sublattices are updated with this mole fraction + * vector. The mole fractions are also stored within this object, after they + * are normalized to one by dividing by the number of sublattices. * - * @param x Input vector of mole fractions. There is no restriction - * on the sum of the mole fraction vector. Internally, - * this object will pass portions of this vector to the sublattices which assume that the portions - * individually sum to one. - * Length is m_kk. + * @param x Input vector of mole fractions. There is no restriction on the + * sum of the mole fraction vector. Internally, this object will + * pass portions of this vector to the sublattices which assume + * that the portions individually sum to one. Length is m_kk. */ virtual void setMoleFractions(const doublereal* const x); //! Get the species mole fraction vector. /*! - * On output the mole fraction vector will sum to one for each of the subphases which make up this phase. + * On output the mole fraction vector will sum to one for each of the + * subphases which make up this phase. * - * @param x On return, x contains the mole fractions. Must have a - * length greater than or equal to the number of species. + * @param x On return, x contains the mole fractions. Must have a length + * greater than or equal to the number of species. */ virtual void getMoleFractions(doublereal* const x) const; - //! The mole fraction of species k. - /*! - * If k is outside the valid - * range, an exception will be thrown. Note that it is - * somewhat more efficient to call getMoleFractions if the - * mole fractions of all species are desired. - * @param k species index - */ doublereal moleFraction(const int k) const { throw NotImplementedError("LatticeSolidPhase::moleFraction"); } - //! Get the species mass fractions. - /*! - * @param y On return, y contains the mass fractions. Array \a y must have a length - * greater than or equal to the number of species. - */ void getMassFractions(doublereal* const y) const { throw NotImplementedError("LatticeSolidPhase::getMassFractions"); } - //! Mass fraction of species k. - /*! - * If k is outside the valid range, an exception will be thrown. Note that it is - * somewhat more efficient to call getMassFractions if the mass fractions of all species are desired. - * - * @param k species index - */ doublereal massFraction(const int k) const { throw NotImplementedError("LatticeSolidPhase::massFraction"); } - //! Set the mass fractions to the specified values, and then - //! normalize them so that they sum to 1.0. - /*! - * @param y Array of unnormalized mass fraction values (input). - * Must have a length greater than or equal to the number of species. - * Input vector of mass fractions. There is no restriction - * on the sum of the mass fraction vector. Internally, - * the State object will normalize this vector before - * storing its contents. - * Length is m_kk. - */ virtual void setMassFractions(const doublereal* const y) { throw NotImplementedError("LatticeSolidPhase::setMassFractions"); } - //! Set the mass fractions to the specified values without normalizing. - /*! - * This is useful when the normalization - * condition is being handled by some other means, for example - * by a constraint equation as part of a larger set of equations. - * - * @param y Input vector of mass fractions. - * Length is m_kk. - */ virtual void setMassFractions_NoNorm(const doublereal* const y) { throw NotImplementedError("LatticeSolidPhase::setMassFractions_NoNorm"); } @@ -395,58 +319,36 @@ public: throw NotImplementedError("LatticeSolidPhase::setConcentrations"); } - //! This method returns an array of generalized activity concentrations - /*! - * The generalized activity concentrations, - * \f$ C^a_k \f$, are defined such that \f$ a_k = C^a_k / - * C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration - * defined below and \f$ a_k \f$ are activities used in the - * thermodynamic functions. These activity (or generalized) - * concentrations are used by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. Note that they may - * or may not have units of concentration --- they might be - * partial pressures, mole fractions, or surface coverages, - * for example. - * - * @param c Output array of generalized concentrations. The - * units depend upon the implementation of the - * reaction rate expressions within the phase. - */ virtual void getActivityConcentrations(doublereal* c) const; - //! Get the array of non-dimensional molar-based activity coefficients at - //! the current solution temperature, pressure, and solution concentration. - /*! - * @param ac Output vector of activity coefficients. Length: m_kk. - */ virtual void getActivityCoefficients(doublereal* ac) const; //! Get the species chemical potentials. Units: J/kmol. /*! - * This function returns a vector of chemical potentials of the - * species in solution at the current temperature, pressure - * and mole fraction of the solution. + * This function returns a vector of chemical potentials of the species in + * solution at the current temperature, pressure and mole fraction of the + * solution. * - * This returns the underlying lattice chemical potentials, as the units are kmol-1 of - * the sublattice species. + * This returns the underlying lattice chemical potentials, as the units are + * kmol-1 of the sublattice species. * - * @param mu Output vector of species chemical - * potentials. Length: m_kk. Units: J/kmol + * @param mu Output vector of species chemical potentials. Length: m_kk. + * Units: J/kmol */ virtual void getChemPotentials(doublereal* mu) const; - //! Returns an array of partial molar enthalpies for the species in the mixture. + //! Returns an array of partial molar enthalpies for the species in the + //! mixture. /*! - * Units (J/kmol) - * For this phase, the partial molar enthalpies are equal to the - * pure species enthalpies + * Units (J/kmol). For this phase, the partial molar enthalpies are equal to + * the pure species enthalpies * \f[ * \bar h_k(T,P) = \hat h^{ref}_k(T) + (P - P_{ref}) \hat V^0_k * \f] * The reference-state pure-species enthalpies, \f$ \hat h^{ref}_k(T) \f$, - * at the reference pressure,\f$ P_{ref} \f$, - * are computed by the species thermodynamic - * property manager. They are polynomial functions of temperature. + * at the reference pressure,\f$ P_{ref} \f$, are computed by the species + * thermodynamic property manager. They are polynomial functions of + * temperature. * @see SpeciesThermo * * @param hbar Output vector containing partial molar enthalpies. @@ -456,16 +358,16 @@ public: /** * Returns an array of partial molar entropies of the species in the - * solution. Units: J/kmol/K. - * For this phase, the partial molar entropies are equal to the - * pure species entropies plus the ideal solution contribution. + * solution. Units: J/kmol/K. For this phase, the partial molar entropies + * are equal to the pure species entropies plus the ideal solution + * contribution. * \f[ * \bar s_k(T,P) = \hat s^0_k(T) - R log(X_k) * \f] - * The reference-state pure-species entropies,\f$ \hat s^{ref}_k(T) \f$, - * at the reference pressure, \f$ P_{ref} \f$, are computed by the - * species thermodynamic - * property manager. They are polynomial functions of temperature. + * The reference-state pure-species entropies,\f$ \hat s^{ref}_k(T) \f$, at + * the reference pressure, \f$ P_{ref} \f$, are computed by the species + * thermodynamic property manager. They are polynomial functions of + * temperature. * @see SpeciesThermo * * @param sbar Output vector containing partial molar entropies. @@ -474,113 +376,51 @@ public: virtual void getPartialMolarEntropies(doublereal* sbar) const; /** - * Returns an array of partial molar Heat Capacities at constant - * pressure of the species in the - * solution. Units: J/kmol/K. - * For this phase, the partial molar heat capacities are equal - * to the standard state heat capacities. + * Returns an array of partial molar Heat Capacities at constant pressure of + * the species in the solution. Units: J/kmol/K. For this phase, the partial + * molar heat capacities are equal to the standard state heat capacities. * * @param cpbar Output vector of partial heat capacities. Length: m_kk. */ virtual void getPartialMolarCp(doublereal* cpbar) const; /** - * returns an array of partial molar volumes of the species - * in the solution. Units: m^3 kmol-1. + * returns an array of partial molar volumes of the species in the solution. + * Units: m^3 kmol-1. * - * For this solution, thepartial molar volumes are equal to the - * constant species molar volumes. + * For this solution, thepartial molar volumes are equal to the constant + * species molar volumes. * * @param vbar Output vector of partial molar volumes. Length: m_kk. */ virtual void getPartialMolarVolumes(doublereal* vbar) const; - //! Get the array of standard state chemical potentials at unit activity for the species - //! at their standard states at the current T and P of the solution. + //! Get the array of standard state chemical potentials at unit activity for + //! the species at their standard states at the current T and + //! P of the solution. /*! - * These are the standard state chemical potentials \f$ \mu^0_k(T,P) - * \f$. The values are evaluated at the current - * temperature and pressure of the solution. + * These are the standard state chemical potentials \f$ \mu^0_k(T,P) \f$. + * The values are evaluated at the current temperature and pressure of the + * solution. * - * This returns the underlying lattice standard chemical potentials, as the units are kmol-1 of - * the sublattice species. + * This returns the underlying lattice standard chemical potentials, as the + * units are kmol-1 of the sublattice species. * * @param mu0 Output vector of chemical potentials. - * Length: m_kk. Units: J/kmol + * Length: m_kk. Units: J/kmol */ virtual void getStandardChemPotentials(doublereal* mu0) const; - //! Return the standard concentration for the kth species - /*! - * The standard concentration \f$ C^0_k \f$ used to normalize - * the activity (i.e., generalized) concentration. In many cases, this quantity - * will be the same for all species in a phase - for example, - * for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this - * reason, this method returns a single value, instead of an - * array. However, for phases in which the standard - * concentration is species-specific (e.g. surface species of - * different sizes), this method may be called with an - * optional parameter indicating the species. - * - * @param k Optional parameter indicating the species. The default - * is to assume this refers to species 0. - * @return - * Returns the standard concentration. The units are by definition - * dependent on the ThermoPhase and kinetics manager representation. - */ virtual doublereal standardConcentration(size_t k=0) const; - - //! Natural logarithm of the standard concentration of the kth species. - /*! - * @param k index of the species (defaults to zero) - */ virtual doublereal logStandardConc(size_t k=0) const; + //@} /// @name Thermodynamic Values for the Species Reference States //@{ - //! Returns the vector of nondimensional enthalpies of the reference state at the current - //! temperature of the solution and the reference pressure for the species. - /*! - * This function fills in its one entry in hrt[] by calling - * the underlying species thermo function for the - * dimensionless Gibbs free energy, calculated from the - * dimensionless enthalpy and entropy. - * - * @param grt Vector of dimensionless Gibbs free energies of the reference state - * length = m_kk - */ virtual void getGibbs_RT_ref(doublereal* grt) const; - - //! Returns the vector of the Gibbs function of the reference state at the current - //! temperatureof the solution and the reference pressure for the species. - /*! - * units = J/kmol - * - * This function fills in its one entry in g[] by calling the underlying species thermo - * functions for the Gibbs free energy, calculated from enthalpy and the - * entropy, and the multiplying by RT. - * - * @param g Vector of Gibbs free energies of the reference state. - * length = m_kk - */ virtual void getGibbs_ref(doublereal* g) const; - //! Initialize the ThermoPhase object after all species have been set up - /*! - * @internal Initialize. - * - * This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called from ThermoPhase::initThermoXML(), - * which is called from importPhase(), - * just prior to returning from function importPhase(). - */ virtual void initThermo(); //! Initialize vectors that depend on the number of species and sublattices @@ -594,35 +434,16 @@ public: */ virtual void installSlavePhases(XML_Node* phaseNode); - //! Set equation of state parameter values from XML entries. - /*! - * This method is called by function importPhase() when processing a phase - * definition in an input file. It should be overloaded in subclasses to set - * any parameters that are specific to that particular phase - * model. Note, this method is called before the phase is - * initialized with elements and/or species. - * - * @param eosdata An XML_Node object corresponding to - * the "thermo" entry for this phase in the input file. - */ virtual void setParametersFromXML(const XML_Node& eosdata); //! Set the Lattice mole fractions using a string /*! - * @param n Integer value of the lattice whose mole fractions are being set - * @param x string containing Name:value pairs that will specify the mole fractions - * of species on a particular lattice + * @param n Integer value of the lattice whose mole fractions are being set + * @param x string containing Name:value pairs that will specify the mole + * fractions of species on a particular lattice */ void setLatticeMoleFractionsByName(int n, const std::string& x); - //! Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1) - /*! - * The 298K heat of formation is defined as the enthalpy change to create the standard state - * of the species from its constituent elements in their standard states at 298 K and 1 bar. - * - * @param k Species k - * @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar - */ virtual void modifyOneHf298SS(const size_t k, const doublereal Hf298New); protected: diff --git a/include/cantera/thermo/MargulesVPSSTP.h b/include/cantera/thermo/MargulesVPSSTP.h index 2bf1b2d09..d9f97b9d8 100644 --- a/include/cantera/thermo/MargulesVPSSTP.h +++ b/include/cantera/thermo/MargulesVPSSTP.h @@ -1,15 +1,6 @@ /** - * @file MargulesVPSSTP.h - * Header for intermediate ThermoPhase object for phases which - * employ Gibbs excess free energy based formulations - * (see \ref thermoprops - * and class \link Cantera::MargulesVPSSTP MargulesVPSSTP\endlink). - * - * Header file for a derived class of ThermoPhase that handles - * variable pressure standard state methods for calculating - * thermodynamic properties that are further based upon activities - * based on the molality scale. These include most of the methods for - * calculating liquid electrolyte thermodynamics. + * @file MargulesVPSSTP.h (see \ref thermoprops and class \link + * Cantera::MargulesVPSSTP MargulesVPSSTP\endlink). */ /* * Copyright (2006) Sandia Corporation. Under the terms of @@ -24,256 +15,223 @@ namespace Cantera { -/** - * @ingroup thermoprops - */ - -//! MargulesVPSSTP is a derived class of GibbsExcessVPSSTP that employs -//! the Margules approximation for the excess Gibbs free energy +//! MargulesVPSSTP is a derived class of GibbsExcessVPSSTP that employs the +//! Margules approximation for the excess Gibbs free energy /*! - * MargulesVPSSTP derives from class GibbsExcessVPSSTP which is derived - * from VPStandardStateTP, - * and overloads the virtual methods defined there with ones that - * use expressions appropriate for the Margules Excess Gibbs free energy + * MargulesVPSSTP derives from class GibbsExcessVPSSTP which is derived from + * VPStandardStateTP, and overloads the virtual methods defined there with ones + * that use expressions appropriate for the Margules Excess Gibbs free energy * approximation. * * The independent unknowns are pressure, temperature, and mass fraction. * - * Several concepts are introduced. The first concept is there are temporary - * variables for holding the species standard state values - * of Cp, H, S, G, and V at the - * last temperature and pressure called. These functions are not recalculated - * if a new call is made using the previous temperature and pressure. Currently, - * these variables and the calculation method are handled by the VPSSMgr class, - * for which VPStandardStateTP owns a pointer to. - * - * To support the above functionality, pressure and temperature variables, - * m_plast_ss and m_tlast_ss, are kept which store the last pressure and temperature - * used in the evaluation of standard state properties. - * - * This class is usually used for nearly incompressible phases. For those phases, it - * makes sense to change the equation of state independent variable from - * density to pressure. The variable m_Pcurrent contains the current value of the - * pressure within the phase. - * *
*

Specification of Species Standard State Properties

*
* - * All species are defined to have standard states that depend upon both - * the temperature and the pressure. The Margules approximation assumes - * symmetric standard states, where all of the standard state assume - * that the species are in pure component states at the temperature - * and pressure of the solution. I don't think it prevents, however, - * some species from being dilute in the solution. + * All species are defined to have standard states that depend upon both the + * temperature and the pressure. The Margules approximation assumes symmetric + * standard states, where all of the standard state assume that the species are + * in pure component states at the temperature and pressure of the solution. I + * don't think it prevents, however, some species from being dilute in the + * solution. * *
*

Specification of Solution Thermodynamic Properties

*
* - * The molar excess Gibbs free energy is given by the following formula which is a sum over interactions i. - * Each of the interactions are binary interactions involving two of the species in the phase, denoted, Ai - * and Bi. - * This is the generalization of the Margules formulation for a phase - * that has more than 2 species. + * The molar excess Gibbs free energy is given by the following formula which is + * a sum over interactions i. Each of the interactions are binary + * interactions involving two of the species in the phase, denoted, Ai + * and Bi. This is the generalization of the Margules formulation for a + * phase that has more than 2 species. * - * \f[ - * G^E = \sum_i \left( H_{Ei} - T S_{Ei} \right) - * \f] - * \f[ - * H^E_i = n X_{Ai} X_{Bi} \left( h_{o,i} + h_{1,i} X_{Bi} \right) - * \f] - * \f[ - * S^E_i = n X_{Ai} X_{Bi} \left( s_{o,i} + s_{1,i} X_{Bi} \right) - * \f] + * \f[ + * G^E = \sum_i \left( H_{Ei} - T S_{Ei} \right) + * \f] + * \f[ + * H^E_i = n X_{Ai} X_{Bi} \left( h_{o,i} + h_{1,i} X_{Bi} \right) + * \f] + * \f[ + * S^E_i = n X_{Ai} X_{Bi} \left( s_{o,i} + s_{1,i} X_{Bi} \right) + * \f] * * where n is the total moles in the solution. * - * The activity of a species defined in the phase is given by an excess - * Gibbs free energy formulation. + * The activity of a species defined in the phase is given by an excess Gibbs + * free energy formulation. * - * \f[ - * a_k = \gamma_k X_k - * \f] + * \f[ + * a_k = \gamma_k X_k + * \f] * * where * - * \f[ - * R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i} - * \f] + * \f[ + * R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i} + * \f] * * Taking the derivatives results in the following expression * - * \f[ - * R T \ln( \gamma_k )= \sum_i \left( \left( \delta_{Ai,k} X_{Bi} + \delta_{Bi,k} X_{Ai} - X_{Ai} X_{Bi} \right) - * \left( g^E_{o,i} + g^E_{1,i} X_{Bi} \right) + - * \left( \delta_{Bi,k} - X_{Bi} \right) X_{Ai} X_{Bi} g^E_{1,i} \right) - * \f] + * \f[ + * R T \ln( \gamma_k )= \sum_i \left( \left( \delta_{Ai,k} X_{Bi} + \delta_{Bi,k} X_{Ai} - X_{Ai} X_{Bi} \right) + * \left( g^E_{o,i} + g^E_{1,i} X_{Bi} \right) + + * \left( \delta_{Bi,k} - X_{Bi} \right) X_{Ai} X_{Bi} g^E_{1,i} \right) + * \f] * where - * \f$ g^E_{o,i} = h_{o,i} - T s_{o,i} \f$ and \f$ g^E_{1,i} = h_{1,i} - T s_{1,i} \f$ - * and where \f$ X_k \f$ is the mole fraction of species k. + * \f$ g^E_{o,i} = h_{o,i} - T s_{o,i} \f$ and + * \f$ g^E_{1,i} = h_{1,i} - T s_{1,i} \f$ and where + * \f$ X_k \f$ is the mole fraction of species k. * - * This object inherits from the class VPStandardStateTP. Therefore, the specification and - * calculation of all standard state and reference state values are handled at that level. Various functional - * forms for the standard state are permissible. - * The chemical potential for species k is equal to + * This object inherits from the class VPStandardStateTP. Therefore, the + * specification and calculation of all standard state and reference state + * values are handled at that level. Various functional forms for the standard + * state are permissible. The chemical potential for species k is equal + * to * - * \f[ - * \mu_k(T,P) = \mu^o_k(T, P) + R T \ln(\gamma_k X_k) - * \f] + * \f[ + * \mu_k(T,P) = \mu^o_k(T, P) + R T \ln(\gamma_k X_k) + * \f] * - * The partial molar entropy for species k is given by the following relation, + * The partial molar entropy for species k is given by * - * \f[ - * \tilde{s}_k(T,P) = s^o_k(T,P) - R \ln( \gamma_k X_k ) - * - R T \frac{d \ln(\gamma_k) }{dT} - * \f] + * \f[ + * \tilde{s}_k(T,P) = s^o_k(T,P) - R \ln( \gamma_k X_k ) + * - R T \frac{d \ln(\gamma_k) }{dT} + * \f] * * The partial molar enthalpy for species k is given by * - * \f[ - * \tilde{h}_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] + * \f[ + * \tilde{h}_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} + * \f] * - * The partial molar volume for species k is + * The partial molar volume for species k is * - * \f[ - * \tilde V_k(T,P) = V^o_k(T,P) + R T \frac{d \ln(\gamma_k) }{dP} - * \f] + * \f[ + * \tilde V_k(T,P) = V^o_k(T,P) + R T \frac{d \ln(\gamma_k) }{dP} + * \f] * * The partial molar Heat Capacity for species k is * - * \f[ - * \tilde{C}_{p,k}(T,P) = C^o_{p,k}(T,P) - 2 R T \frac{d \ln( \gamma_k )}{dT} - * - R T^2 \frac{d^2 \ln(\gamma_k) }{{dT}^2} - * \f] + * \f[ + * \tilde{C}_{p,k}(T,P) = C^o_{p,k}(T,P) - 2 R T \frac{d \ln( \gamma_k )}{dT} + * - R T^2 \frac{d^2 \ln(\gamma_k) }{{dT}^2} + * \f] * *
*

%Application within Kinetics Managers

*
* - * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / - * C^s_k, \f$ where \f$ C^s_k \f$ is a standard concentration - * defined below and \f$ a_k \f$ are activities used in the - * thermodynamic functions. These activity (or generalized) - * concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. - * The activity concentration,\f$ C^a_k \f$,is given by the following expression. + * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / C^s_k, \f$ where + * \f$ C^s_k \f$ is a standard concentration defined below and \f$ a_k \f$ are + * activities used in the thermodynamic functions. These activity (or + * generalized) concentrations are used by kinetics manager classes to compute + * the forward and reverse rates of elementary reactions. The activity + * concentration,\f$ C^a_k \f$,is given by the following expression. * - * \f[ - * C^a_k = C^s_k X_k = \frac{P}{R T} X_k - * \f] + * \f[ + * C^a_k = C^s_k X_k = \frac{P}{R T} X_k + * \f] * * The standard concentration for species k is independent of k and equal to * - * \f[ - * C^s_k = C^s = \frac{P}{R T} - * \f] + * \f[ + * C^s_k = C^s = \frac{P}{R T} + * \f] * - * For example, a bulk-phase binary gas reaction between species j and k, producing - * a new gas species l would have the - * following equation for its rate of progress variable, \f$ R^1 \f$, which has - * units of kmol m-3 s-1. + * For example, a bulk-phase binary gas reaction between species j and k, + * producing a new gas species l would have the following equation for its rate + * of progress variable, \f$ R^1 \f$, which has units of kmol m-3 s-1. * - * \f[ + * \f[ * R^1 = k^1 C_j^a C_k^a = k^1 (C^s a_j) (C^s a_k) - * \f] - * where - * \f[ - * C_j^a = C^s a_j \mbox{\quad and \quad} C_k^a = C^s a_k - * \f] + * \f] + * where + * \f[ + * C_j^a = C^s a_j \mbox{\quad and \quad} C_k^a = C^s a_k + * \f] * - * \f$ C_j^a \f$ is the activity concentration of species j, and - * \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^s \f$ - * is the standard concentration. \f$ a_j \f$ is - * the activity of species j which is equal to the mole fraction of j. + * \f$ C_j^a \f$ is the activity concentration of species j, and \f$ C_k^a \f$ + * is the activity concentration of species k. \f$ C^s \f$ is the standard + * concentration. \f$ a_j \f$ is the activity of species j which is equal to the + * mole fraction of j. * - * The reverse rate constant can then be obtained from the law of microscopic reversibility - * and the equilibrium expression for the system. + * The reverse rate constant can then be obtained from the law of microscopic + * reversibility and the equilibrium expression for the system. * - * \f[ - * \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} ) - * \f] + * \f[ + * \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} ) + * \f] * - * \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, associated with - * the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ and their associated activities, - * \f$ a_l \f$, repeated here: + * \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, + * associated with the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ + * and their associated activities, \f$ a_l \f$, repeated here: * - * \f[ - * \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l) - * \f] + * \f[ + * \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l) + * \f] * - * We can switch over to expressing the equilibrium constant in terms of the reference - * state chemical potentials + * We can switch over to expressing the equilibrium constant in terms of the + * reference state chemical potentials * - * \f[ - * K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P} - * \f] + * \f[ + * K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P} + * \f] * - * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over - * to activity concentrations. When this is done: + * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by + * changing over to activity concentrations. When this is done: * - * \f[ - * \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 = - * \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT} - * \f] + * \f[ + * \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 = + * \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT} + * \f] * - * %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$, - * using the second and third part of the above expression as a definition for the concentration - * equilibrium constant. + * %Kinetics managers will calculate the concentration equilibrium constant, \f$ + * K_c \f$, using the second and third part of the above expression as a + * definition for the concentration equilibrium constant. * - * For completeness, the pressure equilibrium constant may be obtained as well + * For completeness, the pressure equilibrium constant may be obtained as well * - * \f[ - * \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) - * \f] + * \f[ + * \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) + * \f] * - * \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. However, it isn't - * necessarily the simplest form of the equilibrium constant for other types of phases; \f$ K_c \f$ is - * used instead because it is completely general. + * \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. + * However, it isn't necessarily the simplest form of the equilibrium constant + * for other types of phases; \f$ K_c \f$ is used instead because it is + * completely general. * - * The reverse rate of progress may be written down as - * \f[ + * The reverse rate of progress may be written down as + * \f[ * R^{-1} = k^{-1} C_l^a = k^{-1} (C^o a_l) - * \f] + * \f] * - * where we can use the concept of microscopic reversibility to - * write the reverse rate constant in terms of the - * forward reate constant and the concentration equilibrium - * constant, \f$ K_c \f$. + * where we can use the concept of microscopic reversibility to write the + * reverse rate constant in terms of the forward reate constant and the + * concentration equilibrium constant, \f$ K_c \f$. * - * \f[ - * k^{-1} = k^1 K^1_c - * \f] + * \f[ + * k^{-1} = k^1 K^1_c + * \f] * - * \f$k^{-1} \f$ has units of s-1. + * \f$k^{-1} \f$ has units of s-1. * * @ingroup thermoprops */ class MargulesVPSSTP : public GibbsExcessVPSSTP { public: - //! Constructor - /*! - * This doesn't do much more than initialize constants with - * default values for water at 25C. Water molecular weight - * comes from the default elements.xml file. It actually - * differs slightly from the IAPWS95 value of 18.015268. However, - * density conservation and therefore element conservation - * is the more important principle to follow. - */ MargulesVPSSTP(); - //! Construct and initialize a MargulesVPSSTP ThermoPhase object - //! directly from an XML input file + //! Construct and initialize a MargulesVPSSTP ThermoPhase object directly + //! from an XML input file /*! * Working constructors * - * The two constructors below are the normal way - * the phase initializes itself. They are shells that call - * the routine initThermo(), with a reference to the - * XML database to get the info for the phase. + * The two constructors below are the normal way the phase initializes + * itself. They are shells that call the routine initThermo(), with a + * reference to the XML database to get the info for the phase. * * @param inputFile Name of the input file containing the phase XML data * to set up the object @@ -282,8 +240,8 @@ public: */ MargulesVPSSTP(const std::string& inputFile, const std::string& id = ""); - //! Construct and initialize a MargulesVPSSTP ThermoPhase object - //! directly from an XML database + //! Construct and initialize a MargulesVPSSTP ThermoPhase object directly + //! from an XML database /*! * @param phaseRef XML phase node containing the description of the phase * @param id id attribute containing the name of the phase. @@ -291,124 +249,83 @@ public: */ MargulesVPSSTP(XML_Node& phaseRef, const std::string& id = ""); - //! Copy constructor - /*! - * Note this stuff will not work until the underlying phase - * has a working copy constructor - * - * @param b class to be copied - */ MargulesVPSSTP(const MargulesVPSSTP& b); - - //! Assignment operator - /*! - * @param b class to be copied. - */ MargulesVPSSTP& operator=(const MargulesVPSSTP& b); - - //! Duplication routine for objects which inherit from ThermoPhase. - /*! - * This virtual routine can be used to duplicate ThermoPhase objects - * inherited from ThermoPhase even if the application only has - * a pointer to ThermoPhase to work with. - */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; //! @name Molar Thermodynamic Properties //! @{ - /// Molar enthalpy. Units: J/kmol. virtual doublereal enthalpy_mole() const; - - /// Molar entropy. Units: J/kmol. virtual doublereal entropy_mole() const; - - /// Molar heat capacity at constant pressure. Units: J/kmol/K. virtual doublereal cp_mole() const; - - /// Molar heat capacity at constant volume. Units: J/kmol/K. virtual doublereal cv_mole() const; /** * @} * @name Activities, Standard States, and Activity Concentrations * - * The activity \f$a_k\f$ of a species in solution is - * related to the chemical potential by \f[ \mu_k = \mu_k^0(T) - * + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is - * the chemical potential at unit activity, which depends only - * on temperature and pressure. + * The activity \f$a_k\f$ of a species in solution is related to the + * chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The + * quantity \f$\mu_k^0(T,P)\f$ is the chemical potential at unit activity, + * which depends only on temperature and pressure. * @{ */ - //! Get the array of non-dimensional molar-based ln activity coefficients at - //! the current solution temperature, pressure, and solution concentration. - /*! - * @param lnac Output vector of ln activity coefficients. Length: m_kk. - */ virtual void getLnActivityCoefficients(doublereal* lnac) const; //@} /// @name Partial Molar Properties of the Solution //@{ - //! Get the species chemical potentials. Units: J/kmol. - /*! - * This function returns a vector of chemical potentials of the - * species in solution at the current temperature, pressure - * and mole fraction of the solution. - * - * @param mu Output vector of species chemical - * potentials. Length: m_kk. Units: J/kmol - */ virtual void getChemPotentials(doublereal* mu) const; - //! Returns an array of partial molar enthalpies for the species - //! in the mixture. + //! Returns an array of partial molar enthalpies for the species in the + //! mixture. /*! * Units (J/kmol) * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * molality-based activity coefficient wrt temperature + * For this phase, the partial molar enthalpies are equal to the standard + * state enthalpies modified by the derivative of the molality-based + * activity coefficient wrt temperature * - * \f[ + * \f[ * \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] + * \f] * * @param hbar Vector of returned partial molar enthalpies * (length m_kk, units = J/kmol) */ virtual void getPartialMolarEnthalpies(doublereal* hbar) const; - //! Returns an array of partial molar entropies for the species - //! in the mixture. + //! Returns an array of partial molar entropies for the species in the + //! mixture. /*! * Units (J/kmol) * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature + * For this phase, the partial molar enthalpies are equal to the standard + * state enthalpies modified by the derivative of the activity coefficient + * wrt temperature * - * \f[ + * \f[ * \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} * - R \ln( \gamma_k X_k) * - R T \frac{d \ln(\gamma_k) }{dT} - * \f] + * \f] * * @param sbar Vector of returned partial molar entropies * (length m_kk, units = J/kmol/K) */ virtual void getPartialMolarEntropies(doublereal* sbar) const; - //! Returns an array of partial molar entropies for the species - //! in the mixture. + //! Returns an array of partial molar entropies for the species in the + //! mixture. /*! * Units (J/kmol) * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature + * For this phase, the partial molar enthalpies are equal to the standard + * state enthalpies modified by the derivative of the activity coefficient + * wrt temperature * * \f[ * ??????????????? @@ -423,161 +340,38 @@ public: */ virtual void getPartialMolarCp(doublereal* cpbar) const; - //! Return an array of partial molar volumes for the - //! species in the mixture. Units: m^3/kmol. - /*! - * Frequently, for this class of thermodynamics representations, - * the excess Volume due to mixing is zero. Here, we set it as - * a default. It may be overridden in derived classes. - * - * @param vbar Output vector of species partial molar volumes. - * Length = m_kk. units are m^3/kmol. - */ virtual void getPartialMolarVolumes(doublereal* vbar) const; - - //! Get the species electrochemical potentials. - /*! - * These are partial molar quantities. - * This method adds a term \f$ Fz_k \phi_k \f$ to the - * to each chemical potential. - * - * Units: J/kmol - * - * @param mu output vector containing the species electrochemical potentials. - * Length: m_kk., units = J/kmol - */ void getElectrochemPotentials(doublereal* mu) const; - //! Get the array of temperature second derivatives of the log activity coefficients + //! Get the array of temperature second derivatives of the log activity + //! coefficients /*! - * This function is a virtual class, but it first appears in GibbsExcessVPSSTP - * class and derived classes from GibbsExcessVPSSTP. - * * units = 1/Kelvin * - * @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of the - * log Activity Coefficients. length = m_kk + * @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of + * the log Activity Coefficients. length = m_kk */ virtual void getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const; - //! Get the array of temperature derivatives of the log activity coefficients - /*! - * This function is a virtual class, but it first appears in GibbsExcessVPSSTP - * class and derived classes from GibbsExcessVPSSTP. - * - * units = 1/Kelvin - * - * @param dlnActCoeffdT Output vector of temperature derivatives of the - * log Activity Coefficients. length = m_kk - */ virtual void getdlnActCoeffdT(doublereal* dlnActCoeffdT) const; /// @} - /// @name Initialization - /// The following methods are used in the process of constructing - /// the phase and setting its parameters from a specification in an - /// input file. They are not normally used in application programs. - /// To see how they are used, see importPhase() + /// @name Initialization The following methods are used in the process of + /// constructing the phase and setting its parameters from a + /// specification in an input file. They are not normally used in + /// application programs. To see how they are used, see importPhase() /// @{ - /*! - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase(). - */ virtual void initThermo(); - - /** - * Import and initialize a ThermoPhase object - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ void initThermoXML(XML_Node& phaseNode, const std::string& id); //! @} //! @name Derivatives of Thermodynamic Variables needed for Applications //! @{ - //! Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along - //! a line in parameter space or along a line in physical space - /*! - * - * @param dTds Input of temperature change along the path - * @param dXds Input vector of changes in mole fraction along the path. length = m_kk - * Along the path length it must be the case that the mole fractions sum to one. - * @param dlnActCoeffds Output vector of the directional derivatives of the - * log Activity Coefficients along the path. length = m_kk - * units are 1/units(s). if s is a physical coordinate then the units are 1/m. - */ virtual void getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const; - - //! Get the array of log concentration-like derivatives of the - //! log activity coefficients - diagonal component - /*! - * This function is a virtual method. For ideal mixtures - * (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the - * logarithm of the activity coefficient with respect to the - * logarithm of the mole fraction. - * - * units = dimensionless - * - * @param dlnActCoeffdlnX_diag Output vector of the diagonal component of the log(mole fraction) - * derivatives of the log Activity Coefficients. - * length = m_kk - */ virtual void getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const; - - //! Get the array of derivatives of the log activity coefficients wrt mole numbers - diagonal only - /*! - * This function is a virtual method. For ideal mixtures - * (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the - * logarithm of the activity coefficient with respect to the - * logarithm of the concentration-like variable (i.e. mole fraction, - * molality, etc.) that represents the standard state. - * - * units = dimensionless - * - * @param dlnActCoeffdlnN_diag Output vector of the diagonal entries for the log(mole fraction) - * derivatives of the log Activity Coefficients. - * length = m_kk - */ virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const; - - //! Get the array of derivatives of the ln activity coefficients with respect to the ln species mole numbers - /*! - * Implementations should take the derivative of the logarithm of the activity coefficient with respect to a - * log of a species mole number (with all other species mole numbers held constant) - * - * units = 1 / kmol - * - * dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log act_coeff for the mth - * species with respect to the number of moles of the kth species. - * - * \f[ - * \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i} - * \f] - * - * @param ld Number of rows in the matrix - * @param dlnActCoeffdlnN Output vector of derivatives of the - * log Activity Coefficients. length = m_kk * m_kk - */ virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN); //@} @@ -585,65 +379,65 @@ public: private: //! Process an XML node called "binaryNeutralSpeciesParameters" /*! - * This node contains all of the parameters necessary to describe - * the Margules model for a particular binary interaction. - * This function reads the XML file and writes the coefficients - * it finds to an internal data structures. + * This node contains all of the parameters necessary to describe the + * Margules model for a particular binary interaction. This function reads + * the XML file and writes the coefficients it finds to an internal data + * structures. * * @param xmlBinarySpecies Reference to the XML_Node named "binaryNeutralSpeciesParameters" * containing the binary interaction */ void readXMLBinarySpecies(XML_Node& xmlBinarySpecies); - //! Resize internal arrays within the object that depend upon the number - //! of binary Margules interaction terms + //! Resize internal arrays within the object that depend upon the number of + //! binary Margules interaction terms /*! * @param num Number of binary Margules interaction terms */ void resizeNumInteractions(const size_t num); - //! Initialize lengths of local variables after all species have - //! been identified. + //! Initialize lengths of local variables after all species have been + //! identified. void initLengths(); //! Update the activity coefficients /*! - * This function will be called to update the internally stored - * natural logarithm of the activity coefficients + * This function will be called to update the internally stored natural + * logarithm of the activity coefficients */ void s_update_lnActCoeff() const; //! Update the derivative of the log of the activity coefficients wrt T /*! - * This function will be called to update the internally stored - * derivative of the natural logarithm of the activity coefficients - * wrt temperature. + * This function will be called to update the internally stored derivative + * of the natural logarithm of the activity coefficients wrt temperature. */ void s_update_dlnActCoeff_dT() const; - //! Update the derivative of the log of the activity coefficients - //! wrt log(mole fraction) + //! Update the derivative of the log of the activity coefficients wrt + //! log(mole fraction) /*! - * This function will be called to update the internally stored - * derivative of the natural logarithm of the activity coefficients - * wrt logarithm of the mole fractions. + * This function will be called to update the internally stored derivative + * of the natural logarithm of the activity coefficients wrt logarithm of + * the mole fractions. */ void s_update_dlnActCoeff_dlnX_diag() const; - //! Update the derivative of the log of the activity coefficients - //! wrt log(moles) - diagonal only + //! Update the derivative of the log of the activity coefficients wrt + //! log(moles) - diagonal only /*! - * This function will be called to update the internally stored diagonal entries for the - * derivative of the natural logarithm of the activity coefficients - * wrt logarithm of the moles. + * This function will be called to update the internally stored diagonal + * entries for the derivative of the natural logarithm of the activity + * coefficients wrt logarithm of the moles. */ void s_update_dlnActCoeff_dlnN_diag() const; - //! Update the derivative of the log of the activity coefficients wrt log(moles_m) + //! Update the derivative of the log of the activity coefficients wrt + //! log(moles_m) /*! - * This function will be called to update the internally stored - * derivative of the natural logarithm of the activity coefficients - * wrt logarithm of the mole number of species + * This function will be called to update the internally stored derivative + * of the natural logarithm of the activity coefficients wrt logarithm of + * the mole number of species */ void s_update_dlnActCoeff_dlnN() const; @@ -701,15 +495,15 @@ protected: //! vector of species indices representing species A in the interaction /*! - * Each Margules excess Gibbs free energy term involves two species, A and B. - * This vector identifies species A. + * Each Margules excess Gibbs free energy term involves two species, A and + * B. This vector identifies species A. */ std::vector m_pSpecies_A_ij; //! vector of species indices representing species B in the interaction /*! - * Each Margules excess Gibbs free energy term involves two species, A and B. - * This vector identifies species B. + * Each Margules excess Gibbs free energy term involves two species, A and + * B. This vector identifies species B. */ std::vector m_pSpecies_B_ij; diff --git a/include/cantera/thermo/MaskellSolidSolnPhase.h b/include/cantera/thermo/MaskellSolidSolnPhase.h index 3e6a624a7..c4a7e34a6 100644 --- a/include/cantera/thermo/MaskellSolidSolnPhase.h +++ b/include/cantera/thermo/MaskellSolidSolnPhase.h @@ -19,10 +19,10 @@ namespace Cantera { /** - * Class MaskellSolidSolnPhase represents a condensed phase - * non-ideal solution with 2 species following the thermodynamic - * model described in Maskell, Shaw, and Tye, Manganese Dioxide Electrode -- IX, - * Electrochimica Acta 28(2) pp 231-235, 1983. + * Class MaskellSolidSolnPhase represents a condensed phase non-ideal solution + * with 2 species following the thermodynamic model described in Maskell, Shaw, + * and Tye, Manganese Dioxide Electrode -- IX, Electrochimica Acta 28(2) pp + * 231-235, 1983. * * @ingroup thermoprops */ @@ -31,68 +31,28 @@ class MaskellSolidSolnPhase : public VPStandardStateTP public: MaskellSolidSolnPhase(); - //! Copy Constructor MaskellSolidSolnPhase(const MaskellSolidSolnPhase&); - - //! Assignment operator MaskellSolidSolnPhase& operator=(const MaskellSolidSolnPhase&); - - /*! - * Base Class Duplication Function - * - * Given a pointer to ThermoPhase, this function can duplicate the object. - */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; - /** - * This method returns the array of generalized - * concentrations. The generalized concentrations are used - * in the evaluation of the rates of progress for reactions - * involving species in this phase. The generalized - * concentration divided by the standard concentration is also - * equal to the activity of species. - * - * @param c Pointer to array of doubles of length m_kk, which on exit - * will contain the generalized concentrations. - */ virtual void getActivityConcentrations(doublereal* c) const; - - //! Return the standard concentration for the kth species - /*! - * The standard concentration \f$ C^0_k \f$ used to normalize the - * generalized concentration. - * - * @param k Species number: this is an optional parameter, - */ virtual doublereal standardConcentration(size_t k=0) const { return 1.0; } - - //! Natural logarithm of the standard concentration of the kth species. - /*! - * @param k index of the species (defaults to zero) - */ virtual doublereal logStandardConc(size_t k=0) const { return 0.0; } //! @name Molar Thermodynamic Properties of the Solution //! @{ - /** - * Molar enthalpy of the solution. Units: J/kmol. - */ - virtual doublereal enthalpy_mole() const; - /** - * Molar entropy of the solution. Units: J/kmol/K. - */ + virtual doublereal enthalpy_mole() const; virtual doublereal entropy_mole() const; //@} /** @name Mechanical Equation of State Properties * - * In this equation of state implementation, the density is a - * function only of the mole fractions. Therefore, it can't be - * an independent variable. Instead, the pressure is used as the - * independent variable. Functions which try to set the thermodynamic - * state by calling setDensity() may cause an exception to be - * thrown. + * In this equation of state implementation, the density is a function only + * of the mole fractions. Therefore, it can't be an independent variable. + * Instead, the pressure is used as the independent variable. Functions + * which try to set the thermodynamic state by calling setDensity() may + * cause an exception to be thrown. */ //@{ @@ -106,25 +66,20 @@ public: } /** - * Set the pressure at constant temperature. Units: Pa. - * This method sets a constant within the object. - * The mass density is not a function of pressure. + * Set the pressure at constant temperature. Units: Pa. This method sets a + * constant within the object. The mass density is not a function of + * pressure. * * @param p Input Pressure (Pa) */ virtual void setPressure(doublereal p); /** - * Overwritten setDensity() function is necessary because the - * density is not an independent variable. + * Overwritten setDensity() function is necessary because the density is not + * an independent variable. * * This function will now throw an error condition * - * @internal May have to adjust the strategy here to make - * the eos for these materials slightly compressible, in order - * to create a condition where the density is a function of - * the pressure. - * * @param rho Input density */ virtual void setDensity(const doublereal rho); @@ -132,8 +87,8 @@ public: virtual void calcDensity(); /** - * Overwritten setMolarDensity() function is necessary because the - * density is not an independent variable. + * Overwritten setMolarDensity() function is necessary because the density + * is not an independent variable. * * This function will now throw an error condition. * @@ -148,120 +103,35 @@ public: * @{ */ - //! Get the array of species activity coefficients - /*! - * @param ac output vector of activity coefficients. Length: m_kk - */ virtual void getActivityCoefficients(doublereal* ac) const; - - /** - * Get the species chemical potentials. Units: J/kmol. - * - * @param mu Output vector of chemical potentials. - */ virtual void getChemPotentials(doublereal* mu) const; - - /** - * Get the array of non-dimensional species solution - * chemical potentials at the current T and P - * - * @param mu Output vector of dimensionless chemical potentials. Length = m_kk. - */ virtual void getChemPotentials_RT(doublereal* mu) const; //@} /// @name Partial Molar Properties of the Solution //@{ - //! Returns an array of partial molar enthalpies for the species in the mixture. - /*! - * Units (J/kmol) - * - * @param hbar Output vector containing partial molar enthalpies. - * Length: m_kk. - */ virtual void getPartialMolarEnthalpies(doublereal* hbar) const; - - /** - * Returns an array of partial molar entropies of the species in the - * solution. Units: J/kmol/K. - * - * @param sbar Output vector containing partial molar entropies. - * Length: m_kk. - */ virtual void getPartialMolarEntropies(doublereal* sbar) const; - - /** - * Returns an array of partial molar Heat Capacities at constant - * pressure of the species in the - * solution. Units: J/kmol/K. - * - * @param cpbar Output vector of partial heat capacities. Length: m_kk. - */ virtual void getPartialMolarCp(doublereal* cpbar) const; - - /** - * returns an array of partial molar volumes of the species - * in the solution. Units: m^3 kmol-1. - * - * @param vbar Output vector of partial molar volumes. Length: m_kk. - */ virtual void getPartialMolarVolumes(doublereal* vbar) const; - - //! Get the Gibbs functions for the standard - //! state of the species at the current T and P of the solution - /*! - * Units are Joules/kmol - * @param gpure Output vector of standard state Gibbs free energies - * Length: m_kk. - */ virtual void getPureGibbs(doublereal* gpure) const; - - //! Get the array of chemical potentials at unit activity for the species - //! at their standard states at the current T and P of the solution. - /*! - * These are the standard state chemical potentials \f$ \mu^0_k(T,P) - * \f$. The values are evaluated at the current - * temperature and pressure of the solution - * - * @param mu Output vector of chemical potentials. - * Length: m_kk. - */ virtual void getStandardChemPotentials(doublereal* mu) const; //@} /// @name Utility Functions //@{ - /** - * @internal Import and initialize a ThermoPhase object using an XML - * tree. Here we read extra information about the XML description of a - * phase. Regular information about elements and species and their - * reference state thermodynamic information have already been read at - * this point. For example, we do not need to call this function for - * ideal gas equations of state. This function is called from - * importPhase() after the elements and the species are initialized - * with default ideal solution level data. - * - * @param phaseNode This object must be the phase node of a complete XML - * tree description of the phase, including all of the - * species data. In other words while "phase" must point to - * an XML phase object, it must have sibling nodes - * "speciesData" that describe the species in the phase. - * @param id ID of the phase. If nonnull, a check is done to see if - * phaseNode is pointing to the phase with the correct id. - */ virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); - void set_h_mix(const doublereal hmix) { h_mixing = hmix; } //@} private: /** - * m_Pcurrent = The current pressure - * Since the density isn't a function of pressure, but only of the - * mole fractions, we need to independently specify the pressure. + * m_Pcurrent = The current pressure. Since the density isn't a function of + * pressure, but only of the mole fractions, we need to independently + * specify the pressure. */ doublereal m_Pcurrent; @@ -274,10 +144,8 @@ private: //! Vector containing the species reference enthalpies at T = m_tlast mutable vector_fp m_h0_RT; - /** - * Vector containing the species reference constant pressure - * heat capacities at T = m_tlast - */ + //! Vector containing the species reference constant pressure heat + //! capacities at T = m_tlast mutable vector_fp m_cp0_R; //! Vector containing the species reference Gibbs functions at T = m_tlast @@ -286,7 +154,8 @@ private: //! Vector containing the species reference entropies at T = m_tlast mutable vector_fp m_s0_R; - //! Value of the enthalpy change on mixing due to protons changing from type B to type A configurations. + //! Value of the enthalpy change on mixing due to protons changing from type + //! B to type A configurations. doublereal h_mixing; //! Index of the species whose mole fraction defines the extent of reduction r diff --git a/include/cantera/thermo/MetalPhase.h b/include/cantera/thermo/MetalPhase.h index 2cab28638..369df4b67 100644 --- a/include/cantera/thermo/MetalPhase.h +++ b/include/cantera/thermo/MetalPhase.h @@ -36,7 +36,6 @@ public: return *this; } - //! Duplicator virtual ThermoPhase* duplMyselfAsThermoPhase() const { MetalPhase* idg = new MetalPhase(*this); return (ThermoPhase*) idg; diff --git a/include/cantera/thermo/MetalSHEelectrons.h b/include/cantera/thermo/MetalSHEelectrons.h index 359bf6417..4af162d97 100644 --- a/include/cantera/thermo/MetalSHEelectrons.h +++ b/include/cantera/thermo/MetalSHEelectrons.h @@ -19,19 +19,19 @@ namespace Cantera { -//! Class MetalSHEelectrons represents electrons within -//! a metal, adjacent to an aqueous electrolyte, that are consistent with the SHE reference electrode. +//! Class MetalSHEelectrons represents electrons within a metal, adjacent to an +//! aqueous electrolyte, that are consistent with the SHE reference electrode. /*! - * The class is based on the electron having a chemical potential - * equal to one-half of the entropy of the H2 gas at the system pressure + * The class is based on the electron having a chemical potential equal to one- + * half of the entropy of the H2 gas at the system pressure * * Specification of Species Standard State Properties * - * This class inherits from SingleSpeciesTP. - * It is assumed that the reference state thermodynamics may be - * obtained by a pointer to a populated species thermodynamic property - * manager class (see ThermoPhase::m_spthermo). How to relate pressure - * changes to the reference state thermodynamics is resolved at this level. + * This class inherits from SingleSpeciesTP. It is assumed that the reference + * state thermodynamics may be obtained by a pointer to a populated species + * thermodynamic property manager class (see ThermoPhase::m_spthermo). How to + * relate pressure changes to the reference state thermodynamics is resolved at + * this level. * * The enthalpy function is given by the following relation. * @@ -39,20 +39,20 @@ namespace Cantera * h^o_k(T,P) = h^{ref}_k(T) * \f] * - * The standard state constant-pressure heat capacity is independent of pressure: + * The standard state constant-pressure heat capacity is independent of pressure: * * \f[ * Cp^o_k(T,P) = Cp^{ref}_k(T) * \f] * - * The standard state entropy depends in the following fashion on pressure: + * The standard state entropy depends in the following fashion on pressure: * * \f[ * S^o_k(T,P) = S^{ref}_k(T) - R \ln(\frac{P}{P_{ref}}) * \f] * - * The standard state Gibbs free energy is obtained from the enthalpy and entropy - * functions: + * The standard state Gibbs free energy is obtained from the enthalpy and + * entropy functions: * * \f[ * \mu^o_k(T,P) = h^o_k(T,P) - S^o_k(T,P) T @@ -67,7 +67,7 @@ namespace Cantera * \mu^{ref}_k(T) = h^{ref}_k(T) - T S^{ref}_k(T) * \f] * - * The standard state internal energy is obtained from the enthalpy function also + * The standard state internal energy is obtained from the enthalpy function also * * \f[ * u^o_k(T,P) = h^o_k(T) - R T @@ -75,28 +75,26 @@ namespace Cantera * * Specification of Solution Thermodynamic Properties * - * All solution properties are obtained from the standard state - * species functions, since there is only one species in the phase. + * All solution properties are obtained from the standard state species + * functions, since there is only one species in the phase. * * %Application within Kinetics Managers * - * The standard concentration is equal to 1.0. This means that the - * kinetics operator works on an activities basis. Since this - * is a stoichiometric substance, this means that the concentration - * of this phase drops out of kinetics expressions since the activity is - * always equal to one. + * The standard concentration is equal to 1.0. This means that the kinetics + * operator works on an activities basis. Since this is a stoichiometric + * substance, this means that the concentration of this phase drops out of + * kinetics expressions since the activity is always equal to one. * - * This is what is expected of electrons. The only effect that this class will - * have on reactions is in terms of the standard state chemical potential, which - * is equal to 1/2 of the H2 gas chemical potential, and the voltage assigned - * to the electron, which is the voltage of the metal. + * This is what is expected of electrons. The only effect that this class will + * have on reactions is in terms of the standard state chemical potential, which + * is equal to 1/2 of the H2 gas chemical potential, and the voltage assigned to + * the electron, which is the voltage of the metal. * * Instantiation of the Class * - * The constructor for this phase is located in the default ThermoFactory - * for %Cantera. A new MetalSHEelectrons object may be created by - * the following code snippets, where the file metalSHEelectrons.xml exists - * in a local directory: + * The constructor for this phase is located in the default ThermoFactory for + * %Cantera. A new MetalSHEelectrons object may be created by the following code + * snippets, where the file metalSHEelectrons.xml exists in a local directory: * * @code * MetalSHEelectrons *eMetal = new MetalSHEelectrons("metalSHEelectrons.xml", ""); @@ -114,8 +112,8 @@ namespace Cantera * ThermoPhase *eMetal = newPhase("MetalSHEelectrons.xml", "MetalSHEelectrons"); * @endcode * - * Additionally, this phase may be created without including an XML file with - * the special command, where the default file is embedded into this object. + * Additionally, this phase may be created without including an XML file with + * the special command, where the default file is embedded into this object. * * @code * MetalSHEelectrons *eMetal = new MetalSHEelectrons("MetalSHEelectrons_default.xml", ""); @@ -123,11 +121,10 @@ namespace Cantera * * XML Example * - * The phase model name for this is called MetalSHEelectrons. It must be supplied - * as the model attribute of the thermo XML element entry. - * Within the phase XML block, - * the density of the phase must be specified though it's not used. An example of an XML file - * this phase is given below. + * The phase model name for this is called MetalSHEelectrons. It must be + * supplied as the model attribute of the thermo XML element entry. Within the + * phase XML block, the density of the phase must be specified though it's not + * used. An example of an XML file this phase is given below. * * @code * @@ -171,8 +168,8 @@ namespace Cantera * * @endcode * - * The model attribute, "MetalSHEelectrons", on the thermo element - * identifies the phase as being a MetalSHEelectrons object. + * The model attribute, "MetalSHEelectrons", on the thermo element identifies + * the phase as being a MetalSHEelectrons object. * * @ingroup thermoprops */ @@ -199,26 +196,8 @@ public: */ MetalSHEelectrons(XML_Node& phaseRef, const std::string& id = ""); - //! Copy constructor - /*! - * @param right Object to be copied - */ MetalSHEelectrons(const MetalSHEelectrons& right); - - //! Assignment operator - /*! - * @param right Object to be copied - */ MetalSHEelectrons& operator=(const MetalSHEelectrons& right); - - //! Duplication function - /*! - * This virtual function is used to create a duplicate of the - * current phase. It's used to duplicate the phase when given - * a ThermoPhase pointer to the phase. - * - * @return It returns a ThermoPhase pointer. - */ ThermoPhase* duplMyselfAsThermoPhase() const; /** @@ -233,38 +212,22 @@ public: //! Report the Pressure. Units: Pa. /*! - * For an incompressible substance, the density is independent of - * pressure. This method simply returns the stored pressure value. + * For an incompressible substance, the density is independent of pressure. + * This method simply returns the stored pressure value. */ virtual doublereal pressure() const; //! Set the pressure at constant temperature. Units: Pa. /*! - * For an incompressible substance, the density is - * independent of pressure. Therefore, this method only - * stores the specified pressure value. It does not - * modify the density. + * For an incompressible substance, the density is independent of pressure. + * Therefore, this method only stores the specified pressure value. It does + * not modify the density. * * @param p Pressure (units - Pa) */ virtual void setPressure(doublereal p); - //! Returns the isothermal compressibility. Units: 1/Pa. - /*! - * The isothermal compressibility is defined as - * \f[ - * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T - * \f] - */ virtual doublereal isothermalCompressibility() const; - - //! Return the volumetric thermal expansion coefficient. Units: 1/K. - /*! - * The thermal expansion coefficient is defined as - * \f[ - * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P - * \f] - */ virtual doublereal thermalExpansionCoeff() const; //! @} @@ -276,30 +239,27 @@ public: //! This method returns an array of generalized concentrations /*! - * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / - * C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration - * defined below and \f$ a_k \f$ are activities used in the - * thermodynamic functions. These activity (or generalized) - * concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. + * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / C^0_k, \f$ where + * \f$ C^0_k \f$ is a standard concentration defined below and \f$ a_k \f$ + * are activities used in the thermodynamic functions. These activity (or + * generalized) concentrations are used by kinetics manager classes to + * compute the forward and reverse rates of elementary reactions. * - * For a stoichiometric substance, there is - * only one species, and the generalized concentration is 1.0. + * For a stoichiometric substance, there is only one species, and the + * generalized concentration is 1.0. * - * @param c Output array of generalized concentrations. The - * units depend upon the implementation of the - * reaction rate expressions within the phase. + * @param c Output array of generalized concentrations. The units depend + * upon the implementation of the reaction rate expressions within + * the phase. */ virtual void getActivityConcentrations(doublereal* c) const; //! Return the standard concentration for the kth species /*! - * The standard concentration \f$ C^0_k \f$ used to normalize - * the activity (i.e., generalized) concentration. - * This phase assumes that the kinetics operator works on an - * dimensionless basis. Thus, the standard concentration is - * equal to 1.0. + * The standard concentration \f$ C^0_k \f$ used to normalize the activity + * (i.e., generalized) concentration. This phase assumes that the kinetics + * operator works on an dimensionless basis. Thus, the standard + * concentration is equal to 1.0. * * @param k Optional parameter indicating the species. The default * is to assume this refers to species 0. @@ -314,17 +274,17 @@ public: */ virtual doublereal logStandardConc(size_t k=0) const; - //! Get the array of chemical potentials at unit activity for the species - //! at their standard states at the current T and P of the solution. + //! Get the array of chemical potentials at unit activity for the species at + //! their standard states at the current T and P of the + //! solution. /*! - * For a stoichiometric substance, there is no activity term in - * the chemical potential expression, and therefore the - * standard chemical potential and the chemical potential - * are both equal to the molar Gibbs function. + * For a stoichiometric substance, there is no activity term in the chemical + * potential expression, and therefore the standard chemical potential and + * the chemical potential are both equal to the molar Gibbs function. * - * These are the standard state chemical potentials \f$ \mu^0_k(T,P) - * \f$. The values are evaluated at the current - * temperature and pressure of the solution + * These are the standard state chemical potentials \f$ \mu^0_k(T,P) \f$. + * The values are evaluated at the current temperature and pressure of the + * solution * * @param mu0 Output vector of chemical potentials. * Length: m_kk. @@ -335,48 +295,19 @@ public: /// @name Properties of the Standard State of the Species in the Solution //@{ - //! Get the nondimensional Enthalpy functions for the species - //! at their standard states at the current T and P of the solution. - /*! - * @param hrt Output vector of nondimensional standard state enthalpies. - * Length: m_kk. - */ virtual void getEnthalpy_RT(doublereal* hrt) const; - - //! Get the array of nondimensional Entropy functions for the - //! standard state species at the current T and P of the solution. - /*! - * @param sr Output vector of nondimensional standard state entropies. - * Length: m_kk. - */ virtual void getEntropy_R(doublereal* sr) const; - - //! Get the nondimensional Gibbs functions for the species - //! in their standard states at the current T and P of the solution. - /*! - * @param grt Output vector of nondimensional standard state Gibbs free energies - * Length: m_kk. - */ virtual void getGibbs_RT(doublereal* grt) const; - - //! Get the nondimensional Heat Capacities at constant - //! pressure for the species standard states - //! at the current T and P of the solution - /*! - * @param cpr Output vector of nondimensional standard state heat capacities - * Length: m_kk. - */ virtual void getCp_R(doublereal* cpr) const; - //! Returns the vector of nondimensional Internal Energies of the standard - //! state species at the current T and P of the solution + //! Returns the vector of nondimensional Internal Energies of the standard + //! state species at the current T and P of the solution /*! - * For an incompressible, - * stoichiometric substance, the molar internal energy is - * independent of pressure. Since the thermodynamic properties - * are specified by giving the standard-state enthalpy, the - * term \f$ P_{ref} \hat v\f$ is subtracted from the specified reference molar - * enthalpy to compute the standard state molar internal energy. + * For an incompressible, stoichiometric substance, the molar internal + * energy is independent of pressure. Since the thermodynamic properties are + * specified by giving the standard-state enthalpy, the term \f$ P_{ref} + * \hat v\f$ is subtracted from the specified reference molar enthalpy to + * compute the standard state molar internal energy. * * @param urt output vector of nondimensional standard state * internal energies of the species. Length: m_kk. @@ -387,14 +318,6 @@ public: /// @name Thermodynamic Values for the Species Reference States //@{ - //! Returns the vector of nondimensional - //! internal Energies of the reference state at the current temperature - //! of the solution and the reference pressure for each species. - /*! - * @param urt Output vector of nondimensional reference state - * internal energies of the species. - * Length: m_kk - */ virtual void getIntEnergy_RT_ref(doublereal* urt) const; // @} @@ -402,8 +325,7 @@ public: //! Make the default XML tree /*! - * @return Returns a malloced XML tree containing the - * default info. + * @returns a malloced XML tree containing the default info. */ static XML_Node* makeDefaultXMLTree(); @@ -432,13 +354,7 @@ public: //! Set equation of state parameter values from XML entries. /*! - * This method is called by function importPhase() when processing a phase - * definition in an input file. It should be overloaded in subclasses to set - * any parameters that are specific to that particular phase - * model. Note, this method is called before the phase is - * initialized with elements and/or species. - * - * For this phase, the density of the phase is specified in this block. + * For this phase, the density of the phase is specified in this block. * * @param eosdata An XML_Node object corresponding to * the "thermo" entry for this phase in the input file. diff --git a/include/cantera/thermo/MineralEQ3.h b/include/cantera/thermo/MineralEQ3.h index d27531f59..3249c6635 100644 --- a/include/cantera/thermo/MineralEQ3.h +++ b/include/cantera/thermo/MineralEQ3.h @@ -20,27 +20,25 @@ namespace Cantera { -//! Class MineralEQ3 represents a stoichiometric (fixed -//! composition) incompressible substance based on EQ3's parameterization +//! Class MineralEQ3 represents a stoichiometric (fixed composition) +//! incompressible substance based on EQ3's parameterization /*! - * This class inherits from SingleSpeciesSSTP class. - * EQ's parameterization is mapped onto the Shomate polynomial class. + * This class inherits from SingleSpeciesTP class. EQ's parameterization is + * mapped onto the Shomate polynomial class. * * Specification of Species Standard State Properties * - * This class inherits from SingleSpeciesTP. - * It is assumed that the reference state thermodynamics may be - * obtained by a pointer to a populated species thermodynamic property - * manager class (see ThermoPhase::m_spthermo). How to relate pressure - * changes to the reference state thermodynamics is resolved at this level. + * This class inherits from SingleSpeciesTP. It is assumed that the reference + * state thermodynamics may be obtained by a pointer to a populated species + * thermodynamic property manager class (see ThermoPhase::m_spthermo). How to + * relate pressure changes to the reference state thermodynamics is resolved at + * this level. * - * For an incompressible, - * stoichiometric substance, the molar internal energy is - * independent of pressure. Since the thermodynamic properties - * are specified by giving the standard-state enthalpy, the - * term \f$ P_0 \hat v\f$ is subtracted from the specified molar - * enthalpy to compute the molar internal energy. The entropy is - * assumed to be independent of the pressure. + * For an incompressible, stoichiometric substance, the molar internal energy is + * independent of pressure. Since the thermodynamic properties are specified by + * giving the standard-state enthalpy, the term \f$ P_0 \hat v\f$ is subtracted + * from the specified molar enthalpy to compute the molar internal energy. The + * entropy is assumed to be independent of the pressure. * * The enthalpy function is given by the following relation. * @@ -49,45 +47,44 @@ namespace Cantera * h^{ref}_k(T) + \tilde v \left( P - P_{ref} \right) * \f] * - * For an incompressible, - * stoichiometric substance, the molar internal energy is - * independent of pressure. Since the thermodynamic properties - * are specified by giving the standard-state enthalpy, the - * term \f$ P_{ref} \tilde v\f$ is subtracted from the specified reference molar - * enthalpy to compute the molar internal energy. + * For an incompressible, stoichiometric substance, the molar internal energy is + * independent of pressure. Since the thermodynamic properties are specified by + * giving the standard-state enthalpy, the term \f$ P_{ref} \tilde v\f$ is + * subtracted from the specified reference molar enthalpy to compute the molar + * internal energy. * * \f[ * u^o_k(T,P) = h^{ref}_k(T) - P_{ref} \tilde v * \f] * - * The standard state heat capacity and entropy are independent - * of pressure. The standard state Gibbs free energy is obtained - * from the enthalpy and entropy functions. + * The standard state heat capacity and entropy are independent of pressure. The + * standard state Gibbs free energy is obtained from the enthalpy and entropy + * functions. * * Specification of Solution Thermodynamic Properties * - * All solution properties are obtained from the standard state - * species functions, since there is only one species in the phase. + * All solution properties are obtained from the standard state species + * functions, since there is only one species in the phase. * * %Application within Kinetics Managers * - * The standard concentration is equal to 1.0. This means that the - * kinetics operator works on an (activities basis). Since this - * is a stoichiometric substance, this means that the concentration - * of this phase drops out of kinetics expressions. + * The standard concentration is equal to 1.0. This means that the kinetics + * operator works on an (activities basis). Since this is a stoichiometric + * substance, this means that the concentration of this phase drops out of + * kinetics expressions. * - * An example of a reaction using this is a sticking coefficient - * reaction of a substance in an ideal gas phase on a surface with a bulk phase - * species in this phase. In this case, the rate of progress for this - * reaction, \f$ R_s \f$, may be expressed via the following equation: + * An example of a reaction using this is a sticking coefficient reaction of a + * substance in an ideal gas phase on a surface with a bulk phase species in + * this phase. In this case, the rate of progress for this reaction, + * \f$ R_s \f$, may be expressed via the following equation: * \f[ * R_s = k_s C_{gas} * \f] * where the units for \f$ R_s \f$ are kmol m-2 s-1. \f$ C_{gas} \f$ has units - * of kmol m-3. Therefore, the kinetic rate constant, \f$ k_s \f$, has - * units of m s-1. Nowhere does the concentration of the bulk phase - * appear in the rate constant expression, since it's a stoichiometric - * phase and the activity is always equal to 1.0. + * of kmol m-3. Therefore, the kinetic rate constant, \f$ k_s \f$, has units of + * m s-1. Nowhere does the concentration of the bulk phase appear in the rate + * constant expression, since it's a stoichiometric phase and the activity is + * always equal to 1.0. * * @ingroup thermoprops */ @@ -114,26 +111,8 @@ public: */ MineralEQ3(XML_Node& phaseRef, const std::string& id = ""); - //! Copy constructor - /*! - * @param right Object to be copied - */ MineralEQ3(const MineralEQ3& right); - - //! Assignment operator - /*! - * @param right Object to be copied - */ MineralEQ3& operator=(const MineralEQ3& right); - - //! Duplication function - /*! - * This virtual function is used to create a duplicate of the - * current phase. It's used to duplicate the phase when given - * a ThermoPhase pointer to the phase. - * - * @return It returns a ThermoPhase pointer. - */ ThermoPhase* duplMyselfAsThermoPhase() const; /** @@ -148,76 +127,56 @@ public: //! Report the Pressure. Units: Pa. /*! - * For an incompressible substance, the density is independent - * of pressure. This method simply returns the stored - * pressure value. + * For an incompressible substance, the density is independent of pressure. + * This method simply returns the stored pressure value. */ virtual doublereal pressure() const; //! Set the pressure at constant temperature. Units: Pa. /*! - * For an incompressible substance, the density is - * independent of pressure. Therefore, this method only - * stores the specified pressure value. It does not - * modify the density. + * For an incompressible substance, the density is independent of pressure. + * Therefore, this method only stores the specified pressure value. It does + * not modify the density. * * @param p Pressure (units - Pa) */ virtual void setPressure(doublereal p); - //! Returns the isothermal compressibility. Units: 1/Pa. - /*! - * The isothermal compressibility is defined as - * \f[ - * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T - * \f] - */ virtual doublereal isothermalCompressibility() const; - - //! Return the volumetric thermal expansion coefficient. Units: 1/K. - /*! - * The thermal expansion coefficient is defined as - * \f[ - * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P - * \f] - */ virtual doublereal thermalExpansionCoeff() const; /** * @} * @name Activities, Standard States, and Activity Concentrations * - * This section is largely handled by parent classes, since there - * is only one species. Therefore, the activity is equal to one. + * This section is largely handled by parent classes, since there is only + * one species. Therefore, the activity is equal to one. * @{ */ //! This method returns an array of generalized concentrations /*! - * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / - * C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration - * defined below and \f$ a_k \f$ are activities used in the - * thermodynamic functions. These activity (or generalized) - * concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. + * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / C^0_k, \f$ where + * \f$ C^0_k \f$ is a standard concentration defined below and \f$ a_k \f$ + * are activities used in the thermodynamic functions. These activity (or + * generalized) concentrations are used by kinetics manager classes to + * compute the forward and reverse rates of elementary reactions. * - * For a stoichiometric substance, there is - * only one species, and the generalized concentration is 1.0. + * For a stoichiometric substance, there is only one species, and the + * generalized concentration is 1.0. * - * @param c Output array of generalized concentrations. The - * units depend upon the implementation of the - * reaction rate expressions within the phase. + * @param c Output array of generalized concentrations. The units depend + * upon the implementation of the reaction rate expressions within + * the phase. */ virtual void getActivityConcentrations(doublereal* c) const; //! Return the standard concentration for the kth species /*! - * The standard concentration \f$ C^0_k \f$ used to normalize - * the activity (i.e., generalized) concentration. - * This phase assumes that the kinetics operator works on an - * dimensionless basis. Thus, the standard concentration is - * equal to 1.0. + * The standard concentration \f$ C^0_k \f$ used to normalize the activity + * (i.e., generalized) concentration. This phase assumes that the kinetics + * operator works on an dimensionless basis. Thus, the standard + * concentration is equal to 1.0. * * @param k Optional parameter indicating the species. The default * is to assume this refers to species 0. @@ -225,20 +184,15 @@ public: * Returns The standard Concentration as 1.0 */ virtual doublereal standardConcentration(size_t k=0) const; - - //! Natural logarithm of the standard concentration of the kth species. - /*! - * @param k index of the species (defaults to zero) - */ virtual doublereal logStandardConc(size_t k=0) const; - //! Get the array of chemical potentials at unit activity for the species - //! at their standard states at the current T and P of the solution. + //! Get the array of chemical potentials at unit activity for the species at + //! their standard states at the current T and P of the + //! solution. /*! - * For a stoichiometric substance, there is no activity term in - * the chemical potential expression, and therefore the - * standard chemical potential and the chemical potential - * are both equal to the molar Gibbs function. + * For a stoichiometric substance, there is no activity term in the chemical + * potential expression, and therefore the standard chemical potential and + * the chemical potential are both equal to the molar Gibbs function. * * These are the standard state chemical potentials \f$ \mu^0_k(T,P) * \f$. The values are evaluated at the current @@ -253,51 +207,22 @@ public: /// @name Properties of the Standard State of the Species in the Solution //@{ - //! Get the nondimensional Enthalpy functions for the species - //! at their standard states at the current T and P of the solution. - /*! - * @param hrt Output vector of nondimensional standard state enthalpies. - * Length: m_kk. - */ virtual void getEnthalpy_RT(doublereal* hrt) const; - - //! Get the array of nondimensional Entropy functions for the - //! standard state species at the current T and P of the solution. - /*! - * @param sr Output vector of nondimensional standard state entropies. - * Length: m_kk. - */ virtual void getEntropy_R(doublereal* sr) const; - - //! Get the nondimensional Gibbs functions for the species - //! in their standard states at the current T and P of the solution. - /*! - * @param grt Output vector of nondimensional standard state Gibbs free energies - * Length: m_kk. - */ virtual void getGibbs_RT(doublereal* grt) const; - - //! Get the nondimensional Heat Capacities at constant - //! pressure for the species standard states - //! at the current T and P of the solution - /*! - * @param cpr Output vector of nondimensional standard state heat capacities - * Length: m_kk. - */ virtual void getCp_R(doublereal* cpr) const; //! Returns the vector of nondimensional Internal Energies of the standard //! state species at the current T and P of the solution /*! - * For an incompressible, - * stoichiometric substance, the molar internal energy is - * independent of pressure. Since the thermodynamic properties - * are specified by giving the standard-state enthalpy, the - * term \f$ P_{ref} \hat v\f$ is subtracted from the specified reference molar + * For an incompressible, stoichiometric substance, the molar internal + * energy is independent of pressure. Since the thermodynamic properties are + * specified by giving the standard-state enthalpy, the term + * \f$ P_{ref} \hat v\f$ is subtracted from the specified reference molar * enthalpy to compute the standard state molar internal energy. * - * @param urt output vector of nondimensional standard state - * internal energies of the species. Length: m_kk. + * @param urt output vector of nondimensional standard state internal + * energies of the species. Length: m_kk. */ virtual void getIntEnergy_RT(doublereal* urt) const; @@ -305,35 +230,12 @@ public: /// @name Thermodynamic Values for the Species Reference States //@{ - //! Returns the vector of nondimensional - //! internal Energies of the reference state at the current temperature - //! of the solution and the reference pressure for each species. - /*! - * @param urt Output vector of nondimensional reference state - * internal energies of the species. - * Length: m_kk - */ virtual void getIntEnergy_RT_ref(doublereal* urt) const; //! @} - //! Initialize the phase parameters from an XML file. + //! @copydoc ThermoPhase::initThermoXML /*! - * initThermoXML() (virtual from ThermoPhase) - * - * This gets called from importPhase(). It processes the XML file - * after the species are set up. This is the main routine for - * reading in activity coefficient parameters. - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. + * This is the main routine for reading in activity coefficient parameters. */ virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); @@ -360,18 +262,9 @@ public: */ virtual void getParameters(int& n, doublereal* const c) const; - //! Set equation of state parameter values from XML entries. + //! @copydoc ThermoPhase::setParametersFromXML /*! - * This method is called by function importPhase() when processing a phase - * definition in an input file. It should be overloaded in subclasses to set - * any parameters that are specific to that particular phase - * model. Note, this method is called before the phase is - * initialized with elements and/or species. - * - * For this phase, the density of the phase is specified in this block. - * - * @param eosdata An XML_Node object corresponding to - * the "thermo" entry for this phase in the input file. + * For this phase, the density of the phase is specified in this block. */ virtual void setParametersFromXML(const XML_Node& eosdata); doublereal LookupGe(const std::string& elemName); @@ -380,8 +273,8 @@ public: protected: //! Value of the Absolute Gibbs Free Energy NIST scale at T_r and P_r /*! - * This is the NIST scale value of Gibbs free energy at T_r = 298.15 - * and P_r = 1 atm. + * This is the NIST scale value of Gibbs free energy at T_r = 298.15 + * and P_r = 1 atm. * * J kmol-1 */ @@ -395,19 +288,19 @@ protected: //! Input Value of deltaG of Formation at Tr and Pr (cal gmol-1) /*! - * Tr = 298.15 Pr = 1 atm + * Tr = 298.15 Pr = 1 atm * - * This is the delta G for the formation reaction of the - * ion from elements in their stable state at Tr, Pr. + * This is the delta G for the formation reaction of the ion from elements + * in their stable state at Tr, Pr. */ doublereal m_deltaG_formation_pr_tr; //! Input Value of deltaH of Formation at Tr and Pr (cal gmol-1) /*! - * Tr = 298.15 Pr = 1 atm + * Tr = 298.15 Pr = 1 atm * - * This is the delta H for the formation reaction of the - * ion from elements in their stable state at Tr, Pr. + * This is the delta H for the formation reaction of the ion from elements + * in their stable state at Tr, Pr. */ doublereal m_deltaH_formation_pr_tr; diff --git a/include/cantera/thermo/MixedSolventElectrolyte.h b/include/cantera/thermo/MixedSolventElectrolyte.h index 7baa57f44..9466de006 100644 --- a/include/cantera/thermo/MixedSolventElectrolyte.h +++ b/include/cantera/thermo/MixedSolventElectrolyte.h @@ -1,15 +1,6 @@ /** - * @file MixedSolventElectrolyte.h - * Header for intermediate ThermoPhase object for phases which - * employ Gibbs excess free energy based formulations - * (see \ref thermoprops - * and class \link Cantera::MargulesVPSSTP MargulesVPSSTP\endlink). - * - * Header file for a derived class of ThermoPhase that handles - * variable pressure standard state methods for calculating - * thermodynamic properties that are further based upon activities - * based on the molality scale. These include most of the methods for - * calculating liquid electrolyte thermodynamics. + * @file MixedSolventElectrolyte.h (see \ref thermoprops and class \link + * Cantera::MixedSolventElectrolyte MixedSolventElectrolyte \endlink). */ /* * Copyright (2006) Sandia Corporation. Under the terms of @@ -24,245 +15,211 @@ namespace Cantera { -/** - * @ingroup thermoprops - */ - -//! MixedSolventElectrolyte is a derived class of GibbsExcessVPSSTP that employs -//! the DH and local Marguless approximations for the excess Gibbs free energy +//! MixedSolventElectrolyte is a derived class of GibbsExcessVPSSTP that employs +//! the DH and local Marguless approximations for the excess Gibbs free energy /*! * MixedSolventElectrolyte derives from class GibbsExcessVPSSTP which is derived - * from VPStandardStateTP, - * and overloads the virtual methods defined there with ones that - * use expressions appropriate for the Margules Excess Gibbs free energy - * approximation. + * from VPStandardStateTP. * * The independent unknowns are pressure, temperature, and mass fraction. * - * Several concepts are introduced. The first concept is there are temporary - * variables for holding the species standard state values - * of Cp, H, S, G, and V at the - * last temperature and pressure called. These functions are not recalculated - * if a new call is made using the previous temperature and pressure. Currently, - * these variables and the calculation method are handled by the VPSSMgr class, - * for which VPStandardStateTP owns a pointer to. - * - * To support the above functionality, pressure and temperature variables, - * m_plast_ss and m_tlast_ss, are kept which store the last pressure and temperature - * used in the evaluation of standard state properties. - * - * This class is usually used for nearly incompressible phases. For those phases, it - * makes sense to change the equation of state independent variable from - * density to pressure. The variable m_Pcurrent contains the current value of the - * pressure within the phase. - * *
*

Specification of Species Standard State Properties

*
* - * All species are defined to have standard states that depend upon both - * the temperature and the pressure. The Margules approximation assumes - * symmetric standard states, where all of the standard state assume - * that the species are in pure component states at the temperature - * and pressure of the solution. I don't think it prevents, however, - * some species from being dilute in the solution. + * All species are defined to have standard states that depend upon both the + * temperature and the pressure. The Margules approximation assumes symmetric + * standard states, where all of the standard state assume that the species are + * in pure component states at the temperature and pressure of the solution. I + * don't think it prevents, however, some species from being dilute in the + * solution. * *
*

Specification of Solution Thermodynamic Properties

*
* - * The molar excess Gibbs free energy is given by the following formula which is a sum over interactions i. - * Each of the interactions are binary interactions involving two of the species in the phase, denoted, Ai - * and Bi. - * This is the generalization of the Margules formulation for a phase - * that has more than 2 species. + * The molar excess Gibbs free energy is given by the following formula which is + * a sum over interactions i. Each of the interactions are binary + * interactions involving two of the species in the phase, denoted, Ai + * and Bi. This is the generalization of the Margules formulation for a + * phase that has more than 2 species. * - * \f[ - * G^E = \sum_i \left( H_{Ei} - T S_{Ei} \right) - * \f] - * \f[ - * H^E_i = n X_{Ai} X_{Bi} \left( h_{o,i} + h_{1,i} X_{Bi} \right) - * \f] - * \f[ - * S^E_i = n X_{Ai} X_{Bi} \left( s_{o,i} + s_{1,i} X_{Bi} \right) - * \f] + * \f[ + * G^E = \sum_i \left( H_{Ei} - T S_{Ei} \right) + * \f] + * \f[ + * H^E_i = n X_{Ai} X_{Bi} \left( h_{o,i} + h_{1,i} X_{Bi} \right) + * \f] + * \f[ + * S^E_i = n X_{Ai} X_{Bi} \left( s_{o,i} + s_{1,i} X_{Bi} \right) + * \f] * * where n is the total moles in the solution. * - * The activity of a species defined in the phase is given by an excess - * Gibbs free energy formulation. + * The activity of a species defined in the phase is given by an excess Gibbs + * free energy formulation. * - * \f[ - * a_k = \gamma_k X_k - * \f] + * \f[ + * a_k = \gamma_k X_k + * \f] * * where * - * \f[ - * R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i} - * \f] + * \f[ + * R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i} + * \f] * * Taking the derivatives results in the following expression * - * \f[ - * R T \ln( \gamma_k )= \sum_i \left( \left( \delta_{Ai,k} X_{Bi} + \delta_{Bi,k} X_{Ai} - X_{Ai} X_{Bi} \right) - * \left( g^E_{o,i} + g^E_{1,i} X_{Bi} \right) + - * \left( \delta_{Bi,k} - X_{Bi} \right) X_{Ai} X_{Bi} g^E_{1,i} \right) - * \f] - * where - * \f$ g^E_{o,i} = h_{o,i} - T s_{o,i} \f$ and \f$ g^E_{1,i} = h_{1,i} - T s_{1,i} \f$ - * and where \f$ X_k \f$ is the mole fraction of species k. + * \f[ + * R T \ln( \gamma_k )= \sum_i \left( \left( \delta_{Ai,k} X_{Bi} + \delta_{Bi,k} X_{Ai} - X_{Ai} X_{Bi} \right) + * \left( g^E_{o,i} + g^E_{1,i} X_{Bi} \right) + + * \left( \delta_{Bi,k} - X_{Bi} \right) X_{Ai} X_{Bi} g^E_{1,i} \right) + * \f] + * where \f$ g^E_{o,i} = h_{o,i} - T s_{o,i} \f$ and + * \f$ g^E_{1,i} = h_{1,i} - T s_{1,i} \f$ and where \f$ X_k \f$ is the mole + * fraction of species k. * - * This object inherits from the class VPStandardStateTP. Therefore, the specification and - * calculation of all standard state and reference state values are handled at that level. Various functional - * forms for the standard state are permissible. - * The chemical potential for species k is equal to + * This object inherits from the class VPStandardStateTP. Therefore, the + * specification and calculation of all standard state and reference state + * values are handled at that level. Various functional forms for the standard + * state are permissible. The chemical potential for species k is equal + * to * - * \f[ - * \mu_k(T,P) = \mu^o_k(T, P) + R T \ln(\gamma_k X_k) - * \f] + * \f[ + * \mu_k(T,P) = \mu^o_k(T, P) + R T \ln(\gamma_k X_k) + * \f] * * The partial molar entropy for species k is given by the following relation, * - * \f[ - * \tilde{s}_k(T,P) = s^o_k(T,P) - R \ln( \gamma_k X_k ) - * - R T \frac{d \ln(\gamma_k) }{dT} - * \f] + * \f[ + * \tilde{s}_k(T,P) = s^o_k(T,P) - R \ln( \gamma_k X_k ) + * - R T \frac{d \ln(\gamma_k) }{dT} + * \f] * * The partial molar enthalpy for species k is given by * - * \f[ - * \tilde{h}_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] + * \f[ + * \tilde{h}_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} + * \f] * * The partial molar volume for species k is * - * \f[ - * \tilde V_k(T,P) = V^o_k(T,P) + R T \frac{d \ln(\gamma_k) }{dP} - * \f] + * \f[ + * \tilde V_k(T,P) = V^o_k(T,P) + R T \frac{d \ln(\gamma_k) }{dP} + * \f] * * The partial molar Heat Capacity for species k is * - * \f[ - * \tilde{C}_{p,k}(T,P) = C^o_{p,k}(T,P) - 2 R T \frac{d \ln( \gamma_k )}{dT} - * - R T^2 \frac{d^2 \ln(\gamma_k) }{{dT}^2} - * \f] + * \f[ + * \tilde{C}_{p,k}(T,P) = C^o_{p,k}(T,P) - 2 R T \frac{d \ln( \gamma_k )}{dT} + * - R T^2 \frac{d^2 \ln(\gamma_k) }{{dT}^2} + * \f] * *
*

%Application within Kinetics Managers

*
* - * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / - * C^s_k, \f$ where \f$ C^s_k \f$ is a standard concentration - * defined below and \f$ a_k \f$ are activities used in the - * thermodynamic functions. These activity (or generalized) - * concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. - * The activity concentration,\f$ C^a_k \f$,is given by the following expression. + * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / C^s_k, \f$ where + * \f$ C^s_k \f$ is a standard concentration defined below and \f$ a_k \f$ are + * activities used in the thermodynamic functions. These activity (or + * generalized) concentrations are used by kinetics manager classes to compute + * the forward and reverse rates of elementary reactions. The activity + * concentration, \f$ C^a_k \f$, is given by the following expression. * - * \f[ - * C^a_k = C^s_k X_k = \frac{P}{R T} X_k - * \f] + * \f[ + * C^a_k = C^s_k X_k = \frac{P}{R T} X_k + * \f] * - * The standard concentration for species k is independent of k and equal to + * The standard concentration for species k is independent of k + * and equal to * - * \f[ - * C^s_k = C^s = \frac{P}{R T} - * \f] + * \f[ + * C^s_k = C^s = \frac{P}{R T} + * \f] * - * For example, a bulk-phase binary gas reaction between species j and k, producing - * a new gas species l would have the - * following equation for its rate of progress variable, \f$ R^1 \f$, which has - * units of kmol m-3 s-1. + * For example, a bulk-phase binary gas reaction between species j and k, + * producing a new gas species l would have the following equation for its rate + * of progress variable, \f$ R^1 \f$, which has units of kmol m-3 s-1. * - * \f[ + * \f[ * R^1 = k^1 C_j^a C_k^a = k^1 (C^s a_j) (C^s a_k) - * \f] - * where - * \f[ + * \f] + * where + * \f[ * C_j^a = C^s a_j \mbox{\quad and \quad} C_k^a = C^s a_k - * \f] + * \f] * - * \f$ C_j^a \f$ is the activity concentration of species j, and - * \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^s \f$ - * is the standard concentration. \f$ a_j \f$ is - * the activity of species j which is equal to the mole fraction of j. + * \f$ C_j^a \f$ is the activity concentration of species j, and \f$ C_k^a \f$ + * is the activity concentration of species k. \f$ C^s \f$ is the standard + * concentration. \f$ a_j \f$ is the activity of species j which is equal to the + * mole fraction of j. * - * The reverse rate constant can then be obtained from the law of microscopic reversibility - * and the equilibrium expression for the system. + * The reverse rate constant can then be obtained from the law of microscopic + * reversibility and the equilibrium expression for the system. * - * \f[ - * \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} ) - * \f] + * \f[ + * \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} ) + * \f] * - * \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, associated with - * the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ and their associated activities, - * \f$ a_l \f$, repeated here: + * \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, + * associated with the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ + * and their associated activities, \f$ a_l \f$, repeated here: * - * \f[ - * \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l) - * \f] + * \f[ + * \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l) + * \f] * - * We can switch over to expressing the equilibrium constant in terms of the reference - * state chemical potentials + * We can switch over to expressing the equilibrium constant in terms of the + * reference state chemical potentials * - * \f[ - * K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P} - * \f] + * \f[ + * K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P} + * \f] * - * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over - * to activity concentrations. When this is done: + * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by + * changing over to activity concentrations. When this is done: * - * \f[ - * \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 = - * \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT} - * \f] + * \f[ + * \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 = + * \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT} + * \f] * - * Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$, - * using the second and third part of the above expression as a definition for the concentration - * equilibrium constant. + * Kinetics managers will calculate the concentration equilibrium constant, \f$ + * K_c \f$, using the second and third part of the above expression as a + * definition for the concentration equilibrium constant. * - * For completeness, the pressure equilibrium constant may be obtained as well + * For completeness, the pressure equilibrium constant may be obtained as well * - * \f[ - * \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) - * \f] + * \f[ + * \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) + * \f] * - * \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. However, it isn't - * necessarily the simplest form of the equilibrium constant for other types of phases; \f$ K_c \f$ is - * used instead because it is completely general. + * \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. + * However, it isn't necessarily the simplest form of the equilibrium constant + * for other types of phases; \f$ K_c \f$ is used instead because it is + * completely general. * - * The reverse rate of progress may be written down as - * \f[ + * The reverse rate of progress may be written down as + * \f[ * R^{-1} = k^{-1} C_l^a = k^{-1} (C^o a_l) - * \f] + * \f] * - * where we can use the concept of microscopic reversibility to - * write the reverse rate constant in terms of the - * forward reate constant and the concentration equilibrium - * constant, \f$ K_c \f$. + * where we can use the concept of microscopic reversibility to write the + * reverse rate constant in terms of the forward reate constant and the + * concentration equilibrium constant, \f$ K_c \f$. * - * \f[ - * k^{-1} = k^1 K^1_c - * \f] + * \f[ + * k^{-1} = k^1 K^1_c + * \f] * - * \f$k^{-1} \f$ has units of s-1. + * \f$k^{-1} \f$ has units of s-1. * * @ingroup thermoprops */ class MixedSolventElectrolyte : public MolarityIonicVPSSTP { public: - //! Constructor - /*! - * This doesn't do much more than initialize constants with - * default values for water at 25C. Water molecular weight - * comes from the default elements.xml file. It actually - * differs slightly from the IAPWS95 value of 18.015268. However, - * density conservation and therefore element conservation - * is the more important principle to follow. - */ MixedSolventElectrolyte(); //! Construct and initialize a MixedSolventElectrolyte ThermoPhase object @@ -285,179 +242,58 @@ public: */ MixedSolventElectrolyte(XML_Node& phaseRef, const std::string& id = ""); - //! Copy constructor - /*! - * @param b class to be copied - */ MixedSolventElectrolyte(const MixedSolventElectrolyte& b); - - //! Assignment operator - /*! - * @param b class to be copied. - */ MixedSolventElectrolyte& operator=(const MixedSolventElectrolyte& b); - - //! Duplication routine for objects which inherit from ThermoPhase. - /*! - * This virtual routine can be used to duplicate ThermoPhase objects - * inherited from ThermoPhase even if the application only has - * a pointer to ThermoPhase to work with. - */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; //! @name Molar Thermodynamic Properties //! @{ - /// Molar enthalpy. Units: J/kmol. virtual doublereal enthalpy_mole() const; - - /// Molar entropy. Units: J/kmol. virtual doublereal entropy_mole() const; - - /// Molar heat capacity at constant pressure. Units: J/kmol/K. virtual doublereal cp_mole() const; - - /// Molar heat capacity at constant volume. Units: J/kmol/K. virtual doublereal cv_mole() const; /** * @} * @name Activities, Standard States, and Activity Concentrations * - * The activity \f$a_k\f$ of a species in solution is - * related to the chemical potential by \f[ \mu_k = \mu_k^0(T) - * + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is - * the chemical potential at unit activity, which depends only - * on temperature and pressure. + * The activity \f$a_k\f$ of a species in solution is related to the + * chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The + * quantity \f$\mu_k^0(T,P)\f$ is the chemical potential at unit activity, + * which depends only on temperature and pressure. * @{ */ - //! Get the array of non-dimensional molar-based activity coefficients at - //! the current solution temperature, pressure, and solution concentration. - /*! - * @param ac Output vector of activity coefficients. Length: m_kk. - */ virtual void getActivityCoefficients(doublereal* ac) const; //@} /// @name Partial Molar Properties of the Solution //@{ - //! Get the species chemical potentials. Units: J/kmol. - /*! - * This function returns a vector of chemical potentials of the - * species in solution at the current temperature, pressure - * and mole fraction of the solution. - * - * @param mu Output vector of species chemical - * potentials. Length: m_kk. Units: J/kmol - */ virtual void getChemPotentials(doublereal* mu) const; - - //! Returns an array of partial molar enthalpies for the species - //! in the mixture. - /*! - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * molality-based activity coefficient wrt temperature - * - * \f[ - * \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] - * - * @param hbar Vector of returned partial molar enthalpies - * (length m_kk, units = J/kmol) - */ virtual void getPartialMolarEnthalpies(doublereal* hbar) const; - - //! Returns an array of partial molar entropies for the species - //! in the mixture. - /*! - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature - * - * \f[ - * \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * - R \ln( \gamma_k X_k) - * - R T \frac{d \ln(\gamma_k) }{dT} - * \f] - * - * @param sbar Vector of returned partial molar entropies - * (length m_kk, units = J/kmol/K) - */ virtual void getPartialMolarEntropies(doublereal* sbar) const; - - //! Returns an array of partial molar entropies for the species - //! in the mixture. - /*! - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature - * - * \f[ - * ??????????????? - * \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * - R \ln( \gamma_k X_k) - * - R T \frac{d \ln(\gamma_k) }{dT} - * ??????????????? - * \f] - * - * @param cpbar Vector of returned partial molar heat capacities - * (length m_kk, units = J/kmol/K) - */ virtual void getPartialMolarCp(doublereal* cpbar) const; - - //! Return an array of partial molar volumes for the - //! species in the mixture. Units: m^3/kmol. - /*! - * Frequently, for this class of thermodynamics representations, - * the excess Volume due to mixing is zero. Here, we set it as - * a default. It may be overridden in derived classes. - * - * @param vbar Output vector of species partial molar volumes. - * Length = m_kk. units are m^3/kmol. - */ virtual void getPartialMolarVolumes(doublereal* vbar) const; - - //! Get the species electrochemical potentials. - /*! - * These are partial molar quantities. - * This method adds a term \f$ Fz_k \phi_k \f$ to the - * to each chemical potential. - * - * Units: J/kmol - * - * @param mu output vector containing the species electrochemical potentials. - * Length: m_kk., units = J/kmol - */ void getElectrochemPotentials(doublereal* mu) const; - //! Get the array of temperature second derivatives of the log activity coefficients + //! Get the array of temperature second derivatives of the log activity + //! coefficients /*! - * This function is a virtual class, but it first appears in GibbsExcessVPSSTP - * class and derived classes from GibbsExcessVPSSTP. + * units = 1/Kelvin * - * units = 1/Kelvin - * - * @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of the - * log Activity Coefficients. length = m_kk + * @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of + * the log Activity Coefficients. length = m_kk * */ virtual void getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const; //! Get the array of temperature derivatives of the log activity coefficients /*! - * This function is a virtual class, but it first appears in GibbsExcessVPSSTP - * class and derived classes from GibbsExcessVPSSTP. + * This is a virtual function, which first appears in GibbsExcessVPSSTP. * - * units = 1/Kelvin + * units = 1/Kelvin * * @param dlnActCoeffdT Output vector of temperature derivatives of the * log Activity Coefficients. length = m_kk @@ -466,39 +302,13 @@ public: //! @} //! @name Initialization - /// The following methods are used in the process of constructing - /// the phase and setting its parameters from a specification in an - /// input file. They are not normally used in application programs. - /// To see how they are used, see importPhase(). + /// The following methods are used in the process of constructing the phase + /// and setting its parameters from a specification in an input file. They + /// are not normally used in application programs. To see how they are used, + /// see importPhase(). /// @{ - /*! - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase(). - */ virtual void initThermo(); - - /** - * Import and initialize a ThermoPhase object - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ void initThermoXML(XML_Node& phaseNode, const std::string& id); /** @@ -507,84 +317,22 @@ public: * @{ */ - //! Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along - //! a line in parameter space or along a line in physical space - /*! - * - * @param dTds Input of temperature change along the path - * @param dXds Input vector of changes in mole fraction along the path. length = m_kk - * Along the path length it must be the case that the mole fractions sum to one. - * @param dlnActCoeffds Output vector of the directional derivatives of the - * log Activity Coefficients along the path. length = m_kk - * units are 1/units(s). if s is a physical coordinate then the units are 1/m. - */ virtual void getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const; - - //! Get the array of log concentration-like derivatives of the - //! log activity coefficients - diagonal component - /*! - * This function is a virtual method. For ideal mixtures - * (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the - * logarithm of the activity coefficient with respect to the - * logarithm of the mole fraction. - * - * units = dimensionless - * - * @param dlnActCoeffdlnX_diag Output vector of the diagonal component of the log(mole fraction) - * derivatives of the log Activity Coefficients. - * length = m_kk - */ virtual void getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const; - - //! Get the array of derivatives of the log activity coefficients wrt mole numbers - diagonal only - /*! - * This function is a virtual method. For ideal mixtures - * (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the - * logarithm of the activity coefficient with respect to the - * logarithm of the concentration-like variable (i.e. mole fraction, - * molality, etc.) that represents the standard state. - * - * units = dimensionless - * - * @param dlnActCoeffdlnN_diag Output vector of the diagonal entries for the log(mole fraction) - * derivatives of the log Activity Coefficients. - * length = m_kk - */ virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const; - - //! Get the array of derivatives of the log activity coefficients with respect to the ln species mole numbers - /*! - * Implementations should take the derivative of the logarithm of the activity coefficient with respect to a - * log of a species mole number (with all other species mole numbers held constant) - * - * units = 1 / kmol - * - * dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log act_coeff for the mth - * species with respect to the number of moles of the kth species. - * - * \f[ - * \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i} - * \f] - * - * @param ld Number of rows in the matrix - * @param dlnActCoeffdlnN Output vector of derivatives of the - * log Activity Coefficients. length = m_kk * m_kk - */ virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN); //@} private: //! Process an XML node called "binaryNeutralSpeciesParameters" /*! - * This node contains all of the parameters necessary to describe - * the Margules model for a particular binary interaction. - * This function reads the XML file and writes the coefficients - * it finds to an internal data structures. + * This node contains all of the parameters necessary to describe the + * Margules model for a particular binary interaction. This function reads + * the XML file and writes the coefficients it finds to an internal data + * structures. * - * @param xmlBinarySpecies Reference to the XML_Node named "binaryNeutralSpeciesParameters" - * containing the binary interaction + * @param xmlBinarySpecies Reference to the XML_Node named + * "binaryNeutralSpeciesParameters" containing the binary interaction */ void readXMLBinarySpecies(XML_Node& xmlBinarySpecies); @@ -595,48 +343,47 @@ private: */ void resizeNumInteractions(const size_t num); - //! Initialize lengths of local variables after all species have - //! been identified. + //! Initialize lengths of local variables after all species have been + //! identified. void initLengths(); //! Update the activity coefficients /*! - * This function will be called to update the internally stored - * natural logarithm of the activity coefficients + * This function will be called to update the internally stored natural + * logarithm of the activity coefficients */ void s_update_lnActCoeff() const; //! Update the derivative of the log of the activity coefficients wrt T /*! - * This function will be called to update the internally stored - * derivative of the natural logarithm of the activity coefficients - * wrt temperature. + * This function will be called to update the internally stored derivative + * of the natural logarithm of the activity coefficients wrt temperature. */ void s_update_dlnActCoeff_dT() const; //! Update the derivative of the log of the activity coefficients //! wrt log(mole fraction) /*! - * This function will be called to update the internally stored - * derivative of the natural logarithm of the activity coefficients - * wrt logarithm of the mole fractions. + * This function will be called to update the internally stored derivative + * of the natural logarithm of the activity coefficients wrt logarithm of + * the mole fractions. */ void s_update_dlnActCoeff_dlnX_diag() const; //! Update the derivative of the log of the activity coefficients //! wrt log(moles) - diagonal only /*! - * This function will be called to update the internally stored diagonal entries for the - * derivative of the natural logarithm of the activity coefficients - * wrt logarithm of the moles. + * This function will be called to update the internally stored diagonal + * entries for the derivative of the natural logarithm of the activity + * coefficients wrt logarithm of the moles. */ void s_update_dlnActCoeff_dlnN_diag() const; //! Update the derivative of the log of the activity coefficients wrt log(moles_m) /*! - * This function will be called to update the internally stored - * derivative of the natural logarithm of the activity coefficients - * wrt logarithm of the mole number of species + * This function will be called to update the internally stored derivative + * of the natural logarithm of the activity coefficients wrt logarithm of + * the mole number of species */ void s_update_dlnActCoeff_dlnN() const; @@ -644,65 +391,65 @@ protected: //! number of binary interaction expressions size_t numBinaryInteractions_; - //! Enthalpy term for the binary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Enthalpy term for the binary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_HE_b_ij; - //! Enthalpy term for the ternary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Enthalpy term for the ternary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_HE_c_ij; - //! Enthalpy term for the quaternary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Enthalpy term for the quaternary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_HE_d_ij; - //! Entropy term for the binary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Entropy term for the binary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_SE_b_ij; - //! Entropy term for the ternary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Entropy term for the ternary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_SE_c_ij; - //! Entropy term for the quaternary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Entropy term for the quaternary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_SE_d_ij; - //! Enthalpy term for the binary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Enthalpy term for the binary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_VHE_b_ij; - //! Enthalpy term for the ternary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Enthalpy term for the ternary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_VHE_c_ij; - //! Enthalpy term for the quaternary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Enthalpy term for the quaternary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_VHE_d_ij; - //! Entropy term for the binary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Entropy term for the binary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_VSE_b_ij; - //! Entropy term for the ternary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Entropy term for the ternary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_VSE_c_ij; - //! Entropy term for the quaternary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Entropy term for the quaternary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_VSE_d_ij; //! vector of species indices representing species A in the interaction /*! - * Each Margules excess Gibbs free energy term involves two species, A and B. - * This vector identifies species A. + * Each Margules excess Gibbs free energy term involves two species, A and + * B. This vector identifies species A. */ std::vector m_pSpecies_A_ij; //! vector of species indices representing species B in the interaction /*! - * Each Margules excess Gibbs free energy term involves two species, A and B. - * This vector identifies species B. + * Each Margules excess Gibbs free energy term involves two species, A and + * B. This vector identifies species B. */ std::vector m_pSpecies_B_ij; diff --git a/include/cantera/thermo/MixtureFugacityTP.h b/include/cantera/thermo/MixtureFugacityTP.h index ec0e88517..8e683c29d 100644 --- a/include/cantera/thermo/MixtureFugacityTP.h +++ b/include/cantera/thermo/MixtureFugacityTP.h @@ -39,30 +39,29 @@ namespace Cantera /** * @ingroup thermoprops * - * This is a filter class for ThermoPhase that implements some preparatory - * steps for efficiently handling mixture of gases that whose standard states - * are defined as ideal gases, but which describe also non-ideal solutions. - * In addition a multicomponent liquid phase below the critical temperature of the - * mixture is also allowed. The main subclass is currently a mixture Redlich-Kwong class. + * This is a filter class for ThermoPhase that implements some preparatory steps + * for efficiently handling mixture of gases that whose standard states are + * defined as ideal gases, but which describe also non-ideal solutions. In + * addition a multicomponent liquid phase below the critical temperature of the + * mixture is also allowed. The main subclass is currently a mixture Redlich- + * Kwong class. * - * Several concepts are introduced. The first concept is there are temporary - * variables for holding the species standard state values - * of Cp, H, S, G, and V at the last temperature and pressure called. These functions are not recalculated - * if a new call is made using the previous temperature and pressure. + * Several concepts are introduced. The first concept is there are temporary + * variables for holding the species standard state values of Cp, H, S, G, and V + * at the last temperature and pressure called. These functions are not + * recalculated if a new call is made using the previous temperature and + * pressure. * - * The other concept is that the current state of the mixture is tracked. - * The state variable is either GAS, LIQUID, or SUPERCRIT fluid. Additionally, - * the variable LiquidContent is used and may vary between 0 and 1. + * The other concept is that the current state of the mixture is tracked. The + * state variable is either GAS, LIQUID, or SUPERCRIT fluid. Additionally, the + * variable LiquidContent is used and may vary between 0 and 1. * - * To support the above functionality, pressure and temperature variables, - * m_Plast_ss and m_Tlast_ss, are kept which store the last pressure and temperature - * used in the evaluation of standard state properties. - * - * Typically, only one liquid phase is allowed to be formed within these classes. - * Additionally, there is an inherent contradiction between three phase models and - * the ThermoPhase class. The ThermoPhase class is really only meant to represent a - * single instantiation of a phase. The three phase models may be in equilibrium with - * multiple phases of the fluid in equilibrium with each other. This has yet to be resolved. + * Typically, only one liquid phase is allowed to be formed within these + * classes. Additionally, there is an inherent contradiction between three phase + * models and the ThermoPhase class. The ThermoPhase class is really only meant + * to represent a single instantiation of a phase. The three phase models may be + * in equilibrium with multiple phases of the fluid in equilibrium with each + * other. This has yet to be resolved. * * This class is usually used for non-ideal gases. */ @@ -75,82 +74,41 @@ public: //! Constructor. MixtureFugacityTP(); - //! Copy Constructor. - /*! - * @param b Object to be copied - */ MixtureFugacityTP(const MixtureFugacityTP& b); - - //! Assignment operator - /*! - * @param b Object to be copied - */ MixtureFugacityTP& operator=(const MixtureFugacityTP& b); - - //! Duplication routine - /*! - * @return Returns a duplication - */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; //! @} //! @name Utilities //! @{ - //! This method returns the convention used in specification - //! of the standard state, of which there are currently two, - //! temperature based, and variable pressure based. - /*! - * Currently, there are two standard state conventions: - * - Temperature-based activities, - * `cSS_CONVENTION_TEMPERATURE 0` (default) - * - Variable Pressure and Temperature based activities, - * `cSS_CONVENTION_VPSS 1` - */ virtual int standardStateConvention() const; - //! Set the solution branch to force the ThermoPhase to exist on one branch or another + //! Set the solution branch to force the ThermoPhase to exist on one branch + //! or another /*! - * @param solnBranch Branch that the solution is restricted to. - * the value -1 means gas. The value -2 means unrestricted. - * Values of zero or greater refer to species dominated condensed phases. + * @param solnBranch Branch that the solution is restricted to. the value + * -1 means gas. The value -2 means unrestricted. Values of zero or + * greater refer to species dominated condensed phases. */ virtual void setForcedSolutionBranch(int solnBranch); //! Report the solution branch which the solution is restricted to /*! - * @return Branch that the solution is restricted to. - * the value -1 means gas. The value -2 means unrestricted. - * Values of zero or greater refer to species dominated condensed phases. + * @return Branch that the solution is restricted to. the value -1 means + * gas. The value -2 means unrestricted. Values of zero or greater + * refer to species dominated condensed phases. */ virtual int forcedSolutionBranch() const; //! Report the solution branch which the solution is actually on /*! - * @return Branch that the solution is restricted to. - * the value -1 means gas. The value -2 means superfluid.. - * Values of zero or greater refer to species dominated condensed phases. + * @return Branch that the solution is restricted to. the value -1 means + * gas. The value -2 means superfluid.. Values of zero or greater refer + * to species dominated condensed phases. */ virtual int reportSolnBranchActual() const; - //! Get the array of log concentration-like derivatives of the - //! log activity coefficients - /*! - * For ideal mixtures (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the logarithm of the - * activity coefficient with respect to the logarithm of the - * concentration-like variable (i.e. moles) that represents the standard - * state. - * - * This quantity is to be used in conjunction with derivatives of - * that concentration-like variable when the derivative of the chemical - * potential is taken. - * - * units = dimensionless - * - * @param dlnActCoeffdlnN_diag Output vector of derivatives of the - * log Activity Coefficients. length = m_kk - */ virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const { throw NotImplementedError("MixtureFugacityTP::getdlnActCoeffdlnN_diag"); } @@ -165,9 +123,8 @@ public: * \f$ \mu_k / \hat R T \f$. * Units: unitless * - * We close the loop on this function, here, calling - * getChemPotentials() and then dividing by RT. No need for child - * classes to handle. + * We close the loop on this function, here, calling getChemPotentials() and + * then dividing by RT. No need for child classes to handle. * * @param mu Output vector of non-dimensional species chemical potentials * Length: m_kk. @@ -178,15 +135,14 @@ public: /*! * @name Properties of the Standard State of the Species in the Solution * - * Within MixtureFugacityTP, these properties are calculated via a common routine, - * _updateStandardStateThermo(), - * which must be overloaded in inherited objects. - * The values are cached within this object, and are not recalculated unless - * the temperature or pressure changes. + * Within MixtureFugacityTP, these properties are calculated via a common + * routine, _updateStandardStateThermo(), which must be overloaded in + * inherited objects. The values are cached within this object, and are not + * recalculated unless the temperature or pressure changes. */ //@{ - //! Get the array of chemical potentials at unit activity. + //! Get the array of chemical potentials at unit activity. /*! * These are the standard state chemical potentials \f$ \mu^0_k(T,P) * \f$. The values are evaluated at the current temperature and pressure. @@ -200,8 +156,8 @@ public: */ virtual void getStandardChemPotentials(doublereal* mu) const; - //! Get the nondimensional Enthalpy functions for the species - //! at their standard states at the current T and P of the solution. + //! Get the nondimensional Enthalpy functions for the species at their + //! standard states at the current T and P of the solution. /*! * For all objects with the Mixture Fugacity approximation, we define the * standard state as an ideal gas at the current temperature and pressure @@ -212,39 +168,43 @@ public: */ virtual void getEnthalpy_RT(doublereal* hrt) const; - //! Get the array of nondimensional Enthalpy functions for the standard state species + //! Get the array of nondimensional Enthalpy functions for the standard + //! state species at the current T and P of the solution. /*! - * at the current T and P of the solution. * For all objects with the Mixture Fugacity approximation, we define the - * standard state as an ideal gas at the current temperature and pressure - * of the solution. + * standard state as an ideal gas at the current temperature and pressure of + * the solution. * - * @param sr Output vector of nondimensional standard state - * entropies. length = m_kk. + * @param sr Output vector of nondimensional standard state entropies. + * length = m_kk. */ virtual void getEntropy_R(doublereal* sr) const; - //! Get the nondimensional Gibbs functions for the species - //! at their standard states of solution at the current T and P of the solution. + //! Get the nondimensional Gibbs functions for the species at their standard + //! states of solution at the current T and P of the solution. /*! * For all objects with the Mixture Fugacity approximation, we define the * standard state as an ideal gas at the current temperature and pressure * of the solution. * - * @param grt Output vector of nondimensional standard state - * Gibbs free energies. length = m_kk. + * @param grt Output vector of nondimensional standard state Gibbs free + * energies. length = m_kk. */ virtual void getGibbs_RT(doublereal* grt) const; - //! Get the pure Gibbs free energies of each species. - //! Species are assumed to be in their standard states. This is the same - //! as getStandardChemPotentials(). - //! @param[out] gpure Array of standard state Gibbs free energies. - //! length = m_kk. units are J/kmol. + //! Get the pure Gibbs free energies of each species. Species are assumed to + //! be in their standard states. + /*! + * This is the same as getStandardChemPotentials(). + * + * @param[out] gpure Array of standard state Gibbs free energies. length = + * m_kk. units are J/kmol. + */ void getPureGibbs(doublereal* gpure) const; - //! Returns the vector of nondimensional internal Energies of the standard state at the current temperature - //! and pressure of the solution for each species. + //! Returns the vector of nondimensional internal Energies of the standard + //! state at the current temperature and pressure of the solution for each + //! species. /*! * For all objects with the Mixture Fugacity approximation, we define the * standard state as an ideal gas at the current temperature and pressure @@ -254,29 +214,30 @@ public: * u^{ss}_k(T,P) = h^{ss}_k(T) - P * V^{ss}_k * \f] * - * @param urt Output vector of nondimensional standard state - * internal energies. length = m_kk. + * @param urt Output vector of nondimensional standard state internal + * energies. length = m_kk. */ virtual void getIntEnergy_RT(doublereal* urt) const; - //! Get the nondimensional Heat Capacities at constant - //! pressure for the standard state of the species at the current T and P. + //! Get the nondimensional Heat Capacities at constant pressure for the + //! standard state of the species at the current T and P. /*! * For all objects with the Mixture Fugacity approximation, we define the - * standard state as an ideal gas at the current temperature and pressure of the solution. + * standard state as an ideal gas at the current temperature and pressure of + * the solution. * - * @param cpr Output vector containing the - * the nondimensional Heat Capacities at constant - * pressure for the standard state of the species. - * Length: m_kk. + * @param cpr Output vector containing the the nondimensional Heat + * Capacities at constant pressure for the standard state of + * the species. Length: m_kk. */ virtual void getCp_R(doublereal* cpr) const; - //! Get the molar volumes of each species in their standard - //! states at the current T and P of the solution. + //! Get the molar volumes of each species in their standard states at the + //! current T and P of the solution. /*! * For all objects with the Mixture Fugacity approximation, we define the - * standard state as an ideal gas at the current temperature and pressure of the solution. + * standard state as an ideal gas at the current temperature and pressure of + * the solution. * * units = m^3 / kmol * @@ -288,20 +249,18 @@ public: //! Set the temperature of the phase /*! - * Currently this passes down to setState_TP(). It does not - * make sense to calculate the standard state without first - * setting T and P. + * Currently this passes down to setState_TP(). It does not make sense to + * calculate the standard state without first setting T and P. * * @param temp Temperature (kelvin) */ virtual void setTemperature(const doublereal temp); - //! Set the internally stored pressure (Pa) at constant - //! temperature and composition + //! Set the internally stored pressure (Pa) at constant temperature and + //! composition /*! - * Currently this passes down to setState_TP(). It does not - * make sense to calculate the standard state without first - * setting T and P. + * Currently this passes down to setState_TP(). It does not make sense to + * calculate the standard state without first setting T and P. * * @param p input Pressure (Pa) */ @@ -309,102 +268,34 @@ public: protected: /** - * Calculate the density of the mixture using the partial - * molar volumes and mole fractions as input + * Calculate the density of the mixture using the partial molar volumes and + * mole fractions as input * * The formula for this is * * \f[ - * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}} + * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}} * \f] * - * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are - * the molecular weights, and \f$V_k\f$ are the pure species - * molar volumes. + * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular + * weights, and \f$V_k\f$ are the pure species molar volumes. * - * Note, the basis behind this formula is that in an ideal - * solution the partial molar volumes are equal to the pure - * species molar volumes. We have additionally specified - * in this class that the pure species molar volumes are - * independent of temperature and pressure. + * Note, the basis behind this formula is that in an ideal solution the + * partial molar volumes are equal to the pure species molar volumes. We + * have additionally specified in this class that the pure species molar + * volumes are independent of temperature and pressure. */ virtual void calcDensity(); public: - //! Set the temperature and pressure at the same time - /*! - * Note this function triggers a reevaluation of the standard - * state quantities. - * - * @param T temperature (kelvin) - * @param pres pressure (pascal) - */ virtual void setState_TP(doublereal T, doublereal pres); - - //! Set the internally stored temperature (K) and density (kg/m^3) - /*! - * @param T Temperature in kelvin - * @param rho Density (kg/m^3) - */ virtual void setState_TR(doublereal T, doublereal rho); - - //! Set the temperature (K), pressure (Pa), and mole fractions. - /*! - * Note, the mole fractions are set first before the pressure is set. - * Setting the pressure may involve the solution of a nonlinear equation. - * - * @param t Temperature (K) - * @param p Pressure (Pa) - * @param x Vector of mole fractions. Length is equal to m_kk. - */ virtual void setState_TPX(doublereal t, doublereal p, const doublereal* x); - //! Set the mass fractions to the specified values, and then - //! normalize them so that they sum to 1.0. - /*! - * @param y Array of unnormalized mass fraction values (input). - * Must have a length greater than or equal to the number of species. - */ virtual void setMassFractions(const doublereal* const y); - - //!Set the mass fractions to the specified values without normalizing. - /*! - * This is useful when the normalization - * condition is being handled by some other means, for example - * by a constraint equation as part of a larger set of - * equations. - * - * @param y Input vector of mass fractions. Length is m_kk. - */ virtual void setMassFractions_NoNorm(const doublereal* const y); - - //! Set the mole fractions to the specified values, and then - //! normalize them so that they sum to 1.0. - /*! - * @param x Array of unnormalized mole fraction values (input). - * Must have a length greater than or equal to the number of species. - */ virtual void setMoleFractions(const doublereal* const x); - - //! Set the mole fractions to the specified values without normalizing. - /*! - * This is useful when the normalization - * condition is being handled by some other means, for example - * by a constraint equation as part of a larger set of equations. - * - * @param x Input vector of mole fractions. Length is m_kk. - */ virtual void setMoleFractions_NoNorm(const doublereal* const x); - - //! Set the concentrations to the specified values within the phase. - /*! - * @param c The input vector to this routine is in dimensional - * units. For volumetric phases c[k] is the - * concentration of the kth species in kmol/m3. - * For surface phases, c[k] is the concentration - * in kmol/m2. The length of the vector is the number - * of species in the phase. - */ virtual void setConcentrations(const doublereal* const c); protected: @@ -413,8 +304,8 @@ protected: public: //! Returns the current pressure of the phase /*! - * The pressure is an independent variable in this phase. Its current value - * is stored in the object MixtureFugacityTP. + * The pressure is an independent variable in this phase. Its current value + * is stored in the object MixtureFugacityTP. * * @return return the pressure in pascals. */ @@ -423,12 +314,12 @@ public: } protected: - //! Updates the reference state thermodynamic functions at the current T of the solution. + //! Updates the reference state thermodynamic functions at the current T of + //! the solution. /*! - * This function must be called for every call to functions in this - * class. It checks to see whether the temperature has changed and - * thus the ss thermodynamics functions for all of the species - * must be recalculated. + * This function must be called for every call to functions in this class. + * It checks to see whether the temperature has changed and thus the ss + * thermodynamics functions for all of the species must be recalculated. * * This function is responsible for updating the following internal members: * @@ -440,52 +331,24 @@ protected: virtual void _updateReferenceStateThermo() const; public: - /// @name Thermodynamic Values for the Species Reference States (MixtureFugacityTP) + /// @name Thermodynamic Values for the Species Reference States /*! - * There are also temporary - * variables for holding the species reference-state values of Cp, H, S, and V at the - * last temperature and reference pressure called. These functions are not recalculated - * if a new call is made using the previous temperature. - * All calculations are done within the routine _updateRefStateThermo(). + * There are also temporary variables for holding the species reference- + * state values of Cp, H, S, and V at the last temperature and reference + * pressure called. These functions are not recalculated if a new call is + * made using the previous temperature. All calculations are done within the + * routine _updateRefStateThermo(). */ //@{ - //! Returns the vector of nondimensional - //! enthalpies of the reference state at the current temperature - //! of the solution and the reference pressure for the species. - /*! - * @param hrt Output vector contains the nondimensional enthalpies - * of the reference state of the species - * length = m_kk, units = dimensionless. - */ virtual void getEnthalpy_RT_ref(doublereal* hrt) const; - - //! Modify the value of the 298 K Heat of Formation of the standard state of - //! one species in the phase (J kmol-1) - /*! - * The 298K heat of formation is defined as the enthalpy change to create the standard state - * of the species from its constituent elements in their standard states at 298 K and 1 bar. - * - * @param k Index of the species - * @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar. - * units = J/kmol. - */ + virtual void getGibbs_RT_ref(doublereal* grt) const; void modifyOneHf298SS(const size_t k, const doublereal Hf298New); - //! Returns the vector of nondimensional - //! Gibbs free energies of the reference state at the current temperature - //! of the solution and the reference pressure for the species. - /*! - * @param grt Output vector contains the nondimensional Gibbs free energies - * of the reference state of the species - * length = m_kk, units = dimensionless. - */ - virtual void getGibbs_RT_ref(doublereal* grt) const; - protected: - //! Returns the vector of nondimensional - //! Gibbs free energies of the reference state at the current temperature - //! of the solution and the reference pressure for the species. + //! Returns the vector of nondimensional Gibbs free energies of the + //! reference state at the current temperature of the solution and the + //! reference pressure for the species. /*! * @return Output vector contains the nondimensional Gibbs free energies * of the reference state of the species @@ -494,49 +357,9 @@ protected: const vector_fp& gibbs_RT_ref() const; public: - /*! - * Returns the vector of the - * Gibbs function of the reference state at the current temperature - * of the solution and the reference pressure for the species. - * units = J/kmol - * - * @param g Output vector contain the Gibbs free energies - * of the reference state of the species - * length = m_kk, units = J/kmol. - */ virtual void getGibbs_ref(doublereal* g) const; - - /*! - * Returns the vector of nondimensional - * entropies of the reference state at the current temperature - * of the solution and the reference pressure for the species. - * - * @param er Output vector contain the nondimensional entropies - * of the species in their reference states - * length: m_kk, units: dimensionless. - */ virtual void getEntropy_R_ref(doublereal* er) const; - - /*! - * Returns the vector of nondimensional - * constant pressure heat capacities of the reference state - * at the current temperature of the solution - * and reference pressure for the species. - * - * @param cprt Output vector contains the nondimensional heat capacities - * of the species in their reference states - * length: m_kk, units: dimensionless. - */ virtual void getCp_R_ref(doublereal* cprt) const; - - //! Get the molar volumes of the species reference states at the current - //! T and reference pressure of the solution. - /*! - * units = m^3 / kmol - * - * @param vol Output vector containing the standard state volumes. - * Length: m_kk. - */ virtual void getStandardVolumes_ref(doublereal* vol) const; //@} @@ -549,58 +372,8 @@ public: */ //@{ - //! Set the initial state of the phase to the conditions specified in the state XML element. - /*! - * This method sets the temperature, pressure, and mole fraction vector to a set default value. - * - * @param state An XML_Node object corresponding to - * the "state" entry for this phase in the input file. - */ virtual void setStateFromXML(const XML_Node& state); - - //! @internal Initialize the object - /*! - * This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called after calling installSpecies() - * for each species in the phase. It's called before calling - * initThermoXML() for the phase. Therefore, it's the correct - * place for initializing vectors which have lengths equal to the - * number of species. - */ virtual void initThermo(); - - //! Initialize a ThermoPhase object, potentially reading activity - //! coefficient information from an XML database. - /*! - * This routine initializes the lengths in the current object and - * then calls the parent routine. - * This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase(). - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); private: @@ -622,70 +395,74 @@ protected: */ doublereal z() const; - //! Calculate the deviation terms for the total entropy of the mixture from the - //! ideal gas mixture + //! Calculate the deviation terms for the total entropy of the mixture from + //! the ideal gas mixture /* - * Here we use the current state conditions + * Here we use the current state conditions * - * @return Returns the change in entropy in units of J kmol-1 K-1. + * @returns the change in entropy in units of J kmol-1 K-1. */ virtual doublereal sresid() const; - //! Calculate the deviation terms for the total enthalpy of the mixture from the ideal gas mixture + //! Calculate the deviation terms for the total enthalpy of the mixture from + //! the ideal gas mixture /* - * Here we use the current state conditions + * Here we use the current state conditions * - * @return Returns the change in entropy in units of J kmol-1. + * @returns the change in entropy in units of J kmol-1. */ virtual doublereal hresid() const; //! Estimate for the saturation pressure /*! - * Note: this is only used as a starting guess for later routines that actually calculate an - * accurate value for the saturation pressure. + * Note: this is only used as a starting guess for later routines that + * actually calculate an accurate value for the saturation pressure. * - * @param TKelvin temperature in kelvin - * @return returns the estimated saturation pressure at the given temperature + * @param TKelvin temperature in kelvin + * @return the estimated saturation pressure at the given temperature */ virtual doublereal psatEst(doublereal TKelvin) const; public: //! Estimate for the molar volume of the liquid /*! - * Note: this is only used as a starting guess for later routines that actually calculate an - * accurate value for the liquid molar volume. - * This routine doesn't change the state of the system. + * Note: this is only used as a starting guess for later routines that + * actually calculate an accurate value for the liquid molar volume. This + * routine doesn't change the state of the system. * - * @param TKelvin temperature in kelvin - * @param pres Pressure in Pa. This is used as an initial guess. If the routine - * needs to change the pressure to find a stable liquid state, the - * new pressure is returned in this variable. - * @return Returns the estimate of the liquid volume. If the liquid can't be found, this - * routine returns -1. + * @param TKelvin temperature in kelvin + * @param pres Pressure in Pa. This is used as an initial guess. If the + * routine needs to change the pressure to find a stable + * liquid state, the new pressure is returned in this + * variable. + * @returns the estimate of the liquid volume. If the liquid can't be + * found, this routine returns -1. */ virtual doublereal liquidVolEst(doublereal TKelvin, doublereal& pres) const; - //! Calculates the density given the temperature and the pressure and a guess at the density. + //! Calculates the density given the temperature and the pressure and a + //! guess at the density. /*! - * Note, below T_c, this is a multivalued function. We do not cross the vapor dome in this. - * This is protected because it is called during setState_TP() routines. Infinite loops would result - * if it were not protected. + * Note, below T_c, this is a multivalued function. We do not cross the + * vapor dome in this. This is protected because it is called during + * setState_TP() routines. Infinite loops would result if it were not + * protected. * * -> why is this not const? * - * parameters: - * @param TKelvin Temperature in Kelvin - * @param pressure Pressure in Pascals (Newton/m**2) - * @param phaseRequested int representing the phase whose density we are requesting. If we put - * a gas or liquid phase here, we will attempt to find a volume in that - * part of the volume space, only, in this routine. A value of FLUID_UNDEFINED - * means that we will accept anything. - * - * @param rhoguess Guessed density of the fluid. A value of -1.0 indicates that there - * is no guessed density - * @return We return the density of the fluid at the requested phase. If we have not found any - * acceptable density we return a -1. If we have found an acceptable density at a - * different phase, we return a -2. + * @param TKelvin Temperature in Kelvin + * @param pressure Pressure in Pascals (Newton/m**2) + * @param phaseRequested int representing the phase whose density we are + * requesting. If we put a gas or liquid phase here, we will attempt to + * find a volume in that part of the volume space, only, in this + * routine. A value of FLUID_UNDEFINED means that we will accept + * anything. + * @param rhoguess Guessed density of the fluid. A value of -1.0 indicates + * that there is no guessed density + * @return We return the density of the fluid at the requested phase. If + * we have not found any acceptable density we return a -1. If we + * have found an acceptable density at a different phase, we + * return a -2. */ virtual doublereal densityCalc(doublereal TKelvin, doublereal pressure, int phaseRequested, doublereal rhoguess); @@ -706,8 +483,8 @@ protected: public: //! Returns the Phase State flag for the current state of the object /*! - * @param checkState If true, this function does a complete check to see where - * in parameters space we are + * @param checkState If true, this function does a complete check to see + * where in parameters space we are * * There are three values: * - WATER_GAS below the critical temperature but below the critical density @@ -716,58 +493,59 @@ public: */ int phaseState(bool checkState = false) const; - //! Return the value of the density at the liquid spinodal point (on the liquid side) - //! for the current temperature. + //! Return the value of the density at the liquid spinodal point (on the + //! liquid side) for the current temperature. /*! - * @return returns the density with units of kg m-3 + * @returns the density with units of kg m-3 */ virtual doublereal densSpinodalLiquid() const; - //! Return the value of the density at the gas spinodal point (on the gas side) - //! for the current temperature. + //! Return the value of the density at the gas spinodal point (on the gas + //! side) for the current temperature. /*! - * @return returns the density with units of kg m-3 + * @returns the density with units of kg m-3 */ virtual doublereal densSpinodalGas() const; public: - //! Calculate the saturation pressure at the current mixture content for the given temperature + //! Calculate the saturation pressure at the current mixture content for the + //! given temperature /*! - * @param TKelvin (input) Temperature (Kelvin) - * @param molarVolGas (return) Molar volume of the gas - * @param molarVolLiquid (return) Molar volume of the liquid - * @return Returns the saturation pressure at the given temperature + * @param TKelvin (input) Temperature (Kelvin) + * @param molarVolGas (return) Molar volume of the gas + * @param molarVolLiquid (return) Molar volume of the liquid + * @returns the saturation pressure at the given temperature */ doublereal calculatePsat(doublereal TKelvin, doublereal& molarVolGas, doublereal& molarVolLiquid); public: - //! Calculate the saturation pressure at the current mixture content for the given temperature + //! Calculate the saturation pressure at the current mixture content for the + //! given temperature /*! - * @param TKelvin Temperature (Kelvin) - * @return The saturation pressure at the given temperature + * @param TKelvin Temperature (Kelvin) + * @return The saturation pressure at the given temperature */ virtual doublereal satPressure(doublereal TKelvin); protected: //! Calculate the pressure given the temperature and the molar volume /*! - * Calculate the pressure given the temperature and the molar volume - * * @param TKelvin temperature in kelvin * @param molarVol molar volume ( m3/kmol) - * @return Returns the pressure. + * @returns the pressure. */ virtual doublereal pressureCalc(doublereal TKelvin, doublereal molarVol) const; - //! Calculate the pressure and the pressure derivative given the temperature and the molar volume + //! Calculate the pressure and the pressure derivative given the temperature + //! and the molar volume /*! * Temperature and mole number are held constant * * @param TKelvin temperature in kelvin * @param molarVol molar volume ( m3/kmol) * @param presCalc Returns the pressure. - * @return Returns the derivative of the pressure wrt the molar volume + * @returns the derivative of the pressure wrt the molar volume */ virtual doublereal dpdVCalc(doublereal TKelvin, doublereal molarVol, doublereal& presCalc) const; @@ -784,12 +562,12 @@ protected: }; protected: - //! Current value of the pressures + //! Current value of the pressure /*! - * Because the pressure is now a calculation, we store the result of the calculation whenever - * it is recalculated. + * Because the pressure is now a calculation, we store the result of the + * calculation whenever it is recalculated. * - * units = Pascals + * units = Pascals */ doublereal m_Pcurrent; @@ -811,7 +589,8 @@ protected: //! Force the system to be on a particular side of the spinodal curve int forcedState_; - //! The last temperature at which the reference state thermodynamic properties were calculated at. + //! The last temperature at which the reference state thermodynamic + //! properties were calculated at. mutable doublereal m_Tlast_ref; //! Temporary storage for log of p/rt diff --git a/include/cantera/thermo/MolalityVPSSTP.h b/include/cantera/thermo/MolalityVPSSTP.h index a4b870f78..c22b3b01c 100644 --- a/include/cantera/thermo/MolalityVPSSTP.h +++ b/include/cantera/thermo/MolalityVPSSTP.h @@ -24,26 +24,20 @@ namespace Cantera { -/** - * @ingroup thermoprops - */ - /*! - * MolalityVPSSTP is a derived class of ThermoPhase that handles - * variable pressure standard state methods for calculating - * thermodynamic properties that are further based on - * molality-scaled activities. - * This category incorporates most of the methods - * for calculating liquid electrolyte thermodynamics that have been - * developed since the 1970's. + * MolalityVPSSTP is a derived class of ThermoPhase that handles variable + * pressure standard state methods for calculating thermodynamic properties that + * are further based on molality-scaled activities. This category incorporates + * most of the methods for calculating liquid electrolyte thermodynamics that + * have been developed since the 1970's. * - * This class adds additional functions onto the ThermoPhase interface - * that handle molality based standard states. The ThermoPhase - * class includes a member function, ThermoPhase::activityConvention() - * that indicates which convention the activities are based on. The - * default is to assume activities are based on the molar convention. - * However, classes which derive from the MolalityVPSSTP class return - * cAC_CONVENTION_MOLALITY from this member function. + * This class adds additional functions onto the ThermoPhase interface that + * handle molality based standard states. The ThermoPhase class includes a + * member function, ThermoPhase::activityConvention() that indicates which + * convention the activities are based on. The default is to assume activities + * are based on the molar convention. However, classes which derive from the + * MolalityVPSSTP class return cAC_CONVENTION_MOLALITY from this member + * function. * * The molality of a solute, \f$ m_i \f$, is defined as * @@ -55,34 +49,34 @@ namespace Cantera * \tilde{M}_o = \frac{M_o}{1000} * \f] * - * where \f$ M_o \f$ is the molecular weight of the solvent. The molality - * has units of gmol kg-1. For the solute, the molality may be - * considered as the amount of gmol's of solute per kg of solvent, a natural - * experimental quantity. - * - * The formulas for calculating mole fractions if given the molalities of - * the solutes is stated below. First calculate \f$ L^{sum} \f$, an intermediate + * where \f$ M_o \f$ is the molecular weight of the solvent. The molality has + * units of gmol kg-1. For the solute, the molality may be considered + * as the amount of gmol's of solute per kg of solvent, a natural experimental * quantity. * - * \f[ - * L^{sum} = \frac{1}{\tilde{M}_o X_o} = \frac{1}{\tilde{M}_o} + \sum_{i\ne o} m_i - * \f] - * Then, - * \f[ - * X_o = \frac{1}{\tilde{M}_o L^{sum}} - * \f] - * \f[ - * X_i = \frac{m_i}{L^{sum}} - * \f] - * where \f$ X_o \f$ is the mole fraction of solvent, and \f$ X_o \f$ is the - * mole fraction of solute i. Thus, the molality scale and the mole fraction - * scale offer a one-to-one mapping between each other, except in the limit - * of a zero solvent mole fraction. + * The formulas for calculating mole fractions if given the molalities of the + * solutes is stated below. First calculate \f$ L^{sum} \f$, an intermediate + * quantity. * - * The standard states for thermodynamic objects that derive from MolalityVPSSTP - * are on the unit molality basis. Chemical potentials - * of the solutes, \f$ \mu_k \f$, and the solvent, \f$ \mu_o \f$, which are based - * on the molality form, have the following general format: + * \f[ + * 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. Thus, the molality scale and the mole + * fraction scale offer a one-to-one mapping between each other, except in the + * limit of a zero solvent mole fraction. + * + * The standard states for thermodynamic objects that derive from MolalityVPSSTP + * are on the unit molality basis. Chemical potentials of the solutes, \f$ \mu_k + * \f$, and the solvent, \f$ \mu_o \f$, which are based on the molality form, + * have the following general format: * * \f[ * \mu_k = \mu^{\triangle}_k(T,P) + R T ln(\gamma_k^{\triangle} \frac{m_k}{m^\triangle}) @@ -91,130 +85,115 @@ namespace Cantera * \mu_o = \mu^o_o(T,P) + RT ln(a_o) * \f] * - * where \f$ \gamma_k^{\triangle} \f$ is the molality based activity coefficient for species - * \f$k\f$. + * where \f$ \gamma_k^{\triangle} \f$ is the molality based activity coefficient + * for species \f$k\f$. * * The chemical potential of the solvent is thus expressed in a different format * than the chemical potential of the solutes. Additionally, the activity of the - * solvent, \f$ a_o \f$, is further reexpressed in terms of an osmotic coefficient, - * \f$ \phi \f$. - * \f[ - * \phi = \frac{- ln(a_o)}{\tilde{M}_o \sum_{i \ne o} m_i} - * \f] + * solvent, \f$ a_o \f$, is further reexpressed in terms of an osmotic + * coefficient, \f$ \phi \f$. + * \f[ + * \phi = \frac{- ln(a_o)}{\tilde{M}_o \sum_{i \ne o} m_i} + * \f] * - * MolalityVPSSTP::osmoticCoefficient() returns the value of \f$ \phi \f$. - * Note there are a few of definitions of the osmotic coefficient floating - * around. We use the one defined in - * (Activity Coefficients in Electrolyte Solutions, K. S. Pitzer - * CRC Press, Boca Raton, 1991, p. 85, Eqn. 28). This definition is most clearly - * related to theoretical calculation. + * MolalityVPSSTP::osmoticCoefficient() returns the value of \f$ \phi \f$. Note + * there are a few of definitions of the osmotic coefficient floating around. We + * use the one defined in (Activity Coefficients in Electrolyte Solutions, K. S. + * Pitzer CRC Press, Boca Raton, 1991, p. 85, Eqn. 28). This definition is most + * clearly related to theoretical calculation. * - * The molar-based activity coefficients \f$ \gamma_k \f$ may be calculated - * from the molality-based - * activity coefficients, \f$ \gamma_k^\triangle \f$ by the following - * formula. + * The molar-based activity coefficients \f$ \gamma_k \f$ may be calculated from + * the molality-based activity coefficients, \f$ \gamma_k^\triangle \f$ by the + * following formula. * \f[ * \gamma_k = \frac{\gamma_k^\triangle}{X_o} * \f] - * For purposes of establishing a convention, the molar activity coefficient of the - * solvent is set equal to the molality-based activity coefficient of the + * For purposes of establishing a convention, the molar activity coefficient of + * the solvent is set equal to the molality-based activity coefficient of the * solvent: * \f[ * \gamma_o = \gamma_o^\triangle * \f] * - * The molality-based and molarity-based standard states may be related to one - * another by the following formula. + * The molality-based and molarity-based standard states may be related to one + * another by the following formula. * * \f[ * \mu_k^\triangle(T,P) = \mu_k^o(T,P) + R T \ln(\tilde{M}_o m^\triangle) * \f] * - * An important convention is followed in all routines that derive from MolalityVPSSTP. - * Standard state thermodynamic functions and reference state thermodynamic functions - * return the molality-based quantities. Also all functions which return - * activities return the molality-based activities. The reason for this convention - * has been discussed in supporting memos. However, it's important because the - * term in the equation above is non-trivial. For example it's equal - * to 2.38 kcal gmol-1 for water at 298 K. + * An important convention is followed in all routines that derive from + * MolalityVPSSTP. Standard state thermodynamic functions and reference state + * thermodynamic functions return the molality-based quantities. Also all + * functions which return activities return the molality-based activities. The + * reason for this convention has been discussed in supporting memos. However, + * it's important because the term in the equation above is non-trivial. For + * example it's equal to 2.38 kcal gmol-1 for water at 298 K. * - * In order to prevent a singularity, this class includes the concept of a minimum - * value for the solvent mole fraction. All calculations involving the formulation - * of activity coefficients and other non-ideal solution behavior adhere to - * this concept of a minimal value for the solvent mole fraction. This makes sense - * because these solution behavior were all designed and measured far away from - * the zero solvent singularity condition and are not applicable in that limit. + * In order to prevent a singularity, this class includes the concept of a + * minimum value for the solvent mole fraction. All calculations involving the + * formulation of activity coefficients and other non-ideal solution behavior + * adhere to this concept of a minimal value for the solvent mole fraction. This + * makes sense because these solution behavior were all designed and measured + * far away from the zero solvent singularity condition and are not applicable + * in that limit. * - * This objects add a layer that supports molality. It inherits from VPStandardStateTP. + * This objects add a layer that supports molality. It inherits from + * VPStandardStateTP. * - * All objects that derive from this are assumed to have molality based standard states. + * All objects that derive from this are assumed to have molality based standard + * states. * - * Molality based activity coefficients are scaled according to the current - * pH scale. See the Eq3/6 manual for details. + * Molality based activity coefficients are scaled according to the current pH + * scale. See the Eq3/6 manual for details. * - * Activity coefficients for species k may be altered between scales s1 to s2 - * using the following formula + * Activity coefficients for species k may be altered between scales s1 to s2 + * using the following formula * - * \f[ - * ln(\gamma_k^{s2}) = ln(\gamma_k^{s1}) - * + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right) - * \f] + * \f[ + * ln(\gamma_k^{s2}) = ln(\gamma_k^{s1}) + * + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right) + * \f] * - * where j is any one species. For the NBS scale, j is equal to the Cl- species - * and + * where j is any one species. For the NBS scale, j is equal to the Cl- species + * and * - * \f[ - * ln(\gamma_{Cl-}^{s2}) = \frac{-A_{\phi} \sqrt{I}}{1.0 + 1.5 \sqrt{I}} - * \f] + * \f[ + * ln(\gamma_{Cl-}^{s2}) = \frac{-A_{\phi} \sqrt{I}}{1.0 + 1.5 \sqrt{I}} + * \f] * - * The Pitzer scale doesn't actually change anything. The pitzer scale is defined - * as the raw unscaled activity coefficients produced by the underlying objects. + * The Pitzer scale doesn't actually change anything. The pitzer scale is + * defined as the raw unscaled activity coefficients produced by the underlying + * objects. * - *

SetState Strategy

+ *

SetState Strategy

* - * The MolalityVPSSTP object does not have a setState strategy concerning the - * molalities. It does not keep track of whether the molalities have changed. - * It's strictly an interfacial layer that writes the current mole fractions to the - * State object. When molalities are needed it recalculates the molalities from - * the State object's mole fraction vector. + * The MolalityVPSSTP object does not have a setState strategy concerning the + * molalities. It does not keep track of whether the molalities have changed. + * It's strictly an interfacial layer that writes the current mole fractions to + * the State object. When molalities are needed it recalculates the molalities + * from the State object's mole fraction vector. * - * @todo Make two solvent minimum fractions. One would be for calculation of the non-ideal - * factors. The other one would be for purposes of stoichiometry evaluation. the - * stoichiometry evaluation one would be a 1E-13 limit. Anything less would create - * problems with roundoff error. + * @todo Make two solvent minimum fractions. One would be for calculation of the + * non-ideal factors. The other one would be for purposes of stoichiometry + * evaluation. the stoichiometry evaluation one would be a 1E-13 limit. + * Anything less would create problems with roundoff error. */ class MolalityVPSSTP : public VPStandardStateTP { public: /// Default Constructor /*! - * This doesn't do much more than initialize constants with - * default values for water at 25C. Water molecular weight - * comes from the default elements.xml file. It actually - * differs slightly from the IAPWS95 value of 18.015268. However, - * density conservation and therefore element conservation - * is the more important principle to follow. + * This doesn't do much more than initialize constants with default values + * for water at 25C. Water molecular weight comes from the default + * elements.xml file. It actually differs slightly from the IAPWS95 value of + * 18.015268. However, density conservation and therefore element + * conservation is the more important principle to follow. */ MolalityVPSSTP(); - //! Copy constructor - /*! - * @param b class to be copied - */ MolalityVPSSTP(const MolalityVPSSTP& b); - - /// Assignment operator - /*! - * @param b class to be copied. - */ MolalityVPSSTP& operator=(const MolalityVPSSTP& b); - - //! Duplication routine for objects which inherit from ThermoPhase. - /*! - * This virtual routine can be used to duplicate objects - * inherited from ThermoPhase even if the application only has - * a pointer to ThermoPhase to work with. - */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; //! @name Utilities @@ -223,8 +202,8 @@ public: //! Set the pH scale, which determines the scale for single-ion activity //! coefficients. /*! - * Single ion activity coefficients are not unique in terms of the - * representing actual measurable quantities. + * Single ion activity coefficients are not unique in terms of the + * representing actual measurable quantities. * * @param pHscaleType Integer representing the pHscale */ @@ -233,8 +212,8 @@ public: //! Reports the pH scale, which determines the scale for single-ion activity //! coefficients. /*! - * Single ion activity coefficients are not unique in terms of the - * representing actual measurable quantities. + * Single ion activity coefficients are not unique in terms of the + * representing actual measurable quantities. * * @return Return the pHscale type */ @@ -247,8 +226,8 @@ public: /** * This routine sets the index number of the solvent for the phase. * - * Note, having a solvent is a precursor to many things having to do - * with molality. + * Note, having a solvent is a precursor to many things having to do with + * molality. * * @param k the solvent index number */ @@ -258,11 +237,11 @@ public: size_t solventIndex() const; /** - * Sets the minimum mole fraction in the molality formulation. - * Note the molality formulation is singular in the limit that - * the solvent mole fraction goes to zero. Numerically, how - * this limit is treated and resolved is an ongoing issue within - * Cantera. The minimum mole fraction must be in the range 0 to 0.9. + * Sets the minimum mole fraction in the molality formulation. Note the + * molality formulation is singular in the limit that the solvent mole + * fraction goes to zero. Numerically, how this limit is treated and + * resolved is an ongoing issue within Cantera. The minimum mole fraction + * must be in the range 0 to 0.9. * * @param xmolSolventMIN Input double containing the minimum mole fraction */ @@ -273,12 +252,12 @@ public: //! Calculates the molality of all species and stores the result internally. /*! - * We calculate the vector of molalities of the species - * in the phase and store the result internally: - * \f[ + * We calculate the vector of molalities of the species in the phase and + * store the result internally: + * \f[ * m_i = \frac{X_i}{1000 * M_o * X_{o,p}} - * \f] - * where + * \f] + * where * - \f$ M_o \f$ is the molecular weight of the solvent * - \f$ X_o \f$ is the mole fraction of the solvent * - \f$ X_i \f$ is the mole fraction of the solute. @@ -288,14 +267,13 @@ public: */ void calcMolalities() const; - //! This function will return the molalities of the species. + //! This function will return the molalities of the species. /*! - * We calculate the vector of molalities of the species - * in the phase + * We calculate the vector of molalities of the species in the phase * \f[ * m_i = \frac{X_i}{1000 * M_o * X_{o,p}} * \f] - * where + * where * - \f$ M_o \f$ is the molecular weight of the solvent * - \f$ X_o \f$ is the mole fraction of the solvent * - \f$ X_i \f$ is the mole fraction of the solute. @@ -309,14 +287,13 @@ public: //! Set the molalities of the solutes in a phase /*! - * Note, the entry for the solvent is not used. - * We are supplied with the molalities of all of the - * solute species. We then calculate the mole fractions of all - * species and update the ThermoPhase object. - * \f[ + * Note, the entry for the solvent is not used. We are supplied with the + * molalities of all of the solute species. We then calculate the mole + * fractions of all species and update the ThermoPhase object. + * \f[ * m_i = \frac{X_i}{M_o/1000 * X_{o,p}} - * \f] - * where + * \f] + * where * - \f$M_o\f$ is the molecular weight of the solvent * - \f$X_o\f$ is the mole fraction of the solvent * - \f$X_i\f$ is the mole fraction of the solute. @@ -325,18 +302,18 @@ public: * in the denominator. * * The formulas for calculating mole fractions are - * \f[ - * L^{sum} = \frac{1}{\tilde{M}_o X_o} = \frac{1}{\tilde{M}_o} + \sum_{i\ne o} m_i - * \f] - * Then, - * \f[ - * X_o = \frac{1}{\tilde{M}_o L^{sum}} - * \f] - * \f[ - * X_i = \frac{m_i}{L^{sum}} - * \f] - * It is currently an error if the solvent mole fraction is attempted to be set - * to a value lower than \f$X_o^{min}\f$. + * \f[ + * L^{sum} = \frac{1}{\tilde{M}_o X_o} = \frac{1}{\tilde{M}_o} + \sum_{i\ne o} m_i + * \f] + * Then, + * \f[ + * X_o = \frac{1}{\tilde{M}_o L^{sum}} + * \f] + * \f[ + * X_i = \frac{m_i}{L^{sum}} + * \f] + * It is currently an error if the solvent mole fraction is attempted to be + * set to a value lower than \f$ X_o^{min} \f$. * * @param molal Input vector of molalities. Length: m_kk. */ @@ -364,70 +341,31 @@ public: * @} * @name Activities, Standard States, and Activity Concentrations * - * The activity \f$a_k\f$ of a species in solution is - * related to the chemical potential by \f[ \mu_k = \mu_k^0(T) - * + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is - * the chemical potential at unit activity, which depends only - * on temperature and pressure. + * The activity \f$a_k\f$ of a species in solution is related to the + * chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The + * quantity \f$\mu_k^0(T,P)\f$ is the chemical potential at unit activity, + * which depends only on temperature and pressure. * @{ */ /** - * This method returns the activity convention. - * Currently, there are two activity conventions: - * - Molar-based activities: %Unit activity of species at either a - * hypothetical pure solution of the species or at a hypothetical - * pure ideal solution at infinite dilution. - * `cAC_CONVENTION_MOLAR 0` (default) - * - Molality based activities: unit activity of solutes at a hypothetical - * 1 molal solution referenced to infinite dilution at all pressures and - * temperatures. The solvent is still on molar basis. - * `cAC_CONVENTION_MOLALITY 1` - * * We set the convention to molality here. */ int activityConvention() const; - /** - * This method returns an array of generalized concentrations - * \f$ C_k\f$ that are defined such that - * \f$ a_k = C_k / C^0_k, \f$ where \f$ C^0_k \f$ - * is a standard concentration - * defined below. These generalized concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. - * - * @param c Array of generalized concentrations. The - * units depend upon the implementation of the - * reaction rate expressions within the phase. - */ virtual void getActivityConcentrations(doublereal* c) const; - - /** - * The standard concentration \f$ C^0_k \f$ used to normalize - * the generalized concentration. In many cases, this quantity - * will be the same for all species in a phase - for example, - * for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this - * reason, this method returns a single value, instead of an - * array. However, for phases in which the standard - * concentration is species-specific (e.g. surface species of - * different sizes), this method may be called with an - * optional parameter indicating the species. - * - * @param k species index. Defaults to zero. - */ virtual doublereal standardConcentration(size_t k=0) const; - //! Get the array of non-dimensional activities (molality - //! based for this class and classes that derive from it) at - //! the current solution temperature, pressure, and solution concentration. + //! Get the array of non-dimensional activities (molality based for this + //! class and classes that derive from it) at the current solution + //! temperature, pressure, and solution concentration. /*! - * All standard state properties for molality-based phases are - * evaluated consistent with the molality scale. Therefore, this function - * must return molality-based activities. + * All standard state properties for molality-based phases are evaluated + * consistent with the molality scale. Therefore, this function must return + * molality-based activities. * * \f[ - * a_i^\triangle = \gamma_k^{\triangle} \frac{m_k}{m^\triangle} + * a_i^\triangle = \gamma_k^{\triangle} \frac{m_k}{m^\triangle} * \f] * * This function must be implemented in derived classes. @@ -444,10 +382,9 @@ public: * of the molality-based activity coefficients. * See Denbigh p. 278 for a thorough discussion. * - * The molar-based activity coefficients \f$ \gamma_k \f$ may be calculated from the - * molality-based - * activity coefficients, \f$ \gamma_k^\triangle \f$ by the following - * formula. + * The molar-based activity coefficients \f$ \gamma_k \f$ may be calculated + * from the molality-based activity coefficients, \f$ \gamma_k^\triangle \f$ + * by the following formula. * \f[ * \gamma_k = \frac{\gamma_k^\triangle}{X_o} * \f] @@ -463,54 +400,52 @@ public: * Derived classes don't need to overload this function. This function is * handled at this level. * - * @param ac Output vector containing the mole-fraction based activity coefficients. - * length: m_kk. + * @param ac Output vector containing the mole-fraction based activity + * coefficients. length: m_kk. */ void getActivityCoefficients(doublereal* ac) const; - //! Get the array of non-dimensional molality based - //! activity coefficients at the current solution temperature, - //! pressure, and solution concentration. + //! Get the array of non-dimensional molality based activity coefficients at + //! the current solution temperature, pressure, and solution concentration. /*! - * See Denbigh p. 278 for a thorough discussion. This class must be overwritten in - * classes which derive from MolalityVPSSTP. This function takes over from the - * molar-based activity coefficient calculation, getActivityCoefficients(), in - * derived classes. + * See Denbigh p. 278 for a thorough discussion. This class must be + * overwritten in classes which derive from MolalityVPSSTP. This function + * takes over from the molar-based activity coefficient calculation, + * getActivityCoefficients(), in derived classes. * - * These molality based activity coefficients are scaled according to the current - * pH scale. See the Eq3/6 manual for details. + * These molality based activity coefficients are scaled according to the + * current pH scale. See the Eq3/6 manual for details. * - * Activity coefficients for species k may be altered between scales s1 to s2 - * using the following formula + * Activity coefficients for species k may be altered between scales s1 to + * s2 using the following formula * - * \f[ - * ln(\gamma_k^{s2}) = ln(\gamma_k^{s1}) - * + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right) - * \f] + * \f[ + * ln(\gamma_k^{s2}) = ln(\gamma_k^{s1}) + * + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right) + * \f] * - * where j is any one species. For the NBS scale, j is equal to the Cl- species - * and + * where j is any one species. For the NBS scale, j is equal to the Cl- + * species and * - * \f[ - * ln(\gamma_{Cl-}^{s2}) = \frac{-A_{\phi} \sqrt{I}}{1.0 + 1.5 \sqrt{I}} - * \f] + * \f[ + * ln(\gamma_{Cl-}^{s2}) = \frac{-A_{\phi} \sqrt{I}}{1.0 + 1.5 \sqrt{I}} + * \f] * - * @param acMolality Output vector containing the molality based activity coefficients. - * length: m_kk. + * @param acMolality Output vector containing the molality based activity + * coefficients. length: m_kk. */ virtual void getMolalityActivityCoefficients(doublereal* acMolality) const; //! Calculate the osmotic coefficient /*! - * \f[ - * \phi = \frac{- ln(a_o)}{\tilde{M}_o \sum_{i \ne o} m_i} - * \f] + * \f[ + * \phi = \frac{- ln(a_o)}{\tilde{M}_o \sum_{i \ne o} m_i} + * \f] * - * Note there are a few of definitions of the osmotic coefficient floating - * around. We use the one defined in - * (Activity Coefficients in Electrolyte Solutions, K. S. Pitzer - * CRC Press, Boca Raton, 1991, p. 85, Eqn. 28). This definition is most clearly - * related to theoretical calculation. + * Note there are a few of definitions of the osmotic coefficient floating + * around. We use the one defined in (Activity Coefficients in Electrolyte + * Solutions, K. S. Pitzer CRC Press, Boca Raton, 1991, p. 85, Eqn. 28). + * This definition is most clearly related to theoretical calculation. * * units = dimensionless */ @@ -520,16 +455,6 @@ public: /// @name Partial Molar Properties of the Solution //@{ - /** - * Get the species electrochemical potentials. - * These are partial molar quantities. This method adds a term - * \f$ Fz_k \phi_k \f$ to each chemical potential. - * - * Units: J/kmol - * - * @param mu output vector containing the species electrochemical potentials. - * Length: m_kk. - */ void getElectrochemPotentials(doublereal* mu) const; //@} @@ -540,20 +465,6 @@ public: * @{ */ - /** - * This method is used by the ChemEquil element-potential - * based equilibrium solver. - * It sets the state such that the chemical potentials of the - * species within the current phase satisfy - * \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m} - * \left(\frac{\lambda_m} {\hat R T}\right) \f] where - * \f$ \lambda_m \f$ is the element potential of element m. The - * temperature is unchanged. Any phase (ideal or not) that - * implements this method can be equilibrated by ChemEquil. - * - * @param lambda_RT Input vector containing the dimensionless - * element potentials. - */ virtual void setToEquilState(const doublereal* lambda_RT); //@} @@ -564,50 +475,33 @@ public: * definition in an input file. It should be overloaded in subclasses to set * any parameters that are specific to that particular phase model. * - * The MolalityVPSSTP object defines a new method for setting - * the concentrations of a phase. The new method is defined by a - * block called "soluteMolalities". If this block - * is found, the concentrations within that phase are - * set to the "name":"molalities pairs found within that - * XML block. The solvent concentration is then set - * to everything else. + * The MolalityVPSSTP object defines a new method for setting the + * concentrations of a phase. The new method is defined by a block called + * "soluteMolalities". If this block is found, the concentrations within + * that phase are set to the "name":"molalities pairs found within that XML + * block. The solvent concentration is then set to everything else. * * The function first calls the overloaded function, * VPStandardStateTP::setStateFromXML(), to pick up the parent class * behavior. * - * usage: Overloaded functions should call this function - * before carrying out their own behavior. + * usage: Overloaded functions should call this function before carrying out + * their own behavior. * - * @param state An XML_Node object corresponding to - * the "state" entry for this phase in the input file. + * @param state An XML_Node object corresponding to the "state" entry for + * this phase in the input file. */ virtual void setStateFromXML(const XML_Node& state); //@} //! @name Initialization - /// The following methods are used in the process of constructing - /// the phase and setting its parameters from a specification in an - /// input file. They are not normally used in application programs. - /// To see how they are used, see importPhase(). + /// The following methods are used in the process of constructing the phase + /// and setting its parameters from a specification in an input file. They + /// are not normally used in application programs. To see how they are used, + /// see importPhase(). //@{ virtual void initThermo(); - - /** - * Import and initialize a ThermoPhase object - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ void initThermoXML(XML_Node& phaseNode, const std::string& id); //@} @@ -640,36 +534,10 @@ public: */ void setState_TPM(doublereal t, doublereal p, const std::string& m); - //! Get the array of derivatives of the log activity coefficients with respect to the log of the species mole numbers - /*! - * Implementations should take the derivative of the logarithm of the activity coefficient with respect to a - * species log mole number (with all other species mole numbers held constant). The default treatment in the - * ThermoPhase object is to set this vector to zero. - * - * units = 1 / kmol - * - * dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log act_coeff for the mth - * species with respect to the number of moles of the kth species. - * - * \f[ - * \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i} - * \f] - * - * @param ld Number of rows in the matrix - * @param dlnActCoeffdlnN Output vector of derivatives of the - * log Activity Coefficients. length = m_kk * m_kk - */ virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN) { getdlnActCoeffdlnN_numderiv(ld, dlnActCoeffdlnN); } - //! returns a summary of the state of the phase as a string - /*! - * @param show_thermo If true, extra information is printed out - * about the thermodynamic state of the system. - * @param threshold Show information about species with mole fractions - * greater than *threshold*. - */ virtual std::string report(bool show_thermo=true, doublereal threshold=1e-14) const; @@ -677,23 +545,24 @@ protected: virtual void getCsvReportData(std::vector& names, std::vector& data) const; - //! Get the array of unscaled non-dimensional molality based - //! activity coefficients at the current solution temperature, - //! pressure, and solution concentration. + //! Get the array of unscaled non-dimensional molality based activity + //! coefficients at the current solution temperature, pressure, and solution + //! concentration. /*! - * See Denbigh p. 278 for a thorough discussion. This class must be overwritten in - * classes which derive from MolalityVPSSTP. This function takes over from the - * molar-based activity coefficient calculation, getActivityCoefficients(), in - * derived classes. + * See Denbigh p. 278 for a thorough discussion. This class must be + * overwritten in classes which derive from MolalityVPSSTP. This function + * takes over from the molar-based activity coefficient calculation, + * getActivityCoefficients(), in derived classes. * - * @param acMolality Output vector containing the molality based activity coefficients. - * length: m_kk. + * @param acMolality Output vector containing the molality based activity + * coefficients. length: m_kk. */ virtual void getUnscaledMolalityActivityCoefficients(doublereal* acMolality) const; - //! Apply the current phScale to a set of activity Coefficients or activities + //! Apply the current phScale to a set of activity Coefficients or + //! activities /*! - * See the Eq3/6 Manual for a thorough discussion. + * See the Eq3/6 Manual for a thorough discussion. * * @param acMolality input/Output vector containing the molality based * activity coefficients. length: m_kk. @@ -703,46 +572,40 @@ protected: private: //! Returns the index of the Cl- species. /*! - * The Cl- species is special in the sense that its single ion - * molality-based activity coefficient is used in the specification - * of the pH scale for single ions. Therefore, we need to know - * what species index is Cl-. If the species isn't in the species - * list then this routine returns -1, and we can't use the NBS - * pH scale. + * The Cl- species is special in the sense that its single ion molality- + * based activity coefficient is used in the specification of the pH scale + * for single ions. Therefore, we need to know what species index is Cl-. If + * the species isn't in the species list then this routine returns -1, and + * we can't use the NBS pH scale. * - * Right now we use a restrictive interpretation. The species - * must be named "Cl-". It must consist of exactly one Cl and one E - * atom. + * Right now we use a restrictive interpretation. The species must be named + * "Cl-". It must consist of exactly one Cl and one E atom. */ virtual size_t findCLMIndex() const; - //! Initialize lengths of local variables after all species have - //! been identified. + //! Initialize lengths of local variables after all species have been + //! identified. void initLengths(); protected: - //! Index of the solvent - /*! - * Currently the index of the solvent is hard-coded to the value 0 - */ + //! Index of the solvent. Currently the index of the solvent is hard-coded + //! to the value 0 size_t m_indexSolvent; //! Scaling to be used for output of single-ion species activity //! coefficients. /*! - * Index of the species to be used in the single-ion scaling - * law. This is the identity of the Cl- species for the PHSCALE_NBS - * scaling. - * Either PHSCALE_PITZER or PHSCALE_NBS + * Index of the species to be used in the single-ion scaling law. This is + * the identity of the Cl- species for the PHSCALE_NBS scaling. Either + * PHSCALE_PITZER or PHSCALE_NBS */ int m_pHScalingType; //! Index of the phScale species /*! - * Index of the species to be used in the single-ion scaling - * law. This is the identity of the Cl- species for the PHSCALE_NBS - * scaling + * Index of the species to be used in the single-ion scaling law. This is + * the identity of the Cl- species for the PHSCALE_NBS scaling */ size_t m_indexCLM; @@ -750,74 +613,67 @@ protected: doublereal m_weightSolvent; /*! - * In any molality implementation, it makes sense to have - * a minimum solvent mole fraction requirement, since the - * implementation becomes singular in the xmolSolvent=0 - * limit. The default is to set it to 0.01. - * We then modify the molality definition to ensure that - * molal_solvent = 0 when xmol_solvent = 0. + * In any molality implementation, it makes sense to have a minimum solvent + * mole fraction requirement, since the implementation becomes singular in + * the xmolSolvent=0 limit. The default is to set it to 0.01. We then modify + * the molality definition to ensure that molal_solvent = 0 when + * xmol_solvent = 0. */ doublereal m_xmolSolventMIN; - //! This is the multiplication factor that goes inside - //! log expressions involving the molalities of species. - /*! - * It's equal to Wt_0 / 1000, - * where Wt_0 = weight of solvent (kg/kmol) - */ + //! This is the multiplication factor that goes inside log expressions + //! involving the molalities of species. It's equal to Wt_0 / 1000, where + //! Wt_0 = weight of solvent (kg/kmol) doublereal m_Mnaught; - //! Current value of the molalities of the species in the phase. - /*! - * Note this vector is a mutable quantity. - * units are (kg/kmol) - */ + //! Current value of the molalities of the species in the phase. Note this + //! vector is a mutable quantity. units are (kg/kmol) mutable vector_fp m_molalities; }; -//! Scale to be used for the output of single-ion activity coefficients -//! is that used by Pitzer. +//! Scale to be used for the output of single-ion activity coefficients is that +//! used by Pitzer. /*! - * This is the internal scale used within the code. One property is that - * the activity coefficients for the cation and anion of a single salt - * will be equal. This scale is the one presumed by the formulation of the - * single-ion activity coefficients described in this report. + * This is the internal scale used within the code. One property is that the + * activity coefficients for the cation and anion of a single salt will be + * equal. This scale is the one presumed by the formulation of the single-ion + * activity coefficients described in this report. * - * Activity coefficients for species k may be altered between scales s1 to s2 - * using the following formula + * Activity coefficients for species k may be altered between scales s1 to s2 + * using the following formula * - * \f[ - * ln(\gamma_k^{s2}) = ln(\gamma_k^{s1}) - * + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right) - * \f] + * \f[ + * ln(\gamma_k^{s2}) = ln(\gamma_k^{s1}) + * + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right) + * \f] * - * where j is any one species. + * where j is any one species. */ const int PHSCALE_PITZER = 0; -//! Scale to be used for evaluation of single-ion activity coefficients -//! is that used by the NBS standard for evaluation of the pH variable. +//! Scale to be used for evaluation of single-ion activity coefficients is that +//! used by the NBS standard for evaluation of the pH variable. /*! - * This is not the internal scale used within the code. + * This is not the internal scale used within the code. * - * Activity coefficients for species k may be altered between scales s1 to s2 - * using the following formula + * Activity coefficients for species k may be altered between scales s1 to s2 + * using the following formula * - * \f[ - * ln(\gamma_k^{s2}) = ln(\gamma_k^{s1}) - * + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right) - * \f] + * \f[ + * ln(\gamma_k^{s2}) = ln(\gamma_k^{s1}) + * + \frac{z_k}{z_j} \left( ln(\gamma_j^{s2}) - ln(\gamma_j^{s1}) \right) + * \f] * - * where j is any one species. For the NBS scale, j is equal to the Cl- species - * and + * where j is any one species. For the NBS scale, j is equal to the Cl- species + * and * - * \f[ - * ln(\gamma_{Cl-}^{s2}) = \frac{-A_{\phi} \sqrt{I}}{1.0 + 1.5 \sqrt{I}} - * \f] + * \f[ + * ln(\gamma_{Cl-}^{s2}) = \frac{-A_{\phi} \sqrt{I}}{1.0 + 1.5 \sqrt{I}} + * \f] * - * This is the NBS pH scale, which is used in all conventional pH - * measurements. and is based on the Bates-Guggenheim equations. + * This is the NBS pH scale, which is used in all conventional pH measurements. + * and is based on the Bates-Guggenheim equations. */ const int PHSCALE_NBS = 1; diff --git a/include/cantera/thermo/MolarityIonicVPSSTP.h b/include/cantera/thermo/MolarityIonicVPSSTP.h index 4b6c5822e..e57a0a129 100644 --- a/include/cantera/thermo/MolarityIonicVPSSTP.h +++ b/include/cantera/thermo/MolarityIonicVPSSTP.h @@ -1,15 +1,11 @@ /** - * @file MolarityIonicVPSSTP.h - * Header for intermediate ThermoPhase object for phases which - * employ Gibbs excess free energy based formulations - * (see \ref thermoprops - * and class \link Cantera::MolarityIonicVPSSTP MolarityIonicVPSSTP\endlink). + * @file MolarityIonicVPSSTP.h (see \ref thermoprops and class \link + * Cantera::MolarityIonicVPSSTP MolarityIonicVPSSTP\endlink). * - * Header file for a derived class of ThermoPhase that handles - * variable pressure standard state methods for calculating - * thermodynamic properties that are further based upon activities - * based on the molarity scale. In this class, we expect that there are - * ions, but they are treated on the molarity scale. + * Header file for a derived class of ThermoPhase that handles variable pressure + * standard state methods for calculating thermodynamic properties that are + * further based upon activities based on the molarity scale. In this class, we + * expect that there are ions, but they are treated on the molarity scale. */ /* * Copyright (2006) Sandia Corporation. Under the terms of @@ -25,47 +21,34 @@ namespace Cantera { -/** - * @ingroup thermoprops - */ - /*! - * MolarityIonicVPSSTP is a derived class of GibbsExcessVPSSTP that handles - * variable pressure standard state methods for calculating - * thermodynamic properties that are further based on - * expressing the Excess Gibbs free energy as a function of - * the mole fractions (or pseudo mole fractions) of the constituents. - * This category is the workhorse for describing ionic systems which are not on the molality scale. + * MolarityIonicVPSSTP is a derived class of GibbsExcessVPSSTP that handles + * variable pressure standard state methods for calculating thermodynamic + * properties that are further based on expressing the Excess Gibbs free energy + * as a function of the mole fractions (or pseudo mole fractions) of the + * constituents. This category is the workhorse for describing ionic systems + * which are not on the molality scale. * - * This class adds additional functions onto the ThermoPhase interface - * that handles the calculation of the excess Gibbs free energy. The ThermoPhase - * class includes a member function, ThermoPhase::activityConvention() - * that indicates which convention the activities are based on. The - * default is to assume activities are based on the molar convention. - * That default is used here. + * This class adds additional functions onto the ThermoPhase interface that + * handles the calculation of the excess Gibbs free energy. The ThermoPhase + * class includes a member function, ThermoPhase::activityConvention() that + * indicates which convention the activities are based on. The default is to + * assume activities are based on the molar convention. That default is used + * here. * - * All of the Excess Gibbs free energy formulations in this area employ - * symmetrical formulations. + * All of the Excess Gibbs free energy formulations in this area employ + * symmetrical formulations. * - * This layer will massage the mole fraction vector to implement - * cation and anion based mole numbers in an optional manner, such that - * it is expected that there exists a charge balance at all times. - * One of the ions must be a "special ion" in the sense that its' thermodynamic - * functions are set to zero, and the thermo functions of all other - * ions are based on a valuation relative to that special ion. + * This layer will massage the mole fraction vector to implement cation and + * anion based mole numbers in an optional manner, such that it is expected that + * there exists a charge balance at all times. One of the ions must be a + * "special ion" in the sense that its' thermodynamic functions are set to zero, + * and the thermo functions of all other ions are based on a valuation relative + * to that special ion. */ class MolarityIonicVPSSTP : public GibbsExcessVPSSTP { public: - /// Constructor - /*! - * This doesn't do much more than initialize constants with - * default values for water at 25C. Water molecular weight - * comes from the default elements.xml file. It actually - * differs slightly from the IAPWS95 value of 18.015268. However, - * density conservation and therefore element conservation - * is the more important principle to follow. - */ MolarityIonicVPSSTP(); //! Construct and initialize a MolarityIonicVPSSTP ThermoPhase object @@ -87,24 +70,8 @@ public: */ MolarityIonicVPSSTP(XML_Node& phaseRef, const std::string& id = ""); - //! Copy constructor - /*! - * @param b class to be copied - */ MolarityIonicVPSSTP(const MolarityIonicVPSSTP& b); - - /// Assignment operator - /*! - * @param b class to be copied. - */ MolarityIonicVPSSTP& operator=(const MolarityIonicVPSSTP& b); - - //! Duplication routine for objects which inherit from ThermoPhase. - /*! - * This virtual routine can be used to duplicate ThermoPhase objects - * inherited from ThermoPhase even if the application only has - * a pointer to ThermoPhase to work with. - */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; /** @@ -118,39 +85,13 @@ public: * @{ */ - //! Get the array of non-dimensional molar-based ln activity coefficients at - //! the current solution temperature, pressure, and solution concentration. - /*! - * @param lnac Output vector of ln activity coefficients. Length: m_kk. - */ virtual void getLnActivityCoefficients(doublereal* lnac) const; //@} /// @name Partial Molar Properties of the Solution //@{ - //! Get the species chemical potentials. Units: J/kmol. - /*! - * This function returns a vector of chemical potentials of the - * species in solution at the current temperature, pressure - * and mole fraction of the solution. - * - * @param mu Output vector of species chemical - * potentials. Length: m_kk. Units: J/kmol - */ virtual void getChemPotentials(doublereal* mu) const; - - /** - * Get the species electrochemical potentials. - * These are partial molar quantities. - * This method adds a term \f$ Fz_k \phi_k \f$ to the - * to each chemical potential. - * - * Units: J/kmol - * - * @param mu output vector containing the species electrochemical potentials. - * Length: m_kk. - */ void getElectrochemPotentials(doublereal* mu) const; //! Returns an array of partial molar enthalpies for the species @@ -158,33 +99,33 @@ public: /*! * Units (J/kmol) * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * molality-based activity coefficient wrt temperature + * For this phase, the partial molar enthalpies are equal to the standard + * state enthalpies modified by the derivative of the molality-based + * activity coefficient wrt temperature * - * \f[ + * \f[ * \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] + * \f] * * @param hbar Vector of returned partial molar enthalpies * (length m_kk, units = J/kmol) */ virtual void getPartialMolarEnthalpies(doublereal* hbar) const; - //! Returns an array of partial molar entropies for the species - //! in the mixture. + //! Returns an array of partial molar entropies for the species in the + //! mixture. /*! * Units (J/kmol) * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature + * For this phase, the partial molar enthalpies are equal to the standard + * state enthalpies modified by the derivative of the activity coefficient + * wrt temperature * - * \f[ + * \f[ * \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} * - R \ln( \gamma_k X_k) * - R T \frac{d \ln(\gamma_k) }{dT} - * \f] + * \f] * * @param sbar Vector of returned partial molar entropies * (length m_kk, units = J/kmol/K) @@ -196,33 +137,23 @@ public: /*! * Units (J/kmol) * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature + * For this phase, the partial molar enthalpies are equal to the standard + * state enthalpies modified by the derivative of the activity coefficient + * wrt temperature * - * \f[ + * \f[ * ??????????????? * \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} * - R \ln( \gamma_k X_k) * - R T \frac{d \ln(\gamma_k) }{dT} * ??????????????? - * \f] + * \f] * * @param cpbar Vector of returned partial molar heat capacities * (length m_kk, units = J/kmol/K) */ virtual void getPartialMolarCp(doublereal* cpbar) const; - //! Return an array of partial molar volumes for the - //! species in the mixture. Units: m^3/kmol. - /*! - * Frequently, for this class of thermodynamics representations, - * the excess Volume due to mixing is zero. Here, we set it as - * a default. It may be overridden in derived classes. - * - * @param vbar Output vector of species partial molar volumes. - * Length = m_kk. units are m^3/kmol. - */ virtual void getPartialMolarVolumes(doublereal* vbar) const; //@} @@ -237,85 +168,54 @@ public: /// To see how they are used, see importPhase(). /// @{ - /*! - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase(). - */ virtual void initThermo(); - - /** - * Import and initialize a ThermoPhase object - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ void initThermoXML(XML_Node& phaseNode, const std::string& id); //! @} - //! returns a summary of the state of the phase as a string - /*! - * @param show_thermo If true, extra information is printed out - * about the thermodynamic state of the system. - * @param threshold Show information about species with mole fractions - * greater than *threshold*. - */ virtual std::string report(bool show_thermo=true, doublereal threshold=1e-14) const; private: - //! Initialize lengths of local variables after all species have been identified. + //! Initialize lengths of local variables after all species have been + //! identified. void initLengths(); //! Process an XML node called "binaryNeutralSpeciesParameters" /*! - * This node contains all of the parameters necessary to describe - * the Redlich-Kister model for a particular binary interaction. - * This function reads the XML file and writes the coefficients - * it finds to an internal data structures. + * This node contains all of the parameters necessary to describe the + * Redlich-Kister model for a particular binary interaction. This function + * reads the XML file and writes the coefficients it finds to an internal + * data structures. * - * @param xmlBinarySpecies Reference to the XML_Node named "binaryNeutralSpeciesParameters" - * containing the binary interaction + * @param xmlBinarySpecies Reference to the XML_Node named + * "binaryNeutralSpeciesParameters" containing the binary interaction */ void readXMLBinarySpecies(XML_Node& xmlBinarySpecies); //! Update the activity coefficients /*! - * This function will be called to update the internally stored - * natural logarithm of the activity coefficients + * This function will be called to update the internally stored natural + * logarithm of the activity coefficients */ void s_update_lnActCoeff() const; //! Update the derivative of the log of the activity coefficients wrt T /*! - * This function will be called to update the internally stored - * derivative of the natural logarithm of the activity coefficients - * wrt temperature. + * This function will be called to update the internally stored derivative + * of the natural logarithm of the activity coefficients wrt temperature. */ void s_update_dlnActCoeff_dT() const; - //! Internal routine that calculates the derivative of the activity coefficients wrt - //! the mole fractions. + //! Internal routine that calculates the derivative of the activity + //! coefficients wrt the mole fractions. /*! - * This routine calculates the the derivative of the activity coefficients wrt to mole fraction - * with all other mole fractions held constant. This is strictly not permitted. However, if the - * resulting matrix is multiplied by a permissible deltaX vector then everything is ok. + * This routine calculates the the derivative of the activity coefficients + * wrt to mole fraction with all other mole fractions held constant. This is + * strictly not permitted. However, if the resulting matrix is multiplied by + * a permissible deltaX vector then everything is ok. * - * This is the natural way to handle concentration derivatives in this routine. + * This is the natural way to handle concentration derivatives in this + * routine. */ void s_update_dlnActCoeff_dX_() const; diff --git a/include/cantera/thermo/Phase.h b/include/cantera/thermo/Phase.h index cdb456329..8d729c629 100644 --- a/include/cantera/thermo/Phase.h +++ b/include/cantera/thermo/Phase.h @@ -27,10 +27,11 @@ namespace Cantera * support thermodynamic calculations (see \ref thermoprops). */ -//! Class Phase is the base class for phases of matter, managing the species and elements in a phase, as well as the -//! independent variables of temperature, mass density, species mass/mole fraction, -//! and other generalized forces and intrinsic properties (such as electric potential) -//! that define the thermodynamic state. +//! Class Phase is the base class for phases of matter, managing the species and +//! elements in a phase, as well as the independent variables of temperature, +//! mass density, species mass/mole fraction, and other generalized forces and +//! intrinsic properties (such as electric potential) that define the +//! thermodynamic state. /*! * * Class Phase provides information about the elements and species in a @@ -58,11 +59,10 @@ namespace Cantera * temperature and then the density. An example of this is the function * Phase::setState_TRY(double t, double dens, const double* y). * - * Class Phase contains method for saving and restoring the full internal - * states of each phase. These are saveState() and restoreState(). These - * functions operate on a state vector, which is in general of length - * (2 + nSpecies()). The first two entries of the state vector are temperature - * and density. + * Class Phase contains method for saving and restoring the full internal states + * of each phase. These are saveState() and restoreState(). These functions + * operate on a state vector, which is in general of length (2 + nSpecies()). + * The first two entries of the state vector are temperature and density. * * A species name may be referred to via three methods: * @@ -75,17 +75,19 @@ namespace Cantera * complicated assemblies of %Cantera Phases. * * @todo - * Make the concept of saving state vectors more general, so that it can - * handle other cases where there are additional internal state variables, such - * as the voltage, a potential energy, or a strain field. - * - * Specify that the input mole, mass, and volume fraction vectors must sum to one on entry to the set state routines. - * Non-conforming mole/mass fraction vectors are not thermodynamically consistent. - * Moreover, unless we do this, the calculation of Jacobians will be altered whenever the treatment of non-conforming mole - * fractions is changed. Add setState functions corresponding to specifying mole numbers, which is actually what - * is being done (well one of the options, there are many) when non-conforming mole fractions are input. - * Note, we realize that most numerical Jacobian and some analytical Jacobians use non-conforming calculations. - * These can easily be changed to the set mole number setState functions. + * - Make the concept of saving state vectors more general, so that it can + * handle other cases where there are additional internal state variables, + * such as the voltage, a potential energy, or a strain field. + * - Specify that the input mole, mass, and volume fraction vectors must sum + * to one on entry to the set state routines. Non-conforming mole/mass + * fraction vectors are not thermodynamically consistent. Moreover, unless + * we do this, the calculation of Jacobians will be altered whenever the + * treatment of non- conforming mole fractions is changed. Add setState + * functions corresponding to specifying mole numbers, which is actually + * what is being done (well one of the options, there are many) when non- + * conforming mole fractions are input. Note, we realize that most numerical + * Jacobian and some analytical Jacobians use non-conforming calculations. + * These can easily be changed to the set mole number setState functions. * * @ingroup phases */ @@ -106,16 +108,16 @@ public: //! Returns a const reference to the XML_Node that describes the phase. /*! - * The XML_Node for the phase contains all of the input data used to set - * up the model for the phase during its initialization. + * The XML_Node for the phase contains all of the input data used to set up + * the model for the phase during its initialization. */ XML_Node& xml() const; //! Stores the XML tree information for the current phase /*! - * This function now stores the complete XML_Node tree as read into the code - * via a file. This is needed to move around within the XML tree during - * construction of transport and kinetics mechanisms after copy + * This function now stores the complete XML_Node tree as read into the + * code via a file. This is needed to move around within the XML tree + * during construction of transport and kinetics mechanisms after copy * construction operations. * * @param xmlPhase Reference to the XML node corresponding to the phase @@ -191,25 +193,25 @@ public: //! Return the element constraint type //! Possible types include: //! - //! CT_ELEM_TYPE_TURNEDOFF -1 - //! CT_ELEM_TYPE_ABSPOS 0 - //! CT_ELEM_TYPE_ELECTRONCHARGE 1 - //! CT_ELEM_TYPE_CHARGENEUTRALITY 2 - //! CT_ELEM_TYPE_LATTICERATIO 3 - //! CT_ELEM_TYPE_KINETICFROZEN 4 - //! CT_ELEM_TYPE_SURFACECONSTRAINT 5 - //! CT_ELEM_TYPE_OTHERCONSTRAINT 6 + //! - `CT_ELEM_TYPE_TURNEDOFF -1` + //! - `CT_ELEM_TYPE_ABSPOS 0` + //! - `CT_ELEM_TYPE_ELECTRONCHARGE 1` + //! - `CT_ELEM_TYPE_CHARGENEUTRALITY 2` + //! - `CT_ELEM_TYPE_LATTICERATIO 3` + //! - `CT_ELEM_TYPE_KINETICFROZEN 4` + //! - `CT_ELEM_TYPE_SURFACECONSTRAINT 5` + //! - `CT_ELEM_TYPE_OTHERCONSTRAINT 6` //! //! The default is `CT_ELEM_TYPE_ABSPOS`. //! @param m Element index - //! @return Returns the element type + //! @returns the element type int elementType(size_t m) const; //! Change the element type of the mth constraint //! Reassigns an element type. //! @param m Element index //! @param elem_type New elem type to be assigned - //! @return Returns the old element type + //! @returns the old element type int changeElementType(int m, int elem_type); //! Return a read-only reference to the vector of atomic weights. @@ -218,11 +220,11 @@ public: //! Number of elements. size_t nElements() const; - //! Check that the specified element index is in range + //! Check that the specified element index is in range. //! Throws an exception if m is greater than nElements()-1 void checkElementIndex(size_t m) const; - //! Check that an array size is at least nElements() + //! Check that an array size is at least nElements(). //! Throws an exception if mm is less than nElements(). Used before calls //! which take an array pointer. void checkElementArraySize(size_t mm) const; @@ -265,18 +267,18 @@ public: return m_kk; } - //! Check that the specified species index is in range + //! Check that the specified species index is in range. //! Throws an exception if k is greater than nSpecies()-1 void checkSpeciesIndex(size_t k) const; - //! Check that an array size is at least nSpecies() + //! Check that an array size is at least nSpecies(). //! Throws an exception if kk is less than nSpecies(). Used before calls //! which take an array pointer. void checkSpeciesArraySize(size_t kk) const; //!@} end group Element and Species Information - //! Save the current internal state of the phase + //! Save the current internal state of the phase. //! Write to vector 'state' the current internal state. //! @param state output vector. Will be resized to nSpecies() + 2. void saveState(vector_fp& state) const; @@ -353,7 +355,8 @@ public: //! a zero mass fraction. void setState_TRY(doublereal t, doublereal dens, const compositionMap& y); - //! Set the internally stored temperature (K), molar density (kmol/m^3), and mole fractions. + //! Set the internally stored temperature (K), molar density (kmol/m^3), and + //! mole fractions. //! @param t Temperature in kelvin //! @param n molar density (kmol/m^3) //! @param x vector of species mole fractions, length m_kk @@ -388,7 +391,7 @@ public: //! Molecular weight of species \c k. //! @param k index of species \c k - //! @return Returns the molecular weight of species \c k. + //! @returns the molecular weight of species \c k. doublereal molecularWeight(size_t k) const; //! Copy the vector of molecular weights into vector weights. @@ -450,7 +453,7 @@ public: //! length greater than or equal to the number of species. void getMoleFractions(doublereal* const x) const; - //! Set the mole fractions to the specified values + //! Set the mole fractions to the specified values. //! There is no restriction on the sum of the mole fraction vector. //! Internally, the Phase object will normalize this vector before storing //! its contents. @@ -490,8 +493,9 @@ public: //! Get the species concentrations (kmol/m^3). /*! - * @param[out] c The vector of species concentrations. Units are kmol/m^3. The length of - * the vector must be greater than or equal to the number of species within the phase. + * @param[out] c The vector of species concentrations. Units are + * kmol/m^3. The length of the vector must be greater than + * or equal to the number of species within the phase. */ void getConcentrations(doublereal* const c) const; @@ -500,7 +504,7 @@ public: /*! * @param[in] k Index of the species within the phase. * - * @return Returns the concentration of species k (kmol m-3). + * @returns the concentration of species k (kmol m-3). */ doublereal concentration(const size_t k) const; @@ -607,7 +611,7 @@ public: //! @return The molar volume of the phase doublereal molarVolume() const; - //! Set the internally stored density (kg/m^3) of the phase + //! Set the internally stored density (kg/m^3) of the phase. //! Note the density of a phase is an independent variable. //! @param[in] density_ density (kg/m^3). virtual void setDensity(const doublereal density_) { @@ -714,7 +718,7 @@ public: //! Returns a bool indicating whether the object is ready for use /*! - * @return returns true if the object is ready for calculation, false otherwise. + * @returns true if the object is ready for calculation, false otherwise. */ virtual bool ready() const; @@ -726,8 +730,8 @@ public: protected: //! Cached for saved calculations within each ThermoPhase. /*! - * For more information on how to use this, see examples within the source code and documentation - * for this within ValueCache class itself. + * For more information on how to use this, see examples within the source + * code and documentation for this within ValueCache class itself. */ mutable ValueCache m_cache; diff --git a/include/cantera/thermo/PhaseCombo_Interaction.h b/include/cantera/thermo/PhaseCombo_Interaction.h index 8c172968a..ae98f8a94 100644 --- a/include/cantera/thermo/PhaseCombo_Interaction.h +++ b/include/cantera/thermo/PhaseCombo_Interaction.h @@ -20,245 +20,233 @@ namespace Cantera { -/** - * @ingroup thermoprops - */ - -//! PhaseCombo_Interaction is a derived class of GibbsExcessVPSSTP that employs -//! the Margules approximation for the excess Gibbs free energy while eliminating -//! the entropy of mixing term. +//! PhaseCombo_Interaction is a derived class of GibbsExcessVPSSTP that employs +//! the Margules approximation for the excess Gibbs free energy while +//! eliminating the entropy of mixing term. /*! - * PhaseCombo_Interaction derives from class GibbsExcessVPSSTP which is derived from VPStandardStateTP, - * and overloads the virtual methods defined there with ones that - * use expressions appropriate for the Margules Excess Gibbs free energy approximation. - * The reader should refer to the MargulesVPSSTP class for information on that class. - * This class in addition adds a term to the activity coefficient that eliminates the - * ideal solution mixing term within the chemical potential. This is a very radical thing - * to do, but it is supported by experimental evidence under some conditions. + * PhaseCombo_Interaction derives from class GibbsExcessVPSSTP which is derived + * from VPStandardStateTP, and overloads the virtual methods defined there with + * ones that use expressions appropriate for the Margules Excess Gibbs free + * energy approximation. The reader should refer to the MargulesVPSSTP class for + * information on that class. This class in addition adds a term to the activity + * coefficient that eliminates the ideal solution mixing term within the + * chemical potential. This is a very radical thing to do, but it is supported + * by experimental evidence under some conditions. * - * The independent unknowns are pressure, temperature, and mass fraction. + * The independent unknowns are pressure, temperature, and mass fraction. * - * Several concepts are introduced. The first concept is that there are temporary - * variables for holding the species standard state values of Cp, H, S, G, and V at the - * last temperature and pressure called. These functions are not recalculated - * if a new call is made using the previous temperature and pressure. Currently, - * these variables and the calculation method are handled by the VPSSMgr class, - * for which VPStandardStateTP owns a pointer to. + * This class is introduced to represent specific conditions observed in thermal + * batteries. HOwever, it may be physically motivated to represent conditions + * where there may be a mixture of compounds that are not "mixed" at the + * molecular level. Therefore, there is no mixing term. * - * To support the above functionality, pressure and temperature variables, - * m_plast_ss and m_tlast_ss, are kept which store the last pressure and temperature - * used in the evaluation of standard state properties. - * - * This class is introduced to represent specific conditions observed in thermal batteries. - * HOwever, it may be physically motivated to represent conditions where there may - * be a mixture of compounds that are not "mixed" at the molecular level. Therefore, there - * is no mixing term. - * - * The lack of a mixing term has profound effects. First, the mole fraction of a species - * can now be identically zero due to thermodynamic considerations. The phase behaves more - * like a series of phases. That's why we named it PhaseCombo. + * The lack of a mixing term has profound effects. First, the mole fraction of a + * species can now be identically zero due to thermodynamic considerations. The + * phase behaves more like a series of phases. That's why we named it + * PhaseCombo. * *
*

Specification of Species Standard State Properties

*
* - * All species are defined to have standard states that depend upon both - * the temperature and the pressure. The Margules approximation assumes - * symmetric standard states, where all of the standard state assume - * that the species are in pure component states at the temperature - * and pressure of the solution. I don't think it prevents, however, - * some species from being dilute in the solution. + * All species are defined to have standard states that depend upon both the + * temperature and the pressure. The Margules approximation assumes symmetric + * standard states, where all of the standard state assume that the species are + * in pure component states at the temperature and pressure of the solution. I + * don't think it prevents, however, some species from being dilute in the + * solution. * *
*

Specification of Solution Thermodynamic Properties

*
* - * The molar excess Gibbs free energy is given by the following formula which is a sum over interactions i. - * Each of the interactions are binary interactions involving two of the species in the phase, denoted, Ai - * and Bi. - * This is the generalization of the Margules formulation for a phase - * that has more than 2 species. The second term in the excess Gibbs free energy is a negation of the - * ideal solution's mixing term. + * The molar excess Gibbs free energy is given by the following formula which is + * a sum over interactions i. Each of the interactions are binary + * interactions involving two of the species in the phase, denoted, Ai + * and Bi. This is the generalization of the Margules formulation for a + * phase that has more than 2 species. The second term in the excess Gibbs free + * energy is a negation of the ideal solution's mixing term. * - * \f[ - * G^E = \sum_i \left( H_{Ei} - T S_{Ei} \right) - \sum_i \left( n_i R T \ln{X_i} \right) - * \f] - * \f[ - * H^E_i = n X_{Ai} X_{Bi} \left( h_{o,i} + h_{1,i} X_{Bi} \right) - * \f] - * \f[ - * S^E_i = n X_{Ai} X_{Bi} \left( s_{o,i} + s_{1,i} X_{Bi} \right) - * \f] + * \f[ + * G^E = \sum_i \left( H_{Ei} - T S_{Ei} \right) - \sum_i \left( n_i R T \ln{X_i} \right) + * \f] + * \f[ + * H^E_i = n X_{Ai} X_{Bi} \left( h_{o,i} + h_{1,i} X_{Bi} \right) + * \f] + * \f[ + * S^E_i = n X_{Ai} X_{Bi} \left( s_{o,i} + s_{1,i} X_{Bi} \right) + * \f] * - * where n is the total moles in the solution. + * where n is the total moles in the solution. The activity of a species defined + * in the phase is given by an excess Gibbs free energy formulation. * - * The activity of a species defined in the phase is given by an excess Gibbs free energy formulation. + * \f[ + * a_k = \gamma_k X_k + * \f] * - * \f[ - * a_k = \gamma_k X_k - * \f] + * where * - * where + * \f[ + * R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i} + * \f] * - * \f[ - * R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i} - * \f] + * Taking the derivatives results in the following expression * - * Taking the derivatives results in the following expression + * \f[ + * R T \ln( \gamma_k )= \sum_i \left( \left( \delta_{Ai,k} X_{Bi} + \delta_{Bi,k} X_{Ai} - X_{Ai} X_{Bi} \right) + * \left( g^E_{o,i} + g^E_{1,i} X_{Bi} \right) + + * \left( \delta_{Bi,k} - X_{Bi} \right) X_{Ai} X_{Bi} g^E_{1,i} \right) - RT \ln{X_k} + * \f] * - * \f[ - * R T \ln( \gamma_k )= \sum_i \left( \left( \delta_{Ai,k} X_{Bi} + \delta_{Bi,k} X_{Ai} - X_{Ai} X_{Bi} \right) - * \left( g^E_{o,i} + g^E_{1,i} X_{Bi} \right) + - * \left( \delta_{Bi,k} - X_{Bi} \right) X_{Ai} X_{Bi} g^E_{1,i} \right) - RT \ln{X_k} - * \f] + * where \f$ g^E_{o,i} = h_{o,i} - T s_{o,i} \f$ and + * \f$ g^E_{1,i} = h_{1,i} - T s_{1,i} \f$ and where \f$ X_k \f$ is the mole + * fraction of species k. * - * where - * \f$ g^E_{o,i} = h_{o,i} - T s_{o,i} \f$ and \f$ g^E_{1,i} = h_{1,i} - T s_{1,i} \f$ - * and where \f$ X_k \f$ is the mole fraction of species k. + * This object inherits from the class VPStandardStateTP. Therefore, the + * specification and calculation of all standard state and reference state + * values are handled at that level. Various functional forms for the standard + * state are permissible. The chemical potential for species k is equal + * to * - * This object inherits from the class VPStandardStateTP. Therefore, the specification and - * calculation of all standard state and reference state values are handled at that level. Various functional - * forms for the standard state are permissible. - * The chemical potential for species k is equal to + * \f[ + * \mu_k(T,P) = \mu^o_k(T, P) + R T \ln(\gamma_k X_k) + * \f] * - * \f[ - * \mu_k(T,P) = \mu^o_k(T, P) + R T \ln(\gamma_k X_k) - * \f] + * The partial molar entropy for species k is given by the following + * relation, * - * The partial molar entropy for species k is given by the following relation, + * \f[ + * \tilde{s}_k(T,P) = s^o_k(T,P) - R \ln( \gamma_k X_k ) + * - R T \frac{d \ln(\gamma_k) }{dT} + * \f] * - * \f[ - * \tilde{s}_k(T,P) = s^o_k(T,P) - R \ln( \gamma_k X_k ) - * - R T \frac{d \ln(\gamma_k) }{dT} - * \f] + * The partial molar enthalpy for species k is given by * - * The partial molar enthalpy for species k is given by + * \f[ + * \tilde{h}_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} + * \f] * - * \f[ - * \tilde{h}_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] + * The partial molar volume for species k is * - * The partial molar volume for species k is + * \f[ + * \tilde V_k(T,P) = V^o_k(T,P) + R T \frac{d \ln(\gamma_k) }{dP} + * \f] * - * \f[ - * \tilde V_k(T,P) = V^o_k(T,P) + R T \frac{d \ln(\gamma_k) }{dP} - * \f] + * The partial molar Heat Capacity for species k is * - * The partial molar Heat Capacity for species k is - * - * \f[ - * \tilde{C}_{p,k}(T,P) = C^o_{p,k}(T,P) - 2 R T \frac{d \ln( \gamma_k )}{dT} - * - R T^2 \frac{d^2 \ln(\gamma_k) }{{dT}^2} - * \f] + * \f[ + * \tilde{C}_{p,k}(T,P) = C^o_{p,k}(T,P) - 2 R T \frac{d \ln( \gamma_k )}{dT} + * - R T^2 \frac{d^2 \ln(\gamma_k) }{{dT}^2} + * \f] * *
*

%Application within Kinetics Managers

*
* - * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / - * C^s_k, \f$ where \f$ C^s_k \f$ is a standard concentration - * defined below and \f$ a_k \f$ are activities used in the - * thermodynamic functions. These activity (or generalized) concentrations are used - * by kinetics manager classes to compute the forward and reverse rates of elementary reactions. - * The activity concentration,\f$ C^a_k \f$,is given by the following expression. + * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / C^s_k, \f$ where + * \f$ C^s_k \f$ is a standard concentration defined below and \f$ a_k \f$ are + * activities used in the thermodynamic functions. These activity (or + * generalized) concentrations are used by kinetics manager classes to compute + * the forward and reverse rates of elementary reactions. The activity + * concentration,\f$ C^a_k \f$,is given by the following expression. * - * \f[ - * C^a_k = C^s_k X_k = \frac{P}{R T} X_k - * \f] + * \f[ + * C^a_k = C^s_k X_k = \frac{P}{R T} X_k + * \f] * - * The standard concentration for species k is independent of k and equal to + * The standard concentration for species k is independent of k + * and equal to * - * \f[ - * C^s_k = C^s = \frac{P}{R T} - * \f] + * \f[ + * C^s_k = C^s = \frac{P}{R T} + * \f] * - * For example, a bulk-phase binary gas reaction between species j and k, producing - * a new gas species l would have the - * following equation for its rate of progress variable, \f$ R^1 \f$, which has - * units of kmol m-3 s-1. + * For example, a bulk-phase binary gas reaction between species j and k, + * producing a new gas species l would have the following equation for its rate + * of progress variable, \f$ R^1 \f$, which has units of kmol m-3 s-1. * - * \f[ + * \f[ * R^1 = k^1 C_j^a C_k^a = k^1 (C^s a_j) (C^s a_k) - * \f] + * \f] * - * where + * where * - * \f[ + * \f[ * C_j^a = C^s a_j \mbox{\quad and \quad} C_k^a = C^s a_k - * \f] + * \f] * - * \f$ C_j^a \f$ is the activity concentration of species j, and - * \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^s \f$ - * is the standard concentration. \f$ a_j \f$ is - * the activity of species j which is equal to the mole fraction of j. + * \f$ C_j^a \f$ is the activity concentration of species j, and \f$ C_k^a \f$ + * is the activity concentration of species k. \f$ C^s \f$ is the standard + * concentration. \f$ a_j \f$ is the activity of species j which is equal to the + * mole fraction of j. * - * The reverse rate constant can then be obtained from the law of microscopic reversibility - * and the equilibrium expression for the system. + * The reverse rate constant can then be obtained from the law of microscopic + * reversibility and the equilibrium expression for the system. * - * \f[ - * \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} ) - * \f] + * \f[ + * \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} ) + * \f] * - * \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, associated with - * the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ and their associated activities, - * \f$ a_l \f$, repeated here: + * \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, + * associated with the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ + * and their associated activities, \f$ a_l \f$, repeated here: * - * \f[ - * \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l) - * \f] + * \f[ + * \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l) + * \f] * - * We can switch over to expressing the equilibrium constant in terms of the reference - * state chemical potentials + * We can switch over to expressing the equilibrium constant in terms of the + * reference state chemical potentials * - * \f[ - * K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P} - * \f] + * \f[ + * K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P} + * \f] * - * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over - * to activity concentrations. When this is done: + * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by + * changing over to activity concentrations. When this is done: * - * \f[ - * \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 = - * \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT} - * \f] + * \f[ + * \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 = + * \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT} + * \f] * - * Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$, - * using the second and third part of the above expression as a definition for the concentration - * equilibrium constant. + * Kinetics managers will calculate the concentration equilibrium constant, + * \f$ K_c \f$, using the second and third part of the above expression as a + * definition for the concentration equilibrium constant. * - * For completeness, the pressure equilibrium constant may be obtained as well + * For completeness, the pressure equilibrium constant may be obtained as well * - * \f[ - * \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) - * \f] + * \f[ + * \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) + * \f] * - * \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. However, it isn't - * necessarily the simplest form of the equilibrium constant for other types of phases; \f$ K_c \f$ is - * used instead because it is completely general. + * \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. + * However, it isn't necessarily the simplest form of the equilibrium constant + * for other types of phases; \f$ K_c \f$ is used instead because it is + * completely general. * - * The reverse rate of progress may be written down as - * \f[ - * R^{-1} = k^{-1} C_l^a = k^{-1} (C^o a_l) - * \f] + * The reverse rate of progress may be written down as + * \f[ + * R^{-1} = k^{-1} C_l^a = k^{-1} (C^o a_l) + * \f] * - * where we can use the concept of microscopic reversibility to - * write the reverse rate constant in terms of the - * forward reate constant and the concentration equilibrium - * constant, \f$ K_c \f$. + * where we can use the concept of microscopic reversibility to write the + * reverse rate constant in terms of the forward reate constant and the + * concentration equilibrium constant, \f$ K_c \f$. * - * \f[ - * k^{-1} = k^1 K^1_c - * \f] + * \f[ + * k^{-1} = k^1 K^1_c + * \f] * - * \f$k^{-1} \f$ has units of s-1. + * \f$k^{-1} \f$ has units of s-1. * *
*

Instantiation of the Class

*
* - * The constructor for this phase is located in the default ThermoFactory - * for %Cantera. A new PhaseCombo_Interaction object may be created by the following code - * snippet: + * The constructor for this phase is located in the default ThermoFactory for + * %Cantera. A new PhaseCombo_Interaction object may be created by the following + * code snippet: * * @code * XML_Node *xc = get_XML_File("LiFeS_X_combo.xml"); @@ -286,8 +274,8 @@ namespace Cantera *
*

XML Example

*
- * An example of an XML Element named phase setting up a PhaseCombo_Interaction - * object named LiFeS_X is given below. + * An example of an XML Element named phase setting up a PhaseCombo_Interaction + * object named LiFeS_X is given below. * * @code * @@ -320,8 +308,9 @@ namespace Cantera * * @endcode * - * The model attribute "PhaseCombo_Interaction" of the thermo XML element identifies the phase as - * being of the type handled by the PhaseCombo_Interaction object. + * The model attribute "PhaseCombo_Interaction" of the thermo XML element + * identifies the phase as being of the type handled by the + * PhaseCombo_Interaction object. * * @ingroup thermoprops */ @@ -329,14 +318,6 @@ class PhaseCombo_Interaction : public GibbsExcessVPSSTP { public: //! Constructor - /*! - * This doesn't do much more than initialize constants with - * default values for water at 25C. Water molecular weight - * comes from the default elements.xml file. It actually - * differs slightly from the IAPWS95 value of 18.015268. However, - * density conservation and therefore element conservation - * is the more important principle to follow. - */ PhaseCombo_Interaction(); //! Construct and initialize a PhaseCombo_Interaction ThermoPhase object @@ -358,133 +339,89 @@ public: */ PhaseCombo_Interaction(XML_Node& phaseRef, const std::string& id = ""); - //! Copy constructor - /*! - * @param b class to be copied - */ PhaseCombo_Interaction(const PhaseCombo_Interaction& b); - - //! Assignment operator - /*! - * @param b class to be copied. - */ PhaseCombo_Interaction& operator=(const PhaseCombo_Interaction& b); - - //! Duplication routine for objects which inherit from ThermoPhase. - /*! - * This virtual routine can be used to duplicate ThermoPhase objects - * inherited from ThermoPhase even if the application only has - * a pointer to ThermoPhase to work with. - */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; //! @name Utilities //! @{ - //! Equation of state type flag. - /*! - * The ThermoPhase base class returns zero. Subclasses should define this - * to return a unique non-zero value. Known constants defined for this - * purpose are listed in mix_defs.h. - */ virtual int eosType() const; //! @} //! @name Molar Thermodynamic Properties //! @{ - /// Molar enthalpy. Units: J/kmol. virtual doublereal enthalpy_mole() const; - - /// Molar entropy. Units: J/kmol. virtual doublereal entropy_mole() const; - - /// Molar heat capacity at constant pressure. Units: J/kmol/K. virtual doublereal cp_mole() const; - - /// Molar heat capacity at constant volume. Units: J/kmol/K. virtual doublereal cv_mole() const; /** * @} * @name Activities, Standard States, and Activity Concentrations * - * The activity \f$a_k\f$ of a species in solution is - * related to the chemical potential by \f[ \mu_k = \mu_k^0(T) - * + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is - * the chemical potential at unit activity, which depends only - * on temperature and pressure. + * The activity \f$a_k\f$ of a species in solution is related to the + * chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] The + * quantity \f$\mu_k^0(T,P)\f$ is the chemical potential at unit activity, + * which depends only on temperature and pressure. * @{ */ - //! Get the array of non-dimensional molar-based activity coefficients at - //! the current solution temperature, pressure, and solution concentration. - /*! - * @param ac Output vector of activity coefficients. Length: m_kk. - */ virtual void getActivityCoefficients(doublereal* ac) const; //@} /// @name Partial Molar Properties of the Solution //@{ - //! Get the species chemical potentials. Units: J/kmol. - /*! - * This function returns a vector of chemical potentials of the - * species in solution at the current temperature, pressure - * and mole fraction of the solution. - * - * @param mu Output vector of species chemical - * potentials. Length: m_kk. Units: J/kmol - */ virtual void getChemPotentials(doublereal* mu) const; - //! Returns an array of partial molar enthalpies for the species - //! in the mixture. + //! Returns an array of partial molar enthalpies for the species in the + //! mixture. /*! * Units (J/kmol) * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * molality-based activity coefficient wrt temperature + * For this phase, the partial molar enthalpies are equal to the standard + * state enthalpies modified by the derivative of the molality-based + * activity coefficient wrt temperature * - * \f[ + * \f[ * \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] + * \f] * * @param hbar Vector of returned partial molar enthalpies * (length m_kk, units = J/kmol) */ virtual void getPartialMolarEnthalpies(doublereal* hbar) const; - //! Returns an array of partial molar entropies for the species - //! in the mixture. + //! Returns an array of partial molar entropies for the species in the + //! mixture. /*! * Units (J/kmol) * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature + * For this phase, the partial molar enthalpies are equal to the standard + * state enthalpies modified by the derivative of the activity coefficient + * wrt temperature * - * \f[ + * \f[ * \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} * - R \ln( \gamma_k X_k) * - R T \frac{d \ln(\gamma_k) }{dT} - * \f] + * \f] * * @param sbar Vector of returned partial molar entropies * (length m_kk, units = J/kmol/K) */ virtual void getPartialMolarEntropies(doublereal* sbar) const; - //! Returns an array of partial molar entropies for the species - //! in the mixture. + //! Returns an array of partial molar entropies for the species in the + //! mixture. /*! * Units (J/kmol) * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature + * For this phase, the partial molar enthalpies are equal to the standard + * state enthalpies modified by the derivative of the activity coefficient + * wrt temperature * * \f[ * ??????????????? @@ -499,53 +436,30 @@ public: */ virtual void getPartialMolarCp(doublereal* cpbar) const; - //! Return an array of partial molar volumes for the - //! species in the mixture. Units: m^3/kmol. + //! Return an array of partial molar volumes for the species in the mixture. + //! Units: m^3/kmol. /*! - * Frequently, for this class of thermodynamics representations, - * the excess Volume due to mixing is zero. Here, we set it as - * a default. It may be overridden in derived classes. + * Frequently, for this class of thermodynamics representations, the excess + * Volume due to mixing is zero. Here, we set it as a default. It may be + * overridden in derived classes. * * @param vbar Output vector of species partial molar volumes. * Length = m_kk. units are m^3/kmol. */ virtual void getPartialMolarVolumes(doublereal* vbar) const; - //! Get the species electrochemical potentials. - /*! - * These are partial molar quantities. - * This method adds a term \f$ Fz_k \phi_k \f$ to the - * to each chemical potential. - * - * Units: J/kmol - * - * @param mu output vector containing the species electrochemical potentials. - * Length: m_kk., units = J/kmol - */ void getElectrochemPotentials(doublereal* mu) const; - //! Get the array of temperature second derivatives of the log activity coefficients + //! Get the array of temperature second derivatives of the log activity + //! coefficients /*! - * This function is a virtual class, but it first appears in GibbsExcessVPSSTP - * class and derived classes from GibbsExcessVPSSTP. - * * units = 1/Kelvin * - * @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of the - * log Activity Coefficients. length = m_kk + * @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of + * the log Activity Coefficients. length = m_kk */ virtual void getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const; - //! Get the array of temperature derivatives of the log activity coefficients - /*! - * This function is a virtual class, but it first appears in GibbsExcessVPSSTP - * class and derived classes from GibbsExcessVPSSTP. - * - * units = 1/Kelvin - * - * @param dlnActCoeffdT Output vector of temperature derivatives of the - * log Activity Coefficients. length = m_kk - */ virtual void getdlnActCoeffdT(doublereal* dlnActCoeffdT) const; /// @} @@ -556,103 +470,16 @@ public: /// To see how they are used, see importPhase(). /// @{ - /*! - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase(). - */ virtual void initThermo(); - - /** - * Import and initialize a ThermoPhase object - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ void initThermoXML(XML_Node& phaseNode, const std::string& id); //! @} //! @name Derivatives of Thermodynamic Variables needed for Applications //! @{ - //! Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along - //! a line in parameter space or along a line in physical space - /*! - * @param dTds Input of temperature change along the path - * @param dXds Input vector of changes in mole fraction along the path. length = m_kk - * Along the path length it must be the case that the mole fractions sum to one. - * @param dlnActCoeffds Output vector of the directional derivatives of the - * log Activity Coefficients along the path. length = m_kk - * units are 1/units(s). if s is a physical coordinate then the units are 1/m. - */ virtual void getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const; - - //! Get the array of log concentration-like derivatives of the - //! log activity coefficients - diagonal component - /*! - * This function is a virtual method. For ideal mixtures - * (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the - * logarithm of the activity coefficient with respect to the - * logarithm of the mole fraction. - * - * units = dimensionless - * - * @param dlnActCoeffdlnX_diag Output vector of the diagonal component of the log(mole fraction) - * derivatives of the log Activity Coefficients. - * length = m_kk - */ virtual void getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const; - - //! Get the array of derivatives of the log activity coefficients wrt mole numbers - diagonal only - /*! - * This function is a virtual method. For ideal mixtures - * (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the - * logarithm of the activity coefficient with respect to the - * logarithm of the concentration-like variable (i.e. mole fraction, - * molality, etc.) that represents the standard state. - * - * units = dimensionless - * - * @param dlnActCoeffdlnN_diag Output vector of the diagonal entries for the log(mole fraction) - * derivatives of the log Activity Coefficients. - * length = m_kk - */ virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const; - - //! Get the array of derivatives of the log activity coefficients with respect to the ln species mole numbers - /*! - * Implementations should take the derivative of the logarithm of the activity coefficient with respect to a - * log of a species mole number (with all other species mole numbers held constant) - * - * units = 1 / kmol - * - * dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log act_coeff for the mth - * species with respect to the number of moles of the kth species. - * - * \f[ - * \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i} - * \f] - * - * @param ld Number of rows in the matrix - * @param dlnActCoeffdlnN Output vector of derivatives of the - * log Activity Coefficients. length = m_kk * m_kk - */ virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN); //@} @@ -660,65 +487,65 @@ public: private: //! Process an XML node called "binaryNeutralSpeciesParameters" /*! - * This node contains all of the parameters necessary to describe - * the Margules model for a particular binary interaction. - * This function reads the XML file and writes the coefficients - * it finds to an internal data structures. + * This node contains all of the parameters necessary to describe the + * Margules model for a particular binary interaction. This function reads + * the XML file and writes the coefficients it finds to an internal data + * structures. * - * @param xmlBinarySpecies Reference to the XML_Node named "binaryNeutralSpeciesParameters" - * containing the binary interaction + * @param xmlBinarySpecies Reference to the XML_Node named + * "binaryNeutralSpeciesParameters" containing the binary interaction */ void readXMLBinarySpecies(XML_Node& xmlBinarySpecies); - //! Resize internal arrays within the object that depend upon the number - //! of binary Margules interaction terms + //! Resize internal arrays within the object that depend upon the number of + //! binary Margules interaction terms /*! * @param num Number of binary Margules interaction terms */ void resizeNumInteractions(const size_t num); - //! Initialize lengths of local variables after all species have - //! been identified. + //! Initialize lengths of local variables after all species have been + //! identified. void initLengths(); //! Update the activity coefficients /*! - * This function will be called to update the internally stored - * natural logarithm of the activity coefficients + * This function will be called to update the internally stored natural + * logarithm of the activity coefficients */ void s_update_lnActCoeff() const; //! Update the derivative of the log of the activity coefficients wrt T /*! - * This function will be called to update the internally stored - * derivative of the natural logarithm of the activity coefficients - * wrt temperature. + * This function will be called to update the internally stored derivative + * of the natural logarithm of the activity coefficients wrt temperature. */ void s_update_dlnActCoeff_dT() const; - //! Update the derivative of the log of the activity coefficients - //! wrt log(mole fraction) + //! Update the derivative of the log of the activity coefficients wrt + //! log(mole fraction) /*! - * This function will be called to update the internally stored - * derivative of the natural logarithm of the activity coefficients - * wrt logarithm of the mole fractions. + * This function will be called to update the internally stored derivative + * of the natural logarithm of the activity coefficients wrt logarithm of + * the mole fractions. */ void s_update_dlnActCoeff_dlnX_diag() const; - //! Update the derivative of the log of the activity coefficients - //! wrt log(moles) - diagonal only + //! Update the derivative of the log of the activity coefficients wrt + //! log(moles) - diagonal only /*! - * This function will be called to update the internally stored diagonal entries for the - * derivative of the natural logarithm of the activity coefficients - * wrt logarithm of the moles. + * This function will be called to update the internally stored diagonal + * entries for the derivative of the natural logarithm of the activity + * coefficients wrt logarithm of the moles. */ void s_update_dlnActCoeff_dlnN_diag() const; - //! Update the derivative of the log of the activity coefficients wrt log(moles_m) + //! Update the derivative of the log of the activity coefficients wrt + //! log(moles_m) /*! - * This function will be called to update the internally stored - * derivative of the natural logarithm of the activity coefficients - * wrt logarithm of the mole number of species + * This function will be called to update the internally stored derivative + * of the natural logarithm of the activity coefficients wrt logarithm of + * the mole number of species */ void s_update_dlnActCoeff_dlnN() const; @@ -726,65 +553,65 @@ protected: //! number of binary interaction expressions size_t numBinaryInteractions_; - //! Enthalpy term for the binary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Enthalpy term for the binary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_HE_b_ij; - //! Enthalpy term for the ternary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Enthalpy term for the ternary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_HE_c_ij; - //! Enthalpy term for the quaternary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Enthalpy term for the quaternary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_HE_d_ij; - //! Entropy term for the binary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Entropy term for the binary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_SE_b_ij; - //! Entropy term for the ternary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Entropy term for the ternary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_SE_c_ij; - //! Entropy term for the quaternary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Entropy term for the quaternary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_SE_d_ij; - //! Enthalpy term for the binary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Enthalpy term for the binary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_VHE_b_ij; - //! Enthalpy term for the ternary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Enthalpy term for the ternary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_VHE_c_ij; - //! Enthalpy term for the quaternary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Enthalpy term for the quaternary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_VHE_d_ij; - //! Entropy term for the binary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Entropy term for the binary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_VSE_b_ij; - //! Entropy term for the ternary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Entropy term for the ternary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_VSE_c_ij; - //! Entropy term for the quaternary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Entropy term for the quaternary mole fraction interaction of the excess + //! Gibbs free energy expression mutable vector_fp m_VSE_d_ij; //! vector of species indices representing species A in the interaction /*! - * Each Margules excess Gibbs free energy term involves two species, A and B. - * This vector identifies species A. + * Each Margules excess Gibbs free energy term involves two species, A and + * B. This vector identifies species A. */ std::vector m_pSpecies_A_ij; //! vector of species indices representing species B in the interaction /*! - * Each Margules excess Gibbs free energy term involves two species, A and B. - * This vector identifies species B. + * Each Margules excess Gibbs free energy term involves two species, A and + * B. This vector identifies species B. */ std::vector m_pSpecies_B_ij; diff --git a/include/cantera/thermo/PureFluidPhase.h b/include/cantera/thermo/PureFluidPhase.h index d5efbea67..ec3f1a688 100644 --- a/include/cantera/thermo/PureFluidPhase.h +++ b/include/cantera/thermo/PureFluidPhase.h @@ -19,12 +19,11 @@ namespace Cantera { -//! This phase object consists of a single component that can be a -//! gas, a liquid, a mixed gas-liquid fluid, or a fluid beyond its -//! critical point +//! This phase object consists of a single component that can be a gas, a +//! liquid, a mixed gas-liquid fluid, or a fluid beyond its critical point /*! - * The object inherits from ThermoPhase. However, it's built on top - * of the tpx package. + * The object inherits from ThermoPhase. However, it's built on top of the tpx + * package. * * @ingroup thermoprops */ @@ -34,26 +33,8 @@ public: //! Empty Base Constructor PureFluidPhase(); - //! Copy Constructor - /*! - * @param right Object to be copied - */ PureFluidPhase(const PureFluidPhase& right); - - //! Assignment operator - /*! - * @param right Object to be copied - */ PureFluidPhase& operator=(const PureFluidPhase& right); - - //! Duplication function - /*! - * This virtual function is used to create a duplicate of the - * current phase. It's used to duplicate the phase when given - * a ThermoPhase pointer to the phase. - * - * @return It returns a ThermoPhase pointer. - */ ThermoPhase* duplMyselfAsThermoPhase() const; //! Equation of state type @@ -61,22 +42,11 @@ public: return cPureFluid; } - /// Molar enthalpy. Units: J/kmol. virtual doublereal enthalpy_mole() const; - - /// Molar internal energy. Units: J/kmol. virtual doublereal intEnergy_mole() const; - - /// Molar entropy. Units: J/kmol/K. virtual doublereal entropy_mole() const; - - /// Molar Gibbs function. Units: J/kmol. virtual doublereal gibbs_mole() const; - - /// Molar heat capacity at constant pressure. Units: J/kmol/K. virtual doublereal cp_mole() const; - - /// Molar heat capacity at constant volume. Units: J/kmol/K. virtual doublereal cv_mole() const; //! Return the thermodynamic pressure (Pa). @@ -95,130 +65,22 @@ public: */ virtual void setPressure(doublereal p); - //! Get the species chemical potentials. Units: J/kmol. - /*! - * This function returns a vector of chemical potentials of the - * species in solution at the current temperature, pressure - * and mole fraction of the solution. - * - * @param mu Output vector of species chemical - * potentials. Length: m_kk. Units: J/kmol - */ virtual void getChemPotentials(doublereal* mu) const { mu[0] = gibbs_mole(); } - //! Returns an array of partial molar enthalpies for the species - //! in the mixture. Units (J/kmol) - /*! - * @param hbar Output vector of species partial molar enthalpies. - * Length: m_kk. units are J/kmol. - */ virtual void getPartialMolarEnthalpies(doublereal* hbar) const; - - //! Returns an array of partial molar entropies of the species in the - //! solution. Units: J/kmol/K. - /*! - * @param sbar Output vector of species partial molar entropies. - * Length = m_kk. units are J/kmol/K. - */ virtual void getPartialMolarEntropies(doublereal* sbar) const; - - //! Return an array of partial molar internal energies for the - //! species in the mixture. Units: J/kmol. - /*! - * @param ubar Output vector of species partial molar internal energies. - * Length = m_kk. units are J/kmol. - */ virtual void getPartialMolarIntEnergies(doublereal* ubar) const; - - //! Return an array of partial molar heat capacities for the - //! species in the mixture. Units: J/kmol/K - /*! - * @param cpbar Output vector of species partial molar heat - * capacities at constant pressure. - * Length = m_kk. units are J/kmol/K. - */ virtual void getPartialMolarCp(doublereal* cpbar) const; - - //! Return an array of partial molar volumes for the - //! species in the mixture. Units: m^3/kmol. - /*! - * @param vbar Output vector of species partial molar volumes. - * Length = m_kk. units are m^3/kmol. - */ virtual void getPartialMolarVolumes(doublereal* vbar) const; - //! This method returns an array of generalized concentrations - /*! - * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / - * C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration - * defined below and \f$ a_k \f$ are activities used in the - * thermodynamic functions. These activity (or generalized) - * concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. Note that they may - * or may not have units of concentration --- they might be - * partial pressures, mole fractions, or surface coverages, - * for example. - * - * @param c Output array of generalized concentrations. The - * units depend upon the implementation of the - * reaction rate expressions within the phase. - */ virtual void getActivityConcentrations(doublereal* c) const; - - //! Return the standard concentration for the kth species - /*! - * The standard concentration \f$ C^0_k \f$ used to normalize - * the activity (i.e., generalized) concentration. In many cases, this quantity - * will be the same for all species in a phase - for example, - * for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this - * reason, this method returns a single value, instead of an - * array. However, for phases in which the standard - * concentration is species-specific (e.g. surface species of - * different sizes), this method may be called with an - * optional parameter indicating the species. - * - * @param k Optional parameter indicating the species. The default - * is to assume this refers to species 0. - * @return - * Returns the standard concentration. The units are by definition - * dependent on the ThermoPhase and kinetics manager representation. - */ virtual doublereal standardConcentration(size_t k=0) const; - //! Get the array of non-dimensional activities at - //! the current solution temperature, pressure, and solution concentration. - /*! - * Note, for molality based formulations, this returns the - * molality based activities. - * - * We resolve this function at this level by calling - * on the activityConcentration function. However, - * derived classes may want to override this default - * implementation. - * - * @param a Output vector of activities. Length: m_kk. - */ virtual void getActivities(doublereal* a) const; - //! Returns the isothermal compressibility. Units: 1/Pa. - /*! - * The isothermal compressibility is defined as - * \f[ - * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T - * \f] - */ virtual doublereal isothermalCompressibility() const; - - //! Return the volumetric thermal expansion coefficient. Units: 1/K. - /*! - * The thermal expansion coefficient is defined as - * \f[ - * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P - * \f] - */ virtual doublereal thermalExpansionCoeff() const; //! Returns a reference to the substance object @@ -234,83 +96,23 @@ public: */ //@{ - //! Get the array of chemical potentials at unit activity for the species - //! at their standard states at the current T and P of the solution. - /*! - * These are the standard state chemical potentials \f$ \mu^0_k(T,P) - * \f$. The values are evaluated at the current - * temperature and pressure of the solution - * - * @param mu Output vector of chemical potentials. - * Length: m_kk. - */ virtual void getStandardChemPotentials(doublereal* mu) const; - - //! Get the nondimensional Enthalpy functions for the species - //! at their standard states at the current T and P of the solution. - /*! - * @param hrt Output vector of nondimensional standard state enthalpies. - * Length: m_kk. - */ virtual void getEnthalpy_RT(doublereal* hrt) const; - - //! Get the array of nondimensional Entropy functions for the - //! standard state species at the current T and P of the solution. - /*! - * @param sr Output vector of nondimensional standard state entropies. - * Length: m_kk. - */ virtual void getEntropy_R(doublereal* sr) const; - - //! Get the nondimensional Gibbs functions for the species - //! in their standard states at the current T and P of the solution. - /*! - * @param grt Output vector of nondimensional standard state Gibbs free energies - * Length: m_kk. - */ virtual void getGibbs_RT(doublereal* grt) const; //@} /// @name Thermodynamic Values for the Species Reference States /*! - * The species reference state for pure fluids is defined as an ideal gas at the - * reference pressure and current temperature of the fluid. + * The species reference state for pure fluids is defined as an ideal gas at + * the reference pressure and current temperature of the fluid. */ //@{ - //! Returns the vector of nondimensional enthalpies of the reference state at the current temperature - //! of the solution and the reference pressure for the species. - /*! - * @param hrt Output vector containing the nondimensional reference state enthalpies - * Length: m_kk. - */ virtual void getEnthalpy_RT_ref(doublereal* hrt) const; - - //! Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temperature - //! of the solution and the reference pressure for the species. - /*! - * @param grt Output vector containing the nondimensional reference state - * Gibbs Free energies. Length: m_kk. - */ virtual void getGibbs_RT_ref(doublereal* grt) const; - - //! Returns the vector of the Gibbs function of the reference state at the current temperature - //! of the solution and the reference pressure for the species. - /*! - * units = J/kmol - * - * @param g Output vector containing the reference state - * Gibbs Free energies. Length: m_kk. Units: J/kmol. - */ virtual void getGibbs_ref(doublereal* g) const; - - //! Returns the vector of nondimensional entropies of the reference state at the current temperature - //! of the solution and the reference pressure for each species. - /*! - * @param er Output vector containing the nondimensional reference state - * entropies. Length: m_kk. - */ virtual void getEntropy_R_ref(doublereal* er) const; /** @@ -320,52 +122,15 @@ public: * @{ */ - //! Set the internally stored specific enthalpy (J/kg) and pressure (Pa) of the phase. - /*! - * @param h Specific enthalpy (J/kg) - * @param p Pressure (Pa) - * @param tol Optional parameter setting the tolerance of the - * calculation. - */ virtual void setState_HP(doublereal h, doublereal p, doublereal tol = 1.e-8); - //! Set the specific internal energy (J/kg) and specific volume (m^3/kg). - /*! - * This function fixes the internal state of the phase so that - * the specific internal energy and specific volume have the value of the input parameters. - * - * @param u specific internal energy (J/kg) - * @param v specific volume (m^3/kg). - * @param tol Optional parameter setting the tolerance of the - * calculation. - */ virtual void setState_UV(doublereal u, doublereal v, doublereal tol = 1.e-8); - //! Set the specific entropy (J/kg/K) and specific volume (m^3/kg). - /*! - * This function fixes the internal state of the phase so that - * the specific entropy and specific volume have the value of the input parameters. - * - * @param s specific entropy (J/kg/K) - * @param v specific volume (m^3/kg). - * @param tol Optional parameter setting the tolerance of the - * calculation. - */ virtual void setState_SV(doublereal s, doublereal v, doublereal tol = 1.e-8); - //! Set the specific entropy (J/kg/K) and pressure (Pa). - /*! - * This function fixes the internal state of the phase so that - * the specific entropy and the pressure have the value of the input parameters. - * - * @param s specific entropy (J/kg/K) - * @param p specific pressure (Pa). - * @param tol Optional parameter setting the tolerance of the - * calculation. - */ virtual void setState_SP(doublereal s, doublereal p, doublereal tol = 1.e-8); //@} @@ -373,13 +138,8 @@ public: //! @name Critical State Properties //@{ - //! critical temperature virtual doublereal critTemperature() const; - - //! critical pressure virtual doublereal critPressure() const; - - //! critical density virtual doublereal critDensity() const; //@} @@ -387,72 +147,17 @@ public: //! @name Saturation properties. //@{ - //! saturation temperature - /*! - * @param p Pressure (Pa) - */ virtual doublereal satTemperature(doublereal p) const; - - //! Return the saturation pressure given the temperature - /*! - * @param t Temperature (Kelvin) - */ virtual doublereal satPressure(doublereal t); - - //! Return the fraction of vapor at the current conditions virtual doublereal vaporFraction() const; - //! Set the state to a saturated system at a particular temperature - /*! - * @param t Temperature (kelvin) - * @param x Fraction of vapor - */ virtual void setState_Tsat(doublereal t, doublereal x); - - //! Set the state to a saturated system at a particular pressure - /*! - * @param p Pressure (Pa) - * @param x Fraction of vapor - */ virtual void setState_Psat(doublereal p, doublereal x); //@} - //! Initialize the ThermoPhase object after all species have been set up - /*! - * @internal Initialize. - * - * This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called from ThermoPhase::initThermoXML(), - * which is called from importPhase(), - * just prior to returning from function importPhase(). - */ virtual void initThermo(); - - //! Set equation of state parameter values from XML entries. - /*! - * This method is called by function importPhase() when processing a phase - * definition in an input file. It should be overloaded in subclasses to set - * any parameters that are specific to that particular phase - * model. Note, this method is called before the phase is - * initialized with elements and/or species. - * - * @param eosdata An XML_Node object corresponding to - * the "thermo" entry for this phase in the input file. - */ virtual void setParametersFromXML(const XML_Node& eosdata); - //! returns a summary of the state of the phase as a string - /*! - * @param show_thermo If true, extra information is printed out - * about the thermodynamic state of the system. - * @param threshold Unused in this subclass - */ virtual std::string report(bool show_thermo=true, doublereal threshold=1e-14) const; diff --git a/include/cantera/thermo/RedlichKisterVPSSTP.h b/include/cantera/thermo/RedlichKisterVPSSTP.h index ab76821cf..6af271c07 100644 --- a/include/cantera/thermo/RedlichKisterVPSSTP.h +++ b/include/cantera/thermo/RedlichKisterVPSSTP.h @@ -1,15 +1,6 @@ /** - * @file RedlichKisterVPSSTP.h - * Header for intermediate ThermoPhase object for phases which - * employ Gibbs excess free energy based formulations - * (see \ref thermoprops - * and class \link Cantera::RedlichKisterVPSSTP RedlichKisterVPSSTP\endlink). - * - * Header file for a derived class of ThermoPhase that handles - * variable pressure standard state methods for calculating - * thermodynamic properties that are further based upon activities - * based on the molality scale. These include most of the methods for - * calculating liquid electrolyte thermodynamics. + * @file RedlichKisterVPSSTP.h (see \ref thermoprops and class \link + * Cantera::RedlichKisterVPSSTP RedlichKisterVPSSTP\endlink). */ /* * Copyright (2006) Sandia Corporation. Under the terms of @@ -25,240 +16,220 @@ namespace Cantera { -/** - * @ingroup thermoprops - */ - -//! RedlichKisterVPSSTP is a derived class of GibbsExcessVPSSTP that employs -//! the Redlich-Kister approximation for the excess Gibbs free energy +//! RedlichKisterVPSSTP is a derived class of GibbsExcessVPSSTP that employs the +//! Redlich-Kister approximation for the excess Gibbs free energy /*! - * RedlichKisterVPSSTP derives from class GibbsExcessVPSSTP which is derived - * from VPStandardStateTP, and overloads the virtual methods defined there with ones that - * use expressions appropriate for the Redlich Kister Excess Gibbs free energy approximation. + * RedlichKisterVPSSTP derives from class GibbsExcessVPSSTP which is derived + * from VPStandardStateTP, and overloads the virtual methods defined there with + * ones that use expressions appropriate for the Redlich Kister Excess Gibbs + * free energy approximation. * - * The independent unknowns are pressure, temperature, and mass fraction. - * - * Several concepts are introduced. The first concept is there are temporary - * variables for holding the species standard state values of Cp, H, S, G, and V at the - * last temperature and pressure called. These functions are not recalculated - * if a new call is made using the previous temperature and pressure. Currently, - * these variables and the calculation method are handled by the VPSSMgr class, - * for which VPStandardStateTP owns a pointer to. - * - * To support the above functionality, pressure and temperature variables, - * m_plast_ss and m_tlast_ss, are kept which store the last pressure and temperature - * used in the evaluation of standard state properties. - * - * This class is usually used for nearly incompressible phases. For those phases, it - * makes sense to change the equation of state independent variable from - * density to pressure. The variable m_Pcurrent contains the current value of the - * pressure within the phase. + * The independent unknowns are pressure, temperature, and mass fraction. * *
*

Specification of Species Standard State Properties

*
* - * All species are defined to have standard states that depend upon both - * the temperature and the pressure. The Redlich-Kister approximation assumes - * symmetric standard states, where all of the standard state assume - * that the species are in pure component states at the temperature - * and pressure of the solution. I don't think it prevents, however, - * some species from being dilute in the solution. + * All species are defined to have standard states that depend upon both the + * temperature and the pressure. The Redlich-Kister approximation assumes + * symmetric standard states, where all of the standard state assume that the + * species are in pure component states at the temperature and pressure of the + * solution. I don't think it prevents, however, some species from being dilute + * in the solution. * *
*

Specification of Solution Thermodynamic Properties

*
* - * The molar excess Gibbs free energy is given by the following formula which is a sum over interactions i. - * Each of the interactions are binary interactions involving two of the species in the phase, denoted, Ai - * and Bi. - * This is the generalization of the Redlich-Kister formulation for a phase that has more than 2 species. + * The molar excess Gibbs free energy is given by the following formula which is + * a sum over interactions i. Each of the interactions are binary + * interactions involving two of the species in the phase, denoted, Ai + * and Bi. This is the generalization of the Redlich-Kister formulation + * for a phase that has more than 2 species. * - * \f[ - * G^E = \sum_{i} G^E_{i} - * \f] + * \f[ + * G^E = \sum_{i} G^E_{i} + * \f] * - * where + * where * - * \f[ - * G^E_{i} = n X_{Ai} X_{Bi} \sum_m \left( A^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right) - * \f] + * \f[ + * G^E_{i} = n X_{Ai} X_{Bi} \sum_m \left( A^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right) + * \f] * - * and where we can break down the Gibbs free energy contributions into enthalpy and entropy contributions + * and where we can break down the Gibbs free energy contributions into enthalpy and entropy contributions * - * \f[ - * H^E_i = n X_{Ai} X_{Bi} \sum_m \left( H^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right) - * \f] + * \f[ + * H^E_i = n X_{Ai} X_{Bi} \sum_m \left( H^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right) + * \f] * - * \f[ - * S^E_i = n X_{Ai} X_{Bi} \sum_m \left( S^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right) - * \f] + * \f[ + * S^E_i = n X_{Ai} X_{Bi} \sum_m \left( S^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right) + * \f] * - * where n is the total moles in the solution. + * where n is the total moles in the solution. The activity of a species defined + * in the phase is given by an excess Gibbs free energy formulation. * - * The activity of a species defined in the phase is given by an excess Gibbs free energy formulation. + * \f[ + * a_k = \gamma_k X_k + * \f] * - * \f[ - * a_k = \gamma_k X_k - * \f] + * where * - * where + * \f[ + * R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i} + * \f] * - * \f[ - * R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i} - * \f] + * Taking the derivatives results in the following expression + * \f[ + * R T \ln( \gamma_k )= \sum_i \delta_{Ai,k} (1 - X_{Ai}) X_{Bi} \sum_m \left( A^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right) + * + \sum_i \delta_{Ai,k} X_{Ai} X_{Bi} \sum_m \left( A^{i}_0 + A^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^{m-1} (1 - X_{Ai} + X_{Bi}) \right) + * \f] * - * Taking the derivatives results in the following expression - * \f[ - * R T \ln( \gamma_k )= \sum_i \delta_{Ai,k} (1 - X_{Ai}) X_{Bi} \sum_m \left( A^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right) - * + \sum_i \delta_{Ai,k} X_{Ai} X_{Bi} \sum_m \left( A^{i}_0 + A^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^{m-1} (1 - X_{Ai} + X_{Bi}) \right) - * \f] + * This object inherits from the class VPStandardStateTP. Therefore, the + * specification and calculation of all standard state and reference state + * values are handled at that level. Various functional forms for the standard + * state are permissible. The chemical potential for species k is equal + * to * - * This object inherits from the class VPStandardStateTP. Therefore, the specification and - * calculation of all standard state and reference state values are handled at that level. Various functional - * forms for the standard state are permissible. - * The chemical potential for species k is equal to + * \f[ + * \mu_k(T,P) = \mu^o_k(T, P) + R T \ln(\gamma_k X_k) + * \f] * - * \f[ - * \mu_k(T,P) = \mu^o_k(T, P) + R T \ln(\gamma_k X_k) - * \f] + * The partial molar entropy for species k is given by the following + * relation, * - * The partial molar entropy for species k is given by the following relation, - * - * \f[ - * \tilde{s}_k(T,P) = s^o_k(T,P) - R \ln( \gamma_k X_k ) - * - R T \frac{d \ln(\gamma_k) }{dT} - * \f] + * \f[ + * \tilde{s}_k(T,P) = s^o_k(T,P) - R \ln( \gamma_k X_k ) + * - R T \frac{d \ln(\gamma_k) }{dT} + * \f] * * The partial molar enthalpy for species k is given by * - * \f[ - * \tilde{h}_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] + * \f[ + * \tilde{h}_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} + * \f] * * The partial molar volume for species k is * - * \f[ - * \tilde V_k(T,P) = V^o_k(T,P) + R T \frac{d \ln(\gamma_k) }{dP} - * \f] + * \f[ + * \tilde V_k(T,P) = V^o_k(T,P) + R T \frac{d \ln(\gamma_k) }{dP} + * \f] * * The partial molar Heat Capacity for species k is * - * \f[ - * \tilde{C}_{p,k}(T,P) = C^o_{p,k}(T,P) - 2 R T \frac{d \ln( \gamma_k )}{dT} - * - R T^2 \frac{d^2 \ln(\gamma_k) }{{dT}^2} - * \f] + * \f[ + * \tilde{C}_{p,k}(T,P) = C^o_{p,k}(T,P) - 2 R T \frac{d \ln( \gamma_k )}{dT} + * - R T^2 \frac{d^2 \ln(\gamma_k) }{{dT}^2} + * \f] * *
*

%Application within Kinetics Managers

*
* - * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / - * C^s_k, \f$ where \f$ C^s_k \f$ is a standard concentration - * defined below and \f$ a_k \f$ are activities used in the - * thermodynamic functions. These activity (or generalized) - * concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. - * The activity concentration,\f$ C^a_k \f$,is given by the following expression. + * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / C^s_k, \f$ where + * \f$ C^s_k \f$ is a standard concentration defined below and \f$ a_k \f$ are + * activities used in the thermodynamic functions. These activity (or + * generalized) concentrations are used by kinetics manager classes to compute + * the forward and reverse rates of elementary reactions. The activity + * concentration,\f$ C^a_k \f$,is given by the following expression. * - * \f[ - * C^a_k = C^s_k X_k = \frac{P}{R T} X_k - * \f] + * \f[ + * C^a_k = C^s_k X_k = \frac{P}{R T} X_k + * \f] * - * The standard concentration for species k is independent of k and equal to + * The standard concentration for species k is independent of k + * and equal to * - * \f[ - * C^s_k = C^s = \frac{P}{R T} - * \f] + * \f[ + * C^s_k = C^s = \frac{P}{R T} + * \f] * - * For example, a bulk-phase binary gas reaction between species j and k, producing - * a new gas species l would have the - * following equation for its rate of progress variable, \f$ R^1 \f$, which has - * units of kmol m-3 s-1. + * For example, a bulk-phase binary gas reaction between species j and k, + * producing a new gas species l would have the following equation for its rate + * of progress variable, \f$ R^1 \f$, which has units of kmol m-3 s-1. * - * \f[ + * \f[ * R^1 = k^1 C_j^a C_k^a = k^1 (C^s a_j) (C^s a_k) - * \f] - * where - * \f[ - * C_j^a = C^s a_j \mbox{\quad and \quad} C_k^a = C^s a_k - * \f] + * \f] + * where + * \f[ + * C_j^a = C^s a_j \mbox{\quad and \quad} C_k^a = C^s a_k + * \f] * - * \f$ C_j^a \f$ is the activity concentration of species j, and - * \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^s \f$ - * is the standard concentration. \f$ a_j \f$ is - * the activity of species j which is equal to the mole fraction of j. + * \f$ C_j^a \f$ is the activity concentration of species j, and \f$ C_k^a \f$ + * is the activity concentration of species k. \f$ C^s \f$ is the standard + * concentration. \f$ a_j \f$ is the activity of species j which is equal to the + * mole fraction of j. * - * The reverse rate constant can then be obtained from the law of microscopic reversibility - * and the equilibrium expression for the system. + * The reverse rate constant can then be obtained from the law of microscopic + * reversibility and the equilibrium expression for the system. * - * \f[ - * \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} ) - * \f] + * \f[ + * \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} ) + * \f] * - * \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, associated with - * the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ and their associated activities, - * \f$ a_l \f$, repeated here: + * \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, + * associated with the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ + * and their associated activities, \f$ a_l \f$, repeated here: * - * \f[ - * \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l) - * \f] + * \f[ + * \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l) + * \f] * - * We can switch over to expressing the equilibrium constant in terms of the reference - * state chemical potentials + * We can switch over to expressing the equilibrium constant in terms of the + * reference state chemical potentials * - * \f[ - * K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P} - * \f] + * \f[ + * K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P} + * \f] * - * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over - * to activity concentrations. When this is done: + * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by + * changing over to activity concentrations. When this is done: * - * \f[ - * \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 = - * \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT} - * \f] + * \f[ + * \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 = + * \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT} + * \f] * - * %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$, - * using the second and third part of the above expression as a definition for the concentration - * equilibrium constant. + * %Kinetics managers will calculate the concentration equilibrium constant, \f$ + * K_c \f$, using the second and third part of the above expression as a + * definition for the concentration equilibrium constant. * - * For completeness, the pressure equilibrium constant may be obtained as well + * For completeness, the pressure equilibrium constant may be obtained as well * - * \f[ - * \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) - * \f] + * \f[ + * \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) + * \f] * - * \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. However, it isn't - * necessarily the simplest form of the equilibrium constant for other types of phases; \f$ K_c \f$ is - * used instead because it is completely general. + * \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. + * However, it isn't necessarily the simplest form of the equilibrium constant + * for other types of phases; \f$ K_c \f$ is used instead because it is + * completely general. * - * The reverse rate of progress may be written down as - * \f[ + * The reverse rate of progress may be written down as + * \f[ * R^{-1} = k^{-1} C_l^a = k^{-1} (C^o a_l) - * \f] + * \f] * - * where we can use the concept of microscopic reversibility to - * write the reverse rate constant in terms of the - * forward reate constant and the concentration equilibrium - * constant, \f$ K_c \f$. + * where we can use the concept of microscopic reversibility to write the + * reverse rate constant in terms of the forward reate constant and the + * concentration equilibrium constant, \f$ K_c \f$. * - * \f[ - * k^{-1} = k^1 K^1_c - * \f] + * \f[ + * k^{-1} = k^1 K^1_c + * \f] * - * \f$k^{-1} \f$ has units of s-1. + * \f$k^{-1} \f$ has units of s-1. * - * @ingroup thermoprops + * @ingroup thermoprops */ class RedlichKisterVPSSTP : public GibbsExcessVPSSTP { public: //! Constructor /*! - * This doesn't do much more than initialize constants with - * default values. + * This doesn't do much more than initialize constants with default values. */ RedlichKisterVPSSTP(); @@ -281,39 +252,16 @@ public: */ RedlichKisterVPSSTP(XML_Node& phaseRef, const std::string& id = ""); - //! Copy constructor - /*! - * @param b class to be copied - */ RedlichKisterVPSSTP(const RedlichKisterVPSSTP& b); - - //! Assignment operator - /*! - * @param b class to be copied. - */ RedlichKisterVPSSTP& operator=(const RedlichKisterVPSSTP& b); - - //! Duplication routine for objects which inherit from ThermoPhase. - /*! - * This virtual routine can be used to duplicate ThermoPhase objects - * inherited from ThermoPhase even if the application only has - * a pointer to ThermoPhase to work with. - */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; //! @name Molar Thermodynamic Properties //! @{ - /// Molar enthalpy. Units: J/kmol. virtual doublereal enthalpy_mole() const; - - /// Molar entropy. Units: J/kmol. virtual doublereal entropy_mole() const; - - /// Molar heat capacity at constant pressure. Units: J/kmol/K. virtual doublereal cp_mole() const; - - /// Molar heat capacity at constant volume. Units: J/kmol/K. virtual doublereal cv_mole() const; /** @@ -328,36 +276,22 @@ public: * @{ */ - //! Get the array of non-dimensional molar-based ln activity coefficients at - //! the current solution temperature, pressure, and solution concentration. - /*! - * @param lnac Output vector of ln activity coefficients. Length: m_kk. - */ virtual void getLnActivityCoefficients(doublereal* lnac) const; //@} /// @name Partial Molar Properties of the Solution //@{ - //! Get the species chemical potentials. Units: J/kmol. - /*! - * This function returns a vector of chemical potentials of the - * species in solution at the current temperature, pressure - * and mole fraction of the solution. - * - * @param mu Output vector of species chemical - * potentials. Length: m_kk. Units: J/kmol - */ virtual void getChemPotentials(doublereal* mu) const; - //! Returns an array of partial molar enthalpies for the species - //! in the mixture. + //! Returns an array of partial molar enthalpies for the species in the + //! mixture. /*! * Units (J/kmol) * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * molality-based activity coefficient wrt temperature + * For this phase, the partial molar enthalpies are equal to the standard + * state enthalpies modified by the derivative of the molality-based + * activity coefficient wrt temperature * * \f[ * \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} @@ -368,14 +302,14 @@ public: */ virtual void getPartialMolarEnthalpies(doublereal* hbar) const; - //! Returns an array of partial molar entropies for the species - //! in the mixture. + //! Returns an array of partial molar entropies for the species in the + //! mixture. /*! * Units (J/kmol) * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature + * For this phase, the partial molar enthalpies are equal to the standard + * state enthalpies modified by the derivative of the activity coefficient + * wrt temperature * * \f[ * \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} @@ -388,14 +322,14 @@ public: */ virtual void getPartialMolarEntropies(doublereal* sbar) const; - //! Returns an array of partial molar entropies for the species - //! in the mixture. + //! Returns an array of partial molar entropies for the species in the + //! mixture. /*! * Units (J/kmol) * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature + * For this phase, the partial molar enthalpies are equal to the standard + * state enthalpies modified by the derivative of the activity coefficient + * wrt temperature * * \f[ * ??????????????? @@ -410,53 +344,20 @@ public: */ virtual void getPartialMolarCp(doublereal* cpbar) const; - //! Return an array of partial molar volumes for the - //! species in the mixture. Units: m^3/kmol. - /*! - * Frequently, for this class of thermodynamics representations, - * the excess Volume due to mixing is zero. Here, we set it as - * a default. It may be overridden in derived classes. - * - * @param vbar Output vector of species partial molar volumes. - * Length = m_kk. units are m^3/kmol. - */ virtual void getPartialMolarVolumes(doublereal* vbar) const; - //! Get the species electrochemical potentials. - /*! - * These are partial molar quantities. - * This method adds a term \f$ Fz_k \phi_k \f$ to the - * to each chemical potential. - * - * Units: J/kmol - * - * @param mu output vector containing the species electrochemical potentials. - * Length: m_kk., units = J/kmol - */ void getElectrochemPotentials(doublereal* mu) const; - //! Get the array of temperature second derivatives of the log activity coefficients + //! Get the array of temperature second derivatives of the log activity + //! coefficients /*! - * This function is a virtual class, but it first appears in GibbsExcessVPSSTP - * class and derived classes from GibbsExcessVPSSTP. - * * units = 1/Kelvin * - * @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of the - * log Activity Coefficients. length = m_kk + * @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of + * the log Activity Coefficients. length = m_kk */ virtual void getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const; - //! Get the array of temperature derivatives of the log activity coefficients - /*! - * This function is a virtual class, but it first appears in GibbsExcessVPSSTP - * class and derived classes from GibbsExcessVPSSTP. - * - * units = 1/Kelvin - * - * @param dlnActCoeffdT Output vector of temperature derivatives of the - * log Activity Coefficients. length = m_kk - */ virtual void getdlnActCoeffdT(doublereal* dlnActCoeffdT) const; /// @} @@ -466,103 +367,16 @@ public: /// input file. They are not normally used in application programs. /// To see how they are used, see importPhase(). - /*! - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase(). - */ virtual void initThermo(); - - /** - * Import and initialize a ThermoPhase object - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ void initThermoXML(XML_Node& phaseNode, const std::string& id); //! @} //! @name Derivatives of Thermodynamic Variables needed for Applications //! @{ - //! Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along - //! a line in parameter space or along a line in physical space - /*! - * @param dTds Input of temperature change along the path - * @param dXds Input vector of changes in mole fraction along the path. length = m_kk - * Along the path length it must be the case that the mole fractions sum to one. - * @param dlnActCoeffds Output vector of the directional derivatives of the - * log Activity Coefficients along the path. length = m_kk - * units are 1/units(s). if s is a physical coordinate then the units are 1/m. - */ virtual void getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const; - - //! Get the array of log concentration-like derivatives of the - //! log activity coefficients - diagonal component - /*! - * This function is a virtual method. For ideal mixtures - * (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the - * logarithm of the activity coefficient with respect to the - * logarithm of the mole fraction. - * - * units = dimensionless - * - * @param dlnActCoeffdlnX_diag Output vector of the diagonal component of the log(mole fraction) - * derivatives of the log Activity Coefficients. - * length = m_kk - */ virtual void getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const; - - //! Get the array of derivatives of the log activity coefficients wrt mole numbers - diagonal only - /*! - * This function is a virtual method. For ideal mixtures - * (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the - * logarithm of the activity coefficient with respect to the - * logarithm of the concentration-like variable (i.e. mole fraction, - * molality, etc.) that represents the standard state. - * - * units = dimensionless - * - * @param dlnActCoeffdlnN_diag Output vector of the diagonal entries for the log(mole fraction) - * derivatives of the log Activity Coefficients. - * length = m_kk - */ virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const; - - //! Get the array of derivatives of the ln activity coefficients with respect to the ln species mole numbers - /*! - * Implementations should take the derivative of the logarithm of the activity coefficient with respect to a - * log of a species mole number (with all other species mole numbers held constant) - * - * units = 1 / kmol - * - * dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log act_coeff for the mth - * species with respect to the number of moles of the kth species. - * - * \f[ - * \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i} - * \f] - * - * @param ld Number of rows in the matrix - * @param dlnActCoeffdlnN Output vector of derivatives of the - * log Activity Coefficients. length = m_kk * m_kk - */ virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN); //@} @@ -570,13 +384,13 @@ public: private: //! Process an XML node called "binaryNeutralSpeciesParameters" /*! - * This node contains all of the parameters necessary to describe - * the Redlich-Kister model for a particular binary interaction. - * This function reads the XML file and writes the coefficients - * it finds to an internal data structures. + * This node contains all of the parameters necessary to describe the + * Redlich-Kister model for a particular binary interaction. This function + * reads the XML file and writes the coefficients it finds to an internal + * data structures. * - * @param xmlBinarySpecies Reference to the XML_Node named "binaryNeutralSpeciesParameters" - * containing the binary interaction + * @param xmlBinarySpecies Reference to the XML_Node named + * "binaryNeutralSpeciesParameters" containing the binary interaction */ void readXMLBinarySpecies(XML_Node& xmlBinarySpecies); @@ -587,33 +401,34 @@ private: */ void resizeNumInteractions(const size_t num); - //! Initialize lengths of local variables after all species have - //! been identified. + //! Initialize lengths of local variables after all species have been + //! identified. void initLengths(); //! Update the activity coefficients /*! - * This function will be called to update the internally stored - * natural logarithm of the activity coefficients + * This function will be called to update the internally stored natural + * logarithm of the activity coefficients */ void s_update_lnActCoeff() const; //! Update the derivative of the log of the activity coefficients wrt T /*! - * This function will be called to update the internally stored - * derivative of the natural logarithm of the activity coefficients - * wrt temperature. + * This function will be called to update the internally stored derivative + * of the natural logarithm of the activity coefficients wrt temperature. */ void s_update_dlnActCoeff_dT() const; - //! Internal routine that calculates the derivative of the activity coefficients wrt - //! the mole fractions. + //! Internal routine that calculates the derivative of the activity + //! coefficients wrt the mole fractions. /*! - * This routine calculates the the derivative of the activity coefficients wrt to mole fraction - * with all other mole fractions held constant. This is strictly not permitted. However, if the - * resulting matrix is multiplied by a permissible deltaX vector then everything is ok. + * This routine calculates the the derivative of the activity coefficients + * wrt to mole fraction with all other mole fractions held constant. This is + * strictly not permitted. However, if the resulting matrix is multiplied by + * a permissible deltaX vector then everything is ok. * - * This is the natural way to handle concentration derivatives in this routine. + * This is the natural way to handle concentration derivatives in this + * routine. */ void s_update_dlnActCoeff_dX_() const; @@ -621,8 +436,10 @@ private: public: //! Utility routine that calculates a literature expression /*! - * @param VintOut Output contribution to the voltage corresponding to nonideal term - * @param voltsOut Output contribution to the voltage corresponding to nonideal term and mf term + * @param VintOut Output contribution to the voltage corresponding to + * nonideal term + * @param voltsOut Output contribution to the voltage corresponding to + * nonideal term and mf term */ void Vint(double& VintOut, double& voltsOut); #endif @@ -633,42 +450,40 @@ protected: //! vector of species indices representing species A in the interaction /*! - * Each Redlich-Kister excess Gibbs free energy term involves two species, A and B. - * This vector identifies species A. + * Each Redlich-Kister excess Gibbs free energy term involves two species, + * A and B. This vector identifies species A. */ std::vector m_pSpecies_A_ij; //! vector of species indices representing species B in the interaction /*! - * Each Redlich-Kister excess Gibbs free energy term involves two species, A and B. - * This vector identifies species B. + * Each Redlich-Kister excess Gibbs free energy term involves two species, + * A and B. This vector identifies species B. */ std::vector m_pSpecies_B_ij; //! Vector of the length of the polynomial for the interaction. std::vector m_N_ij; - //! Enthalpy term for the binary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Enthalpy term for the binary mole fraction interaction of the excess + //! Gibbs free energy expression mutable std::vector< vector_fp> m_HE_m_ij; - //! Entropy term for the binary mole fraction interaction of the - //! excess Gibbs free energy expression + //! Entropy term for the binary mole fraction interaction of the excess + //! Gibbs free energy expression mutable std::vector< vector_fp> m_SE_m_ij; - //! form of the RedlichKister interaction expression - /*! - * Currently there is only one form. - */ + //! form of the RedlichKister interaction expression. Currently there is + //! only one form. int formRedlichKister_; - //! form of the temperature dependence of the Redlich-Kister interaction expression - /*! - * Currently there is only one form -> constant wrt temperature. - */ + //! form of the temperature dependence of the Redlich-Kister interaction + //! expression. Currently there is only one form -> constant wrt + //! temperature. int formTempModel_; - //! Two dimensional array of derivatives of activity coefficients wrt mole fractions + //! Two dimensional array of derivatives of activity coefficients wrt mole + //! fractions mutable Array2D dlnActCoeff_dX_; }; diff --git a/include/cantera/thermo/RedlichKwongMFTP.h b/include/cantera/thermo/RedlichKwongMFTP.h index 36eb15296..0385ccb00 100644 --- a/include/cantera/thermo/RedlichKwongMFTP.h +++ b/include/cantera/thermo/RedlichKwongMFTP.h @@ -40,7 +40,8 @@ public: /*! * @param infile Name of the input file containing the phase XML data * to set up the object - * @param id ID of the phase in the input file. Defaults to the empty string. + * @param id ID of the phase in the input file. Defaults to the empty + * string. */ RedlichKwongMFTP(const std::string& infile, const std::string& id=""); @@ -48,59 +49,23 @@ public: //! XML database /*! * @param phaseRef XML phase node containing the description of the phase - * @param id id attribute containing the name of the phase. (default is the empty string) + * @param id id attribute containing the name of the phase. (default + * is the empty string) */ RedlichKwongMFTP(XML_Node& phaseRef, const std::string& id = ""); - //! Copy Constructor - /*! - * Copy constructor for the object. Constructed object will be a clone of this object, but will - * also own all of its data. This is a wrapper around the assignment operator - * - * @param right Object to be copied. - */ RedlichKwongMFTP(const RedlichKwongMFTP& right); - - //! Assignment operator - /*! - * Assignment operator for the object. Constructed object will be a clone of this object, but will - * also own all of its data. - * - * @param right Object to be copied. - */ RedlichKwongMFTP& operator=(const RedlichKwongMFTP& right); - - //! Duplicator from the ThermoPhase parent class - /*! - * Given a pointer to a ThermoPhase object, this function will - * duplicate the ThermoPhase object and all underlying structures. - * This is basically a wrapper around the copy constructor. - * - * @return returns a pointer to a ThermoPhase - */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; - /** - * Equation of state type flag. The base class returns - * zero. Subclasses should define this to return a unique - * non-zero value. Constants defined for this purpose are - * listed in mix_defs.h. - */ virtual int eosType() const; //! @name Molar Thermodynamic properties //! @{ - /// Molar enthalpy. Units: J/kmol. virtual doublereal enthalpy_mole() const; - - /// Molar entropy. Units: J/kmol/K. virtual doublereal entropy_mole() const; - - /// Molar heat capacity at constant pressure. Units: J/kmol/K. virtual doublereal cp_mole() const; - - /// Molar heat capacity at constant volume. Units: J/kmol/K. virtual doublereal cv_mole() const; //! @} @@ -123,8 +88,8 @@ public: protected: /** - * Calculate the density of the mixture using the partial - * molar volumes and mole fractions as input + * Calculate the density of the mixture using the partial molar volumes and + * mole fractions as input * * The formula for this is * @@ -132,117 +97,49 @@ protected: * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}} * \f] * - * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are - * the molecular weights, and \f$V_k\f$ are the pure species - * molar volumes. + * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular + * weights, and \f$V_k\f$ are the pure species molar volumes. * - * Note, the basis behind this formula is that in an ideal - * solution the partial molar volumes are equal to the - * species standard state molar volumes. - * The species molar volumes may be functions - * of temperature and pressure. + * Note, the basis behind this formula is that in an ideal solution the + * partial molar volumes are equal to the species standard state molar + * volumes. The species molar volumes may be functions of temperature and + * pressure. */ virtual void calcDensity(); - //! Set the temperature (K) - /*! - * This function sets the temperature, and makes sure that - * the value propagates to underlying objects - * - * @param temp Temperature in kelvin - */ virtual void setTemperature(const doublereal temp); - //! Set the mass fractions to the specified values, and then - //! normalize them so that they sum to 1.0. - /*! - * @param y Array of unnormalized mass fraction values (input). - * Must have a length greater than or equal to the number of species. - */ virtual void setMassFractions(const doublereal* const y); - - //!Set the mass fractions to the specified values without normalizing. - /*! - * This is useful when the normalization - * condition is being handled by some other means, for example - * by a constraint equation as part of a larger set of - * equations. - * - * @param y Input vector of mass fractions. Length is m_kk. - */ virtual void setMassFractions_NoNorm(const doublereal* const y); - - //! Set the mole fractions to the specified values, and then - //! normalize them so that they sum to 1.0. - /*! - * @param x Array of unnormalized mole fraction values (input). - * Must have a length greater than or equal to the number of species. - */ virtual void setMoleFractions(const doublereal* const x); - - //! Set the mole fractions to the specified values without normalizing. - /*! - * This is useful when the normalization - * condition is being handled by some other means, for example - * by a constraint equation as part of a larger set of equations. - * - * @param x Input vector of mole fractions. Length is m_kk. - */ virtual void setMoleFractions_NoNorm(const doublereal* const x); - - //! Set the concentrations to the specified values within the phase. - /*! - * @param c The input vector to this routine is in dimensional - * units. For volumetric phases c[k] is the - * concentration of the kth species in kmol/m3. - * For surface phases, c[k] is the concentration - * in kmol/m2. The length of the vector is the number - * of species in the phase. - */ virtual void setConcentrations(const doublereal* const c); public: - //! This method returns an array of generalized concentrations - /*! - * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / - * C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration - * defined below and \f$ a_k \f$ are activities used in the - * thermodynamic functions. These activity (or generalized) - * concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. Note that they may - * or may not have units of concentration --- they might be - * partial pressures, mole fractions, or surface coverages, - * for example. - * - * @param c Output array of generalized concentrations. The - * units depend upon the implementation of the - * reaction rate expressions within the phase. - */ virtual void getActivityConcentrations(doublereal* c) const; - //! Returns the standard concentration \f$ C^0_k \f$, which is used to normalize - //! the generalized concentration. + //! Returns the standard concentration \f$ C^0_k \f$, which is used to + //! normalize the generalized concentration. /*! * This is defined as the concentration by which the generalized - * concentration is normalized to produce the activity. - * In many cases, this quantity will be the same for all species in a phase. - * Since the activity for an ideal gas mixture is - * simply the mole fraction, for an ideal gas \f$ C^0_k = P/\hat R T \f$. + * concentration is normalized to produce the activity. In many cases, this + * quantity will be the same for all species in a phase. Since the activity + * for an ideal gas mixture is simply the mole fraction, for an ideal gas + * \f$ C^0_k = P/\hat R T \f$. * - * @param k Optional parameter indicating the species. The default - * is to assume this refers to species 0. + * @param k Optional parameter indicating the species. The default is to + * assume this refers to species 0. * @return * Returns the standard Concentration in units of m3 kmol-1. */ virtual doublereal standardConcentration(size_t k=0) const; - //! Get the array of non-dimensional activity coefficients at - //! the current solution temperature, pressure, and solution concentration. + //! Get the array of non-dimensional activity coefficients at the current + //! solution temperature, pressure, and solution concentration. /*! * For all objects with the Mixture Fugacity approximation, we define the - * standard state as an ideal gas at the current temperature and pressure - * of the solution. The activities are based on this standard state. + * standard state as an ideal gas at the current temperature and pressure of + * the solution. The activities are based on this standard state. * * @param ac Output vector of activity coefficients. Length: m_kk. */ @@ -257,79 +154,29 @@ public: * \f$ \mu_k / \hat R T \f$. * Units: unitless * - * We close the loop on this function, here, calling - * getChemPotentials() and then dividing by RT. No need for child - * classes to handle. + * We close the loop on this function, here, calling getChemPotentials() and + * then dividing by RT. No need for child classes to handle. * * @param mu Output vector of non-dimensional species chemical potentials * Length: m_kk. */ void getChemPotentials_RT(doublereal* mu) const; - //! Get the species chemical potentials. Units: J/kmol. - /*! - * This function returns a vector of chemical potentials of the - * species in solution at the current temperature, pressure - * and mole fraction of the solution. - * - * @param mu Output vector of species chemical - * potentials. Length: m_kk. Units: J/kmol - */ virtual void getChemPotentials(doublereal* mu) const; - - //! Get the species partial molar enthalpies. Units: J/kmol. - /*! - * @param hbar Output vector of species partial molar enthalpies. - * Length: m_kk. units are J/kmol. - */ virtual void getPartialMolarEnthalpies(doublereal* hbar) const; - - //! Get the species partial molar entropies. Units: J/kmol/K. - /*! - * @param sbar Output vector of species partial molar entropies. - * Length = m_kk. units are J/kmol/K. - */ virtual void getPartialMolarEntropies(doublereal* sbar) const; - - //! Get the species partial molar enthalpies. Units: J/kmol. - /*! - * @param ubar Output vector of species partial molar internal energies. - * Length = m_kk. units are J/kmol. - */ virtual void getPartialMolarIntEnergies(doublereal* ubar) const; - - //! Get the partial molar heat capacities Units: J/kmol/K - /*! - * @param cpbar Output vector of species partial molar heat capacities - * at constant pressure. - * Length = m_kk. units are J/kmol/K. - */ virtual void getPartialMolarCp(doublereal* cpbar) const; - - //! Get the species partial molar volumes. Units: m^3/kmol. - /*! - * @param vbar Output vector of species partial molar volumes. - * Length = m_kk. units are m^3/kmol. - */ virtual void getPartialMolarVolumes(doublereal* vbar) const; //@} /// @name Critical State Properties. //@{ - /// Critical temperature (K). virtual doublereal critTemperature() const; - - /// Critical pressure (Pa). virtual doublereal critPressure() const; - - /// Critical volume (m3/kmol) virtual doublereal critVolume() const; - - // Critical compressibility (unitless) virtual doublereal critCompressibility() const; - - /// Critical density (kg/m3). virtual doublereal critDensity() const; public: @@ -343,71 +190,9 @@ public: */ //@{ - //! Set equation of state parameter values from XML entries. - /*! - * This method is called by function importPhase() when processing a phase - * definition in an input file. It should be overloaded in subclasses to set - * any parameters that are specific to that particular phase model. - * - * @param thermoNode An XML_Node object corresponding to - * the "thermo" entry for this phase in the input file. - */ virtual void setParametersFromXML(const XML_Node& thermoNode); - - //! @internal Initialize the object - /*! - * This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase(). - */ virtual void initThermo(); - - //!This method is used by the ChemEquil equilibrium solver. - /*! - * It sets the state such that the chemical potentials satisfy - * \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m} - * \left(\frac{\lambda_m} {\hat R T}\right) \f] where - * \f$ \lambda_m \f$ is the element potential of element m. The - * temperature is unchanged. Any phase (ideal or not) that - * implements this method can be equilibrated by ChemEquil. - * - * @param lambda_RT Input vector of dimensionless element potentials - * The length is equal to nElements(). - */ void setToEquilState(const doublereal* lambda_RT); - - //! Initialize a ThermoPhase object, potentially reading activity - //! coefficient information from an XML database. - /*! - * This routine initializes the lengths in the current object and - * then calls the parent routine. - * This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase(). - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); private: @@ -435,95 +220,16 @@ private: protected: // Special functions inherited from MixtureFugacityTP - - //! Calculate the deviation terms for the total entropy of the mixture from the - //! ideal gas mixture - /*! - * Here we use the current state conditions - * - * @return Returns the change in entropy in units of J kmol-1 K-1. - */ virtual doublereal sresid() const; - - // Calculate the deviation terms for the total enthalpy of the mixture from the - // ideal gas mixture - /* - * Here we use the current state conditions - * - * @return Returns the change in enthalpy in units of J kmol-1. - */ virtual doublereal hresid() const; -public: - //! Estimate for the molar volume of the liquid - /*! - * Note: this is only used as a starting guess for later routines that actually calculate an - * accurate value for the liquid molar volume. - * This routine doesn't change the state of the system. - * - * @param TKelvin temperature in kelvin - * @param pres Pressure in Pa. This is used as an initial guess. If the routine - * needs to change the pressure to find a stable liquid state, the - * new pressure is returned in this variable. - * @return Returns the estimate of the liquid volume. - */ - virtual doublereal liquidVolEst(doublereal TKelvin, doublereal& pres) const; - //! Calculates the density given the temperature and the pressure and a guess at the density. - /*! - * Note, below T_c, this is a multivalued function. We do not cross the vapor dome in this. - * This is protected because it is called during setState_TP() routines. Infinite loops would result - * if it were not protected. - * - * -> why is this not const? - * - * parameters: - * @param TKelvin Temperature in Kelvin - * @param pressure Pressure in Pascals (Newton/m**2) - * @param phase int representing the phase whose density we are requesting. If we put - * a gas or liquid phase here, we will attempt to find a volume in that - * part of the volume space, only, in this routine. A value of FLUID_UNDEFINED - * means that we will accept anything. - * @param rhoguess Guessed density of the fluid. A value of -1.0 indicates that there - * is no guessed density - * @return We return the density of the fluid at the requested phase. If we have not found any - * acceptable density we return a -1. If we have found an acceptable density at a - * different phase, we return a -2. - */ +public: + virtual doublereal liquidVolEst(doublereal TKelvin, doublereal& pres) const; virtual doublereal densityCalc(doublereal TKelvin, doublereal pressure, int phase, doublereal rhoguess); - //! Return the value of the density at the liquid spinodal point (on the liquid side) - //! for the current temperature. - /*! - * @return returns the density with units of kg m-3 - */ virtual doublereal densSpinodalLiquid() const; - - //! Return the value of the density at the gas spinodal point (on the gas side) - //! for the current temperature. - /*! - * @return returns the density with units of kg m-3 - */ virtual doublereal densSpinodalGas() const; - - //! Calculate the pressure given the temperature and the molar volume - /*! - * Calculate the pressure given the temperature and the molar volume - * - * @param TKelvin temperature in kelvin - * @param molarVol molar volume ( m3/kmol) - * @return Returns the pressure. - */ virtual doublereal pressureCalc(doublereal TKelvin, doublereal molarVol) const; - - //! Calculate the pressure and the pressure derivative given the temperature and the molar volume - /*! - * Temperature and mole number are held constant - * - * @param TKelvin temperature in kelvin - * @param molarVol molar volume ( m3/kmol) - * @param presCalc Returns the pressure. - * @return Returns the derivative of the pressure wrt the molar volume - */ virtual doublereal dpdVCalc(doublereal TKelvin, doublereal molarVol, doublereal& presCalc) const; //! Calculate dpdV and dpdT at the current conditions @@ -536,19 +242,20 @@ public: //! Update the a and b parameters /*! - * The a and the b parameters depend on the mole fraction and the temperature. - * This function updates the internal numbers based on the state of the object. + * The a and the b parameters depend on the mole fraction and the + * temperature. This function updates the internal numbers based on the + * state of the object. */ void updateAB(); - //! Calculate the a and the b parameters given the temperature + //! Calculate the a and the b parameters given the temperature /*! - * This function doesn't change the internal state of the object, so it is a const - * function. It does use the stored mole fractions in the object. + * This function doesn't change the internal state of the object, so it is a + * const function. It does use the stored mole fractions in the object. * - * @param temp Temperature (TKelvin) - * @param aCalc (output) Returns the a value - * @param bCalc (output) Returns the b value. + * @param temp Temperature (TKelvin) + * @param aCalc (output) Returns the a value + * @param bCalc (output) Returns the b value. */ void calculateAB(doublereal temp, doublereal& aCalc, doublereal& bCalc) const; @@ -623,22 +330,22 @@ protected: //! The derivative of the pressure wrt the volume /*! - * Calculated at the current conditions - * temperature and mole number kept constant + * Calculated at the current conditions. temperature and mole number kept + * constant */ mutable doublereal dpdV_; //! The derivative of the pressure wrt the temperature /*! - * Calculated at the current conditions - * Total volume and mole number kept constant + * Calculated at the current conditions. Total volume and mole number kept + * constant */ mutable doublereal dpdT_; //! Vector of derivatives of pressure wrt mole number /*! - * Calculated at the current conditions - * Total volume, temperature and other mole number kept constant + * Calculated at the current conditions. Total volume, temperature and + * other mole number kept constant */ mutable vector_fp dpdni_; diff --git a/include/cantera/thermo/SemiconductorPhase.h b/include/cantera/thermo/SemiconductorPhase.h index c3c2c58e2..bc55961da 100644 --- a/include/cantera/thermo/SemiconductorPhase.h +++ b/include/cantera/thermo/SemiconductorPhase.h @@ -20,8 +20,7 @@ const int cHole = 1; /** * @ingroup thermoprops * - * Class SemiconductorPhase represents electrons and holes - * in a semiconductor. + * Class SemiconductorPhase represents electrons and holes in a semiconductor. * */ class SemiconductorPhase : public ThermoPhase @@ -42,7 +41,6 @@ public: return *this; } - //! Duplicator virtual ThermoPhase* duplMyselfAsThermoPhase() const { SemiconductorPhase* idg = new SemiconductorPhase(*this); return (ThermoPhase*) idg; diff --git a/include/cantera/thermo/SingleSpeciesTP.h b/include/cantera/thermo/SingleSpeciesTP.h index a11ec4973..27e6b57fd 100644 --- a/include/cantera/thermo/SingleSpeciesTP.h +++ b/include/cantera/thermo/SingleSpeciesTP.h @@ -20,47 +20,39 @@ namespace Cantera /** * @ingroup thermoprops * - * The SingleSpeciesTP class is a filter class for ThermoPhase. - * What it does is to simplify the construction of ThermoPhase - * objects by assuming that the phase consists of one and - * only one type of species. In other words, it's a stoichiometric - * phase. However, no assumptions are made concerning the - * thermodynamic functions or the equation of state of the - * phase. Therefore it's an incomplete description of - * the thermodynamics. The complete description must be - * made in a derived class of SingleSpeciesTP. + * The SingleSpeciesTP class is a filter class for ThermoPhase. What it does is + * to simplify the construction of ThermoPhase objects by assuming that the + * phase consists of one and only one type of species. In other words, it's a + * stoichiometric phase. However, no assumptions are made concerning the + * thermodynamic functions or the equation of state of the phase. Therefore it's + * an incomplete description of the thermodynamics. The complete description + * must be made in a derived class of SingleSpeciesTP. * - * Several different groups of thermodynamic functions are resolved - * at this level by this class. For example, All partial molar property - * routines call their single species standard state equivalents. - * All molar solution thermodynamic routines call the single species - * standard state equivalents. - * Activities routines are resolved at this level, as there is only - * one species. + * Several different groups of thermodynamic functions are resolved at this + * level by this class. For example, All partial molar property routines call + * their single species standard state equivalents. All molar solution + * thermodynamic routines call the single species standard state equivalents. + * Activities routines are resolved at this level, as there is only one species. * - * It is assumed that the reference state thermodynamics may be - * obtained by a pointer to a populated species thermodynamic property - * manager class (see ThermoPhase::m_spthermo). How to relate pressure - * changes to the reference state thermodynamics is again left open - * to implementation. + * It is assumed that the reference state thermodynamics may be obtained by a + * pointer to a populated species thermodynamic property manager class (see + * ThermoPhase::m_spthermo). How to relate pressure changes to the reference + * state thermodynamics is again left open to implementation. * - * Mole fraction and Mass fraction vectors are assumed to be equal - * to x[0] = 1 y[0] = 1, respectively. Simplifications to the interface - * of setState_TPY() and setState_TPX() functions result and are made - * within the class. + * Mole fraction and Mass fraction vectors are assumed to be equal to x[0] = 1 + * y[0] = 1, respectively. Simplifications to the interface of setState_TPY() + * and setState_TPX() functions result and are made within the class. * - * Note, this class can handle the thermodynamic description of one - * phase of one species. It can not handle the description of phase - * equilibrium between two phases of a stoichiometric compound - * (e.g. water liquid and water vapor, below the critical point). - * However, it may be used to describe the thermodynamics of one phase - * of such a compound even past the phase equilibrium point, up to the - * point where the phase itself ceases to be a stable phase. + * Note, this class can handle the thermodynamic description of one phase of one + * species. It can not handle the description of phase equilibrium between two + * phases of a stoichiometric compound (e.g. water liquid and water vapor, below + * the critical point). However, it may be used to describe the thermodynamics + * of one phase of such a compound even past the phase equilibrium point, up to + * the point where the phase itself ceases to be a stable phase. * - * This class doesn't do much at the initialization level. - * Its SingleSpeciesTP::initThermo() - * member does check that one and only one species has been defined - * to occupy the phase. + * This class doesn't do much at the initialization level. Its + * SingleSpeciesTP::initThermo() member does check that one and only one species + * has been defined to occupy the phase. */ class SingleSpeciesTP : public ThermoPhase { @@ -68,104 +60,47 @@ public: //! Base empty constructor. SingleSpeciesTP(); - //! Copy constructor - /*! - * @param right Object to be copied - */ SingleSpeciesTP(const SingleSpeciesTP& right); - - //! Assignment operator - /*! - * @param right Object to be copied - */ SingleSpeciesTP& operator=(const SingleSpeciesTP& right); - - //! Duplication function - /*! - * This virtual function is used to create a duplicate of the - * current phase. It's used to duplicate the phase when given - * a ThermoPhase pointer to the phase. - * - * @return It returns a ThermoPhase pointer. - */ ThermoPhase* duplMyselfAsThermoPhase() const; /** - * Returns the equation of state type flag. - * This is a modified base class. - * Therefore, if not overridden in derived classes, - * this call will throw an exception. + * Returns the equation of state type flag. This is a modified base class. + * Therefore, if not overridden in derived classes, this call will throw an + * exception. */ virtual int eosType() const; /** - * @name Molar Thermodynamic Properties of the Solution + * @name Molar Thermodynamic Properties of the Solution * - * These functions are resolved at this level, by reference - * to the partial molar functions and standard state - * functions for species 0. Derived classes don't need - * to supply entries for these functions. + * These functions are resolved at this level, by reference to the partial + * molar functions and standard state functions for species 0. Derived + * classes don't need to supply entries for these functions. * @{ */ - /// Molar enthalpy. Units: J/kmol. - /*! - * This function is resolved here by calling the standard state - * thermo function. - */ doublereal enthalpy_mole() const; - - /// Molar internal energy. Units: J/kmol. - /*! - * This function is resolved here by calling the standard state - * thermo function. - */ doublereal intEnergy_mole() const; - - /// Molar entropy. Units: J/kmol/K. - /*! - * This function is resolved here by calling the standard state - * thermo function. - */ doublereal entropy_mole() const; - - /// Molar Gibbs function. Units: J/kmol. - /*! - * This function is resolved here by calling the standard state - * thermo function. - */ doublereal gibbs_mole() const; - - /// Molar heat capacity at constant pressure. Units: J/kmol/K. - /*! - * This function is resolved here by calling the standard state - * thermo function. - */ doublereal cp_mole() const; - - /// Molar heat capacity at constant volume. Units: J/kmol/K. - /*! - * This function is resolved here by calling the standard state - * thermo function. - */ doublereal cv_mole() const; /** * @} * @name Activities, Standard State, and Activity Concentrations * - * The activity \f$a_k\f$ of a species in solution is - * related to the chemical potential by \f[ \mu_k = \mu_k^0(T) - * + \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T)\f$ is - * the chemical potential at unit activity, which depends only - * on temperature. + * The activity \f$a_k\f$ of a species in solution is related to the + * chemical potential by \f[ \mu_k = \mu_k^0(T) + \hat R T \log a_k. \f] + * The quantity \f$\mu_k^0(T)\f$ is the chemical potential at unit activity, + * which depends only on temperature. * @{ */ /** - * Get the array of non-dimensional activities at - * the current solution temperature, pressure, and - * solution concentration. + * Get the array of non-dimensional activities at the current solution + * temperature, pressure, and solution concentration. * * We redefine this function to just return 1.0 here. * @@ -175,13 +110,6 @@ public: a[0] = 1.0; } - /** - * Get the array of non-dimensional activity coefficients at - * the current solution temperature, pressure, and - * solution concentration. - * - * @param ac Output vector of activity coefficients. Length: 1. - */ virtual void getActivityCoefficients(doublereal* ac) const { ac[0] = 1.0; } @@ -189,50 +117,49 @@ public: //@} /// @name Partial Molar Properties of the Solution /// - /// These functions are resolved at this level, by reference - /// to the partial molar functions and standard state - /// functions for species 0. Derived classes don't need - /// to supply entries for these functions. + /// These functions are resolved at this level, by reference to the partial + /// molar functions and standard state functions for species 0. Derived + /// classes don't need to supply entries for these functions. //@{ - //! Get the array of non-dimensional species chemical potentials - //! These are partial molar Gibbs free energies. + //! Get the array of non-dimensional species chemical potentials. These are + //! partial molar Gibbs free energies. /*! - * These are the phase, partial molar, and the standard state - * dimensionless chemical potentials. + * These are the phase, partial molar, and the standard state dimensionless + * chemical potentials. * \f$ \mu_k / \hat R T \f$. * * Units: unitless * - * @param murt On return, Contains the chemical potential / RT of the single species - * and the phase. Units are unitless. Length = 1 + * @param murt On return, Contains the chemical potential / RT of the + * single species and the phase. Units are unitless. Length = 1 */ void getChemPotentials_RT(doublereal* murt) const; //! Get the array of chemical potentials /*! - * These are the phase, partial molar, and the standard state chemical potentials. + * These are the phase, partial molar, and the standard state chemical + * potentials. * \f$ \mu(T,P) = \mu^0_k(T,P) \f$. * - * @param mu On return, Contains the chemical potential of the single species - * and the phase. Units are J / kmol . Length = 1 + * @param mu On return, Contains the chemical potential of the single + * species and the phase. Units are J / kmol . Length = 1 */ void getChemPotentials(doublereal* mu) const; //! Get the species electrochemical potentials. Units: J/kmol. /*! - * This method adds a term \f$ Fz_k \phi_k \f$ to - * each chemical potential. + * This method adds a term \f$ Fz_k \phi_k \f$ to each chemical potential. * - * This is resolved here. A single species phase - * is not allowed to have anything other than a zero charge. + * This is resolved here. A single species phase is not allowed to have + * anything other than a zero charge. * - * @param mu On return, Contains the electrochemical potential of the single species - * and the phase. Units J/kmol . Length = 1 + * @param mu On return, Contains the electrochemical potential of the + * single species and the phase. Units J/kmol . Length = 1 */ void getElectrochemPotentials(doublereal* mu) const; - //! Get the species partial molar enthalpies. Units: J/kmol. + //! Get the species partial molar enthalpies. Units: J/kmol. /*! * These are the phase enthalpies. \f$ h_k \f$. * @@ -245,8 +172,8 @@ public: /*! * These are the phase internal energies. \f$ u_k \f$. * - * @param ubar On return, Contains the internal energy of the single species - * and the phase. Units are J / kmol . Length = 1 + * @param ubar On return, Contains the internal energy of the single species + * and the phase. Units are J / kmol . Length = 1 */ virtual void getPartialMolarIntEnergies(doublereal* ubar) const; @@ -254,8 +181,8 @@ public: /*! * This is the phase entropy. \f$ s(T,P) = s_o(T,P) \f$. * - * @param sbar On return, Contains the entropy of the single species - * and the phase. Units are J / kmol / K . Length = 1 + * @param sbar On return, Contains the entropy of the single species and the + * phase. Units are J / kmol / K . Length = 1 */ void getPartialMolarEntropies(doublereal* sbar) const; @@ -263,7 +190,7 @@ public: /*! * This is the phase heat capacity. \f$ Cp(T,P) = Cp_o(T,P) \f$. * - * @param cpbar On return, Contains the heat capacity of the single species + * @param cpbar On return, Contains the heat capacity of the single species * and the phase. Units are J / kmol / K . Length = 1 */ void getPartialMolarCp(doublereal* cpbar) const; @@ -272,8 +199,8 @@ public: /*! * This is the phase molar volume. \f$ V(T,P) = V_o(T,P) \f$. * - * @param vbar On return, Contains the molar volume of the single species - * and the phase. Units are m^3 / kmol. Length = 1 + * @param vbar On return, Contains the molar volume of the single species + * and the phase. Units are m^3 / kmol. Length = 1 */ void getPartialMolarVolumes(doublereal* vbar) const; @@ -285,22 +212,15 @@ public: /// are not resolved at the SingleSpeciesTP level. //@{ - /** - * Get the dimensional Gibbs functions for the standard - * state of the species at the current T and P. - * - * @param gpure returns a vector of size 1, containing the Gibbs function - * Units: J/kmol. - */ void getPureGibbs(doublereal* gpure) const; - //! Get the molar volumes of each species in their standard - //! states at the current T and P of the solution. + //! Get the molar volumes of each species in their standard states at the + //! current T and P of the solution. /*! * units = m^3 / kmol * - * We resolve this function at this level, by assigning - * the molecular weight divided by the phase density + * We resolve this function at this level, by assigning the molecular weight + * divided by the phase density * * @param vbar On output this contains the standard volume of the species * and phase (m^3/kmol). Vector of length 1 @@ -310,80 +230,15 @@ public: //@} /// @name Thermodynamic Values for the Species Reference State /// - /// Almost all functions in this group are resolved by this - /// class. It is assumed that the m_spthermo species thermo - /// pointer is populated and yields the reference state thermodynamics - /// The internal energy function is not given by this - /// class, since it would involve a specification of the - /// equation of state. + /// Almost all functions in this group are resolved by this class. The + /// internal energy function is not given by this class, since it would + /// involve a specification of the equation of state. //@{ - /*! - * Returns the vector of nondimensional - * enthalpies of the reference state at the current temperature - * of the solution and the reference pressure for the species. - * - * This function is resolved in this class. It is assumed that the m_spthermo species thermo - * pointer is populated and yields the reference state. - * - * @param hrt Output vector containing the nondimensional reference state enthalpies - * Length: m_kk. - */ virtual void getEnthalpy_RT_ref(doublereal* hrt) const; - - /*! - * Returns the vector of nondimensional - * enthalpies of the reference state at the current temperature - * of the solution and the reference pressure for the species. - * - * This function is resolved in this class. It is assumed that the m_spthermo species thermo - * pointer is populated and yields the reference state. - * - * @param grt Output vector containing the nondimensional reference state - * Gibbs Free energies. Length: m_kk. - */ virtual void getGibbs_RT_ref(doublereal* grt) const; - - /*! - * Returns the vector of the - * Gibbs function of the reference state at the current temperature - * of the solution and the reference pressure for the species. - * units = J/kmol - * - * This function is resolved in this class. It is assumed that the m_spthermo species thermo - * pointer is populated and yields the reference state. - * - * @param g Output vector containing the reference state - * Gibbs Free energies. Length: m_kk. Units: J/kmol. - */ virtual void getGibbs_ref(doublereal* g) const; - - /*! - * Returns the vector of nondimensional - * entropies of the reference state at the current temperature - * of the solution and the reference pressure for each species. - * - * This function is resolved in this class. It is assumed that the m_spthermo species thermo - * pointer is populated and yields the reference state. - * - * @param er Output vector containing the nondimensional reference state - * entropies. Length: m_kk. - */ virtual void getEntropy_R_ref(doublereal* er) const; - - /*! - * Returns the vector of nondimensional - * constant pressure heat capacities of the reference state - * at the current temperature of the solution - * and reference pressure for each species. - * - * This function is resolved in this class. It is assumed that the m_spthermo species thermo - * pointer is populated and yields the reference state. - * - * @param cprt Output vector of nondimensional reference state - * heat capacities at constant pressure for the species. - * Length: m_kk - */ virtual void getCp_R_ref(doublereal* cprt) const; /** @@ -399,68 +254,18 @@ public: //! Mole fractions are fixed, with x[0] = 1.0. void setMoleFractions(const doublereal* const x) {}; - //! Set the internally stored specific enthalpy (J/kg) and pressure (Pa) of the phase. - /*! - * @param h Specific enthalpy (J/kg) - * @param p Pressure (Pa) - * @param tol Optional parameter setting the tolerance of the - * calculation. - */ virtual void setState_HP(doublereal h, doublereal p, doublereal tol = 1.e-8); - - //! Set the specific internal energy (J/kg) and specific volume (m^3/kg). - /*! - * This function fixes the internal state of the phase so that - * the specific internal energy and specific volume have the value of the input parameters. - * - * @param u specific internal energy (J/kg) - * @param v specific volume (m^3/kg). - * @param tol Optional parameter setting the tolerance of the - * calculation. - */ virtual void setState_UV(doublereal u, doublereal v, doublereal tol = 1.e-8); - - //! Set the specific entropy (J/kg/K) and pressure (Pa). - /*! - * This function fixes the internal state of the phase so that - * the specific entropy and the pressure have the value of the input parameters. - * - * @param s specific entropy (J/kg/K) - * @param p specific pressure (Pa). - * @param tol Optional parameter setting the tolerance of the - * calculation. - */ virtual void setState_SP(doublereal s, doublereal p, doublereal tol = 1.e-8); - - //! Set the specific entropy (J/kg/K) and specific volume (m^3/kg). - /*! - * This function fixes the internal state of the phase so that - * the specific entropy and specific volume have the value of the input parameters. - * - * @param s specific entropy (J/kg/K) - * @param v specific volume (m^3/kg). - * @param tol Optional parameter setting the tolerance of the - * calculation. - */ virtual void setState_SV(doublereal s, doublereal v, doublereal tol = 1.e-8); //@} /** - * @internal Initialize. - * - * This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase(). - * - * Inheriting objects should call this function + * @copydoc ThermoPhase::initThermo * * This version sets the mole fraction vector to x[0] = 1.0, and then * calls the ThermoPhase::initThermo() function. @@ -468,16 +273,11 @@ public: virtual void initThermo(); protected: - //! The current pressure of the solution (Pa) - /*! - * It gets initialized to 1 atm. - */ + //! The current pressure of the solution (Pa). It gets initialized to 1 atm. doublereal m_press; - /*! - * Reference pressure (Pa) must be the same for all species - * - defaults to 1 atm. - */ + // Reference pressure (Pa). Must be the same for all species. Defaults to + // 1 atm. doublereal m_p0; //! Dimensionless enthalpy at the (mtlast, m_p0) @@ -488,10 +288,9 @@ protected: mutable vector_fp m_s0_R; /** - * @internal - * This crucial internal routine calls the species thermo - * update program to calculate new species Cp0, H0, and - * S0 whenever the temperature has changed. + * @internal This crucial internal routine calls the species thermo update + * program to calculate new species Cp0, H0, and S0 whenever the + * temperature has changed. */ void _updateThermo() const; }; diff --git a/include/cantera/thermo/StoichSubstance.h b/include/cantera/thermo/StoichSubstance.h index faefb91ef..21fb7e18b 100644 --- a/include/cantera/thermo/StoichSubstance.h +++ b/include/cantera/thermo/StoichSubstance.h @@ -18,12 +18,12 @@ namespace Cantera { -//! Class StoichSubstance represents a stoichiometric (fixed -//! composition) incompressible substance. +//! Class StoichSubstance represents a stoichiometric (fixed composition) +//! incompressible substance. /*! * This class internally changes the independent degree of freedom from density - * to pressure. This is necessary because the phase is incompressible. It uses - * a constant volume approximation. + * to pressure. This is necessary because the phase is incompressible. It uses a + * constant volume approximation. * * Specification of Species Standard State Properties * @@ -171,26 +171,8 @@ public: */ StoichSubstance(XML_Node& phaseRef, const std::string& id = ""); - //! Copy constructor - /*! - * @param right Object to be copied - */ StoichSubstance(const StoichSubstance& right); - - //! Assignment operator - /*! - * @param right Object to be copied - */ StoichSubstance& operator=(const StoichSubstance& right); - - //! Duplication function - /*! - * This virtual function is used to create a duplicate of the current phase. - * It's used to duplicate the phase when given a ThermoPhase pointer to the - * phase. - * - * @return It returns a ThermoPhase pointer. - */ ThermoPhase* duplMyselfAsThermoPhase() const; /** @@ -220,22 +202,7 @@ public: */ virtual void setPressure(doublereal p); - //! Returns the isothermal compressibility. Units: 1/Pa. - /*! - * The isothermal compressibility is defined as - * \f[ - * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T - * \f] - */ virtual doublereal isothermalCompressibility() const; - - //! Return the volumetric thermal expansion coefficient. Units: 1/K. - /*! - * The thermal expansion coefficient is defined as - * \f[ - * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P - * \f] - */ virtual doublereal thermalExpansionCoeff() const; /** @@ -277,11 +244,6 @@ public: * Returns The standard Concentration as 1.0 */ virtual doublereal standardConcentration(size_t k=0) const; - - //! Natural logarithm of the standard concentration of the kth species. - /*! - * @param k index of the species (defaults to zero) - */ virtual doublereal logStandardConc(size_t k=0) const; //! Get the array of chemical potentials at unit activity for the species @@ -305,36 +267,9 @@ public: /// @name Properties of the Standard State of the Species in the Solution //@{ - //! Get the nondimensional Enthalpy functions for the species - //! at their standard states at the current T and P of the solution. - /*! - * @param hrt Output vector of nondimensional standard state enthalpies. - * Length: m_kk. - */ virtual void getEnthalpy_RT(doublereal* hrt) const; - - //! Get the array of nondimensional Entropy functions for the - //! standard state species at the current T and P of the solution. - /*! - * @param sr Output vector of nondimensional standard state entropies. - * Length: m_kk. - */ virtual void getEntropy_R(doublereal* sr) const; - - //! Get the nondimensional Gibbs functions for the species - //! in their standard states at the current T and P of the solution. - /*! - * @param grt Output vector of nondimensional standard state Gibbs free energies - * Length: m_kk. - */ virtual void getGibbs_RT(doublereal* grt) const; - - //! Get the nondimensional Heat Capacities at constant pressure for the - //! species standard states at the current T and P of the solution - /*! - * @param cpr Output vector of nondimensional standard state heat capacities - * Length: m_kk. - */ virtual void getCp_R(doublereal* cpr) const; //! Returns the vector of nondimensional Internal Energies of the standard @@ -359,30 +294,18 @@ public: //! state at the current temperature of the solution and the reference //! pressure for each species. /*! - * @param urt Output vector of nondimensional reference state - * internal energies of the species. - * Length: m_kk + * @param urt Output vector of nondimensional reference state internal + * energies of the species. Length: m_kk */ virtual void getIntEnergy_RT_ref(doublereal* urt) const; // @} - /* - * @internal Initialize. This method is provided to allow subclasses to - * perform any initialization required after all species have been added. - * For example, it might be used to resize internal work arrays that must - * have an entry for each species. The base class implementation does - * nothing, and subclasses that do not require initialization do not need to - * overload this method. When importing a CTML phase description, this - * method is called just prior to returning from function importPhase(). - */ virtual void initThermo(); - virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); //! Set the equation of state parameters /*! * @internal - * The number and meaning of these depends on the subclass. * * @param n number of parameters * @param c array of \a n coefficients @@ -405,12 +328,6 @@ public: //! Set equation of state parameter values from XML entries. /*! - * This method is called by function importPhase() when processing a phase - * definition in an input file. It should be overloaded in subclasses to set - * any parameters that are specific to that particular phase model. Note, - * this method is called before the phase is initialized with elements - * and/or species. - * * For this phase, the density of the phase is specified in this block. * * @param eosdata An XML_Node object corresponding to diff --git a/include/cantera/thermo/SurfPhase.h b/include/cantera/thermo/SurfPhase.h index 97c07b696..31764d7c0 100644 --- a/include/cantera/thermo/SurfPhase.h +++ b/include/cantera/thermo/SurfPhase.h @@ -17,12 +17,11 @@ namespace Cantera { -//! A simple thermodynamic model for a surface phase, -//! assuming an ideal solution model. +//! A simple thermodynamic model for a surface phase, assuming an ideal solution +//! model. /*! - * The surface consists of a grid of equivalent sites. - * Surface species may be defined to - * occupy one or more sites. The surface species are assumed to be + * The surface consists of a grid of equivalent sites. Surface species may be + * defined to occupy one or more sites. The surface species are assumed to be * independent, and thus the species form an ideal solution. * * The density of surface sites is given by the variable \f$ n_0 \f$, @@ -30,13 +29,13 @@ namespace Cantera * * Specification of Species Standard State Properties * - * It is assumed that the reference state thermodynamics may be - * obtained by a pointer to a populated species thermodynamic property - * manager class (see ThermoPhase::m_spthermo). How to relate pressure - * changes to the reference state thermodynamics is resolved at this level. + * It is assumed that the reference state thermodynamics may be obtained by a + * pointer to a populated species thermodynamic property manager class (see + * ThermoPhase::m_spthermo). How to relate pressure changes to the reference + * state thermodynamics is resolved at this level. * - * Pressure is defined as an independent variable in this phase. However, it has - * no effect on any quantities, as the molar concentration is a constant. + * Pressure is defined as an independent variable in this phase. However, it has + * no effect on any quantities, as the molar concentration is a constant. * * Therefore, The standard state internal energy for species k is * equal to the enthalpy for species k. @@ -45,8 +44,8 @@ namespace Cantera * u^o_k = h^o_k * \f] * - * Also, the standard state chemical potentials, entropy, and heat capacities - * are independent of pressure. The standard state Gibbs free energy is obtained + * Also, the standard state chemical potentials, entropy, and heat capacities + * are independent of pressure. The standard state Gibbs free energy is obtained * from the enthalpy and entropy functions. * * Specification of Solution Thermodynamic Properties @@ -112,8 +111,8 @@ namespace Cantera * * XML Example * - * An example of an XML Element named phase setting up a SurfPhase object named diamond_100 - * is given below. + * An example of an XML Element named phase setting up a SurfPhase object named + * diamond_100 is given below. * * @code * @@ -150,8 +149,8 @@ public: */ SurfPhase(doublereal n0 = 1.0); - //! Construct and initialize a SurfPhase ThermoPhase object - //! directly from an ASCII input file + //! Construct and initialize a SurfPhase ThermoPhase object directly from an + //! ASCII input file /*! * @param infile name of the input file * @param id name of the phase id in the file. @@ -159,42 +158,15 @@ public: */ SurfPhase(const std::string& infile, const std::string& id); - //! Construct and initialize a SurfPhase ThermoPhase object - //! directly from an XML database + //! Construct and initialize a SurfPhase ThermoPhase object directly from an + //! XML database /*! * @param xmlphase XML node pointing to a SurfPhase description */ SurfPhase(XML_Node& xmlphase); - //! Copy Constructor - /*! - * Copy constructor for the object. Constructed - * object will be a clone of this object, but will - * also own all of its data. - * This is a wrapper around the assignment operator - * - * @param right Object to be copied. - */ SurfPhase(const SurfPhase& right); - - //! Assignment operator - /*! - * Assignment operator for the object. Constructed - * object will be a clone of this object, but will - * also own all of its data. - * - * @param right Object to be copied. - */ SurfPhase& operator=(const SurfPhase& right); - - //! Duplicator from the ThermoPhase parent class - /* - * Given a pointer to a ThermoPhase object, this function will - * duplicate the ThermoPhase object and all underlying structures. - * This is basically a wrapper around the copy constructor. - * - * @return returns a pointer to a ThermoPhase - */ ThermoPhase* duplMyselfAsThermoPhase() const; //! Equation of state type flag. @@ -211,10 +183,9 @@ public: * \f[ * \hat h(T,P) = \sum_k X_k \hat h^0_k(T), * \f] - * and is a function only of temperature. - * The standard-state pure-species Enthalpies - * \f$ \hat h^0_k(T) \f$ are computed by the species thermodynamic - * property manager. + * and is a function only of temperature. The standard-state pure-species + * Enthalpies \f$ \hat h^0_k(T) \f$ are computed by the species + * thermodynamic property manager. * * \see SpeciesThermo */ @@ -222,9 +193,8 @@ public: //! Return the Molar Internal Energy. Units: J/kmol /** - * For a surface phase, the pressure is not a relevant - * thermodynamic variable, and so the Enthalpy is equal to the - * Internal Energy. + * For a surface phase, the pressure is not a relevant thermodynamic + * variable, and so the Enthalpy is equal to the Internal Energy. */ virtual doublereal intEnergy_mole() const; @@ -237,87 +207,36 @@ public: virtual doublereal entropy_mole() const; virtual doublereal cp_mole() const; - virtual doublereal cv_mole() const; - //! Get the species chemical potentials. Units: J/kmol. - /*! - * This function returns a vector of chemical potentials of the - * species in solution at the current temperature, pressure - * and mole fraction of the solution. - * - * @param mu Output vector of species chemical - * potentials. Length: m_kk. Units: J/kmol - */ virtual void getChemPotentials(doublereal* mu) const; - - //! Returns an array of partial molar enthalpies for the species - //! in the mixture. Units (J/kmol) - /*! - * @param hbar Output vector of species partial molar enthalpies. - * Length: m_kk. units are J/kmol. - */ virtual void getPartialMolarEnthalpies(doublereal* hbar) const; - - //! Returns an array of partial molar entropies of the species in the - //! solution. Units: J/kmol/K. - /*! - * @param sbar Output vector of species partial molar entropies. - * Length = m_kk. units are J/kmol/K. - */ virtual void getPartialMolarEntropies(doublereal* sbar) const; - - //! Return an array of partial molar heat capacities for the - //! species in the mixture. Units: J/kmol/K - /*! - * @param cpbar Output vector of species partial molar heat - * capacities at constant pressure. - * Length = m_kk. units are J/kmol/K. - */ virtual void getPartialMolarCp(doublereal* cpbar) const; - - //! Return an array of partial molar volumes for the - //! species in the mixture. Units: m^3/kmol. - /*! - * @param vbar Output vector of species partial molar volumes. - * Length = m_kk. units are m^3/kmol. - */ virtual void getPartialMolarVolumes(doublereal* vbar) const; - - //! Get the array of chemical potentials at unit activity for the - //! standard state species at the current T and P of the solution. - /*! - * These are the standard state chemical potentials \f$ \mu^0_k(T,P) - * \f$. The values are evaluated at the current - * temperature and pressure of the solution - * - * @param mu0 Output vector of chemical potentials. - * Length: m_kk. - */ virtual void getStandardChemPotentials(doublereal* mu0) const; //! Return a vector of activity concentrations for each species /*! - * For this phase the activity concentrations,\f$ C^a_k \f$, are defined to be - * equal to the actual concentrations, \f$ C^s_k \f$. - * Activity concentrations are + * For this phase the activity concentrations,\f$ C^a_k \f$, are defined to + * be equal to the actual concentrations, \f$ C^s_k \f$. Activity + * concentrations are * * \f[ * C^a_k = C^s_k = \frac{\theta_k n_0}{s_k} * \f] * - * where \f$ \theta_k \f$ is the surface site fraction for species k, - * \f$ n_0 \f$ is the surface site density for the phase, and - * \f$ s_k \f$ is the surface size of species k. + * where \f$ \theta_k \f$ is the surface site fraction for species k, + * \f$ n_0 \f$ is the surface site density for the phase, and + * \f$ s_k \f$ is the surface size of species k. * - * \f$ C^a_k\f$ that are defined such that \f$ a_k = C^a_k / - * C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration - * defined below and \f$ a_k \f$ are activities used in - * the thermodynamic functions. These activity concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. Note that they may - * or may not have units of concentration --- they might be - * partial pressures, mole fractions, or surface coverages, + * \f$ C^a_k\f$ that are defined such that \f$ a_k = C^a_k / C^0_k, \f$ + * where \f$ C^0_k \f$ is a standard concentration defined below and \f$ a_k + * \f$ are activities used in the thermodynamic functions. These activity + * concentrations are used by kinetics manager classes to compute the + * forward and reverse rates of elementary reactions. Note that they may or + * may not have units of concentration --- they might be partial pressures, + * mole fractions, or surface coverages, * * @param c vector of activity concentration (kmol m-2). */ @@ -325,16 +244,15 @@ public: //! Return the standard concentration for the kth species /*! - * The standard concentration \f$ C^0_k \f$ used to normalize - * the activity (i.e., generalized) concentration. - * For this phase, the standard concentration is species- - * specific + * The standard concentration \f$ C^0_k \f$ used to normalize the activity + * (i.e., generalized) concentration. For this phase, the standard + * concentration is species- specific * * \f[ * C^0_k = \frac{n_0}{s_k} * \f] * - * This definition implies that the activity is equal to \f$ \theta_k \f$. + * This definition implies that the activity is equal to \f$ \theta_k \f$. * * @param k Optional parameter indicating the species. The default * is to assume this refers to species 0. @@ -342,11 +260,6 @@ public: * Returns the standard Concentration in units of m3 kmol-1. */ virtual doublereal standardConcentration(size_t k = 0) const; - - //! Return the log of the standard concentration for the kth species - /*! - * @param k species index (default 0) - */ virtual doublereal logStandardConc(size_t k=0) const; //! Set the equation of state parameters from the argument list @@ -364,15 +277,13 @@ public: /*! * The Equation-of-State data consists of one item, the site density. * - * @param thermoData Reference to an XML_Node named thermo - * containing the equation-of-state data. The - * XML_Node is within the phase XML_Node describing - * the SurfPhase object. + * @param thermoData Reference to an XML_Node named thermo containing the + * equation-of-state data. The XML_Node is within the + * phase XML_Node describing the SurfPhase object. * - * An example of the contents of the thermoData XML_Node is provided - * below. The units attribute is used to supply the units of the - * site density in any convenient form. Internally it is changed - * into MKS form. + * An example of the contents of the thermoData XML_Node is provided below. + * The units attribute is used to supply the units of the site density in + * any convenient form. Internally it is changed into MKS form. * * @code * @@ -387,8 +298,8 @@ public: //! Set the initial state of the Surface Phase from an XML_Node /*! - * State variables that can be set by this routine are - * the temperature and the surface site coverages. + * State variables that can be set by this routine are the temperature and + * the surface site coverages. * * @param state XML_Node containing the state information * @@ -417,47 +328,10 @@ public: */ void setSiteDensity(doublereal n0); - //! Get the nondimensional Gibbs functions for the species - //! in their standard states at the current T and P of the solution. - /*! - * @param grt Output vector of nondimensional standard state Gibbs free energies - * Length: m_kk. - */ virtual void getGibbs_RT(doublereal* grt) const; - - //! Get the nondimensional Enthalpy functions for the species standard states - //! at their standard states at the current T and P of the solution. - /*! - * @param hrt Output vector of nondimensional standard state enthalpies. - * Length: m_kk. - */ virtual void getEnthalpy_RT(doublereal* hrt) const; - - //! Get the array of nondimensional Entropy functions for the - //! species standard states at the current T and P of the solution. - /*! - * @param sr Output vector of nondimensional standard state entropies. - * Length: m_kk. - */ virtual void getEntropy_R(doublereal* sr) const; - - //! Get the nondimensional Heat Capacities at constant - //! pressure for the species standard states - //! at the current T and P of the solution - /*! - * @param cpr Output vector of nondimensional standard state heat capacities - * Length: m_kk. - */ virtual void getCp_R(doublereal* cpr) const; - - //! Get the molar volumes of the species standard states at the current - //! T and P of the solution. - /*! - * units = m^3 / kmol - * - * @param vol Output vector containing the standard state volumes. - * Length: m_kk. - */ virtual void getStandardVolumes(doublereal* vol) const; //! Return the thermodynamic pressure (Pa). @@ -465,8 +339,8 @@ public: return m_press; } - //! Set the internally stored pressure (Pa) at constant - //! temperature and composition + //! Set the internally stored pressure (Pa) at constant temperature and + //! composition /*! * @param p input Pressure (Pa) */ @@ -475,56 +349,20 @@ public: } virtual void getPureGibbs(doublereal* g) const; - - //! Returns the vector of nondimensional - //! Gibbs Free Energies of the reference state at the current temperature - //! of the solution and the reference pressure for the species. - /*! - * @param grt Output vector containing the nondimensional reference state - * Gibbs Free energies. Length: m_kk. - */ virtual void getGibbs_RT_ref(doublereal* grt) const; - - //! Returns the vector of nondimensional - //! enthalpies of the reference state at the current temperature - //! of the solution and the reference pressure for the species. - /*! - * @param hrt Output vector of nondimensional standard state enthalpies. - * Length: m_kk. - */ virtual void getEnthalpy_RT_ref(doublereal* hrt) const; - - //! Returns the vector of nondimensional - //! entropies of the reference state at the current temperature - //! of the solution and the reference pressure for each species. - /*! - * @param er Output vector containing the nondimensional reference state - * entropies. Length: m_kk. - */ virtual void getEntropy_R_ref(doublereal* er) const; - - //! Returns the vector of nondimensional constant pressure heat capacities - //! of the reference state at the current temperature of the solution and - //! reference pressure for each species. - /*! - * @param cprt Output vector of nondimensional reference state - * heat capacities at constant pressure for the species. - * Length: m_kk - */ virtual void getCp_R_ref(doublereal* cprt) const; //! Set the surface site fractions to a specified state. /*! - * This routine converts to concentrations - * in kmol/m2, using m_n0, the surface site density, - * and size(k), which is defined to be the number of - * surface sites occupied by the kth molecule. - * It then calls Phase::setConcentrations to set the - * internal concentration in the object. + * This routine converts to concentrations in kmol/m2, using m_n0, the + * surface site density, and size(k), which is defined to be the number of + * surface sites occupied by the kth molecule. It then calls + * Phase::setConcentrations to set the internal concentration in the object. * - * @param theta This is the surface site fraction - * for the kth species in the surface phase. - * This is a dimensionless quantity. + * @param theta This is the surface site fraction for the kth species in + * the surface phase. This is a dimensionless quantity. * * This routine normalizes the theta's to 1, before application */ @@ -532,16 +370,13 @@ public: //! Set the surface site fractions to a specified state. /*! - * This routine converts to concentrations - * in kmol/m2, using m_n0, the surface site density, - * and size(k), which is defined to be the number of - * surface sites occupied by the kth molecule. - * It then calls Phase::setConcentrations to set the - * internal concentration in the object. + * This routine converts to concentrations in kmol/m2, using m_n0, the + * surface site density, and size(k), which is defined to be the number of + * surface sites occupied by the kth molecule. It then calls + * Phase::setConcentrations to set the internal concentration in the object. * - * @param theta This is the surface site fraction - * for the kth species in the surface phase. - * This is a dimensionless quantity. + * @param theta This is the surface site fraction for the kth species in + * the surface phase. This is a dimensionless quantity. */ void setCoveragesNoNorm(const doublereal* theta); @@ -558,8 +393,8 @@ public: /*! * Get the coverages. * - * @param theta Array theta must be at least as long as - * the number of species. + * @param theta Array theta must be at least as long as the number of + * species. */ void getCoverages(doublereal* theta) const; @@ -590,20 +425,19 @@ protected: //! vector storing the log of the size of each species. /*! - * The size of each species is defined as the number of surface - * sites each species occupies. + * The size of each species is defined as the number of surface sites each + * species occupies. */ mutable vector_fp m_logsize; private: //! Update the species reference state thermodynamic functions /*! - * The polynomials for the standard state functions are only - * reevaluated if the temperature has changed. + * The polynomials for the standard state functions are only reevaluated if + * the temperature has changed. * - * @param force Boolean, which if true, forces a reevaluation - * of the thermo polynomials. - * default = false. + * @param force Boolean, which if true, forces a reevaluation of the thermo + * polynomials. default = false. */ void _updateThermo(bool force=false) const; }; diff --git a/include/cantera/thermo/ThermoPhase.h b/include/cantera/thermo/ThermoPhase.h index 355d2d956..ba9274c64 100644 --- a/include/cantera/thermo/ThermoPhase.h +++ b/include/cantera/thermo/ThermoPhase.h @@ -39,35 +39,31 @@ const int cSS_CONVENTION_VPSS = 1; const int cSS_CONVENTION_SLAVE = 2; //@} -//! Base class for a phase with thermodynamic properties. +//! Base class for a phase with thermodynamic properties. /*! - * Class ThermoPhase is the base class for the family of classes - * that represent phases of matter of any type. It defines a - * common public interface, and implements a few methods. Most of - * the methods, however, are declared virtual and are meant to be - * overloaded in derived classes. The standard way used - * throughout Cantera to compute properties of phases of matter is - * through pointers of type ThermoPhase* that point to objects of - * subclasses of ThermoPhase. + * Class ThermoPhase is the base class for the family of classes that represent + * phases of matter of any type. It defines a common public interface, and + * implements a few methods. Most of the methods, however, are declared virtual + * and are meant to be overloaded in derived classes. The standard way used + * throughout Cantera to compute properties of phases of matter is through + * pointers of type ThermoPhase* that point to objects of subclasses of + * ThermoPhase. * * Class ThermoPhase extends class Phase by adding methods to compute * thermodynamic properties in addition to the ones (temperature, density, - * composition) that class Phase provides. The distinction is that - * the methods declared in ThermoPhase require knowing the - * particular equation of state of the phase of interest, while - * those of class Phase do not, since they only involve data values - * stored within the object. + * composition) that class Phase provides. The distinction is that the methods + * declared in ThermoPhase require knowing the particular equation of state of + * the phase of interest, while those of class Phase do not, since they only + * involve data values stored within the object. * - * Instances of subclasses of ThermoPhase should be created using - * the factory class ThermoFactory, not by calling the constructor - * directly. This allows new classes to be used with the various - * Cantera language interfaces. + * Instances of subclasses of ThermoPhase should be created using the factory + * class ThermoFactory, not by calling the constructor directly. This allows new + * classes to be used with the various Cantera language interfaces. * - * To implement a new equation of state, derive a class from - * ThermoPhase and overload the virtual methods in - * ThermoPhase. Methods that are not needed can be left - * unimplemented, which will cause an exception to be thrown if it - * is called. + * To implement a new equation of state, derive a class from ThermoPhase and + * overload the virtual methods in ThermoPhase. Methods that are not needed can + * be left unimplemented, which will cause an exception to be thrown if it is + * called. * * Relationship with the kinetics operator: * @@ -76,21 +72,19 @@ const int cSS_CONVENTION_SLAVE = 2; * Describe K_a, K_p, and K_c, These are three different equilibrium * constants. * - * K_a is the calculation of the equilibrium constant from the - * standard state Gibbs free energy values. It is by definition - * dimensionless. + * K_a is the calculation of the equilibrium constant from the standard state + * Gibbs free energy values. It is by definition dimensionless. * - * K_p is the calculation of the equilibrium constant from the - * reference state Gibbs free energy values. It is by definition - * dimensionless. The pressure dependence is handled entirely - * on the RHS of the equilibrium expression. + * K_p is the calculation of the equilibrium constant from the reference state + * Gibbs free energy values. It is by definition dimensionless. The pressure + * dependence is handled entirely on the RHS of the equilibrium expression. * - * K_c is the equilibrium constant calculated from the - * activity concentrations. The dimensions depend on the number - * of products and reactants. + * K_c is the equilibrium constant calculated from the activity + * concentrations. The dimensions depend on the number of products and + * reactants. * - * The kinetics manager requires the calculation of K_c for the - * calculation of the reverse rate constant + * The kinetics manager requires the calculation of K_c for the calculation of + * the reverse rate constant * * @ingroup thermoprops * @ingroup phases @@ -135,10 +129,9 @@ public: //! Equation of state type flag. /*! - * The base class returns - * zero. Subclasses should define this to return a unique - * non-zero value. Constants defined for this purpose are - * listed in mix_defs.h. + * The base class returns zero. Subclasses should define this to return a + * unique non-zero value. Constants defined for this purpose are listed in + * mix_defs.h. */ virtual int eosType() const { return 0; @@ -155,38 +148,43 @@ public: //! Minimum temperature for which the thermodynamic data for the species //! or phase are valid. /*! - * If no argument is supplied, the - * value returned will be the lowest temperature at which the - * data for \e all species are valid. Otherwise, the value - * will be only for species \a k. This function is a wrapper - * that calls the species thermo minTemp function. + * If no argument is supplied, the value returned will be the lowest + * temperature at which the data for \e all species are valid. Otherwise, + * the value will be only for species \a k. This function is a wrapper that + * calls the species thermo minTemp function. * - * @param k index of the species. Default is -1, which will return the max of the min value - * over all species. + * @param k index of the species. Default is -1, which will return the max + * of the min value over all species. */ virtual doublereal minTemp(size_t k = npos) const { return m_spthermo->minTemp(k); } - //! Report the 298 K Heat of Formation of the standard state of one species (J kmol-1) + //! Report the 298 K Heat of Formation of the standard state of one species + //! (J kmol-1) /*! - * The 298K Heat of Formation is defined as the enthalpy change to create the standard state - * of the species from its constituent elements in their standard states at 298 K and 1 bar. + * The 298K Heat of Formation is defined as the enthalpy change to create + * the standard state of the species from its constituent elements in their + * standard states at 298 K and 1 bar. * * @param k species index - * @return Returns the current value of the Heat of Formation at 298K and 1 bar + * @return Returns the current value of the Heat of Formation at 298K + * and 1 bar */ doublereal Hf298SS(const int k) const { return m_spthermo->reportOneHf298(k); } - //! Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1) + //! Modify the value of the 298 K Heat of Formation of one species in the + //! phase (J kmol-1) /*! - * The 298K heat of formation is defined as the enthalpy change to create the standard state - * of the species from its constituent elements in their standard states at 298 K and 1 bar. + * The 298K heat of formation is defined as the enthalpy change to create + * the standard state of the species from its constituent elements in their + * standard states at 298 K and 1 bar. * * @param k Species k - * @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar + * @param Hf298New Specify the new value of the Heat of Formation at + * 298K and 1 bar */ virtual void modifyOneHf298SS(const size_t k, const doublereal Hf298New) { m_spthermo->modifyOneHf298(k, Hf298New); @@ -196,14 +194,13 @@ public: //! Maximum temperature for which the thermodynamic data for the species //! are valid. /*! - * If no argument is supplied, the - * value returned will be the highest temperature at which the - * data for \e all species are valid. Otherwise, the value - * will be only for species \a k. This function is a wrapper - * that calls the species thermo maxTemp function. + * If no argument is supplied, the value returned will be the highest + * temperature at which the data for \e all species are valid. Otherwise, + * the value will be only for species \a k. This function is a wrapper that + * calls the species thermo maxTemp function. * - * @param k index of the species. Default is -1, which will return the min of the max value - * over all species. + * @param k index of the species. Default is -1, which will return the min + * of the max value over all species. */ virtual doublereal maxTemp(size_t k = npos) const { return m_spthermo->maxTemp(k); @@ -211,10 +208,11 @@ public: //! Returns the chargeNeutralityNecessity boolean /*! - * Some phases must have zero net charge in order for their thermodynamics functions to be valid. - * If this is so, then the value returned from this function is true. - * If this is not the case, then this is false. Now, ideal gases have this parameter set to false, - * while solution with molality-based activity coefficients have this parameter set to true. + * Some phases must have zero net charge in order for their thermodynamics + * functions to be valid. If this is so, then the value returned from this + * function is true. If this is not the case, then this is false. Now, ideal + * gases have this parameter set to false, while solution with molality- + * based activity coefficients have this parameter set to true. */ bool chargeNeutralityNecessary() const { return m_chargeNeutralityNecessary; @@ -260,11 +258,10 @@ public: //! Return the thermodynamic pressure (Pa). /*! - * 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, - * Y_K) \f$. + * 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, Y_K) \f$. */ virtual doublereal pressure() const { throw NotImplementedError("ThermoPhase::pressure"); @@ -331,18 +328,17 @@ public: * @} * @name Activities, Standard States, and Activity Concentrations * - * The activity \f$a_k\f$ of a species in solution is related - * to the chemical potential by \f[ \mu_k = \mu_k^0(T,P) + - * \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is - * the standard chemical potential at unit activity, - * which depends on temperature and pressure, - * but not on composition. The activity is dimensionless. + * The activity \f$a_k\f$ of a species in solution is related to the + * chemical potential by \f[ \mu_k = \mu_k^0(T,P) + \hat R T \log a_k. \f] + * The quantity \f$\mu_k^0(T,P)\f$ is the standard chemical potential at + * unit activity, which depends on temperature and pressure, but not on + * composition. The activity is dimensionless. * @{ */ - //! This method returns the convention used in specification - //! of the activities, of which there are currently two, molar- - //! and molality-based conventions. + //! 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 @@ -360,9 +356,9 @@ public: */ virtual int activityConvention() const; - //! This method returns the convention used in specification - //! of the standard state, of which there are currently two, - //! temperature based, and variable pressure based. + //! This method returns the convention used in specification of the standard + //! state, of which there are currently two, temperature based, and variable + //! pressure based. /*! * Currently, there are two standard state conventions: * - Temperature-based activities @@ -380,20 +376,17 @@ public: //! This method returns an array of generalized concentrations /*! - * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / - * C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration - * defined below and \f$ a_k \f$ are activities used in the - * thermodynamic functions. These activity (or generalized) - * concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. Note that they may - * or may not have units of concentration --- they might be - * partial pressures, mole fractions, or surface coverages, - * for example. + * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / C^0_k, \f$ where + * \f$ C^0_k \f$ is a standard concentration defined below and \f$ a_k \f$ + * are activities used in the thermodynamic functions. These activity (or + * generalized) concentrations are used by kinetics manager classes to + * compute the forward and reverse rates of elementary reactions. Note that + * they may or may not have units of concentration --- they might be partial + * pressures, mole fractions, or surface coverages, for example. * - * @param c Output array of generalized concentrations. The - * units depend upon the implementation of the - * reaction rate expressions within the phase. + * @param c Output array of generalized concentrations. The units depend + * upon the implementation of the reaction rate expressions within + * the phase. */ virtual void getActivityConcentrations(doublereal* c) const { throw NotImplementedError("ThermoPhase::getActivityConcentrations"); @@ -401,15 +394,14 @@ public: //! Return the standard concentration for the kth species /*! - * The standard concentration \f$ C^0_k \f$ used to normalize - * the activity (i.e., generalized) concentration. In many cases, this quantity - * will be the same for all species in a phase - for example, - * for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this - * reason, this method returns a single value, instead of an - * array. However, for phases in which the standard - * concentration is species-specific (e.g. surface species of - * different sizes), this method may be called with an - * optional parameter indicating the species. + * The standard concentration \f$ C^0_k \f$ used to normalize the activity + * (i.e., generalized) concentration. In many cases, this quantity will be + * the same for all species in a phase - for example, for an ideal gas \f$ + * C^0_k = P/\hat R T \f$. For this reason, this method returns a single + * value, instead of an array. However, for phases in which the standard + * concentration is species-specific (e.g. surface species of different + * sizes), this method may be called with an optional parameter indicating + * the species. * * @param k Optional parameter indicating the species. The default * is to assume this refers to species 0. @@ -427,16 +419,15 @@ public: */ virtual doublereal logStandardConc(size_t k=0) const; - //! Get the array of non-dimensional activities at - //! the current solution temperature, pressure, and solution concentration. + //! Get the array of non-dimensional activities at the current solution + //! temperature, pressure, and solution concentration. /*! - * Note, for molality based formulations, this returns the - * molality based activities. + * Note, for molality based formulations, this returns the molality based + * activities. * - * We resolve this function at this level by calling - * on the activityConcentration function. However, - * derived classes may want to override this default - * implementation. + * 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. */ @@ -481,9 +472,9 @@ public: //! Get the species chemical potentials. Units: J/kmol. /*! - * This function returns a vector of chemical potentials of the - * species in solution at the current temperature, pressure - * and mole fraction of the solution. + * This function returns a vector of chemical potentials of the species in + * solution at the current temperature, pressure and mole fraction of the + * solution. * * @param mu Output vector of species chemical * potentials. Length: m_kk. Units: J/kmol @@ -495,10 +486,9 @@ public: //! Get the species electrochemical potentials. /*! * These are partial molar quantities. This method adds a term \f$ F z_k - * \phi_p \f$ to each chemical potential. - * The electrochemical potential of species k in a phase p, \f$ \zeta_k \f$, - * is related to the chemical potential via - * the following equation, + * \phi_p \f$ to each chemical potential. The electrochemical potential of + * species k in a phase p, \f$ \zeta_k \f$, is related to the chemical + * potential via the following equation, * * \f[ * \zeta_{k}(T,P) = \mu_{k}(T,P) + F z_k \phi_p @@ -570,12 +560,13 @@ public: /// @name Properties of the Standard State of the Species in the Solution //@{ - //! Get the array of chemical potentials at unit activity for the species - //! at their standard states at the current T and P of the solution. + //! Get the array of chemical potentials at unit activity for the species at + //! their standard states at the current T and P 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 + * \f$. The values are evaluated at the current temperature and pressure of + * the solution * * @param mu Output vector of chemical potentials. * Length: m_kk. @@ -584,8 +575,8 @@ public: throw NotImplementedError("ThermoPhase::getStandardChemPotentials"); } - //! Get the nondimensional Enthalpy functions for the species - //! at their standard states at the current T and P of the solution. + //! Get the nondimensional Enthalpy functions for the species at their + //! standard states at the current T and P of the solution. /*! * @param hrt Output vector of nondimensional standard state enthalpies. * Length: m_kk. @@ -594,8 +585,8 @@ public: throw NotImplementedError("ThermoPhase::getEnthalpy_RT"); } - //! Get the array of nondimensional Entropy functions for the - //! standard state species at the current T and P of the solution. + //! Get the array of nondimensional Entropy functions for the standard state + //! species at the current T and P of the solution. /*! * @param sr Output vector of nondimensional standard state entropies. * Length: m_kk. @@ -604,29 +595,29 @@ public: throw NotImplementedError("ThermoPhase::getEntropy_R"); } - //! Get the nondimensional Gibbs functions for the species - //! in their 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 T and P of the solution. /*! - * @param grt Output vector of nondimensional standard state Gibbs free energies - * Length: m_kk. + * @param grt Output vector of nondimensional standard state Gibbs free + * energies. Length: m_kk. */ virtual void getGibbs_RT(doublereal* grt) const { throw NotImplementedError("ThermoPhase::getGibbs_RT"); } - //! Get the Gibbs functions for the standard - //! state of the species at the current T and P of the solution + //! Get the Gibbs functions for the standard state of the species at the + //! current T and P of the solution /*! * Units are Joules/kmol - * @param gpure Output vector of standard state Gibbs free energies + * @param gpure Output vector of standard state Gibbs free energies. * Length: m_kk. */ virtual void getPureGibbs(doublereal* gpure) const { throw NotImplementedError("ThermoPhase::getPureGibbs"); } - //! Returns the vector of nondimensional Internal Energies of the standard - //! state species at the current T and P of the solution + //! Returns the vector of nondimensional Internal Energies of the standard + //! state species at the current T and P of the solution /*! * @param urt output vector of nondimensional standard state internal energies * of the species. Length: m_kk. @@ -635,12 +626,12 @@ public: throw NotImplementedError("ThermoPhase::getIntEnergy_RT"); } - //! Get the nondimensional Heat Capacities at constant - //! pressure 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 T and P of the + //! solution /*! - * @param cpr Output vector of nondimensional standard state heat capacities - * Length: m_kk. + * @param cpr Output vector of nondimensional standard state heat + * capacities. Length: m_kk. */ virtual void getCp_R(doublereal* cpr) const { throw NotImplementedError("ThermoPhase::getCp_R"); @@ -662,24 +653,20 @@ public: /// @name Thermodynamic Values for the Species Reference States //@{ - //! Returns the vector of nondimensional - //! enthalpies of the reference state at the current temperature - //! of the solution and the reference pressure for the species. + //! Returns the vector of nondimensional enthalpies of the reference state + //! at the current temperature of the solution and the reference pressure + //! for the species. /*! - * This base function will throw a CanteraException unless - * it is overwritten in a derived class. - * - * @param hrt Output vector containing the nondimensional reference state - * enthalpies - * Length: m_kk. + * @param hrt Output vector containing the nondimensional reference + * state enthalpies. Length: m_kk. */ virtual void getEnthalpy_RT_ref(doublereal* hrt) const { throw NotImplementedError("ThermoPhase::getEnthalpy_RT_ref"); } - //! Returns the vector of nondimensional - //! Gibbs Free Energies of the reference state at the current temperature - //! of the solution and the reference pressure for the species. + //! Returns the vector of nondimensional Gibbs Free Energies of the + //! reference state at the current temperature of the solution and the + //! reference pressure for the species. /*! * @param grt Output vector containing the nondimensional reference state * Gibbs Free energies. Length: m_kk. @@ -688,46 +675,42 @@ public: throw NotImplementedError("ThermoPhase::getGibbs_RT_ref"); } - //! Returns the vector of the - //! Gibbs function of the reference state at the current temperature - //! of the solution and the reference pressure for the species. + //! Returns the vector of the Gibbs function of the reference state at the + //! current temperature of the solution and the reference pressure for the + //! species. /*! - * units = J/kmol - * * @param g Output vector containing the reference state - * Gibbs Free energies. Length: m_kk. Units: J/kmol. + * Gibbs Free energies. Length: m_kk. Units: J/kmol. */ virtual void getGibbs_ref(doublereal* g) const { throw NotImplementedError("ThermoPhase::getGibbs_ref"); } - //! Returns the vector of nondimensional - //! entropies of the reference state at the current temperature - //! of the solution and the reference pressure for each species. + //! Returns the vector of nondimensional entropies of the reference state at + //! the current temperature of the solution and the reference pressure for + //! each species. /*! - * @param er Output vector containing the nondimensional reference state - * entropies. Length: m_kk. + * @param er Output vector containing the nondimensional reference + * state entropies. Length: m_kk. */ virtual void getEntropy_R_ref(doublereal* er) const { throw NotImplementedError("ThermoPhase::getEntropy_R_ref"); } - //! Returns the vector of nondimensional - //! internal Energies of the reference state at the current temperature - //! of the solution and the reference pressure for each species. + //! Returns the vector of nondimensional internal Energies of the reference + //! state at the current temperature of the solution and the reference + //! pressure for each species. /*! - * @param urt Output vector of nondimensional reference state - * internal energies of the species. - * Length: m_kk + * @param urt Output vector of nondimensional reference state internal + * energies of the species. Length: m_kk */ virtual void getIntEnergy_RT_ref(doublereal* urt) const { throw NotImplementedError("ThermoPhase::getIntEnergy_RT_ref"); } - //! Returns the vector of nondimensional - //! constant pressure heat capacities of the reference state - //! at the current temperature of the solution - //! and reference pressure for each species. + //! Returns the vector of nondimensional constant pressure heat capacities + //! of the reference state at the current temperature of the solution and + //! reference pressure for each species. /*! * @param cprt Output vector of nondimensional reference state * heat capacities at constant pressure for the species. @@ -737,8 +720,8 @@ public: throw NotImplementedError("ThermoPhase::getCp_R_ref()"); } - //! Get the molar volumes of the species reference states at the current - //! T and P_ref of the solution. + //! Get the molar volumes of the species reference states at the current + //! T and P_ref of the solution. /*! * units = m^3 / kmol * @@ -766,51 +749,38 @@ public: */ virtual void getReferenceComposition(doublereal* const x) const; - // The methods below are not virtual, and should not - // be overloaded. + // The methods below are not virtual, and should not be overloaded. //@} //! @name Specific Properties //@{ - /** - * Specific enthalpy. Units: J/kg. - */ + //! Specific enthalpy. Units: J/kg. doublereal enthalpy_mass() const { return enthalpy_mole()/meanMolecularWeight(); } - /** - * Specific internal energy. Units: J/kg. - */ + //! Specific internal energy. Units: J/kg. doublereal intEnergy_mass() const { return intEnergy_mole()/meanMolecularWeight(); } - /** - * Specific entropy. Units: J/kg/K. - */ + //! Specific entropy. Units: J/kg/K. doublereal entropy_mass() const { return entropy_mole()/meanMolecularWeight(); } - /** - * Specific Gibbs function. Units: J/kg. - */ + //! Specific Gibbs function. Units: J/kg. doublereal gibbs_mass() const { return gibbs_mole()/meanMolecularWeight(); } - /** - * Specific heat at constant pressure. Units: J/kg/K. - */ + //! Specific heat at constant pressure. Units: J/kg/K. doublereal cp_mass() const { return cp_mole()/meanMolecularWeight(); } - /** - * Specific heat at constant volume. Units: J/kg/K. - */ + //! Specific heat at constant volume. Units: J/kg/K. doublereal cv_mass() const { return cv_mole()/meanMolecularWeight(); } @@ -842,16 +812,14 @@ public: * @{ */ - //! Set the internally stored pressure (Pa) at constant - //! temperature and composition + //! Set the internally stored pressure (Pa) at constant temperature and + //! composition /*! - * This method must be reimplemented in derived classes, where it - * may involve the solution of a nonlinear equation. Within %Cantera, - * the independent variable is the density. Therefore, this function - * solves for the density that will yield the desired input pressure. - * The temperature and composition are held constant during this process. - * - * This base class function will print an error, if not overwritten. + * This method must be reimplemented in derived classes, where it may + * involve the solution of a nonlinear equation. Within %Cantera, the + * independent variable is the density. Therefore, this function solves for + * the density that will yield the desired input pressure. The temperature + * and composition are held constant during this process. * * @param p input Pressure (Pa) */ @@ -890,12 +858,14 @@ public: * * @param t Temperature (K) * @param p Pressure (Pa) - * @param x String containing a composition map of the mole fractions. Species not in - * the composition map are assumed to have zero mole fraction + * @param x String containing a composition map of the mole fractions. + * Species not in the composition map are assumed to have zero + * mole fraction */ virtual void setState_TPX(doublereal t, doublereal p, const std::string& x); - //! Set the internally stored temperature (K), pressure (Pa), and mass fractions of the phase. + //! Set the internally stored temperature (K), pressure (Pa), and mass + //! fractions of the phase. /*! * Note, the mass fractions are set first before the pressure is set. * Setting the pressure may involve the solution of a nonlinear equation. @@ -907,7 +877,8 @@ public: */ virtual void setState_TPY(doublereal t, doublereal p, const doublereal* y); - //! Set the internally stored temperature (K), pressure (Pa), and mass fractions of the phase + //! Set the internally stored temperature (K), pressure (Pa), and mass + //! fractions of the phase /*! * Note, the mass fractions are set first before the pressure is set. * Setting the pressure may involve the solution of a nonlinear equation. @@ -919,15 +890,17 @@ public: */ virtual void setState_TPY(doublereal t, doublereal p, const compositionMap& y); - //! Set the internally stored temperature (K), pressure (Pa), and mass fractions of the phase + //! Set the internally stored temperature (K), pressure (Pa), and mass + //! fractions of the phase /*! * Note, the mass fractions are set first before the pressure is set. * Setting the pressure may involve the solution of a nonlinear equation. * * @param t Temperature (K) * @param p Pressure (Pa) - * @param y String containing a composition map of the mass fractions. Species not in - * the composition map are assumed to have zero mass fraction + * @param y String containing a composition map of the mass fractions. + * Species not in the composition map are assumed to have zero + * mass fraction */ virtual void setState_TPY(doublereal t, doublereal p, const std::string& y); @@ -954,9 +927,9 @@ public: //! Set the internally stored pressure (Pa) and mass fractions. /*! - * Note, the temperature is held constant during this operation. - * Note, the mass fractions are set first before the pressure is set. - * Setting the pressure may involve the solution of a nonlinear equation. + * Note, the temperature is held constant during this operation. Note, the + * mass fractions are set first before the pressure is set. Setting the + * pressure may involve the solution of a nonlinear equation. * * @param p Pressure (Pa) * @param y Vector of mass fractions. @@ -964,7 +937,8 @@ public: */ virtual void setState_PY(doublereal p, doublereal* y); - //! Set the internally stored specific enthalpy (J/kg) and pressure (Pa) of the phase. + //! Set the internally stored specific enthalpy (J/kg) and pressure (Pa) of + //! the phase. /*! * @param h Specific enthalpy (J/kg) * @param p Pressure (Pa) @@ -976,8 +950,9 @@ public: //! Set the specific internal energy (J/kg) and specific volume (m^3/kg). /*! - * This function fixes the internal state of the phase so that - * the specific internal energy and specific volume have the value of the input parameters. + * This function fixes the internal state of the phase so that the specific + * internal energy and specific volume have the value of the input + * parameters. * * @param u specific internal energy (J/kg) * @param v specific volume (m^3/kg). @@ -989,8 +964,8 @@ public: //! Set the specific entropy (J/kg/K) and pressure (Pa). /*! - * This function fixes the internal state of the phase so that - * the specific entropy and the pressure have the value of the input parameters. + * This function fixes the internal state of the phase so that the specific + * entropy and the pressure have the value of the input parameters. * * @param s specific entropy (J/kg/K) * @param p specific pressure (Pa). @@ -1002,8 +977,8 @@ public: //! Set the specific entropy (J/kg/K) and specific volume (m^3/kg). /*! - * This function fixes the internal state of the phase so that - * the specific entropy and specific volume have the value of the input parameters. + * This function fixes the internal state of the phase so that the specific + * entropy and specific volume have the value of the input parameters. * * @param s specific entropy (J/kg/K) * @param v specific volume (m^3/kg). @@ -1013,14 +988,13 @@ public: */ virtual void setState_SV(doublereal s, doublereal v, doublereal tol = 1.e-4); - //! Set the density (kg/m**3) and pressure (Pa) at constant - //! composition + //! Set the density (kg/m**3) and pressure (Pa) at constant composition /*! - * This method must be reimplemented in derived classes, where it - * may involve the solution of a nonlinear equation. Within %Cantera, - * the independent variable is the density. Therefore, this function - * solves for the temperature that will yield the desired input pressure - * and density. The composition is held constant during this process. + * This method must be reimplemented in derived classes, where it may + * involve the solution of a nonlinear equation. Within %Cantera, the + * independent variable is the density. Therefore, this function solves for + * the temperature that will yield the desired input pressure and density. + * The composition is held constant during this process. * * This base class function will print an error, if not overwritten. * @@ -1034,7 +1008,8 @@ public: //! Set the density (kg/m**3), pressure (Pa) and mole fractions /*! * Note, the mole fractions are set first before the density and pressure - * are set. Setting the pressure may involve the solution of a nonlinear equation. + * are set. Setting the pressure may involve the solution of a nonlinear + * equation. * * @param rho Density (kg/m^3) * @param p Pressure (Pa) @@ -1046,7 +1021,8 @@ public: //! Set the density (kg/m**3), pressure (Pa) and mole fractions /*! * Note, the mole fractions are set first before the density and pressure - * are set. Setting the pressure may involve the solution of a nonlinear equation. + * are set. Setting the pressure may involve the solution of a nonlinear + * equation. * * @param rho Density (kg/m^3) * @param p Pressure (Pa) @@ -1058,19 +1034,22 @@ public: //! Set the density (kg/m**3), pressure (Pa) and mole fractions /*! * Note, the mole fractions are set first before the density and pressure - * are set. Setting the pressure may involve the solution of a nonlinear equation. + * are set. Setting the pressure may involve the solution of a nonlinear + * equation. * * @param rho Density (kg/m^3) * @param p Pressure (Pa) - * @param x String containing a composition map of the mole fractions. Species not in - * the composition map are assumed to have zero mole fraction + * @param x String containing a composition map of the mole fractions. + * Species not in the composition map are assumed to have zero + * mole fraction */ virtual void setState_RPX(doublereal rho, doublereal p, const std::string& x); //! Set the density (kg/m**3), pressure (Pa) and mass fractions /*! * Note, the mass fractions are set first before the density and pressure - * are set. Setting the pressure may involve the solution of a nonlinear equation. + * are set. Setting the pressure may involve the solution of a nonlinear + * equation. * * @param rho Density (kg/m^3) * @param p Pressure (Pa) @@ -1082,7 +1061,8 @@ public: //! Set the density (kg/m**3), pressure (Pa) and mass fractions /*! * Note, the mass fractions are set first before the density and pressure - * are set. Setting the pressure may involve the solution of a nonlinear equation. + * are set. Setting the pressure may involve the solution of a nonlinear + * equation. * * @param rho Density (kg/m^3) * @param p Pressure (Pa) @@ -1094,12 +1074,14 @@ public: //! Set the density (kg/m**3), pressure (Pa) and mass fractions /*! * Note, the mass fractions are set first before the density and pressure - * are set. Setting the pressure may involve the solution of a nonlinear equation. + * are set. Setting the pressure may involve the solution of a nonlinear + * equation. * * @param rho Density (kg/m^3) * @param p Pressure (Pa) - * @param y String containing a composition map of the mole fractions. Species not in - * the composition map are assumed to have zero mole fraction + * @param y String containing a composition map of the mole fractions. + * Species not in the composition map are assumed to have zero + * mole fraction */ virtual void setState_RPY(doublereal rho, doublereal p, const std::string& y); @@ -1206,9 +1188,8 @@ public: //! Returns the element potentials stored in the ThermoPhase object /*! - * Returns the stored element potentials. - * The element potentials are retrieved from their stored - * dimensionless forms by multiplying by RT. + * Returns the stored element potentials. The element potentials are + * retrieved from their stored dimensionless forms by multiplying by RT. * @param lambda Output vector containing the element potentials. * Length = nElements. Units are Joules/kmol. * @return bool indicating whether there are any valid stored element @@ -1329,12 +1310,11 @@ public: //! 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(). + * 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(). * * @param spthermo input pointer to the species thermodynamic property * manager. @@ -1343,8 +1323,8 @@ public: */ void setSpeciesThermo(SpeciesThermo* spthermo); - //! Return a changeable reference to the calculation manager - //! for species reference-state thermodynamic properties + //! Return a changeable reference to the calculation manager for species + //! reference-state thermodynamic properties /*! * @param k Species id. The default is -1, meaning return the default * @@ -1356,21 +1336,18 @@ public: * @internal * Initialization of a ThermoPhase object using an ctml file. * - * This routine is a precursor to initThermoXML(XML_Node*) - * routine, which does most of the work. - * Here we read extra information about the XML description - * of a phase. Regular information about elements and species - * and their reference state thermodynamic information - * have already been read at this point. - * For example, we do not need to call this function for - * ideal gas equations of state. + * This routine is a precursor to initThermoXML(XML_Node*) routine, which + * does most of the work. Here we read extra information about the XML + * description of a phase. Regular information about elements and species + * and their reference state thermodynamic information have already been + * read at this point. For example, we do not need to call this function for + * ideal gas equations of state. * - * @param inputFile XML file containing the description of the - * phase + * @param inputFile XML file containing the description of the phase * - * @param id Optional parameter identifying the name of the - * phase. If none is given, the first XML - * phase element encountered will be used. + * @param id Optional parameter identifying the name of the phase. If none + * is given, the first XML phase element encountered will be + * used. */ virtual void initThermoFile(const std::string& inputFile, const std::string& id); @@ -1379,31 +1356,25 @@ public: /*! * @internal * - * Here we read extra information about the XML description - * of a phase. Regular information about elements and species - * and their reference state thermodynamic information - * have already been read at this point. - * For example, we do not need to call this function for - * ideal gas equations of state. This function is called from importPhase() - * after the elements and the species are initialized with - * default ideal solution level data. + * Here we read extra information about the XML description of a phase. + * Regular information about elements and species and their reference state + * thermodynamic information have already been read at this point. For + * example, we do not need to call this function for ideal gas equations of + * state. This function is called from importPhase() after the elements and + * the species are initialized with default ideal solution level data. * - * The default implementation in ThermoPhase calls the - * virtual function initThermo() and then sets the "state" of the - * phase by looking for an XML element named "state", and then - * interpreting its contents by calling the virtual function - * setStateFromXML(). + * The default implementation in ThermoPhase calls the virtual function + * initThermo() and then sets the "state" of the phase by looking for an XML + * element named "state", and then interpreting its contents by calling the + * virtual function setStateFromXML(). * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. + * @param phaseNode This object must be the phase node of a complete XML + * tree description of the phase, including all of the species data. In + * other words while "phase" must point to an XML phase object, it must + * have sibling nodes "speciesData" that describe the species in the + * phase. + * @param id ID of the phase. If nonnull, a check is done to see if + * phaseNode is pointing to the phase with the correct id. */ virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); @@ -1411,31 +1382,28 @@ public: /*! * @internal Initialize. * - * This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called from ThermoPhase::initThermoXML(), - * which is called from importPhase(), - * just prior to returning from function importPhase(). + * This method is provided to allow subclasses to perform any initialization + * required after all species have been added. For example, it might be used + * to resize internal work arrays that must have an entry for each species. + * The base class implementation does nothing, and subclasses that do not + * require initialization do not need to overload this method. When + * importing a CTML phase description, this method is called from + * initThermoXML(), which is called from importPhase(), just prior to + * returning from function importPhase(). */ virtual void initThermo(); //! Add in species from Slave phases /*! - * This hook is used for cSS_CONVENTION_SLAVE phases + * This hook is used for cSS_CONVENTION_SLAVE phases * - * @param phaseNode XML Element for the phase + * @param phaseNode XML Element for the phase */ virtual void installSlavePhases(XML_Node* phaseNode); //! Set the equation of state parameters /*! - * @internal - * The number and meaning of these depends on the subclass. + * @internal The number and meaning of these depends on the subclass. * * @param n number of parameters * @param c array of \a n coefficients @@ -1445,8 +1413,7 @@ public: //! Get the equation of state parameters in a vector /*! - * @internal - * The number and meaning of these depends on the subclass. + * @internal The number and meaning of these depends on the subclass. * * @param n number of parameters * @param c array of \a n coefficients @@ -1458,24 +1425,23 @@ public: /*! * This method is called by function importPhase() when processing a phase * definition in an input file. It should be overloaded in subclasses to set - * any parameters that are specific to that particular phase - * model. Note, this method is called before the phase is - * initialized with elements and/or species. + * any parameters that are specific to that particular phase model. Note, + * this method is called before the phase is initialized with elements + * and/or species. * * @param eosdata An XML_Node object corresponding to * the "thermo" entry for this phase in the input file. */ virtual void setParametersFromXML(const XML_Node& eosdata) {} - //! Set the initial state of the phase to the conditions - //! specified in the state XML element. + //! 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. + * 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. + * @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); @@ -1483,55 +1449,55 @@ public: //! @name Derivatives of Thermodynamic Variables needed for Applications //! @{ - //! Get the change in activity coefficients wrt changes in state (temp, mole fraction, etc) along - //! a line in parameter space or along a line in physical space + //! Get the change in activity coefficients wrt changes in state (temp, mole + //! fraction, etc) along a line in parameter space or along a line in + //! physical space /*! * @param dTds Input of temperature change along the path - * @param dXds Input vector of changes in mole fraction along the path. length = m_kk - * Along the path length it must be the case that the mole fractions sum to one. + * @param dXds Input vector of changes in mole fraction along the + * path. length = m_kk Along the path length it must + * be the case that the mole fractions sum to one. * @param dlnActCoeffds Output vector of the directional derivatives of the - * log Activity Coefficients along the path. length = m_kk - * units are 1/units(s). if s is a physical coordinate then the units are 1/m. + * log Activity Coefficients along the path. length = + * m_kk units are 1/units(s). if s is a physical + * coordinate then the units are 1/m. */ virtual void getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const { throw NotImplementedError("ThermoPhase::getdlnActCoeffds"); } - //! Get the array of ln mole fraction derivatives of the log activity coefficients - diagonal component only + //! Get the array of ln mole fraction derivatives of the log activity + //! coefficients - diagonal component only /*! - * This function is a virtual method. For ideal mixtures - * (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the - * logarithm of the activity coefficient with respect to the - * logarithm of the mole fraction variable - * that represents the standard state. - * This quantity is to be used in conjunction with derivatives of - * that mole fraction variable when the derivative of the chemical - * potential is taken. + * For ideal mixtures (unity activity coefficients), this can return zero. + * Implementations should take the derivative of the logarithm of the + * activity coefficient with respect to the logarithm of the mole fraction + * variable that represents the standard state. This quantity is to be used + * in conjunction with derivatives of that mole fraction variable when the + * derivative of the chemical potential is taken. * - * units = dimensionless + * units = dimensionless * - * @param dlnActCoeffdlnX_diag Output vector of derivatives of the - * log Activity Coefficients wrt the mole fractions. length = m_kk + * @param dlnActCoeffdlnX_diag Output vector of derivatives of the log + * Activity Coefficients wrt the mole fractions. length = m_kk */ virtual void getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const { throw NotImplementedError("ThermoPhase::getdlnActCoeffdlnX_diag"); } - //! Get the array of log species mole number derivatives of the log activity coefficients + //! Get the array of log species mole number derivatives of the log activity + //! coefficients /*! - * This function is a virtual method. - * For ideal mixtures (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the - * logarithm of the activity coefficient with respect to the - * logarithm of the concentration-like variable (i.e. moles) - * that represents the standard state. - * This quantity is to be used in conjunction with derivatives of - * that species mole number variable when the derivative of the chemical - * potential is taken. + * For ideal mixtures (unity activity coefficients), this can return zero. + * Implementations should take the derivative of the logarithm of the + * activity coefficient with respect to the logarithm of the concentration- + * like variable (i.e. moles) that represents the standard state. This + * quantity is to be used in conjunction with derivatives of that species + * mole number variable when the derivative of the chemical potential is + * taken. * - * units = dimensionless + * units = dimensionless * * @param dlnActCoeffdlnN_diag Output vector of derivatives of the * log Activity Coefficients. length = m_kk @@ -1540,22 +1506,25 @@ public: throw NotImplementedError("ThermoPhase::getdlnActCoeffdlnN_diag"); } - //! Get the array of derivatives of the log activity coefficients with respect to the log of the species mole numbers + //! Get the array of derivatives of the log activity coefficients with + //! respect to the log of the species mole numbers /*! - * Implementations should take the derivative of the logarithm of the activity coefficient with respect to a - * species log mole number (with all other species mole numbers held constant). The default treatment in the + * Implementations should take the derivative of the logarithm of the + * activity coefficient with respect to a species log mole number (with all + * other species mole numbers held constant). The default treatment in the * ThermoPhase object is to set this vector to zero. * * units = 1 / kmol * - * dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log act_coeff for the mth - * species with respect to the number of moles of the kth species. + * dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log + * act_coeff for the mth species with respect to the + * number of moles of the kth species. * * \f[ - * \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i} + * \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i} * \f] * - * @param ld Number of rows in the matrix + * @param ld Number of rows in the matrix * @param dlnActCoeffdlnN Output vector of derivatives of the * log Activity Coefficients. length = m_kk * m_kk */ @@ -1578,11 +1547,11 @@ public: doublereal threshold=-1e-14) const; //! returns a summary of the state of the phase to a comma separated file. - //! To customize the data included in the report, derived classes should - //! override the getCsvReportData method. /*! - * @param csvFile ofstream file to print comma separated data for - * the phase + * To customize the data included in the report, derived classes should + * override the getCsvReportData method. + * + * @param csvFile ofstream file to print comma separated data for the phase */ virtual void reportCSV(std::ofstream& csvFile) const; @@ -1594,45 +1563,39 @@ protected: virtual void getCsvReportData(std::vector& names, std::vector& data) const; - //! Pointer to the calculation manager for species - //! reference-state thermodynamic properties + //! Pointer to the calculation manager for species reference-state + //! thermodynamic properties /*! - * This class is called when the reference-state thermodynamic properties - * of all the species in the phase needs to be evaluated. + * This class is called when the reference-state thermodynamic properties + * of all the species in the phase needs to be evaluated. */ SpeciesThermo* m_spthermo; //! Vector of pointers to the species databases. /*! - * This is used to access data needed to - * construct the transport manager and other properties - * later in the initialization process. - * We create a copy of the XML_Node data read in here. Therefore, we own this - * data. + * This is used to access data needed to construct the transport manager and + * other properties later in the initialization process. We create a copy of + * the XML_Node data read in here. Therefore, we own this data. */ std::vector m_speciesData; - //! Stored value of the electric potential for this phase - /*! - * Units are Volts - */ + //! Stored value of the electric potential for this phase. Units are Volts. doublereal m_phi; - /// Vector of element potentials. - /// Length equal to number of elements. + //! Vector of element potentials. Length equal to number of elements. vector_fp m_lambdaRRT; - //! Boolean indicating whether there is a valid set of saved element potentials - //! for this phase + //! Boolean indicating whether there is a valid set of saved element + //! potentials for this phase bool m_hasElementPotentials; //! Boolean indicating whether a charge neutrality condition is a necessity /*! - * Note, the charge neutrality condition is not a necessity for ideal gas phases. There may - * be a net charge in those phases, because the NASA polynomials for ionized species - * in Ideal gases take this condition into account. - * However, liquid phases usually require charge neutrality in order for their derived - * thermodynamics to be valid. + * Note, the charge neutrality condition is not a necessity for ideal gas + * phases. There may be a net charge in those phases, because the NASA + * polynomials for ionized species in Ideal gases take this condition into + * account. However, liquid phases usually require charge neutrality in + * order for their derived thermodynamics to be valid. */ bool m_chargeNeutralityNecessary; @@ -1641,10 +1604,10 @@ protected: //! Reference Mole Fraction Composition /*! - * Occasionally, the need arises to find a safe mole fraction vector to initialize - * the object to. This contains such a vector. - * The algorithm will pick up the mole fraction vector that is applied from - * the state XML file in the input file + * Occasionally, the need arises to find a safe mole fraction vector to + * initialize the object to. This contains such a vector. The algorithm + * will pick up the mole fraction vector that is applied from the state XML + * file in the input file * @deprecated To be removed after Cantera 2.3. */ vector_fp xMol_Ref; diff --git a/include/cantera/thermo/VPStandardStateTP.h b/include/cantera/thermo/VPStandardStateTP.h index 3cbe89a3e..026d40a7f 100644 --- a/include/cantera/thermo/VPStandardStateTP.h +++ b/include/cantera/thermo/VPStandardStateTP.h @@ -4,9 +4,6 @@ * variable pressure standard state methods for calculating * thermodynamic properties (see \ref thermoprops and * class \link Cantera::VPStandardStateTP VPStandardStateTP\endlink). - * - * These include most of the - * methods for calculating liquid electrolyte thermodynamics. */ /* * Copyright (2005) Sandia Corporation. Under the terms of @@ -24,31 +21,29 @@ namespace Cantera /** * @ingroup thermoprops * - * This is a filter class for ThermoPhase that implements some prepatory - * steps for efficiently handling - * a variable pressure standard state for species. + * This is a filter class for ThermoPhase that implements some prepatory steps + * for efficiently handling a variable pressure standard state for species. * - * Several concepts are introduced. The first concept is there are temporary - * variables for holding the species standard state values - * of Cp, H, S, G, and V at the - * last temperature and pressure called. These functions are not recalculated - * if a new call is made using the previous temperature and pressure. Currently, - * these variables and the calculation method are handled by the VPSSMgr class, - * for which VPStandardStateTP owns a pointer to. + * Several concepts are introduced. The first concept is there are temporary + * variables for holding the species standard state values of Cp, H, S, G, and V + * at the last temperature and pressure called. These functions are not + * recalculated if a new call is made using the previous temperature and + * pressure. Currently, these variables and the calculation method are handled + * by the VPSSMgr class, for which VPStandardStateTP owns a pointer to. * - * To support the above functionality, pressure and temperature variables, - * m_Plast_ss and m_Tlast_ss, are kept which store the last pressure and temperature - * used in the evaluation of standard state properties. + * To support the above functionality, pressure and temperature variables, + * m_Plast_ss and m_Tlast_ss, are kept which store the last pressure and + * temperature used in the evaluation of standard state properties. * - * This class is usually used for nearly incompressible phases. For those phases, it - * makes sense to change the equation of state independent variable from - * density to pressure. The variable m_Pcurrent contains the current value of the - * pressure within the phase. + * This class is usually used for nearly incompressible phases. For those + * phases, it makes sense to change the equation of state independent variable + * from density to pressure. The variable m_Pcurrent contains the current value + * of the pressure within the phase. * - * @todo - * Put some teeth into this level by overloading the setDensity() function. It should - * now throw an exception. Instead, setPressure routines should calculate the - * solution density and then call State:setDensity() directly. + * @todo Put some teeth into this level by overloading the setDensity() + * function. It should now throw an exception. Instead, setPressure routines + * should calculate the solution density and then call State:setDensity() + * directly. */ class VPStandardStateTP : public ThermoPhase { @@ -58,58 +53,17 @@ public: /// Constructor. VPStandardStateTP(); - //! Copy Constructor. - /*! - * @param b Object to be copied - */ VPStandardStateTP(const VPStandardStateTP& b); - - //! Assignment operator - /*! - * @param b Object to be copied - */ VPStandardStateTP& operator=(const VPStandardStateTP& b); - - //! Destructor. virtual ~VPStandardStateTP(); - - //! Duplication routine virtual ThermoPhase* duplMyselfAsThermoPhase() const; //@} //! @name Utilities (VPStandardStateTP) //@{ - //! This method returns the convention used in specification - //! of the standard state, of which there are currently two, - //! temperature based, and variable pressure based. - /*! - * Currently, there are two standard state conventions: - * - Temperature-based activities, - * `cSS_CONVENTION_TEMPERATURE 0` (default) - * - Variable Pressure and Temperature-based activities, - * `cSS_CONVENTION_VPSS 1` - */ virtual int standardStateConvention() const; - //! Get the array of log concentration-like derivatives of the - //! log activity coefficients - /*! - * This function is a virtual method. For ideal mixtures - * (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the - * logarithm of the activity coefficient with respect to the - * logarithm of the concentration-like variable (i.e. moles) - * that represents the standard state. - * This quantity is to be used in conjunction with derivatives of - * that concentration-like variable when the derivative of the chemical - * potential is taken. - * - * units = dimensionless - * - * @param dlnActCoeffdlnN_diag Output vector of derivatives of the - * log Activity Coefficients. length = m_kk - */ virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const { throw NotImplementedError("VPStandardStateTP::getdlnActCoeffdlnN_diag"); } @@ -120,12 +74,10 @@ public: //! Get the array of non-dimensional species chemical potentials. /*! - * These are partial molar Gibbs free energies, - * \f$ \mu_k / \hat R T \f$. + * These are partial molar Gibbs free energies, \f$ \mu_k / \hat R T \f$. * - * We close the loop on this function, here, calling - * getChemPotentials() and then dividing by RT. No need for child - * classes to handle. + * We close the loop on this function, here, calling getChemPotentials() and + * then dividing by RT. No need for child classes to handle. * * @param mu Output vector of non-dimensional species chemical potentials * Length: m_kk. @@ -135,125 +87,39 @@ public: //@} /*! - * @name Properties of the Standard State of the Species in the Solution (VPStandardStateTP) + * @name Properties of the Standard State of the Species in the Solution * - * Within VPStandardStateTP, these properties are calculated via a common routine, - * _updateStandardStateThermo(), which must be overloaded in inherited - * objects. The values are cached within this object, and are not + * Within VPStandardStateTP, these properties are calculated via a common + * routine, _updateStandardStateThermo(), which must be overloaded in + * inherited objects. The values are cached within this object, and are not * recalculated unless the temperature or pressure changes. */ //@{ - //!Get the array of chemical potentials at unit activity. - /*! - * These are the standard state chemical potentials \f$ \mu^0_k(T,P) - * \f$. The values are evaluated at the current temperature and pressure. - * - * @param mu Output vector of standard state chemical potentials. - * length = m_kk. units are J / kmol. - */ virtual void getStandardChemPotentials(doublereal* mu) const; - - /** - * Get the nondimensional Enthalpy functions for the species - * at their standard states at the current - * T and P of the solution. - * - * @param hrt Output vector of standard state enthalpies. - * length = m_kk. units are unitless. - */ virtual void getEnthalpy_RT(doublereal* hrt) const; - - /** - * Get the array of nondimensional Enthalpy functions for the - * standard state species - * at the current T and P of the solution. - * - * @param sr Output vector of nondimensional standard state - * entropies. length = m_kk. - */ virtual void getEntropy_R(doublereal* sr) const; - - /** - * Get the nondimensional Gibbs functions for the species - * at their standard states of solution at the current T and P - * of the solution. - * - * @param grt Output vector of nondimensional standard state - * Gibbs free energies. length = m_kk. - */ virtual void getGibbs_RT(doublereal* grt) const; - - //! Get the standard state Gibbs functions for each species - //! at the current T and P. - /*! - * (Note resolved at this level) - * - * @param gpure Output vector of standard state - * Gibbs free energies. length = m_kk. - * units are J/kmol. - */ void getPureGibbs(doublereal* gpure) const; - - /** - * Returns the vector of nondimensional - * internal Energies of the standard state at the current temperature - * and pressure of the solution for each species. - * \f[ - * u^{ss}_k(T,P) = h^{ss}_k(T) - P * V^{ss}_k - * \f] - * - * @param urt Output vector of nondimensional standard state - * internal energies. length = m_kk. - */ virtual void getIntEnergy_RT(doublereal* urt) const; - - /** - * Get the nondimensional Heat Capacities at constant - * pressure for the standard state of the species - * at the current T and P. - * - * This is redefined here to call the internal function, _updateStandardStateThermo(), - * which calculates all standard state properties at the same time. - * - * @param cpr Output vector containing the - * the nondimensional Heat Capacities at constant - * pressure for the standard state of the species. - * Length: m_kk. - */ virtual void getCp_R(doublereal* cpr) const; - - //! Get the molar volumes of each species in their standard - //! states at the current - //! T and P of the solution. - /*! - * units = m^3 / kmol - * - * This is redefined here to call the internal function, _updateStandardStateThermo(), - * which calculates all standard state properties at the same time. - * - * @param vol Output vector of species volumes. length = m_kk. - * units = m^3 / kmol - */ virtual void getStandardVolumes(doublereal* vol) const; virtual const vector_fp& getStandardVolumes() const; //! Set the temperature of the phase /*! - * Currently this passes down to setState_TP(). It does not - * make sense to calculate the standard state without first - * setting T and P. + * Currently this passes down to setState_TP(). It does not make sense to + * calculate the standard state without first setting T and P. * * @param temp Temperature (kelvin) */ virtual void setTemperature(const doublereal temp); - //! Set the internally stored pressure (Pa) at constant - //! temperature and composition + //! Set the internally stored pressure (Pa) at constant temperature and + //! composition /*! - * Currently this passes down to setState_TP(). It does not - * make sense to calculate the standard state without first - * setting T and P. + * Currently this passes down to setState_TP(). It does not make sense to + * calculate the standard state without first setting T and P. * * @param p input Pressure (Pa) */ @@ -261,8 +127,8 @@ public: //! Set the temperature and pressure at the same time /*! - * Note this function triggers a reevaluation of the standard - * state quantities. + * Note this function triggers a reevaluation of the standard state + * quantities. * * @param T temperature (kelvin) * @param pres pressure (pascal) @@ -282,11 +148,10 @@ public: //! Updates the standard state thermodynamic functions at the current T and P of the solution. /*! - * If m_useTmpStandardStateStorage is true, - * this function must be called for every call to functions in this - * class. It checks to see whether the temperature or pressure has changed and - * thus the ss thermodynamics functions for all of the species - * must be recalculated. + * If m_useTmpStandardStateStorage is true, this function must be called for + * every call to functions in this class. It checks to see whether the + * temperature or pressure has changed and thus the ss thermodynamics + * functions for all of the species must be recalculated. * * This function is responsible for updating the following internal members, * when m_useTmpStandardStateStorage is true. @@ -306,8 +171,8 @@ public: protected: /** - * Calculate the density of the mixture using the partial - * molar volumes and mole fractions as input + * Calculate the density of the mixture using the partial molar volumes and + * mole fractions as input. * * The formula for this is * @@ -315,22 +180,20 @@ protected: * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}} * \f] * - * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are - * the molecular weights, and \f$V_k\f$ are the pure species - * molar volumes. + * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are the molecular + * weights, and \f$V_k\f$ are the pure species molar volumes. * - * Note, the basis behind this formula is that in an ideal - * solution the partial molar volumes are equal to the pure - * species molar volumes. We have additionally specified - * in this class that the pure species molar volumes are - * independent of temperature and pressure. + * Note, the basis behind this formula is that in an ideal solution the + * partial molar volumes are equal to the pure species molar volumes. We + * have additionally specified in this class that the pure species molar + * volumes are independent of temperature and pressure. * - * NOTE: This is a non-virtual function, which is not a - * member of the ThermoPhase base class. + * NOTE: This function is not a member of the ThermoPhase base class. */ virtual void calcDensity(); - //! Updates the standard state thermodynamic functions at the current T and P of the solution. + //! Updates the standard state thermodynamic functions at the current T and + //! P of the solution. /*! * @internal * @@ -354,98 +217,31 @@ protected: virtual void _updateStandardStateThermo() const; public: - /// @name Thermodynamic Values for the Species Reference States (VPStandardStateTP) + /// @name Thermodynamic Values for the Species Reference States /*! - * There are also temporary - * variables for holding the species reference-state values of Cp, H, S, and V at the - * last temperature and reference pressure called. These functions are not recalculated - * if a new call is made using the previous temperature. - * All calculations are done within the routine _updateRefStateThermo(). + * There are also temporary variables for holding the species reference- + * state values of Cp, H, S, and V at the last temperature and reference + * pressure called. These functions are not recalculated if a new call is + * made using the previous temperature. All calculations are done within the + * routine _updateRefStateThermo(). */ //@{ - //! Returns the vector of nondimensional - //! enthalpies of the reference state at the current temperature - //! of the solution and the reference pressure for the species. - /*! - * @param hrt Output vector contains the nondimensional enthalpies - * of the reference state of the species - * length = m_kk, units = dimensionless. - */ virtual void getEnthalpy_RT_ref(doublereal* hrt) const; - - //! Modify the value of the 298 K Heat of Formation of the standard state of - //! one species in the phase (J kmol-1) - /*! - * The 298K heat of formation is defined as the enthalpy change to create the standard state - * of the species from its constituent elements in their standard states at 298 K and 1 bar. - * - * @param k Index of the species - * @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar. - * units = J/kmol. - */ void modifyOneHf298SS(const size_t k, const doublereal Hf298New); - - //! Returns the vector of nondimensional - //! Gibbs free energies of the reference state at the current temperature - //! of the solution and the reference pressure for the species. - /*! - * @param grt Output vector contains the nondimensional Gibbs free energies - * of the reference state of the species - * length = m_kk, units = dimensionless. - */ virtual void getGibbs_RT_ref(doublereal* grt) const; protected: const vector_fp& Gibbs_RT_ref() const; + public: - /*! - * Returns the vector of the - * Gibbs function of the reference state at the current temperature - * of the solution and the reference pressure for the species. - * units = J/kmol - * - * @param g Output vector contain the Gibbs free energies - * of the reference state of the species - * length = m_kk, units = J/kmol. - */ virtual void getGibbs_ref(doublereal* g) const; - - /*! - * Returns the vector of nondimensional - * entropies of the reference state at the current temperature - * of the solution and the reference pressure for the species. - * - * @param er Output vector contain the nondimensional entropies - * of the species in their reference states - * length: m_kk, units: dimensionless. - */ virtual void getEntropy_R_ref(doublereal* er) const; - - /*! - * Returns the vector of nondimensional - * constant pressure heat capacities of the reference state - * at the current temperature of the solution - * and reference pressure for the species. - * - * @param cprt Output vector contains the nondimensional heat capacities - * of the species in their reference states - * length: m_kk, units: dimensionless. - */ virtual void getCp_R_ref(doublereal* cprt) const; - - //! Get the molar volumes of the species reference states at the current - //! T and P_ref of the solution. - /*! - * units = m^3 / kmol - * - * @param vol Output vector containing the standard state volumes. - * Length: m_kk. - */ virtual void getStandardVolumes_ref(doublereal* vol) const; //@} - //! @name Initialization Methods - For Internal use (VPStandardState) + //! @name Initialization Methods - For Internal use /*! * The following methods are used in the process of constructing * the phase and setting its parameters from a specification in an @@ -455,33 +251,6 @@ public: //@{ virtual void initThermo(); - - //! Initialize a ThermoPhase object, potentially reading activity - //! coefficient information from an XML database. - /*! - * This routine initializes the lengths in the current object and - * then calls the parent routine. - * This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase(). - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); using Phase::addSpecies; @@ -495,7 +264,7 @@ public: //! Return a pointer to the VPSSMgr for this phase /*! - * @return Returns a pointer to the VPSSMgr for this phase + * @returns a pointer to the VPSSMgr for this phase */ VPSSMgr* provideVPSSMgr(); @@ -507,18 +276,19 @@ public: protected: //! Current value of the pressure - state variable /*! - * Because we are now using the pressure as a state variable, we need to carry it - * along within this object + * Because we are now using the pressure as a state variable, we need to + * carry it along within this object * * units = Pascals */ doublereal m_Pcurrent; - //! The last temperature at which the standard statethermodynamic properties were calculated at. + //! The last temperature at which the standard statethermodynamic properties + //! were calculated at. mutable doublereal m_Tlast_ss; - //! The last pressure at which the Standard State thermodynamic - //! properties were calculated at. + //! The last pressure at which the Standard State thermodynamic properties + //! were calculated at. mutable doublereal m_Plast_ss; /*! @@ -534,9 +304,8 @@ protected: //! Storage for the PDSS objects for the species /*! - * Storage is in species index order. - * VPStandardStateTp owns each of the objects. - * Copy operations are deep. + * Storage is in species index order. VPStandardStateTp owns each of the + * objects. Copy operations are deep. */ std::vector m_PDSS_storage; }; diff --git a/include/cantera/thermo/WaterSSTP.h b/include/cantera/thermo/WaterSSTP.h index eab1cceb5..d86c8a635 100644 --- a/include/cantera/thermo/WaterSSTP.h +++ b/include/cantera/thermo/WaterSSTP.h @@ -20,64 +20,61 @@ namespace Cantera class WaterPropsIAPWS; class WaterProps; -//! Class for single-component water. This is designed to cover just the -//! liquid part of water. +//! Class for single-component water. This is designed to cover just the liquid +//! part of water. /*! - * The reference is W. Wagner, A. Prub, "The IAPWS Formulation 1995 for the Thermodynamic - * Properties of Ordinary Water Substance for General and Scientific Use," - * J. Phys. Chem. Ref. Dat, 31, 387, 2002. + * The reference is W. Wagner, A. Prub, "The IAPWS Formulation 1995 for the + * Thermodynamic Properties of Ordinary Water Substance for General and + * Scientific Use," J. Phys. Chem. Ref. Dat, 31, 387, 2002. * *
*

Specification of Species Standard State Properties

*
* - * The offsets used in the steam tables are different than NIST's. - * They assume u_liq(TP) = 0.0, s_liq(TP) = 0.0, where TP is the - * triple point conditions: + * The offsets used in the steam tables are different than NIST's. They assume + * u_liq(TP) = 0.0, s_liq(TP) = 0.0, where TP is the triple point conditions: * * - u(273.16, rho) = 0.0 * - s(273.16, rho) = 0.0 * - psat(273.16) = 611.655 Pascal * - rho(273.16, psat) = 999.793 kg m-3 * - * These "steam table" assumptions are used by the WaterPropsIAPWS class. - * Therefore, offsets must be calculated to make the thermodynamic - * properties calculated within this class to be consistent with - * thermo properties within Cantera. + * These "steam table" assumptions are used by the WaterPropsIAPWS class. + * Therefore, offsets must be calculated to make the thermodynamic properties + * calculated within this class to be consistent with thermo properties within + * Cantera. * - * The thermodynamic base state for water is set to the NIST basis here - * by specifying constants, #EW_Offset and #SW_Offset, one for energy - * quantities and one for entropy quantities. The offsets are - * specified so that the following properties hold: + * The thermodynamic base state for water is set to the NIST basis here by + * specifying constants, #EW_Offset and #SW_Offset, one for energy quantities + * and one for entropy quantities. The offsets are specified so that the + * following properties hold: * - * - Delta_Hfo_idealgas(298.15) = -241.826 kJ/gmol - * - So_idealgas(298.15, 1bar) = 188.835 J/gmolK + * - Delta_Hfo_idealgas(298.15) = -241.826 kJ/gmol + * - So_idealgas(298.15, 1bar) = 188.835 J/gmolK * - * (From http://webbook.nist.gov) + * (From http://webbook.nist.gov) * - * The "o" here refers to a hypothetical ideal gas state. The way - * we achieve this in practice is to evaluate at a very low pressure - * and then use the theoretical ideal gas results to scale up to - * higher pressures: + * The "o" here refers to a hypothetical ideal gas state. The way we achieve + * this in practice is to evaluate at a very low pressure and then use the + * theoretical ideal gas results to scale up to higher pressures: * - * Ho(1bar) = H(P0) + * Ho(1bar) = H(P0) * - * So(1bar) = S(P0) + RT ln(1bar/P0) + * So(1bar) = S(P0) + RT ln(1bar/P0) * *
*

%Application within Kinetics Managers

*
* - * This is unimplemented. + * This is unimplemented. * *
*

Instantiation of the Class

*
* * The constructor for this phase is NOT located in the default ThermoFactory - * for %Cantera. However, a new WaterSSTP object may be created by - * the following code snippets, combined with an XML file given in the - * XML example section. + * for %Cantera. However, a new WaterSSTP object may be created by the following + * code snippets, combined with an XML file given in the XML example section. * * @code * WaterSSTP *w = new WaterSSTP("waterSSTPphase.xml",""); @@ -102,8 +99,8 @@ class WaterProps; *

XML Example

*
* - * An example of an XML Element named phase setting up a WaterSSTP object with - * id "water" is given below. + * An example of an XML Element named phase setting up a WaterSSTP object with + * id "water" is given below. * * @code * @@ -129,11 +126,9 @@ public: //! Base constructor WaterSSTP(); - //! Copy constructor WaterSSTP(const WaterSSTP&); - - //! Assignment operator WaterSSTP& operator=(const WaterSSTP&); + ThermoPhase* duplMyselfAsThermoPhase() const; //! Full constructor for a water phase /*! @@ -149,9 +144,6 @@ public: */ explicit WaterSSTP(XML_Node& phaseRef, const std::string& id = ""); - //! Duplicator from a ThermoPhase object - ThermoPhase* duplMyselfAsThermoPhase() const; - virtual int eosType() const { return -1; } @@ -167,187 +159,52 @@ public: virtual doublereal pressure() const; virtual void setPressure(doublereal p); - - //! Returns the isothermal compressibility. Units: 1/Pa. - /*! - * The isothermal compressibility is defined as - * \f[ - * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T - * \f] - * or - * \f[ - * \kappa_T = \frac{1}{\rho}\left(\frac{\partial \rho}{\partial P}\right)_T - * \f] - */ virtual doublereal isothermalCompressibility() const; - - //! Return the volumetric thermal expansion coefficient. Units: 1/K. - /*! - * The thermal expansion coefficient is defined as - * \f[ - * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P - * \f] - */ virtual doublereal thermalExpansionCoeff() const; - //! Return the derivative of the volumetric thermal expansion coefficient. Units: 1/K2. - /*! - * The thermal expansion coefficient is defined as - * \f[ - * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P - * \f] - */ + //! Return the derivative of the volumetric thermal expansion coefficient. + //! Units: 1/K2. virtual doublereal dthermalExpansionCoeffdT() const; //! @} //! @name Properties of the Standard State of the Species in the Solution //! @{ - //! Get the Gibbs function for the species - //! standard states at the current T and P of the solution. - /*! - * @param gss Vector of length m_kk, which on return - * will contain the - * standard state Gibbs function for species k. - */ virtual void getStandardChemPotentials(doublereal* gss) const; - - //!Get the nondimensional Gibbs function for the species - //! standard states at the current T and P of the solution. - /*! - * @param grt Vector of length m_kk, which on return - * will contain the nondimensional - * standard state Gibbs function for species k - */ virtual void getGibbs_RT(doublereal* grt) const; - - //! Get the array of nondimensional Enthalpy functions for the standard state species - //! at the current T and P of the solution. - /*! - * @param hrt Vector of length m_kk, which on return - * will contain the nondimensional - * standard state enthalpy of species k - */ void getEnthalpy_RT(doublereal* hrt) const; - - //! Get the nondimensional Entropies for the species - //! standard states at the current T and P of the solution. - /*! - * @param sr Vector of length m_kk, which on return - * will contain the nondimensional - * standard state entropy for speciesk - */ void getEntropy_R(doublereal* sr) const; - - //! Get the nondimensional heat capacity at constant pressure - //! function for the species standard states at the current T and P of the solution. - /*! - * @param cpr Vector of length m_kk, which on return - * will contain the nondimensional - * constant pressure heat capacity for species k - */ virtual void getCp_R(doublereal* cpr) const; - - //! Returns the vector of nondimensional - //! internal Energies of the standard state at the current - //! temperature and pressure of the solution for each species. - /*! - * @param urt Output vector of standard state nondimensional internal energies. - * Length: m_kk. - */ virtual void getIntEnergy_RT(doublereal* urt) const; //@} //! @name Thermodynamic Values for the Species Reference State /*! - * All functions in this group need to be overrided, because - * the m_spthermo SpeciesThermo function is not adequate for - * the real equation of state. + * All functions in this group need to be overrided, because the + * m_spthermo SpeciesThermo function is not adequate for the real equation + * of state. */ //@{ - //! Returns the vector of nondimensional - //! enthalpies of the reference state at the current temperature - //! of the solution and the reference pressure for the species. - /*! - * @param hrt Output vector containing the nondimensional reference state enthalpies - * Length: m_kk. - */ virtual void getEnthalpy_RT_ref(doublereal* hrt) const; - - /*! - * Returns the vector of nondimensional - * enthalpies of the reference state at the current temperature - * of the solution and the reference pressure for the species. - * - * @param grt Output vector containing the nondimensional reference state - * Gibbs Free energies. Length: m_kk. - */ virtual void getGibbs_RT_ref(doublereal* grt) const; - - /*! - * Returns the vector of the Gibbs function of the reference state at the - * current temperature of the solution and the reference pressure for the - * species. units = J/kmol - * - * @param g Output vector containing the reference state - * Gibbs Free energies. Length: m_kk. Units: J/kmol. - */ virtual void getGibbs_ref(doublereal* g) const; - - /*! - * Returns the vector of nondimensional - * entropies of the reference state at the current temperature - * of the solution and the reference pressure for each species. - * - * @param er Output vector containing the nondimensional reference state - * entropies. Length: m_kk. - */ virtual void getEntropy_R_ref(doublereal* er) const; - - /*! - * Returns the vector of nondimensional - * constant pressure heat capacities of the reference state - * at the current temperature of the solution - * and reference pressure for each species. - * - * @param cprt Output vector of nondimensional reference state - * heat capacities at constant pressure for the species. - * Length: m_kk - */ virtual void getCp_R_ref(doublereal* cprt) const; - - //! Get the molar volumes of the species reference states at the current - //! T and P_ref of the solution. - /*! - * units = m^3 / kmol - * - * @param vol Output vector containing the standard state volumes. - * Length: m_kk. - */ virtual void getStandardVolumes_ref(doublereal* vol) const; //! @} - /// critical temperature virtual doublereal critTemperature() const; - - /// critical pressure virtual doublereal critPressure() const; - - /// critical density virtual doublereal critDensity() const; - /// saturation pressure - /*! - * @param t Temperature (kelvin) - */ virtual doublereal satPressure(doublereal t); //! Return the fraction of vapor at the current conditions /*! - * Below Tcrit, this routine will always return 0, by definition - * of the functionality of the routine. Above Tcrit, we query - * the density to toggle between 0 and 1. + * Below Tcrit, this routine will always return 0, by definition of the + * functionality of the routine. Above Tcrit, we query the density to toggle + * between 0 and 1. */ virtual doublereal vaporFraction() const; @@ -369,49 +226,7 @@ public: */ virtual void setDensity(const doublereal dens); - //!Import and initialize a ThermoPhase object using an XML tree. - /*! - * @internal - * - * Here we read extra information about the XML description - * of a phase. Regular information about elements and species - * and their reference state thermodynamic information - * have already been read at this point. - * For example, we do not need to call this function for - * ideal gas equations of state. This function is called from importPhase() - * after the elements and the species are initialized with - * default ideal solution level data. - * - * The default implementation in ThermoPhase calls the - * virtual function initThermo() and then sets the "state" of the - * phase by looking for an XML element named "state", and then - * interpreting its contents by calling the virtual function - * setStateFromXML(). - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); - - //! Set equation of state parameter values from XML entries. - /*! - * This method is called by function importPhase() when processing a phase - * definition in an input file. It should be overloaded in subclasses to set - * any parameters that are specific to that particular phase - * model. Note, this method is called before the phase is - * initialized with elements and/or species. - * - * @param eosdata An XML_Node object corresponding to - * the "thermo" entry for this phase in the input file. - */ virtual void setParametersFromXML(const XML_Node& eosdata); //! Get a pointer to a changeable WaterPropsIAPWS object @@ -426,9 +241,8 @@ public: protected: /** - * @internal - * This internal routine must be overwritten because - * it is not applicable. + * @internal This internal routine must be overwritten because it is not + * applicable. */ void _updateThermo() const; @@ -438,11 +252,9 @@ private: //! Pointer to the WaterProps object /*! - * This class is used to house several approximation - * routines for properties of water. - * - * This object owns m_waterProps, and the WaterPropsIAPWS object used by - * WaterProps is m_sub, which is defined above. + * This class is used to house several approximation routines for properties + * of water. This object owns m_waterProps, and the WaterPropsIAPWS object + * used by WaterProps is m_sub, which is defined above. */ std::unique_ptr m_waterProps; diff --git a/src/thermo/MixedSolventElectrolyte.cpp b/src/thermo/MixedSolventElectrolyte.cpp index 89b15b04f..acea2b6eb 100644 --- a/src/thermo/MixedSolventElectrolyte.cpp +++ b/src/thermo/MixedSolventElectrolyte.cpp @@ -1,9 +1,6 @@ /** - * @file MixedSolventElectrolyte.cpp - * Definitions for ThermoPhase object for phases which - * employ excess Gibbs free energy formulations related to Margules - * expansions (see \ref thermoprops - * and class \link Cantera::MargulesVPSSTP MargulesVPSSTP\endlink). + * @file MixedSolventElectrolyte.cpp see \ref thermoprops and class \link + * Cantera::MixedSolventElectrolyte MixedSolventElectrolyte \endlink). */ /* * Copyright (2009) Sandia Corporation. Under the terms of diff --git a/src/thermo/MolalityVPSSTP.cpp b/src/thermo/MolalityVPSSTP.cpp index cbf5d0cc7..71ebf4c5b 100644 --- a/src/thermo/MolalityVPSSTP.cpp +++ b/src/thermo/MolalityVPSSTP.cpp @@ -4,11 +4,6 @@ * employ molality based activity coefficient formulations * (see \ref thermoprops * and class \link Cantera::MolalityVPSSTP MolalityVPSSTP\endlink). - * - * Header file for a derived class of ThermoPhase that handles variable pressure - * standard state methods for calculating thermodynamic properties that are - * further based upon activities based on the molality scale. These include - * most of the methods for calculating liquid electrolyte thermodynamics. */ /* * Copyright (2005) Sandia Corporation. Under the terms of
m_formGC ActivityConc StandardConc