diff --git a/include/cantera/thermo/DebyeHuckel.h b/include/cantera/thermo/DebyeHuckel.h index 06c46a57b..260c3e380 100644 --- a/include/cantera/thermo/DebyeHuckel.h +++ b/include/cantera/thermo/DebyeHuckel.h @@ -81,7 +81,7 @@ class PDSS_Water; * The enthalpy function is given by the following relation. * * \f[ - * \raggedright h^\triangle_k(T,P) = h^{\triangle,ref}_k(T) + * h^\triangle_k(T,P) = h^{\triangle,ref}_k(T) * + \tilde v \left( P - P_{ref} \right) * \f] * @@ -201,7 +201,7 @@ class PDSS_Water; * \f$ I_s \f$ we need to * catalog all species in the phase. This is done using the following categories: * - * - cEST_solvent : Solvent species (neutral) + * - cEST_solvent Solvent species (neutral) * - cEST_chargedSpecies Charged species (charged) * - cEST_weakAcidAssociated Species which can break apart into charged species. * It may or may not be charged. These may or @@ -249,8 +249,7 @@ class PDSS_Water; * * DHFORM_DILUTE_LIMIT = 0 * - * This form assumes a dilute limit to DH, and is mainly - * for informational purposes: + * This form assumes a dilute limit to DH, and is mainly for informational purposes: * \f[ * \ln(\gamma_k^\triangle) = - z_k^2 A_{Debye} \sqrt{I} * \f] @@ -278,10 +277,9 @@ class PDSS_Water; * + \log(10) B^{dot}_k I * \f] * - * Note, this particular form where \f$ a_k \f$ can differ in - * multielectrolyte - * solutions has problems with respect to a Gibbs-Duhem analysis. However, - * we include it here because there is a lot of data fit to it. + * Note, this particular form where \f$ a_k \f$ can differ in multielectrolyte + * solutions has problems with respect to a Gibbs-Duhem analysis. However, + * we include it here because there is a lot of data fit to it. * * The activity for the solvent water,\f$ a_o \f$, is not independent and must be * determined from the Gibbs-Duhem relation. Here, we use: @@ -305,15 +303,14 @@ class PDSS_Water; * * DHFORM_BDOT_AUNIFORM = 2 * - * This form assumes Bethke's format for the Debye-Huckel activity coefficient + * This form assumes Bethke's format for the Debye-Huckel activity coefficient * * \f[ * \ln(\gamma_k^\triangle) = -z_k^2 \frac{A_{Debye} \sqrt{I}}{ 1 + B_{Debye} a \sqrt{I}} * + \log(10) B^{dot}_k I * \f] * - * The value of a is determined at the beginning of the - * calculation, and not changed. + * The value of a is determined at the beginning of the calculation, and not changed. * * \f[ * \ln(a_o) = \frac{X_o - 1.0}{X_o} @@ -326,19 +323,18 @@ class PDSS_Water; * * DHFORM_BETAIJ = 3 * - * This form assumes a linear expansion in a virial coefficient form - * It is used extensively in the book by Newmann, "Electrochemistry Systems", - * and is the beginning of - * more complex treatments for stronger electrolytes, fom Pitzer - * and from Harvey, Moller, and Weire. + * This form assumes a linear expansion in a virial coefficient form. + * It is used extensively in the book by Newmann, "Electrochemistry Systems", + * and is the beginning of more complex treatments for stronger electrolytes, + * fom Pitzer and from Harvey, Moller, and Weire. * * \f[ * \ln(\gamma_k^\triangle) = -z_k^2 \frac{A_{Debye} \sqrt{I}}{ 1 + B_{Debye} a \sqrt{I}} * + 2 \sum_j \beta_{j,k} m_j * \f] * - * In the current treatment the binary interaction coefficients, \f$ \beta_{j,k}\f$, are - * independent of temperature and pressure. + * In the current treatment the binary interaction coefficients, \f$ \beta_{j,k}\f$, are + * independent of temperature and pressure. * * \f[ * \ln(a_o) = \frac{X_o - 1.0}{X_o} @@ -384,9 +380,9 @@ class PDSS_Water; * * DHFORM_PITZER_BETAIJ = 4 * - * This form assumes an activity coefficient formulation consistent - * with a truncated form of Pitzer's formulation. Pitzer's formulation is equivalent - * to the formulations above in the dilute limit, where rigorous theory may be applied. + * This form assumes an activity coefficient formulation consistent + * with a truncated form of Pitzer's formulation. Pitzer's formulation is equivalent + * to the formulations above in the dilute limit, where rigorous theory may be applied. * * \f[ * \ln(\gamma_k^\triangle) = -z_k^2 \frac{A_{Debye}}{3} \frac{\sqrt{I}}{ 1 + B_{Debye} a \sqrt{I}} @@ -425,23 +421,19 @@ class PDSS_Water; * {\left(\frac{N_a e^2}{\epsilon R T }\right)}^{3/2} * \f] * - * Units = sqrt(kg/gmol) + * where + * - \f$ N_a \f$ is Avogadro's number + * - \f$ \rho_w \f$ is the density of water + * - \f$ e \f$ is the electronic charge + * - \f$ \epsilon = K \epsilon_o \f$ is the permittivity of water + * - \f$ K \f$ is the dielectric constant of water + * - \f$ \epsilon_o \f$ is the permittivity of free space + * - \f$ \rho_o \f$ is the density of the solvent in its standard state. * - * where - * - \f$ N_a \f$ is Avogadro's number - * - \f$ \rho_w \f$ is the density of water - * - \f$ e \f$ is the electronic charge - * - \f$ \epsilon = K \epsilon_o \f$ is the permittivity of water - * where \f$ K \f$ is the dielectric constant of water, - * and \f$ \epsilon_o \f$ is the permittivity of free space. - * - \f$ \rho_o \f$ is the density of the solvent in its standard state. - * - * Nominal value at 298 K and 1 atm = 1.172576 (kg/gmol)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 + * 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. * @code @@ -607,10 +599,8 @@ class PDSS_Water; */ class DebyeHuckel : public MolalityVPSSTP { - public: - - //! Empty Constructor + //! Default Constructor DebyeHuckel(); //! Copy constructor @@ -622,16 +612,14 @@ public: //! Full constructor for creating the phase. /*! * @param inputFile File name containing the XML description of the phase - * @param id id attribute containing the name of the phase. - * (default is the empty string) + * @param id id attribute containing the name of the phase. */ DebyeHuckel(const std::string& inputFile, const std::string& id = ""); //! Full constructor for creating the phase. /*! * @param phaseRef XML phase node containing the description of the phase - * @param id id attribute containing the name of the phase. - * (default is the empty string) + * @param id id attribute containing the name of the phase. */ DebyeHuckel(XML_Node& phaseRef, const std::string& id = ""); @@ -648,11 +636,8 @@ public: */ ThermoPhase* duplMyselfAsThermoPhase() const; - /** - * - * @name Utilities - * @{ - */ + //! @name Utilities + //! @{ /** * Equation of state type flag. The base class returns @@ -662,29 +647,18 @@ public: */ virtual int eosType() const; - /** - * @} - * @name Molar Thermodynamic Properties of the Solution -------------- - * @{ - */ + //! @} + //! @name Molar Thermodynamic Properties of the Solution + //! @{ - /// Molar enthalpy. Units: J/kmol. - /** - * Molar enthalpy of the solution. Units: J/kmol. - * (HKM -> Bump up to Parent object) - */ + /// Molar enthalpy of the solution. Units: J/kmol. virtual doublereal enthalpy_mole() const; - /// Molar internal energy. Units: J/kmol. - /** - * Molar internal energy of the solution. Units: J/kmol. - * (HKM -> Bump up to Parent object) - */ + /// Molar internal energy of the solution. Units: J/kmol. virtual doublereal intEnergy_mole() const; /// Molar entropy. Units: J/kmol/K. /** - * Molar entropy of the solution. Units: J/kmol/K. * For an ideal, constant partial molar volume solution mixture with * pure species phases which exhibit zero volume expansivity: * \f[ @@ -697,15 +671,10 @@ public: * property manager. The pure species entropies are independent of * temperature since the volume expansivities are equal to zero. * @see SpeciesThermo - * - * (HKM -> Bump up to Parent object) */ virtual doublereal entropy_mole() const; /// Molar Gibbs function. Units: J/kmol. - /* - * (HKM -> Bump up to Parent object) - */ virtual doublereal gibbs_mole() const; /// Molar heat capacity at constant pressure. Units: J/kmol/K. @@ -718,7 +687,7 @@ public: virtual doublereal cv_mole() const; //@} - /** @name Mechanical Equation of State Properties ------------------------- + /** @name Mechanical Equation of State Properties //@{ * * In this equation of state implementation, the density is a @@ -787,14 +756,10 @@ public: * This function will now throw an error condition if the * input isn't exactly equal to the current density. * - * * @todo Now have a compressible ss equation for liquid water. * Therefore, this phase is compressible. May still * want to change the independent variable however. * - * NOTE: This is an overwritten function from the State.h - * class - * * @param rho Input density (kg/m^3). */ void setDensity(const doublereal rho); @@ -807,22 +772,16 @@ public: * This function will now throw an error condition if the input * isn't exactly equal to the current molar density. * - * NOTE: This is a virtual function overwritten from the State.h - * class - * * @param conc Input molar density (kmol/m^3). */ virtual void setMolarDensity(const doublereal conc); //! Set the temperature (K) /*! - * Overwritten setTemperature(double) from State.h. This - * function sets the temperature, and makes sure that + * This function sets the temperature, and makes sure that * the value propagates to underlying objects, such as * the water standard state model. * - * @todo Make Phase::setTemperature a virtual function - * * @param temp Temperature in kelvin */ virtual void setTemperature(const doublereal temp); @@ -842,6 +801,9 @@ public: * \f[ * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T * \f] + * + * It's equal to zero for this model, since the molar volume + * doesn't change with pressure or temperature. */ virtual doublereal isothermalCompressibility() const; @@ -852,20 +814,12 @@ public: * \f[ * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P * \f] + * + * It's equal to zero for this model, since the molar volume + * doesn't change with pressure or temperature. */ virtual doublereal thermalExpansionCoeff() const; - /** - * @} - * @name Potential Energy - * - * Species may have an additional potential energy due to the - * presence of external gravitation or electric fields. These - * methods allow specifying a potential energy for individual - * species. - * @{ - */ - /** * @} * @name Activities, Standard States, and Activity Concentrations @@ -935,6 +889,10 @@ public: * Inherited classes are responsible for overriding the default * values if necessary. * + * On return uA contains the powers of the units (MKS assumed) + * of the standard concentrations and generalized concentrations + * for the kth species. + * * @param uA Output vector containing the units * uA[0] = kmol units - default = 1 * uA[1] = m units - default = -nDim(), the number of spatial @@ -959,7 +917,7 @@ public: * derived classes may want to override this default * implementation. * - * (note solvent is on molar scale). + * (note solvent activity coefficient is on molar scale). * * @param ac Output vector of activities. Length: m_kk. */ @@ -972,6 +930,8 @@ public: * note solvent is on molar scale. The solvent molar * based activity coefficient is returned. * + * Note, most of the work is done in an internal private routine + * * @param acMolality Vector of Molality-based activity coefficients * Length: m_kk */ @@ -979,7 +939,7 @@ public: getMolalityActivityCoefficients(doublereal* acMolality) const; //@} - /// @name Partial Molar Properties of the Solution ----------------- + /// @name Partial Molar Properties of the Solution //@{ @@ -992,9 +952,6 @@ public: * \f[ * \mu_k = \mu^{\triangle}_k(T,P) + R T ln(\gamma_k^{\triangle} m_k) * \f] - * or another way to phrase this is - * - * where * * @param mu Output vector of species chemical * potentials. Length: m_kk. Units: J/kmol @@ -1029,8 +986,9 @@ public: /** * Maxwell's equations provide an insight in how to calculate this * (p.215 Smith and Van Ness) - * - * d(chemPot_i)/dT = -sbar_i + * \f[ + * \frac{d\mu_i}{dT} = -\bar{s}_i + * \f] * * For this phase, the partial molar entropies are equal to the * SS species entropies plus the ideal solution contribution.following @@ -1039,7 +997,7 @@ public: * \bar s_k(T,P) = \hat s^0_k(T) - R log(M0 * molality[k]) * \f] * \f[ - * \bar s_solvent(T,P) = \hat s^0_solvent(T) + * \bar s_{solvent}(T,P) = \hat s^0_{solvent}(T) * - R ((xmolSolvent - 1.0) / xmolSolvent) * \f] * @@ -1066,8 +1024,15 @@ public: //! Return an array of partial molar volumes for the //! species in the mixture. Units: m^3/kmol. /*! - * For this solution, the partial molar volumes are equal to the - * constant species molar volumes. + * For this solution, the partial molar volumes are normally + * equal to theconstant species molar volumes, except + * when the activity coefficients depend on pressure. + * + * The general relation is + * + * vbar_i = d(chemPot_i)/dP at const T, n + * = V0_i + d(Gex)/dP)_T,M + * = V0_i + RT d(lnActCoeffi)dP _T,M * * @param vbar Output vector of species partial molar volumes. * Length = m_kk. units are m^3/kmol. @@ -1076,53 +1041,9 @@ public: //@} - protected: - - //! Updates the standard state thermodynamic functions at the current T and P of the solution. - /*! - * @internal - * - * This function gets called for every call to a public function in this - * class. It checks to see whether the temperature or pressure has changed and - * thus whether the ss thermodynamics functions must be recalculated. - * - * @param pres Pressure at which to evaluate the standard states. - * The default, indicated by a -1.0, is to use the current pressure - */ - //virtual void _updateStandardStateThermo() const; - - //@} - /// @name Thermodynamic Values for the Species Reference States --- - //@{ - - - /////////////////////////////////////////////////////// - // - // The methods below are not virtual, and should not - // be overloaded. - // - ////////////////////////////////////////////////////// - - /** - * @name Specific Properties - * @{ - */ - - - /** - * @name Setting the State - * - * These methods set all or part of the thermodynamic - * state. - * @{ - */ - - //@} - /** * @name Chemical Equilibrium - * Chemical equilibrium. * @{ */ @@ -1143,10 +1064,8 @@ public: err("setToEquilState"); } - //@} - //! Set the equation of state parameters /*! * @internal @@ -1177,21 +1096,14 @@ public: * model. Note, this method is called before the phase is * initialized with elements and/or species. * + * HKM -> Right now, the parameters are set elsewhere (initThermoXML) + * It just didn't seem to fit. + * * @param eosdata An XML_Node object corresponding to * the "thermo" entry for this phase in the input file. */ virtual void setParametersFromXML(const XML_Node& eosdata); - //--------------------------------------------------------- - /// @name Critical state properties. - /// These methods are only implemented by some subclasses. - - //@{ - - - - //@} - /// @name Saturation properties. /// These methods are only implemented by subclasses that /// implement full liquid-vapor equations of state. @@ -1236,12 +1148,10 @@ public: //@} - /* * -------------- Utilities ------------------------------- */ - //! Initialize the object's internal lengths after species are set /** * @internal Initialize. This method is provided to allow @@ -1292,35 +1202,32 @@ public: * \f[ * A_{Debye} = \frac{F e B_{Debye}}{8 \pi \epsilon R T} {\left( C_o \tilde{M}_o \right)}^{1/2} * \f] - * where - * + * where * \f[ * B_{Debye} = \frac{F} {{(\frac{\epsilon R T}{2})}^{1/2}} * \f] * Therefore: - * \f[ + * \f[ * A_{Debye} = \frac{1}{8 \pi} * {\left(\frac{2 N_a \rho_o}{1000}\right)}^{1/2} * {\left(\frac{N_a e^2}{\epsilon R T }\right)}^{3/2} - * \f] + * \f] * - * Units = sqrt(kg/gmol) + * where + * - Units = sqrt(kg/gmol) + * - \f$ N_a \f$ is Avogadro's number + * - \f$ \rho_w \f$ is the density of water + * - \f$ e \f$ is the electronic charge + * - \f$ \epsilon = K \epsilon_o \f$ is the permittivity of water + * - \f$ K \f$ is the dielectric constant of water, + * - \f$ \epsilon_o \f$ is the permittivity of free space. + * - \f$ \rho_o \f$ is the density of the solvent in its standard state. * - * where - * - \f$ N_a \f$ is Avogadro's number - * - \f$ \rho_w \f$ is the density of water - * - \f$ e \f$ is the electronic charge - * - \f$ \epsilon = K \epsilon_o \f$ is the permittivity of water - * where \f$ K \f$ is the dielectric constant of water, - * and \f$ \epsilon_o \f$ is the permittivity of free space. - * = \f$ \rho_o \f$ is the density of the solvent in its standard state. - * - * Nominal value at 298 K and 1 atm = 1.172576 (kg/gmol)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 + * 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 * * @param temperature Temperature in kelvin. Defaults to -1, in which * case the temperature of the phase is assumed. @@ -1331,14 +1238,13 @@ public: virtual double A_Debye_TP(double temperature = -1.0, double pressure = -1.0) const; - //! Value of the derivative of the Debye Huckel constant with //! respect to temperature. /*! * This is a function of temperature and pressure. See A_Debye_TP() for * a definition of \f$ A_{Debye} \f$. * - * Units = sqrt(kg/gmol) K-1 + * Units = sqrt(kg/gmol) K-1 * * @param temperature Temperature in kelvin. Defaults to -1, in which * case the temperature of the phase is assumed. @@ -1355,7 +1261,7 @@ public: * This is a function of temperature and pressure. See A_Debye_TP() for * a definition of \f$ A_{Debye} \f$. * - * Units = sqrt(kg/gmol) K-2 + * Units = sqrt(kg/gmol) K-2 * * @param temperature Temperature in kelvin. Defaults to -1, in which * case the temperature of the phase is assumed. @@ -1372,7 +1278,7 @@ public: * This is a function of temperature and pressure. See A_Debye_TP() for * a definition of \f$ A_{Debye} \f$. * - * Units = sqrt(kg/gmol) Pa-1 + * Units = sqrt(kg/gmol) Pa-1 * * @param temperature Temperature in kelvin. Defaults to -1, in which * case the temperature of the phase is assumed. @@ -1400,8 +1306,6 @@ public: } private: - - //! Static function that implements the non-polar species //! salt-out modifications. /*! @@ -1411,7 +1315,6 @@ private: */ double _nonpolarActCoeff(double IionicMolality) const; - //! Formula for the osmotic coefficient that occurs in the GWB. /*! * It is originally from Helgeson for a variable @@ -1425,11 +1328,8 @@ private: * NaCl brine. It's to be used with extreme caution. */ double _lnactivityWaterHelgesonFixedForm() const; - - //@} - protected: @@ -1497,9 +1397,7 @@ protected: */ vector_fp m_Aionic; - /** - * Current value of the ionic strength on the molality scale - */ + //! Current value of the ionic strength on the molality scale mutable double m_IionicMolality; /** @@ -1588,18 +1486,16 @@ protected: //! Array of B_Dot values /** - * B_Dot -> This expression is an extension of the - * Debye-Huckel expression used in some formulations - * to extend DH to higher molalities. - * B_dot is specific to the major ionic pair. + * This expression is an extension of the Debye-Huckel expression used + * in some formulations to extend DH to higher molalities. B_dot is + * specific to the major ionic pair. */ vector_fp m_B_Dot; /** - * m_npActCoeff -> These are coefficients to describe - * the increase in activity coeff for non-polar molecules - * due to the electrolyte becoming stronger (the so-called - * salt-out effect) + * These are coefficients to describe the increase in activity coeff for + * non-polar molecules due to the electrolyte becoming stronger (the + * so-called salt-out effect) */ vector_fp m_npActCoeff; @@ -1616,19 +1512,13 @@ protected: */ double m_densWaterSS; - /** - * Pointer to the water property calculator - */ + //! Pointer to the water property calculator WaterProps* m_waterProps; - /** - * Temporary array used in equilibrium calculations - */ + //! Temporary array used in equilibrium calculations mutable vector_fp m_pp; - /** - * vector of size m_kk, used as a temporary holding area. - */ + //! vector of size m_kk, used as a temporary holding area. mutable vector_fp m_tmpV; /** @@ -1670,6 +1560,8 @@ protected: mutable vector_fp m_dlnActCoeffMolaldP; private: + + //! Bail out of functions with an error exit if they are not implemented. doublereal err(const std::string& msg) const; //! Initialize the internal lengths. @@ -1682,8 +1574,9 @@ private: private: //! Calculate the log activity coefficients /*! - * This function updates the internally stored - * natural logarithm of the molality activity coefficients + * This function updates the internally stored natural logarithm of the + * molality activity coefficients. This is the main routine for + * implementing the activity coefficient formulation. */ void s_update_lnMolalityActCoeff() const; @@ -1695,8 +1588,6 @@ private: * * We assume that the activity coefficients are current in this routine * - * - * * The solvent activity coefficient is on the molality scale. Its derivative is too. */ void s_update_dlnMolalityActCoeff_dT() const; @@ -1711,8 +1602,6 @@ private: * * solvent activity coefficient is on the molality * scale. Its derivatives are too. - * - * note: private routine */ void s_update_d2lnMolalityActCoeff_dT2() const; @@ -1734,8 +1623,3 @@ private: } #endif - - - - - diff --git a/include/cantera/thermo/GibbsExcessVPSSTP.h b/include/cantera/thermo/GibbsExcessVPSSTP.h index 7fd8fc137..daf9a3d96 100644 --- a/include/cantera/thermo/GibbsExcessVPSSTP.h +++ b/include/cantera/thermo/GibbsExcessVPSSTP.h @@ -39,14 +39,14 @@ namespace Cantera * and semi-miscible compounds. * * It includes - * . regular solutions - * . Margules expansions - * . NTRL equation - * . Wilson's equation - * . UNIQUAC equation of state. + * - regular solutions + * - Margules expansions + * - NTRL equation + * - Wilson's equation + * - UNIQUAC equation of state. * - * This class adds additional functions onto the %ThermoPhase interface - * that handles the calculation of the excess Gibbs free energy. The %ThermoPhase + * This class adds additional functions onto the ThermoPhase interface + * that handles the calculation of the excess Gibbs free energy. The ThermoPhase * class includes a member function, ThermoPhase::activityConvention() * that indicates which convention the activities are based on. The * default is to assume activities are based on the molar convention. @@ -55,15 +55,13 @@ namespace Cantera * All of the Excess Gibbs free energy formulations in this area employ * symmetrical formulations. * - * - * Chemical potentials + * Chemical potentials * of species k, \f$ \mu_o \f$, has the following general format: * * \f[ * \mu_k = \mu^o_k(T,P) + R T ln( \gamma_k X_k ) * \f] * - * * where \f$ \gamma_k^{\triangle} \f$ is a molar based activity coefficient for species * \f$k\f$. * @@ -71,7 +69,6 @@ namespace Cantera * fraction vector. That's one of its primary usages. In order to keep the mole fraction * vector constant, all of the setState functions are redesigned at this layer. * - * *

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

@@ -96,15 +93,12 @@ namespace Cantera * All setState functions that set the internal state of the ThermoPhase object are * overloaded at this level, so that a current mole fraction vector is maintained within * the object. - * - * */ class GibbsExcessVPSSTP : public VPStandardStateTP { - public: - - /// Constructors + //! @name Constructors + //! @{ /*! * This doesn't do much more than initialize constants with * default values for water at 25C. Water molecular weight @@ -117,16 +111,12 @@ public: //! Copy constructor /*! - * Note this stuff will not work until the underlying phase - * has a working copy constructor - * * @param b class to be copied */ GibbsExcessVPSSTP(const GibbsExcessVPSSTP& b); /// Assignment operator /*! - * * @param b class to be copied. */ GibbsExcessVPSSTP& operator=(const GibbsExcessVPSSTP& b); @@ -141,13 +131,7 @@ public: * a pointer to ThermoPhase to work with. */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; - - /** - * - * @name Utilities - * @{ - */ - + //! @} //! Equation of state type flag. /*! @@ -159,23 +143,9 @@ public: */ virtual int eosType() const; - - - /** - * @} - * @name Molar Thermodynamic Properties - * @{ - */ - - - - - - /** - * @} - * @name Mechanical Properties - * @{ - */ + //! @} + //! @name Mechanical Properties + //! @{ //! Set the internally stored pressure (Pa) at constant //! temperature and composition @@ -191,7 +161,6 @@ public: virtual void setPressure(doublereal p); protected: - /** * Calculate the density of the mixture using the partial * molar volumes and mole fractions as input @@ -218,17 +187,6 @@ protected: void calcDensity(); public: - /** - * @} - * @name Potential Energy - * - * Species may have an additional potential energy due to the - * presence of external gravitation or electric fields. These - * methods allow specifying a potential energy for individual - * species. - * @{ - */ - /** * @} * @name Activities, Standard States, and Activity Concentrations @@ -259,8 +217,6 @@ public: */ virtual void getActivityConcentrations(doublereal* c) const; - - /** * The standard concentration \f$ C^0_k \f$ used to normalize * the generalized concentration. In many cases, this quantity @@ -393,12 +349,10 @@ public: err("getdlnActCoeffdlnX"); } - //@} /// @name Partial Molar Properties of the Solution //@{ - /** * Get the species electrochemical potentials. * These are partial molar quantities. @@ -425,39 +379,13 @@ public: virtual void getPartialMolarVolumes(doublereal* vbar) const; virtual const vector_fp& getPartialMolarVolumes() const; - //@} - /// @name Properties of the Standard State of the Species in the Solution - //@{ - - - - //@} - /// @name Thermodynamic Values for the Species Reference States - //@{ - - - /////////////////////////////////////////////////////// - // - // The methods below are not virtual, and should not - // be overloaded. - // - ////////////////////////////////////////////////////// - - /** - * @name Specific Properties - * @{ - */ - - /** + * @} * @name Setting the State - * - * These methods set all or part of the thermodynamic - * state. + * These methods set all or part of the thermodynamic state. * @{ */ - //! Set the temperature (K) and pressure (Pa) /*! * Set the temperature and pressure. @@ -467,15 +395,6 @@ public: */ virtual void setState_TP(doublereal t, doublereal p); - //@} - - /** - * @name Chemical Equilibrium - * Routines that implement the Chemical equilibrium capability - * for a single phase, based on the element-potential method. - * @{ - */ - /** * Set the mass fractions to the specified values, and then * normalize them so that they sum to 1.0. @@ -500,7 +419,6 @@ public: */ virtual void setMassFractions_NoNorm(const doublereal* const y); - /** * Set the mole fractions to the specified values, and then * normalize them so that they sum to 1.0. @@ -537,18 +455,8 @@ public: * of species in the phase. */ virtual void setConcentrations(const doublereal* const c); - //@} - - - /// The following methods are used in the process of constructing - /// the phase and setting its parameters from a specification in an - /// input file. They are not normally used in application programs. - /// To see how they are used, see files importCTML.cpp and - /// ThermoFactory.cpp. - - /*! * @internal Initialize. This method is provided to allow * subclasses to perform any initialization required after all @@ -564,9 +472,7 @@ public: */ virtual void initThermo(); - private: - //! Initialize lengths of local variables after all species have //! been identified. void initLengths(); @@ -580,17 +486,14 @@ private: doublereal err(const std::string& msg) const; protected: - //! utility routine to check mole fraction sum /*! * @param x vector of mole fractions. + * @deprecated */ double checkMFSum(const doublereal* const x) const; protected: - - // HKM get rid of _Scaled_ prefix - //! Storage for the current values of the mole fractions of the species /*! * This vector is kept up-to-date when the setState functions are called. @@ -634,15 +537,8 @@ protected: //! Temporary storage space that is fair game mutable std::vector m_pp; - }; - } #endif - - - - - diff --git a/include/cantera/thermo/HMWSoln.h b/include/cantera/thermo/HMWSoln.h index ddf4c8cf1..289bb8579 100644 --- a/include/cantera/thermo/HMWSoln.h +++ b/include/cantera/thermo/HMWSoln.h @@ -22,7 +22,6 @@ namespace Cantera { - /** * Major Parameters: * The form of the Pitzer expression refers to the @@ -36,11 +35,9 @@ namespace Cantera * * Only one form is supported atm. This parameter is included for * future expansion. - * */ #define PITZERFORM_BASE 0 - /*! * @name Temperature Dependence of the Pitzer Coefficients * @@ -64,7 +61,6 @@ namespace Cantera * * beta0 = q0 + q3(1/T - 1/Tr) + q4(ln(T/Tr)) + * q1(T - Tr) + q2(T**2 - Tr**2) - * */ //@{ #define PITZER_TEMP_CONSTANT 0 @@ -131,8 +127,8 @@ class PDSS_Water; * The enthalpy function is given by the following relation. * * \f[ - * \raggedright h^\triangle_k(T,P) = h^{\triangle,ref}_k(T) - * + \tilde{v}_k \left( P - P_{ref} \right) + * h^\triangle_k(T,P) = h^{\triangle,ref}_k(T) + * + \tilde{v}_k \left( P - P_{ref} \right) * \f] * * For an incompressible, @@ -356,139 +352,140 @@ class PDSS_Water; * 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[ + * \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] * - * 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 \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 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$ \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$ 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$ contributions, which - * capture cation-cation and anion-anion interactions, also have an - * ionic strength dependence. + * 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 * - * 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. + * 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. * * *

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[ + * \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] * - * 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[ + * \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] * - * The activity coefficient for a particular anion X is given by + * The activity coefficient for a particular anion X is given by * - * \f[ + * \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] + * where the function \f$ F \f$ is given by * - * \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] + * \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] * - * 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[ + * \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] * * where \f$ h(x) \f$ is defined as * @@ -497,11 +494,11 @@ class PDSS_Water; * \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

@@ -547,7 +544,6 @@ class PDSS_Water; * * 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} )} @@ -681,7 +677,7 @@ class PDSS_Water; * + q_4^{{\beta}0} \ln \left( \frac{T}{T_r} \right) * \f] * - * This same COMPLEX1 temperature + * 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$, @@ -704,13 +700,10 @@ class PDSS_Water; * 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. @@ -766,23 +759,23 @@ class PDSS_Water; * 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 @@ -889,10 +882,10 @@ class PDSS_Water; * \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[ + * \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] + * where * * \f[ * B_{Debye} = \frac{F} {{(\frac{\epsilon R T}{2})}^{1/2}} @@ -904,25 +897,24 @@ class PDSS_Water; * {\left(\frac{N_a e^2}{\epsilon R T }\right)}^{3/2} * \f] * - * Units = sqrt(kg/gmol) + * Units = sqrt(kg/gmol) * - * where - * - \f$ N_a \f$ is Avogadro's number - * - \f$ \rho_w \f$ is the density of water - * - \f$ e \f$ is the electronic charge - * - \f$ \epsilon = K \epsilon_o \f$ is the permittivity of water - * where \f$ K \f$ is the dielectric constant of water, - * and \f$ \epsilon_o \f$ is the permittivity of free space. - * - \f$ \rho_o \f$ is the density of the solvent in its standard state. + * where + * - \f$ N_a \f$ is Avogadro's number + * - \f$ \rho_w \f$ is the density of water + * - \f$ e \f$ is the electronic charge + * - \f$ \epsilon = K \epsilon_o \f$ is the permittivity of water + * - \f$ K \f$ is the dielectric constant of water, + * - \f$ \epsilon_o \f$ is the permittivity of free space. + * - \f$ \rho_o \f$ is the density of the solvent in its standard state. * - * 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 + * 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 * * @@ -1242,12 +1234,8 @@ public: //! Construct and initialize an HMWSoln ThermoPhase object //! directly from an ASCII input file /*! - * Working constructors - * - * The two constructors below are the normal way - * the phase initializes itself. They are shells that call - * the routine initThermo(), with a reference to the - * XML database to get the info for the phase. + * This constructor is a shell that calls 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 @@ -1265,7 +1253,6 @@ public: */ HMWSoln(XML_Node& phaseRef, const std::string& id = ""); - //! Copy Constructor /*! * Copy constructor for the object. Constructed @@ -1287,33 +1274,31 @@ public: */ HMWSoln& operator=(const HMWSoln& right); - - //! This is a special constructor, used to replicate test problems - //! during the initial verification of the object + //! This is a special constructor, used to replicate test problems + //! during the initial verification of the object /*! - * - * * test problems: - * 1 = NaCl problem - 5 species - - * the thermo is read in from an XML file + * 1 = NaCl problem - 5 species - the thermo is read in from an XML file * - * speci molality charge - * Cl- 6.0954 6.0997E+00 -1 - * H+ 1.0000E-08 2.1628E-09 1 - * Na+ 6.0954E+00 6.0997E+00 1 - * OH- 7.5982E-07 1.3977E-06 -1 - * HMW_params____beta0MX__beta1MX__beta2MX__CphiMX_____alphaMX__thetaij - * 10 - * 1 2 0.1775 0.2945 0.0 0.00080 2.0 0.0 - * 1 3 0.0765 0.2664 0.0 0.00127 2.0 0.0 - * 1 4 0.0 0.0 0.0 0.0 0.0 -0.050 - * 2 3 0.0 0.0 0.0 0.0 0.0 0.036 - * 2 4 0.0 0.0 0.0 0.0 0.0 0.0 - * 3 4 0.0864 0.253 0.0 0.0044 2.0 0.0 - * Triplet_interaction_parameters_psiaa'_or_psicc' - * 2 - * 1 2 3 -0.004 - * 1 3 4 -0.006 + * speci molality charge + * Cl- 6.0954 6.0997E+00 -1 + * H+ 1.0000E-08 2.1628E-09 1 + * Na+ 6.0954E+00 6.0997E+00 1 + * OH- 7.5982E-07 1.3977E-06 -1 + * + * HMW_params____beta0MX__beta1MX__beta2MX__CphiMX_____alphaMX__thetaij + * 10 + * 1 2 0.1775 0.2945 0.0 0.00080 2.0 0.0 + * 1 3 0.0765 0.2664 0.0 0.00127 2.0 0.0 + * 1 4 0.0 0.0 0.0 0.0 0.0 -0.050 + * 2 3 0.0 0.0 0.0 0.0 0.0 0.036 + * 2 4 0.0 0.0 0.0 0.0 0.0 0.0 + * 3 4 0.0864 0.253 0.0 0.0044 2.0 0.0 + * + * Triplet_interaction_parameters_psiaa'_or_psicc' + * 2 + * 1 2 3 -0.004 + * 1 3 4 -0.006 * * @param testProb Hard -coded test problem to instantiate. * Current valid values are 1. @@ -1333,10 +1318,9 @@ public: */ ThermoPhase* duplMyselfAsThermoPhase() const; - - //! Import, construct, and initialize a HMWSoln phase - /*! specification from an XML tree into the current object. - * + //! Import, construct, and initialize a HMWSoln phase + //! specification from an XML tree into the current object. + /* * This routine is a precursor to constructPhaseXML(XML_Node*) * routine, which does most of the work. * @@ -1348,17 +1332,16 @@ public: */ void constructPhaseFile(std::string inputFile, std::string id); - //! Import and initialize a HMWSoln phase specification in an XML tree into the current object. + //! Import and initialize a HMWSoln 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 @@ -1373,24 +1356,14 @@ public: */ void constructPhaseXML(XML_Node& phaseNode, std::string id); - /** - * @name Utilities - * @{ - */ + //! @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 -------------- - * @{ - */ + //! @} + //! @name Molar Thermodynamic Properties of the Solution + //! @{ /// Molar enthalpy. Units: J/kmol. /** @@ -1416,7 +1389,6 @@ public: */ virtual doublereal relative_molal_enthalpy() const; - /// Molar internal energy. Units: J/kmol. /** * Molar internal energy of the solution. Units: J/kmol. @@ -1459,17 +1431,16 @@ public: */ 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. + //!@} + //! @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. */ + //!@{ /** * Pressure. Units: Pa. @@ -1526,16 +1497,23 @@ public: //! Set the internally stored density (kg/m^3) of the phase. /*! - * Overwritten setDensity() function is necessary because of - * the underlying water model. + * 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. + * + * @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. * - * NOTE: This is an overwritten function from the State.h - * class - * * @param rho Input density (kg/m^3). */ void setDensity(const doublereal rho); @@ -1548,17 +1526,13 @@ public: * This function will now throw an error condition if the input * isn't exactly equal to the current molar density. * - * NOTE: This is a virtual function overwritten from the State.h - * class - * * @param conc Input molar density (kmol/m^3). */ void setMolarDensity(const doublereal conc); //! Set the temperature (K) /*! - * Overwritten setTemperature(double) from State.h. This - * function sets the temperature, and makes sure that + * This function sets the temperature, and makes sure that * the value propagates to underlying objects, such as * the water standard state model. * @@ -1577,13 +1551,14 @@ public: */ virtual void setState_TP(doublereal t, doublereal p); - /** * The isothermal compressibility. Units: 1/Pa. * The isothermal compressibility is defined as * \f[ * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T * \f] + * It's equal to zero for this model, since the molar volume + * doesn't change with pressure or temperature. */ virtual doublereal isothermalCompressibility() const; @@ -1594,6 +1569,8 @@ public: * \f[ * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P * \f] + * It's equal to zero for this model, since the molar volume + * doesn't change with pressure or temperature. */ virtual doublereal thermalExpansionCoeff() const; @@ -1608,8 +1585,6 @@ public: * @{ */ - - /** * @} * @name Activities, Standard States, and Activity Concentrations @@ -1623,7 +1598,6 @@ public: * @{ */ - //! This method returns an array of generalized activity concentrations /*! * The generalized activity concentrations, \f$ C_k^a\f$, are defined such that @@ -1645,7 +1619,6 @@ public: * C_o^a = C^o_o a_o * \f] * - * * @param c Array of generalized concentrations. The * units are kmol m-3 for both the solvent and the solute species */ @@ -1723,7 +1696,6 @@ public: * 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 @@ -1734,7 +1706,6 @@ public: */ virtual doublereal standardConcentration(size_t k=0) const; - //! Returns the natural logarithm of the standard //! concentration of the kth species /*! @@ -1787,9 +1758,9 @@ public: */ virtual void getActivities(doublereal* ac) const; - //@} - /// @name Partial Molar Properties of the Solution ----------------- - //@{ + //! @} + //! @name Partial Molar Properties of the Solution + //! @{ //! Get the species chemical potentials. Units: J/kmol. /*! @@ -1824,7 +1795,6 @@ public: * + R T^2 (\sum_{k \neq o} m_k) \tilde{M_o} (\frac{d \phi}{dT}) * \f] * - * * @param hbar Output vector of species partial molar enthalpies. * Length: m_kk. units are J/kmol. */ @@ -1895,66 +1865,16 @@ 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. */ virtual void getPartialMolarCp(doublereal* cpbar) const; - //@} - - - -protected: - - //! Updates the standard state thermodynamic functions at the current T and P of the solution. - /*! - * @internal - * - * This function gets called for every call to a public function in this - * class. It checks to see whether the temperature or pressure has changed and - * thus whether the ss thermodynamics functions must be recalculated. - * - * @param pres Pressure at which to evaluate the standard states. - * The default, indicated by a -1.0, is to use the current pressure - */ - //virtual void _updateStandardStateThermo() const; - - //@} - /// @name Thermodynamic Values for the Species Reference States --- - //@{ - - - /////////////////////////////////////////////////////// - // - // The methods below are not virtual, and should not - // be overloaded. - // - ////////////////////////////////////////////////////// - - /** - * @name Specific Properties - * @{ - */ - - - /** - * @name Setting the State - * - * These methods set all or part of the thermodynamic - * state. - * @{ - */ - - //@} - - /** - * @name Chemical Equilibrium - * Chemical equilibrium. - * @{ - */ public: + //! @} + //! @name Chemical Equilibrium + //! @{ //!This method is used by the ChemEquil equilibrium solver. /*! @@ -1975,7 +1895,6 @@ public: //@} - //! Set the equation of state parameters /*! * @internal @@ -2005,6 +1924,9 @@ public: * any parameters that are specific to that particular phase * model. * + * HKM -> Right now, the parameters are set elsewhere (initThermoXML) + * It just didn't seem to fit. + * * @param eosdata An XML_Node object corresponding to * the "thermo" entry for this phase in the input file. */ @@ -2013,7 +1935,6 @@ public: //--------------------------------------------------------- /// @name Critical state properties. /// These methods are only implemented by some subclasses. - //@{ /// Critical temperature (K). @@ -2077,7 +1998,6 @@ public: //@} - /* * -------------- Utilities ------------------------------- */ @@ -2101,8 +2021,6 @@ public: //! Initialize the phase parameters from an XML file. /*! - * 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. @@ -2140,7 +2058,6 @@ public: //! respect to temperature as a function of temperature //! and pressure. /*! - * * A_Debye = (F e B_Debye) / (8 Pi epsilon R T) * * Units = sqrt(kg/gmol) @@ -2182,7 +2099,6 @@ public: * * Units = sqrt(kg/gmol) (RT) * - * * @param temperature Temperature of the derivative calculation * or -1 to indicate the current temperature * @@ -2211,6 +2127,7 @@ public: */ double ADebye_J(double temperature = -1.0, 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 @@ -2226,7 +2143,6 @@ public: * * @param pressure Pressure of the derivative calculation * or -1 to indicate the current pressure - * */ double ADebye_V(double temperature = -1.0, double pressure = -1.0) const; @@ -2235,7 +2151,6 @@ public: //! respect to temperature as a function of temperature //! and pressure. /*! - * * A_Debye = (F e B_Debye) / (8 Pi epsilon R T) * * Units = sqrt(kg/gmol) @@ -2256,7 +2171,6 @@ public: double AionicRadius(int k = 0) const; /** - * * formPitzer(): * * Returns the form of the Pitzer parameterization used @@ -2265,9 +2179,7 @@ public: return m_formPitzer; } - /** - * Print out all of the input coefficients. - */ + //! Print out all of the input Pitzer coefficients. void printCoeffs() const; //! Get the array of unscaled non-dimensional molality based @@ -2289,7 +2201,6 @@ private: //! Apply the current phScale to a set of activity Coefficients /*! * See the Eq3/6 Manual for a thorough discussion. - * */ void s_updateScaling_pHScaling() const; @@ -2314,7 +2225,6 @@ private: */ void s_updateScaling_pHScaling_dP() const; - //! Calculate the Chlorine activity coefficient on the NBS scale /*! * We assume here that the m_IionicMolality variable is up to date. @@ -2353,7 +2263,6 @@ private: * The list is repeated here: * * PITZERFORM_BASE = 0 (only one supported atm) - * */ int m_formPitzer; @@ -2430,9 +2339,7 @@ private: */ double m_maxIionicStrength; - /** - * Reference Temperature for the Pitzer formulations. - */ + //! Reference Temperature for the Pitzer formulations. double m_TempPitzerRef; /** @@ -2508,19 +2415,13 @@ private: */ double m_densWaterSS; - /** - * Pointer to the water property calculator - */ + //! Pointer to the water property calculator WaterProps* m_waterProps; - /** - * Temporary array used in equilibrium calculations - */ + //! Temporary array used in equilibrium calculations mutable vector_fp m_pp; - /** - * vector of size m_kk, used as a temporary holding area. - */ + //! vector of size m_kk, used as a temporary holding area. mutable vector_fp m_tmpV; /** @@ -2845,7 +2746,6 @@ private: */ Array2D m_Lambda_nj_coeff; - //! Mu coefficient for the self-ternary neutral coefficient /*! * Array of 2D data used in the Pitzer/HMW formulation. @@ -2883,17 +2783,13 @@ private: 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. /*! - * 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. * * index is the species index */ @@ -2902,8 +2798,8 @@ private: //! 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. * * index is the species index */ @@ -2970,14 +2866,10 @@ private: */ mutable vector_int m_CounterIJ; - /** - * This is elambda, MEC - */ + //! This is elambda, MEC mutable double elambda[17]; - /** - * This is elambda1, MEC - */ + //! This is elambda1, MEC mutable double elambda1[17]; /** @@ -3199,18 +3091,6 @@ private: */ doublereal IMS_slopefCut_; - //! Parameter in the polyExp cutoff treatment having to do with rate of exp decay - doublereal IMS_dfCut_; - - //! Parameter in the polyExp cutoff treatment having to do with rate of exp decay - doublereal IMS_efCut_; - - //! Parameter in the polyExp cutoff treatment having to do with rate of exp decay - doublereal IMS_afCut_; - - //! Parameter in the polyExp cutoff treatment having to do with rate of exp decay - doublereal IMS_bfCut_; - //! Parameter in the polyExp cutoff treatment /*! * This is the slope of the g function at the zero solvent point @@ -3218,18 +3098,17 @@ private: */ doublereal IMS_slopegCut_; - //! Parameter in the polyExp cutoff treatment having to do with - //! rate of exp decay + //! @name Parameters in the polyExp cutoff treatment having to do with rate of exp decay + //! @{ + doublereal IMS_dfCut_; + doublereal IMS_efCut_; + doublereal IMS_afCut_; + doublereal IMS_bfCut_; doublereal IMS_dgCut_; - - //! Parameter in the polyExp cutoff treatment having to do with rate of exp decay doublereal IMS_egCut_; - - //! Parameter in the polyExp cutoff treatment having to do with rate of exp decay doublereal IMS_agCut_; - - //! Parameter in the polyExp cutoff treatment having to do with rate of exp decay doublereal IMS_bgCut_; + //! @} //! value of the solvent mole fraction that centers the cutoff polynomials //! for the cutoff =1 process; @@ -3245,45 +3124,29 @@ private: */ doublereal MC_slopepCut_; - //! Parameter in the Molality Exp cutoff treatment + //! @name Parameters in the Molality Exp cutoff treatment + //! @{ doublereal MC_dpCut_; - - //! Parameter in the Molality Exp cutoff treatment doublereal MC_epCut_; - - //! Parameter in the Molality Exp cutoff treatment doublereal MC_apCut_; - - //! Parameter in the Molality Exp cutoff treatment doublereal MC_bpCut_; - - //! Parameter in the Molality Exp cutoff treatment doublereal MC_cpCut_; - - //! Parameter in the Molality Exp cutoff treatment doublereal CROP_ln_gamma_o_min; - - //! Parameter in the Molality Exp cutoff treatment doublereal CROP_ln_gamma_o_max; - - //! Parameter in the Molality Exp cutoff treatment doublereal CROP_ln_gamma_k_min; - - //! Parameter in the Molality Exp cutoff treatment doublereal CROP_ln_gamma_k_max; //! This is a boolean-type vector indicating whether //! a species's activity coefficient is in the cropped regime /*! - * - * 0 = Not in cropped regime - * 1 = In a transition regime where it is altered but there - * still may be a temperature or pressure dependence - * 2 = In a cropped regime where there is no temperature - * or pressure dependence + * * 0 = Not in cropped regime + * * 1 = In a transition regime where it is altered but there + * still may be a temperature or pressure dependence + * * 2 = In a cropped regime where there is no temperature + * or pressure dependence */ mutable std::vector CROP_speciesCropped_; - + //! @} //! Local error routine /*! @@ -3291,7 +3154,7 @@ private: */ doublereal err(const std::string& msg) const; - //! Initialize all of the species - dependent lengths in the object + //! Initialize all of the species-dependent lengths in the object void initLengths(); //! Apply the current phScale to a set of activity Coefficients or @@ -3314,7 +3177,8 @@ private: //! This function calculates the temperature derivative of the //! natural logarithm of the molality activity coefficients. /*! - * This is the private function. It does all of the direct work. + * This function does all of the direct work. The solvent activity + * coefficient is on the molality scale. It's derivative is too. */ void s_update_dlnMolalityActCoeff_dT() const; @@ -3328,6 +3192,8 @@ private: /** * This function calculates the pressure derivative of the * natural logarithm of the molality activity coefficients. + * + * Assumes that the activity coefficients are current. */ void s_update_dlnMolalityActCoeff_dP() const; @@ -3344,9 +3210,11 @@ private: void s_updateIMS_lnMolalityActCoeff() const; private: + //! Calculate the Pitzer portion of the activity coefficients. /** - * This function does the main pitzer coefficient - * calculation + * 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; @@ -3359,23 +3227,22 @@ private: void s_updatePitzer_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. + * + * It is assumed that the Pitzer activity coefficient and first derivative + * routine are called immediately preceding the call to this routine. */ void s_updatePitzer_d2lnMolalityActCoeff_dT2() const; //! Calculates the Pressure 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 + * It is assumed that the Pitzer activity coefficient and first derivative + * routine are called immediately preceding the calling of this routine. */ void s_updatePitzer_dlnMolalityActCoeff_dP() const; - - - //! Calculates the Pitzer coefficients' dependence on the temperature. /*! * It will also calculate the temperature @@ -3391,13 +3258,12 @@ private: */ 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). + * Calculate E-lambda terms for charge combinations of like sign, using + * method of Pitzer (1975). This implementation is based on Bethke, + * Appendix 2. * * @param is Ionic strength */ @@ -3406,9 +3272,10 @@ private: /** * Calculate etheta and etheta_prime * - * 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. * @@ -3571,4 +3438,3 @@ public: } #endif - diff --git a/include/cantera/thermo/IdealMolalSoln.h b/include/cantera/thermo/IdealMolalSoln.h index f772c0ae6..93d369746 100644 --- a/include/cantera/thermo/IdealMolalSoln.h +++ b/include/cantera/thermo/IdealMolalSoln.h @@ -30,7 +30,6 @@ namespace Cantera /* @{ */ - /** * This phase is based upon the mixing-rule assumption that * all molality-based activity coefficients are equal @@ -65,12 +64,12 @@ namespace Cantera * depending on the value of the member attribute m_formGC, which * is supplied in the XML file. * - * - * - * - * - * - *
m_formGC ActivityConc StandardConc
0 \f$ {m_k}/ { m^{\Delta}}\f$ \f$ 1.0 \f$
1 \f$ m_k / (m^{\Delta} V_k)\f$ \f$ 1.0 / V_k \f$
2 \f$ m_k / (m^{\Delta} V^0_0)\f$ \f$ 1.0 / V^0_0\f$
+ * + * + * + * + * + *
m_formGC ActivityConc StandardConc
0 \f$ {m_k}/ { m^{\Delta}}\f$ \f$ 1.0 \f$
1 \f$ m_k / (m^{\Delta} V_k)\f$ \f$ 1.0 / V_k \f$
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$. @@ -80,37 +79,26 @@ namespace Cantera * The value and form of the activity concentration will affect * reaction rate constants involving species in this phase. * - * @verbatim - - - H2O(l) - - - - 1.0E-5 - 1.0E-5 - 0.20 - 0.05 - 0.6 - 0.0 - - - - - - - - - - @endverbatim - * + * + * + * H2O(l) + * + * + * 1.0E-5 + * 1.0E-5 + * 0.20 + * 0.05 + * 0.6 + * 0.0 + * + * + * */ class IdealMolalSoln : public MolalityVPSSTP { - public: - /// Constructors + /// Constructor IdealMolalSoln(); //! Copy Constructor @@ -153,11 +141,8 @@ public: */ ThermoPhase* duplMyselfAsThermoPhase() const; - /** - * - * @name Utilities - * @{ - */ + //! @name Utilities + //! @{ /** * Equation of state type flag. The base class returns @@ -169,15 +154,12 @@ public: return 0; } - /** - * @} - * @name Molar Thermodynamic Properties of the Solution --------------- - * @{ - */ + //! @} + //! @name Molar Thermodynamic Properties of the Solution + //! @{ //! Molar enthalpy of the solution. Units: J/kmol. /*! - * * Returns the amount of enthalpy per mole of solution. * For an ideal molal solution, * \f[ @@ -194,7 +176,6 @@ public: //! Molar internal energy of the solution: Units: J/kmol. /*! - * * Returns the amount of internal energy per mole of solution. * For an ideal molal solution, * \f[ @@ -223,9 +204,7 @@ public: //! Molar Gibbs function for the solution: Units J/kmol. /*! - * - * Returns the gibbs free energy of the solution per mole - * of the solution. + * Returns the gibbs free energy of the solution per mole of the solution. * * \f[ * \bar{g}(T, P, X_k) = \sum_k X_k \mu_k(T) @@ -237,7 +216,7 @@ public: //! Molar heat capacity of the solution at constant pressure. Units: J/kmol/K. /*! - * \f[ + * \f[ * \bar{c}_p(T, P, X_k) = \sum_k X_k \bar{c}_{p,k}(T) * \f] * @@ -247,15 +226,12 @@ public: //! Molar heat capacity of the solution at constant volume. Units: J/kmol/K. /*! - * Molar heat capacity at constant volume: Units: J/kmol/K. * NOT IMPLEMENTED. - * Units: J/kmol/K */ virtual doublereal cv_mole() const; //@} - /** @name Mechanical Equation of State Properties ------------------------- - //@{ + /** @name Mechanical Equation of State Properties * * In this equation of state implementation, the density is a * function only of the mole fractions. Therefore, it can't be @@ -264,8 +240,7 @@ public: * state by calling setDensity() may cause an exception to be * thrown. */ - - + //@{ /** * Set the pressure at constant temperature. Units: Pa. @@ -296,9 +271,6 @@ protected: * species molar volumes. We have additionally specified * in this class that the pure species molar volumes are * independent of temperature and pressure. - * - * NOTE: This is a non-virtual function, which is not a - * member of the ThermoPhase base class. */ void calcDensity(); @@ -316,9 +288,6 @@ public: * * This function will now throw an error condition. * - * NOTE: This is an overwritten function from the State.h - * class - * * @param rho Input Density */ void setDensity(const doublereal rho); @@ -329,9 +298,6 @@ public: * * This function will now throw an error condition. * - * NOTE: This is an overwritten function from the State.h - * class - * * @param rho Input Density */ void setMolarDensity(const doublereal rho); @@ -381,12 +347,9 @@ public: * @{ */ - //!Set the potential energy of species k to pe. /*! * Units: J/kmol. - * This function must be reimplemented in inherited classes - * of ThermoPhase. * * @param k Species index * @param pe Input potential energy. @@ -395,11 +358,9 @@ public: err("setPotentialEnergy"); } - /* + /** * Get the potential energy of species k. * Units: J/kmol. - * This function must be reimplemented in inherited classes - * of ThermoPhase. * * @param k Species index */ @@ -468,13 +429,13 @@ public: * the program and in the XML input files. * * @param uA Output vector containing the units - * uA[0] = kmol units - default = 1 - * uA[1] = m units - default = -nDim(), the number of spatial - * dimensions in the Phase class. - * uA[2] = kg units - default = 0; - * uA[3] = Pa(pressure) units - default = 0; - * uA[4] = Temperature units - default = 0; - * uA[5] = time units - default = 0 + * uA[0] = kmol units - default = 1 + * uA[1] = m units - default = -nDim(), the number of spatial + * dimensions in the Phase class. + * uA[2] = kg units - default = 0; + * uA[3] = Pa(pressure) units - default = 0; + * uA[4] = Temperature units - default = 0; + * uA[5] = time units - default = 0 * @param k species index. Defaults to 0. * @param sizeUA output int containing the size of the vector. * Currently, this is equal to 6. @@ -510,13 +471,12 @@ public: getMolalityActivityCoefficients(doublereal* acMolality) const; //@} - /// @name Partial Molar Properties of the Solution ----------------- + /// @name Partial Molar Properties of the Solution //@{ //!Get the species chemical potentials: Units: J/kmol. /*! - * * This function returns a vector of chemical potentials of the * species in solution. * @@ -531,7 +491,7 @@ public: * \f$ w \f$ refers to the solvent species. * \f$ X_w \f$ is the mole fraction of the solvent. * \f$ m_k \f$ is the molality of the kth solute. - * \f$ m^\Delta is 1 gmol solute per kg solvent. \f$ + * \f$ m^\Delta \f$ is 1 gmol solute per kg solvent. * * Units: J/kmol. * @@ -622,47 +582,9 @@ public: */ virtual void getPartialMolarCp(doublereal* cpbar) const; - //@} - /// @name Properties of the Standard State of the Species - // in the Solution -- - //@{ - - - - - //@} - /// @name Thermodynamic Values for the Species Reference States --- - //@{ - - - /////////////////////////////////////////////////////// - // - // The methods below are not virtual, and should not - // be overloaded. - // - ////////////////////////////////////////////////////// - - /** - * @name Specific Properties - * @{ - */ - - - /** - * @name Setting the State - * - * These methods set all or part of the thermodynamic - * state. - * @{ - */ - - //@} - - /** - * @name Chemical Equilibrium - * Chemical equilibrium. - * @{ - */ + //!@} + //! @name Chemical Equilibrium + //! @{ /** * This method is used by the ChemEquil equilibrium solver. @@ -710,12 +632,15 @@ public: * any parameters that are specific to that particular phase * model. * + * HKM -> Right now, the parameters are set elsewhere (initThermo) + * It just didn't seem to fit. + * + * * @param eosdata An XML_Node object corresponding to * the "thermo" entry for this phase in the input file. */ virtual void setParametersFromXML(const XML_Node& eosdata); - //--------------------------------------------------------- /// @name Critical state properties. /// These methods are only implemented by some subclasses. @@ -751,14 +676,6 @@ public: //@} - /// @name Saturation properties. - /// These methods are only implemented by subclasses that - /// implement full liquid-vapor equations of state. - /// - - //@} - - /* * -------------- Utilities ------------------------------- */ @@ -793,8 +710,7 @@ public: //! Report the molar volume of species k /*! - * - * units - \f$ m^3 kmol^-1 \f$ + * units - \f$ m^3 kmol^{-1} \f$ * * @param k Species index. */ @@ -802,7 +718,7 @@ public: /*! * Fill in a return vector containing the species molar volumes - * units - \f$ m^3 kmol^-1 \f$ + * units - \f$ m^3 kmol^{-1} \f$ * * @param smv Output vector of species molar volumes. */ @@ -811,7 +727,7 @@ public: protected: /** - * Species molar volume \f$ m^3 kmol^-1 \f$ + * Species molar volume \f$ m^3 kmol^{-1} \f$ */ vector_fp m_speciesMolarVolume; @@ -820,12 +736,12 @@ protected: * depending on the value of the member attribute m_formGC, which * is supplied in the XML file. * - * + *
* * * * - *
m_formGC ActivityConc StandardConc
0 \f$ {m_k}/ { m^{\Delta}}\f$ \f$ 1.0 \f$
1 \f$ m_k / (m^{\Delta} V_k)\f$ \f$ 1.0 / V_k \f$
2 \f$ m_k / (m^{\Delta} V^0_0)\f$ \f$ 1.0 / V^0_0\f$
+ * */ int m_formGC; @@ -834,7 +750,6 @@ public: int IMS_typeCutoff_; private: - /** * Temporary array used in equilibrium calculations */ @@ -861,9 +776,6 @@ public: //! gamma_k minimum for the cutoff process at the zero solvent point doublereal IMS_gamma_k_min_; - //! Parameter in the polyExp cutoff treatment having to do with rate of exp decay - doublereal IMS_cCut_; - //! Parameter in the polyExp cutoff treatment /*! * This is the slope of the f function at the zero solvent point @@ -871,18 +783,6 @@ public: */ doublereal IMS_slopefCut_; - //! Parameter in the polyExp cutoff treatment having to do with rate of exp decay - doublereal IMS_dfCut_; - - //! Parameter in the polyExp cutoff treatment having to do with rate of exp decay - doublereal IMS_efCut_; - - //! Parameter in the polyExp cutoff treatment having to do with rate of exp decay - doublereal IMS_afCut_; - - //! Parameter in the polyExp cutoff treatment having to do with rate of exp decay - doublereal IMS_bfCut_; - //! Parameter in the polyExp cutoff treatment /*! * This is the slope of the g function at the zero solvent point @@ -890,17 +790,18 @@ public: */ doublereal IMS_slopegCut_; - //! Parameter in the polyExp cutoff treatment having to do with rate of exp decay + //! @name Parameters in the polyExp cutoff treatment having to do with rate of exp decay + //! @{ + doublereal IMS_cCut_; + doublereal IMS_dfCut_; + doublereal IMS_efCut_; + doublereal IMS_afCut_; + doublereal IMS_bfCut_; doublereal IMS_dgCut_; - - //! Parameter in the polyExp cutoff treatment having to do with rate of exp decay doublereal IMS_egCut_; - - //! Parameter in the polyExp cutoff treatment having to do with rate of exp decay doublereal IMS_agCut_; - - //! Parameter in the polyExp cutoff treatment having to do with rate of exp decay doublereal IMS_bgCut_; + //! @} private: @@ -914,7 +815,11 @@ private: //! natural logarithm of the molality activity coefficients /*! * Normally the solutes are all zero. However, sometimes they are not, - * due to stability schemes + * due to stability schemes. + * + * gamma_k_molar = gamma_k_molal / Xmol_solvent + * + * gamma_o_molar = gamma_o_molal */ void s_updateIMS_lnMolalityActCoeff() const; @@ -938,8 +843,3 @@ private: } #endif - - - - - diff --git a/include/cantera/thermo/IdealSolnGasVPSS.h b/include/cantera/thermo/IdealSolnGasVPSS.h index 40fd06e9e..acab35610 100644 --- a/include/cantera/thermo/IdealSolnGasVPSS.h +++ b/include/cantera/thermo/IdealSolnGasVPSS.h @@ -19,12 +19,12 @@ namespace Cantera { - class XML_Node; class PDSS; /*! - * @name CONSTANTS - Models for the Standard State of IdealSolnPhase's + * @name CONSTANTS + * Models for the Standard State of an IdealSolnPhase */ //@{ const int cIdealSolnGasPhaseG = 6009; @@ -32,29 +32,26 @@ const int cIdealSolnGasPhase0 = 6010; const int cIdealSolnGasPhase1 = 6011; const int cIdealSolnGasPhase2 = 6012; - /** * @ingroup thermoprops * - * This class can handle either an ideal solution or an ideal gas approximation - * of a phase. - * + * An ideal solution or an ideal gas approximation of a phase. Uses variable + * pressure standard state methods for calculating thermodynamic properties. * * @nosubgrouping */ class IdealSolnGasVPSS : public VPStandardStateTP { - public: - /*! - * * @name Constructors and Duplicators for %IdealSolnGasVPSS - * */ + //! @{ + /// Constructor. IdealSolnGasVPSS(); + /// Create an object from an XML input file IdealSolnGasVPSS(const std::string& infile, std::string id=""); /// Copy Constructor. @@ -66,16 +63,11 @@ public: /// Destructor. virtual ~IdealSolnGasVPSS(); - /* - * Duplication routine - */ + //! Duplication routine virtual ThermoPhase* duplMyselfAsThermoPhase() const; //@} - - /** - * @name Utilities (IdealSolnGasVPSS) - */ + //! @name Utilities (IdealSolnGasVPSS) //@{ /** * Equation of state type flag. The base class returns @@ -85,7 +77,9 @@ public: */ virtual int eosType() const; - //@} + //! @} + //! @name Molar Thermodynamic Properties + //! @{ /// Molar enthalpy. Units: J/kmol. doublereal enthalpy_mole() const; @@ -105,11 +99,9 @@ public: /// Molar heat capacity at constant volume. Units: J/kmol/K. doublereal cv_mole() const; - /** - * @} - * @name Mechanical Properties - * @{ - */ + //! @} + //! @name Mechanical Properties + //! @{ //! Set the pressure in the fluid /*! @@ -146,14 +138,11 @@ protected: * species standard state molar volumes. * The species molar volumes may be functions * of temperature and pressure. - * - * NOTE: This is a non-virtual function, which is not a - * member of the ThermoPhase base class. */ virtual void calcDensity(); + //! @} public: - //! This method returns an array of generalized concentrations /*! * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / @@ -236,7 +225,7 @@ public: virtual void getActivityCoefficients(doublereal* ac) const; - /// @name Partial Molar Properties of the Solution (IdealSolnGasVPSS) + /// @name Partial Molar Properties of the Solution //@{ //! Get the array of non-dimensional species chemical potentials @@ -300,34 +289,10 @@ public: * Length = m_kk. units are m^3/kmol. */ virtual void getPartialMolarVolumes(doublereal* vbar) const; - //@} - /*! - * @name Properties of the Standard State of the Species in the Solution - * - * Properties of the standard states are delegated to the VPSSMgr object. - * The values are cached within this object, and are not recalculated unless - * the temperature or pressure changes. - */ - //@{ - - //@} - - /// @name Thermodynamic Values for the Species Reference States (IdealSolnGasVPSS) - /*! - * Properties of the reference states are delegated to the VPSSMgr object. - * The values are cached within this object, and are not recalculated unless - * the temperature or pressure changes. - */ - //@{ - - //@} - - public: - - //! @name Initialization Methods - For Internal use (VPStandardState) + //! @name Initialization Methods - For Internal use /*! * The following methods are used in the process of constructing * the phase and setting its parameters from a specification in an @@ -337,9 +302,7 @@ public: */ //@{ - - //! Set equation of state parameter values from XML - //! entries. + //! Set equation of state parameter values from XML entries. /*! * This method is called by function importPhase in * file importCTML.cpp when processing a phase definition in @@ -368,7 +331,6 @@ public: */ virtual void initThermo(); - //!This method is used by the ChemEquil equilibrium solver. /*! * It sets the state such that the chemical potentials satisfy @@ -386,7 +348,6 @@ public: //! Initialize a ThermoPhase object, potentially reading activity //! coefficient information from an XML database. /*! - * * This routine initializes the lengths in the current object and * then calls the parent routine. * This method is provided to allow @@ -415,15 +376,13 @@ public: private: //! @internal Initialize the internal lengths in this object. /*! - * Note this is not a virtual function and only handles - * this object + * Note this is not a virtual function and only handles this object */ void initLengths(); //@} protected: - //! boolean indicating what ideal solution this is /*! * - 1 = ideal gas @@ -441,7 +400,6 @@ protected: //! Temporary storage - length = m_kk. vector_fp m_pp; - }; } diff --git a/include/cantera/thermo/IonsFromNeutralVPSSTP.h b/include/cantera/thermo/IonsFromNeutralVPSSTP.h index 51102e390..15d4b03b9 100644 --- a/include/cantera/thermo/IonsFromNeutralVPSSTP.h +++ b/include/cantera/thermo/IonsFromNeutralVPSSTP.h @@ -5,7 +5,7 @@ * (see \ref thermoprops * and class \link Cantera::IonsFromNeutralVPSSTP IonsFromNeutralVPSSTP\endlink). * - * Header file for a derived class of %ThermoPhase that handles + * Header file for a derived class of ThermoPhase that handles * variable pressure standard state methods for calculating * thermodynamic properties that are further based upon activities * based on the molality scale. These include most of the methods for @@ -53,30 +53,29 @@ enum IonSolnType_enumType { * * This object actually employs 4 different mole fraction types. * - * 1) There is a mole fraction associated the the cations and + * 1. There is a mole fraction associated the the cations and * anions and neutrals from this ThermoPhase object. This * is the normal mole fraction vector for this object. * Note, however, it isn't the appropriate mole fraction * vector to use even for obtaining the correct ideal * free energies of mixing. - * 2) There is a mole fraction vector associated with the + * 2. There is a mole fraction vector associated with the * neutral molecule ThermoPhase object. - * 3) There is a mole fraction vector associated with the + * 3. There is a mole fraction vector associated with the * cation lattice. - * 4) There is a mole fraction vector associated with the + * 4. There is a mole fraction vector associated with the * anion lattice * * This object can translate between any of the four mole * fraction representations. - * - * */ class IonsFromNeutralVPSSTP : public GibbsExcessVPSSTP { - public: - /// Constructors + //! @name Constructors + //! @{ + /*! * Default constructor */ @@ -85,12 +84,8 @@ public: //! Construct and initialize an IonsFromNeutralVPSSTP object //! directly from an ASCII input file /*! - * Working constructors - * - * The two constructors below are the normal way - * the phase initializes itself. They are shells that call - * the routine initThermo(), with a reference to the - * XML database to get the info for the phase. + * This constructor is a shell around the routine initThermo(), with a + * reference to the XML database to get the info for the phase. * * @param inputFile Name of the input file containing the phase XML data * to set up the object @@ -134,16 +129,12 @@ public: //! Copy constructor /*! - * Note this stuff will not work until the underlying phase - * has a working copy constructor - * * @param b class to be copied */ IonsFromNeutralVPSSTP(const IonsFromNeutralVPSSTP& b); /// Assignment operator /*! - * * @param b class to be copied. */ IonsFromNeutralVPSSTP& operator=(const IonsFromNeutralVPSSTP& b); @@ -159,6 +150,8 @@ public: */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; + // @} + /// The following methods are used in the process of constructing /// the phase and setting its parameters from a specification in an /// input file. @@ -202,13 +195,8 @@ public: */ void constructPhaseXML(XML_Node& phaseNode, std::string id); - - /** - * - * @name Utilities - * @{ - */ - + //! @name Utilities + //! @{ //! Equation of state type flag. /*! @@ -220,81 +208,36 @@ public: */ virtual int eosType() const; - - - /** - * @} - * @name Molar Thermodynamic Properties - * @{ - */ + //! @} + //! @name Molar Thermodynamic Properties + //! @{ //! Return the Molar enthalpy. Units: J/kmol. /*! - * This is calculated from the partial molar enthalpies of the species + * This is calculated from the partial molar enthalpies of the species. */ virtual doublereal enthalpy_mole() const; /** * Molar internal energy. J/kmol. - * * + * * This is calculated from the soln enthalpy and then * subtracting pV. */ virtual doublereal intEnergy_mole() const; - /** - * Molar entropy. Units: J/kmol/K. - * - * - */ + //! Molar entropy. Units: J/kmol/K. virtual doublereal entropy_mole() const; - /** - * Molar Gibbs free Energy for an ideal gas. - * Units = J/kmol. - */ + //! Molar Gibbs free Energy for an ideal gas. Units = J/kmol. virtual doublereal gibbs_mole() const; - /** - * Molar heat capacity at constant pressure. Units: J/kmol/K. - * For an ideal gas mixture, - * - */ + //! Molar heat capacity at constant pressure. Units: J/kmol/K. virtual doublereal cp_mole() const; - /** - * Molar heat capacity at constant volume. Units: J/kmol/K. - * - */ + //! Molar heat capacity at constant volume. Units: J/kmol/K. virtual doublereal cv_mole() const; - - /** - * @} - * @name Utilities - * @{ - */ - - - - - /** - * @} - * @name Mechanical Properties - * @{ - */ - - /** - * @} - * @name Potential Energy - * - * Species may have an additional potential energy due to the - * presence of external gravitation or electric fields. These - * methods allow specifying a potential energy for individual - * species. - * @{ - */ - /** * @} * @name Activities, Standard States, and Activity Concentrations @@ -314,7 +257,6 @@ public: */ virtual void getActivityCoefficients(doublereal* ac) const; - //@} /// @name Partial Molar Properties of the Solution //@{ @@ -330,7 +272,6 @@ public: */ virtual void getChemPotentials(doublereal* mu) const; - //! Returns an array of partial molar enthalpies for the species //! in the mixture. /*! @@ -387,13 +328,14 @@ public: //! Get the array of log concentration-like derivatives of the //! log activity coefficients - diagonal component /*! - * This function is a virtual method. For ideal mixtures - * (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the - * logarithm of the activity coefficient with respect to the - * logarithm of the mole fraction. + * For ideal mixtures (unity activity coefficients), this can return zero. + * Implementations should take the derivative of the logarithm of the + * activity coefficient with respect to the logarithm of the mole + * fraction. This quantity is to be used in conjunction with derivatives + * of that concentration-like variable when the derivative of the chemical + * potential is taken. * - * units = dimensionless + * units = dimensionless * * @param dlnActCoeffdlnX_diag Output vector of log(mole fraction) * derivatives of the log Activity Coefficients. @@ -404,11 +346,10 @@ public: //! Get the array of log concentration-like derivatives of the //! log activity coefficients - diagonal components /*! - * This function is a virtual method. For ideal mixtures - * (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the - * logarithm of the activity coefficient with respect to the - * logarithm of the species mole numbe. This routine just does the diagonal entries. + * For ideal mixtures (unity activity coefficients), this can return zero. + * Implementations should take the derivative of the logarithm of the + * activity coefficient with respect to the logarithm of the species mole + * numbe. This routine just does the diagonal entries. * * units = dimensionless * @@ -437,7 +378,7 @@ public: * log Activity Coefficients. length = m_kk * m_kk */ virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN) ; - + //! @} //! Get the Salt Dissociation Coefficients //! Returns the vector of dissociation coefficients and vector of charges @@ -450,7 +391,6 @@ public: */ void getDissociationCoeffs(vector_fp& fm_neutralMolec_ions, vector_fp& charges, std::vector& neutMolIndex) const; - //! Return the current value of the neutral mole fraction vector /*! * @param neutralMoleculeMoleFractions Vector of neutral molecule mole fractions. @@ -494,36 +434,9 @@ public: anion=anionList_; } - - //@} - /// @name Properties of the Standard State of the Species in the Solution - //@{ - - - - //@} - /// @name Thermodynamic Values for the Species Reference States - //@{ - - - /////////////////////////////////////////////////////// - // - // The methods below are not virtual, and should not - // be overloaded. - // - ////////////////////////////////////////////////////// - - /** - * @name Specific Properties - * @{ - */ - - /** * @name Setting the State - * - * These methods set all or part of the thermodynamic - * state. + * These methods set all or part of the thermodynamic state. * @{ */ @@ -540,8 +453,7 @@ public: virtual void setState_TP(doublereal t, doublereal p); - //! Calculate ion mole fractions from neutral molecule - //! mole fractions. + //! Calculate ion mole fractions from neutral molecule mole fractions. /*! * @param mf Dump the mole fractions into this vector. */ @@ -612,8 +524,7 @@ public: virtual void setMoleFractions_NoNorm(const doublereal* const x); /** - * Set the concentrations to the specified values within the - * phase. + * Set the concentrations to the specified values within the phase. * * @param c The input vector to this routine is in dimensional * units. For volumetric phases c[k] is the @@ -641,7 +552,6 @@ public: */ virtual void initThermo(); - /** * Import and initialize a ThermoPhase object * @@ -660,8 +570,6 @@ public: private: - - //! Initialize lengths of local variables after all species have //! been identified. void initLengths(); @@ -752,16 +660,15 @@ protected: //! Formula Matrix for composition of neutral molecules //! in terms of the molecules in this ThermoPhase /*! - * fm_neutralMolec_ions[ i + jNeut * m_kk ] + * fm_neutralMolec_ions[ i + jNeut * m_kk ] * - * This is the number of ions of type i in the neutral - * molecule jNeut. + * This is the number of ions of type i in the neutral + * molecule jNeut. */ std::vector fm_neutralMolec_ions_; //! Mapping between ion species and neutral molecule for quick invert. /*! - * * fm_invert_ionForNeutral returns vector of int. Each element represents * an ionic species and stores the value of the corresponding neutral * molecule @@ -774,11 +681,11 @@ protected: * We assume that for a selected set of ion species, that that * ion is only in the neutral molecule, jNeut. * - * therefore, + * therefore, * * NeutralMolecMoleFractions_[jNeut] += moleFractions_[i_ion] / fmij; * - * where fmij is the number of ions in neutral molecule jNeut. + * where fmij is the number of ions in neutral molecule jNeut. * * Thus, we formulate the neutral molecule mole fraction NeutralMolecMoleFractions_[] * vector from this association. We further assume that there are @@ -791,7 +698,6 @@ protected: //! Mole fractions using the Neutral Molecule Mole fraction basis mutable std::vector NeutralMolecMoleFractions_; - //! List of the species in this ThermoPhase which are cation species std::vector cationList_; @@ -845,8 +751,8 @@ private: * This vector is used as a temporary storage area when calculating the ion chemical * potentials. * - * Units = Joules/kmol - * Length = numNeutralMoleculeSpecies_ + * - Units = Joules/kmol + * - Length = numNeutralMoleculeSpecies_ */ mutable std::vector muNeutralMolecule_; @@ -855,18 +761,17 @@ private: * This vector is used as a temporary storage area when calculating the ion chemical * potentials and activity coefficients * - * Units = none - * Length = numNeutralMoleculeSpecies_ + * - Units = none + * - Length = numNeutralMoleculeSpecies_ */ mutable std::vector lnActCoeff_NeutralMolecule_; //! Storage vector for the neutral molecule d ln activity coefficients dT /*! * This vector is used as a temporary storage area when calculating the ion derivatives - * - * Units = 1/Kelvin - * Length = numNeutralMoleculeSpecies_ + * - Units = 1/Kelvin + * - Length = numNeutralMoleculeSpecies_ */ mutable std::vector dlnActCoeffdT_NeutralMolecule_; @@ -874,8 +779,8 @@ private: /*! * This vector is used as a temporary storage area when calculating the ion derivatives * - * Units = none - * Length = numNeutralMoleculeSpecies_ + * - Units = none + * - Length = numNeutralMoleculeSpecies_ */ mutable std::vector dlnActCoeffdlnX_diag_NeutralMolecule_; @@ -883,8 +788,8 @@ private: /*! * This vector is used as a temporary storage area when calculating the ion derivatives * - * Units = none - * Length = numNeutralMoleculeSpecies_ + * - Units = none + * - Length = numNeutralMoleculeSpecies_ */ mutable std::vector dlnActCoeffdlnN_diag_NeutralMolecule_; @@ -892,17 +797,12 @@ private: /*! * This vector is used as a temporary storage area when calculating the ion derivatives * - * Units = none - * Length = numNeutralMoleculeSpecies_ + * - Units = none + * - Length = numNeutralMoleculeSpecies_ */ mutable Array2D dlnActCoeffdlnN_NeutralMolecule_; - }; - - - - } #endif diff --git a/include/cantera/thermo/MargulesVPSSTP.h b/include/cantera/thermo/MargulesVPSSTP.h index 6e356114f..9f7d46314 100644 --- a/include/cantera/thermo/MargulesVPSSTP.h +++ b/include/cantera/thermo/MargulesVPSSTP.h @@ -28,7 +28,6 @@ namespace Cantera * @ingroup thermoprops */ - //! MargulesVPSSTP is a derived class of GibbsExcessVPSSTP that employs //! the Margules approximation for the excess gibbs free energy /*! @@ -91,7 +90,7 @@ namespace Cantera * S^E_i = n X_{Ai} X_{Bi} \left( s_{o,i} + s_{1,i} X_{Bi} \right) * \f] * - * where n is the total moles in the solution. + * where n is the total moles in the solution. * * The activity of a species defined in the phase is given by an excess * Gibbs free energy formulation. @@ -100,7 +99,7 @@ namespace Cantera * a_k = \gamma_k X_k * \f] * - * where + * where * * \f[ * R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i} @@ -188,7 +187,6 @@ namespace Cantera * C_j^a = C^s a_j \mbox{\quad and \quad} C_k^a = C^s a_k * \f] * - * * \f$ C_j^a \f$ is the activity concentration of species j, and * \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^s \f$ * is the standard concentration. \f$ a_j \f$ is @@ -224,11 +222,11 @@ namespace Cantera * \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT} * \f] * - * %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$, - * using the second and third part of the above expression as a definition for the concentration - * equilibrium constant. + * %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$, + * using the second and third part of the above expression as a definition for the concentration + * equilibrium constant. * - * For completeness, the pressure equilibrium constant may be obtained as well + * For completeness, the pressure equilibrium constant may be obtained as well * * \f[ * \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) @@ -254,65 +252,12 @@ namespace Cantera * * \f$k^{-1} \f$ has units of s-1. * - * - *
- *

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: - * - * @code - * XML_Node *xc = get_XML_File("silane.xml"); - * XML_Node * const xs = xc->findNameID("phase", "silane"); - * ThermoPhase *silane_tp = newPhase(*xs); - * IdealGasPhase *silaneGas = dynamic_cast (silane_tp); - * @endcode - * - * or by the following constructor: - * - * @code - * XML_Node *xc = get_XML_File("silane.xml"); - * XML_Node * const xs = xc->findNameID("phase", "silane"); - * IdealGasPhase *silaneGas = new IdealGasPhase(*xs); - * @endcode - * - *
- *

XML Example

- *
- * An example of an XML Element named phase setting up a IdealGasPhase - * object named silane is given below. - * - * - * @verbatim - - - Si H He - - H2 H HE SIH4 SI SIH SIH2 SIH3 H3SISIH SI2H6 - H2SISIH2 SI3H8 SI2 SI3 - - - - - - - @endverbatim - * - * The model attribute "IdealGas" of the thermo XML element identifies the phase as - * being of the type handled by the IdealGasPhase object. - * - * @ingroup thermoprops - * - -*/ + * @ingroup thermoprops + */ class MargulesVPSSTP : public GibbsExcessVPSSTP { public: - //! Constructor /*! * This doesn't do much more than initialize constants with @@ -350,14 +295,11 @@ public: */ MargulesVPSSTP(XML_Node& phaseRef, const std::string& id = ""); - //! Special constructor for a hard-coded problem /*! - * - * @param testProb Hard-coded value. Only the value of 1 is - * used. It's for - * a LiKCl system - * -> test to predict the eutectic and liquidus correctly. + * @param testProb Hard-coded value. Only the value of 1 is used. It's + * for a LiKCl system test to predict the eutectic and + * liquidus correctly. */ MargulesVPSSTP(int testProb); @@ -372,7 +314,6 @@ public: //! Assignment operator /*! - * * @param b class to be copied. */ MargulesVPSSTP& operator=(const MargulesVPSSTP& b); @@ -388,12 +329,8 @@ public: */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; - /** - * - * @name Utilities - * @{ - */ - + //! @name Utilities + //! @{ //! Equation of state type flag. /*! @@ -405,38 +342,21 @@ public: */ virtual int eosType() const; - /** - * @} - * @name Molar Thermodynamic Properties - * @{ - */ + //! @} + //! @name Molar Thermodynamic Properties + //! @{ + /// Molar enthalpy. Units: J/kmol. + virtual doublereal enthalpy_mole() const; - /** - * @} - * @name Utilities for Solvent ID and Molality - * @{ - */ + /// Molar entropy. Units: J/kmol. + virtual doublereal entropy_mole() const; + /// Molar heat capacity at constant pressure. Units: J/kmol/K. + virtual doublereal cp_mole() const; - - - /** - * @} - * @name Mechanical Properties - * @{ - */ - - /** - * @} - * @name Potential Energy - * - * Species may have an additional potential energy due to the - * presence of external gravitation or electric fields. These - * methods allow specifying a potential energy for individual - * species. - * @{ - */ + /// Molar heat capacity at constant volume. Units: J/kmol/K. + virtual doublereal cv_mole() const; /** * @} @@ -450,7 +370,6 @@ public: * @{ */ - //! Get the array of non-dimensional molar-based ln activity coefficients at //! the current solution temperature, pressure, and solution concentration. /*! @@ -458,7 +377,6 @@ public: */ virtual void getLnActivityCoefficients(doublereal* lnac) const; - //@} /// @name Partial Molar Properties of the Solution //@{ @@ -474,18 +392,6 @@ public: */ virtual void getChemPotentials(doublereal* mu) const; - /// Molar enthalpy. Units: J/kmol. - virtual doublereal enthalpy_mole() const; - - /// Molar entropy. Units: J/kmol. - virtual doublereal entropy_mole() const; - - /// Molar heat capacity at constant pressure. Units: J/kmol/K. - virtual doublereal cp_mole() const; - - /// Molar heat capacity at constant volume. Units: J/kmol/K. - virtual doublereal cv_mole() const; - //! Returns an array of partial molar enthalpies for the species //! in the mixture. /*! @@ -598,63 +504,14 @@ public: */ virtual void getdlnActCoeffdT(doublereal* dlnActCoeffdT) const; - - - //@} - /// @name Properties of the Standard State of the Species in the Solution - //@{ - - - - //@} - /// @name Thermodynamic Values for the Species Reference States - //@{ - - - /////////////////////////////////////////////////////// - // - // The methods below are not virtual, and should not - // be overloaded. - // - ////////////////////////////////////////////////////// - - /** - * @name Specific Properties - * @{ - */ - - - /** - * @name Setting the State - * - * These methods set all or part of the thermodynamic - * state. - * @{ - */ - - - - //@} - - /** - * @name Chemical Equilibrium - * Routines that implement the Chemical equilibrium capability - * for a single phase, based on the element-potential method. - * @{ - */ - - - - //@} - - - + /// @} + /// @name Initialization /// The following methods are used in the process of constructing /// the phase and setting its parameters from a specification in an /// input file. They are not normally used in application programs. /// To see how they are used, see files importCTML.cpp and /// ThermoFactory.cpp. - + /// @{ /*! * @internal Initialize. This method is provided to allow @@ -671,7 +528,6 @@ public: */ virtual void initThermo(); - /** * Import and initialize a ThermoPhase object * @@ -688,11 +544,9 @@ public: */ void initThermoXML(XML_Node& phaseNode, const std::string& id); - /** - * @} - * @name Derivatives of Thermodynamic Variables needed for Applications - * @{ - */ + //! @} + //! @name Derivatives of Thermodynamic Variables needed for Applications + //! @{ //! Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along //! a line in parameter space or along a line in physical space @@ -741,7 +595,6 @@ public: */ virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const; - //! Get the array of derivatives of the ln activity coefficients with respect to the ln species mole numbers /*! * Implementations should take the derivative of the logarithm of the activity coefficient with respect to a @@ -765,7 +618,6 @@ public: //@} private: - //! Process an XML node called "binaryNeutralSpeciesParameters" /*! * This node contains all of the parameters necessary to describe @@ -785,7 +637,6 @@ private: */ void resizeNumInteractions(const size_t num); - //! Initialize lengths of local variables after all species have //! been identified. void initLengths(); @@ -831,7 +682,6 @@ private: */ void s_update_dlnActCoeff_dlnN() const; - private: //! Error function /*! @@ -842,8 +692,6 @@ private: doublereal err(const std::string& msg) const; protected: - - //! number of binary interaction expressions size_t numBinaryInteractions_; @@ -895,8 +743,6 @@ protected: //! excess gibbs free energy expression mutable vector_fp m_VSE_d_ij; - - //! vector of species indices representing species A in the interaction /*! * Each Margules excess Gibbs free energy term involves two species, A and B. @@ -922,17 +768,8 @@ protected: * Currently there is only one form -> constant wrt temperature. */ int formTempModel_; - - }; - - } #endif - - - - - diff --git a/include/cantera/thermo/MixedSolventElectrolyte.h b/include/cantera/thermo/MixedSolventElectrolyte.h index a8076592c..302eecf9e 100644 --- a/include/cantera/thermo/MixedSolventElectrolyte.h +++ b/include/cantera/thermo/MixedSolventElectrolyte.h @@ -24,17 +24,15 @@ namespace Cantera { - /** * @ingroup thermoprops */ - //! MixedSolventElectrolyte is a derived class of GibbsExcessVPSSTP that employs //! the DH and local Marguless approximations for the excess gibbs free energy /*! * - * %MargulesVPSSTP derives from class GibbsExcessVPSSTP which is derived + * MixedSolventElectrolyte derives from class GibbsExcessVPSSTP which is derived * from VPStandardStateTP, * and overloads the virtual methods defined there with ones that * use expressions appropriate for the Margules Excess gibbs free energy @@ -92,7 +90,7 @@ namespace Cantera * S^E_i = n X_{Ai} X_{Bi} \left( s_{o,i} + s_{1,i} X_{Bi} \right) * \f] * - * where n is the total moles in the solution. + * where n is the total moles in the solution. * * The activity of a species defined in the phase is given by an excess * Gibbs free energy formulation. @@ -101,7 +99,7 @@ namespace Cantera * a_k = \gamma_k X_k * \f] * - * where + * where * * \f[ * R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i} @@ -255,65 +253,12 @@ namespace Cantera * * \f$k^{-1} \f$ has units of s-1. * + * @ingroup thermoprops * - *
- *

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: - * - * @code - * XML_Node *xc = get_XML_File("silane.xml"); - * XML_Node * const xs = xc->findNameID("phase", "silane"); - * ThermoPhase *silane_tp = newPhase(*xs); - * IdealGasPhase *silaneGas = dynamic_cast (silane_tp); - * @endcode - * - * or by the following constructor: - * - * @code - * XML_Node *xc = get_XML_File("silane.xml"); - * XML_Node * const xs = xc->findNameID("phase", "silane"); - * IdealGasPhase *silaneGas = new IdealGasPhase(*xs); - * @endcode - * - *
- *

XML Example

- *
- * An example of an XML Element named phase setting up a IdealGasPhase - * object named silane is given below. - * - * - * @verbatim - - - Si H He - - H2 H HE SIH4 SI SIH SIH2 SIH3 H3SISIH SI2H6 - H2SISIH2 SI3H8 SI2 SI3 - - - - - - - @endverbatim - * - * The model attribute "IdealGas" of the thermo XML element identifies the phase as - * being of the type handled by the IdealGasPhase object. - * - * @ingroup thermoprops - * - -*/ + */ class MixedSolventElectrolyte : public MolarityIonicVPSSTP { - public: - //! Constructor /*! * This doesn't do much more than initialize constants with @@ -328,13 +273,6 @@ public: //! Construct and initialize a MixedSolventElectrolyte ThermoPhase object //! directly from an xml input file /*! - * Working constructors - * - * The two constructors below are the normal way - * the phase initializes itself. They are shells that call - * the routine initThermo(), with a reference to the - * XML database to get the info for the phase. - * * @param inputFile Name of the input file containing the phase XML data * to set up the object * @param id ID of the phase in the input file. Defaults to the @@ -352,29 +290,22 @@ public: */ MixedSolventElectrolyte(XML_Node& phaseRef, const std::string& id = ""); - //! Special constructor for a hard-coded problem /*! - * - * @param testProb Hard-coded value. Only the value of 1 is - * used. It's for - * a LiKCl system - * -> test to predict the eutectic and liquidus correctly. + * @param testProb Hard-coded value. Only the value of 1 is used. It's + * for a LiKCl system -> test to predict the eutectic and + * liquidus correctly. */ MixedSolventElectrolyte(int testProb); //! Copy constructor /*! - * Note this stuff will not work until the underlying phase - * has a working copy constructor - * * @param b class to be copied */ MixedSolventElectrolyte(const MixedSolventElectrolyte& b); //! Assignment operator /*! - * * @param b class to be copied. */ MixedSolventElectrolyte& operator=(const MixedSolventElectrolyte& b); @@ -390,12 +321,8 @@ public: */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; - /** - * - * @name Utilities - * @{ - */ - + //! @name Utilities + //! @{ //! Equation of state type flag. /*! @@ -407,38 +334,21 @@ public: */ virtual int eosType() const; - /** - * @} - * @name Molar Thermodynamic Properties - * @{ - */ + //! @} + //! @name Molar Thermodynamic Properties + //! @{ + /// Molar enthalpy. Units: J/kmol. + virtual doublereal enthalpy_mole() const; - /** - * @} - * @name Utilities for Solvent ID and Molality - * @{ - */ + /// Molar entropy. Units: J/kmol. + virtual doublereal entropy_mole() const; + /// Molar heat capacity at constant pressure. Units: J/kmol/K. + virtual doublereal cp_mole() const; - - - /** - * @} - * @name Mechanical Properties - * @{ - */ - - /** - * @} - * @name Potential Energy - * - * Species may have an additional potential energy due to the - * presence of external gravitation or electric fields. These - * methods allow specifying a potential energy for individual - * species. - * @{ - */ + /// Molar heat capacity at constant volume. Units: J/kmol/K. + virtual doublereal cv_mole() const; /** * @} @@ -459,9 +369,6 @@ public: */ virtual void getActivityCoefficients(doublereal* ac) const; - - - //@} /// @name Partial Molar Properties of the Solution //@{ @@ -477,18 +384,6 @@ public: */ virtual void getChemPotentials(doublereal* mu) const; - /// Molar enthalpy. Units: J/kmol. - virtual doublereal enthalpy_mole() const; - - /// Molar entropy. Units: J/kmol. - virtual doublereal entropy_mole() const; - - /// Molar heat capacity at constant pressure. Units: J/kmol/K. - virtual doublereal cp_mole() const; - - /// Molar heat capacity at constant volume. Units: J/kmol/K. - virtual doublereal cv_mole() const; - //! Returns an array of partial molar enthalpies for the species //! in the mixture. /*! @@ -549,7 +444,6 @@ public: */ virtual void getPartialMolarCp(doublereal* cpbar) const; - //! Return an array of partial molar volumes for the //! species in the mixture. Units: m^3/kmol. /*! @@ -597,67 +491,17 @@ public: * * @param dlnActCoeffdT Output vector of temperature derivatives of the * log Activity Coefficients. length = m_kk - * */ virtual void getdlnActCoeffdT(doublereal* dlnActCoeffdT) const; - - - //@} - /// @name Properties of the Standard State of the Species in the Solution - //@{ - - - - //@} - /// @name Thermodynamic Values for the Species Reference States - //@{ - - - /////////////////////////////////////////////////////// - // - // The methods below are not virtual, and should not - // be overloaded. - // - ////////////////////////////////////////////////////// - - /** - * @name Specific Properties - * @{ - */ - - - /** - * @name Setting the State - * - * These methods set all or part of the thermodynamic - * state. - * @{ - */ - - - - //@} - - /** - * @name Chemical Equilibrium - * Routines that implement the Chemical equilibrium capability - * for a single phase, based on the element-potential method. - * @{ - */ - - - - //@} - - - + //! @} + //! @name Initialization /// The following methods are used in the process of constructing /// the phase and setting its parameters from a specification in an /// input file. They are not normally used in application programs. /// To see how they are used, see files importCTML.cpp and /// ThermoFactory.cpp. - + /// @{ /*! * @internal Initialize. This method is provided to allow @@ -674,7 +518,6 @@ public: */ virtual void initThermo(); - /** * Import and initialize a ThermoPhase object * @@ -744,7 +587,6 @@ public: */ virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const; - //! Get the array of derivatives of the log activity coefficients with respect to the ln species mole numbers /*! * Implementations should take the derivative of the logarithm of the activity coefficient with respect to a @@ -764,11 +606,9 @@ public: * log Activity Coefficients. length = m_kk * m_kk */ virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN) ; - //@} private: - //! Process an XML node called "binaryNeutralSpeciesParameters" /*! * This node contains all of the parameters necessary to describe @@ -788,7 +628,6 @@ private: */ void resizeNumInteractions(const size_t num); - //! Initialize lengths of local variables after all species have //! been identified. void initLengths(); @@ -834,8 +673,6 @@ private: */ void s_update_dlnActCoeff_dlnN() const; - -private: //! Error function /*! * Print an error string and exit @@ -845,8 +682,6 @@ private: doublereal err(const std::string& msg) const; protected: - - //! number of binary interaction expressions size_t numBinaryInteractions_; @@ -898,8 +733,6 @@ protected: //! excess gibbs free energy expression mutable vector_fp m_VSE_d_ij; - - //! vector of species indices representing species A in the interaction /*! * Each Margules excess Gibbs free energy term involves two species, A and B. @@ -925,17 +758,8 @@ protected: * Currently there is only one form -> constant wrt temperature. */ int formTempModel_; - - }; - - } #endif - - - - - diff --git a/include/cantera/thermo/MolalityVPSSTP.h b/include/cantera/thermo/MolalityVPSSTP.h index 4e5a75b7e..876be8d3d 100644 --- a/include/cantera/thermo/MolalityVPSSTP.h +++ b/include/cantera/thermo/MolalityVPSSTP.h @@ -185,14 +185,11 @@ namespace Cantera * factors. The other one would be for purposes of stoichiometry evaluation. the * stoichiometry evaluation one would be a 1E-13 limit. Anything less would create * problems with roundoff error. - * */ class MolalityVPSSTP : public VPStandardStateTP { - public: - - /// Constructors + /// Default Constructor /*! * This doesn't do much more than initialize constants with * default values for water at 25C. Water molecular weight @@ -205,18 +202,12 @@ public: //! Copy constructor /*! - * Note this stuff will not work until the underlying phase - * has a working copy constructor - * * @param b class to be copied */ MolalityVPSSTP(const MolalityVPSSTP& b); /// Assignment operator /*! - * Note this stuff will not work until the underlying phase - * has a working assignment operator - * * @param b class to be copied. */ MolalityVPSSTP& operator=(const MolalityVPSSTP& b); @@ -224,20 +215,16 @@ public: /// Destructor. virtual ~MolalityVPSSTP(); - //! Duplication routine for objects which inherit from ThermoPhase. + //! Duplication routine for objects which inherit from ThermoPhase. /*! - * This virtual routine can be used to duplicate thermophase objects + * This virtual routine can be used to duplicate objects * inherited from ThermoPhase even if the application only has * a pointer to ThermoPhase to work with. */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; - /** - * - * @name Utilities - * @{ - */ - + //! @name Utilities + //! @{ //! Equation of state type flag. /*! @@ -269,48 +256,35 @@ public: */ int pHScale() const; - /** - * @} - * @name Molar Thermodynamic Properties - * @{ - */ - + //! @} + //! @name Utilities for Solvent ID and Molality + //! @{ /** - * @} - * @name Utilities for Solvent ID and Molality - * @{ - */ - - /** - * This routine sets the index number of the solvent for - * the phase. + * This routine sets the index number of the solvent for the phase. * - * Note, having a solvent - * is a precursor to many things having to do with molality. + * Note, having a solvent is a precursor to many things having to do + * with molality. * * @param k the solvent index number */ void setSolvent(size_t k); + //! Returns the solvent index. + size_t solventIndex() const; + /** * Sets the minimum mole fraction in the molality formulation. * Note the molality formulation is singular in the limit that * the solvent mole fraction goes to zero. Numerically, how * this limit is treated and resolved is an ongoing issue within - * Cantera. + * Cantera. The minimum mole fraction must be in the range 0 to 0.9. * * @param xmolSolventMIN Input double containing the minimum mole fraction */ void setMoleFSolventMin(doublereal xmolSolventMIN); - //! Returns the solvent index. - size_t solventIndex() const; - - /** - * Returns the minimum mole fraction in the molality - * formulation. - */ + //! Returns the minimum mole fraction in the molality formulation. doublereal moleFSolventMin() const; //! Calculates the molality of all species and stores the result internally. @@ -324,7 +298,7 @@ public: * - \f$ M_o \f$ is the molecular weight of the solvent * - \f$ X_o \f$ is the mole fraction of the solvent * - \f$ X_i \f$ is the mole fraction of the solute. - * - \f$ X_{o,p} = max (X_{o}^{min}, X_o) \f$ + * - \f$ X_{o,p} = \max (X_{o}^{min}, X_o) \f$ * - \f$ X_{o}^{min} \f$ = minimum mole fraction of solvent allowed * in the denominator. */ @@ -402,23 +376,6 @@ public: */ void setMolalitiesByName(const std::string& name); - /** - * @} - * @name Mechanical Properties - * @{ - */ - - /** - * @} - * @name Potential Energy - * - * Species may have an additional potential energy due to the - * presence of external gravitation or electric fields. These - * methods allow specifying a potential energy for individual - * species. - * @{ - */ - /** * @} * @name Activities, Standard States, and Activity Concentrations @@ -433,19 +390,15 @@ public: /** * This method returns the activity convention. - * Currently, there are two activity conventions - * Molar-based activities - * Unit activity of species at either a hypothetical pure - * solution of the species or at a hypothetical - * pure ideal solution at infinite dilution - * cAC_CONVENTION_MOLAR 0 - * - default - * - * Molality based activities - * (unit activity of solutes at a hypothetical 1 molal - * solution referenced to infinite dilution at all - * pressures and temperatures). - * cAC_CONVENTION_MOLALITY 1 + * Currently, there are two activity conventions: + * - Molar-based activities: %Unit activity of species at either a + * hypothetical pure solution of the species or at a hypothetical + * pure ideal solution at infinite dilution. + * `cAC_CONVENTION_MOLAR 0` (default) + * - Molality based activities: unit activity of solutes at a hypothetical + * 1 molal solution referenced to infinite dilution at all pressures and + * temperatures. The solvent is still on molar basis. + * `cAC_CONVENTION_MOLALITY 1` * * We set the convention to molality here. */ @@ -514,7 +467,6 @@ public: virtual void getUnitsStandardConc(double* uA, int k = 0, int sizeUA = 6) const; - //! Get the array of non-dimensional activities (molality //! based for this class and classes that derive from it) at //! the current solution temperature, pressure, and solution concentration. @@ -597,8 +549,6 @@ public: */ virtual void getMolalityActivityCoefficients(doublereal* acMolality) const; - - //! Calculate the osmotic coefficient /*! * \f[ @@ -619,12 +569,10 @@ public: /// @name Partial Molar Properties of the Solution //@{ - /** * Get the species electrochemical potentials. - * These are partial molar quantities. - * This method adds a term \f$ Fz_k \phi_k \f$ to the - * to each chemical potential. + * These are partial molar quantities. This method adds a term + * \f$ Fz_k \phi_k \f$ to each chemical potential. * * Units: J/kmol * @@ -633,41 +581,7 @@ public: */ void getElectrochemPotentials(doublereal* mu) const; - //@} - /// @name Properties of the Standard State of the Species in the Solution - //@{ - - - - //@} - /// @name Thermodynamic Values for the Species Reference States - //@{ - - - /////////////////////////////////////////////////////// - // - // The methods below are not virtual, and should not - // be overloaded. - // - ////////////////////////////////////////////////////// - - /** - * @name Specific Properties - * @{ - */ - - - /** - * @name Setting the State - * - * These methods set all or part of the thermodynamic - * state. - * @{ - */ - - //@} - /** * @name Chemical Equilibrium * Routines that implement the Chemical equilibrium capability @@ -691,10 +605,8 @@ public: */ virtual void setToEquilState(const doublereal* lambda_RT); - //@} - //! Set equation of state parameter values from XML entries. /*! * This method is called by function importPhase() in @@ -711,7 +623,7 @@ public: * XML block. The solvent concentration is then set * to everything else. * - * The function first calls the overloaded function , + * The function first calls the overloaded function, * VPStandardStateTP::setStateFromXML(), to pick up the parent class * behavior. * @@ -723,29 +635,17 @@ public: */ virtual void setStateFromXML(const XML_Node& state); + //@} + //! @name Initialization /// The following methods are used in the process of constructing /// the phase and setting its parameters from a specification in an /// input file. They are not normally used in application programs. /// To see how they are used, see files importCTML.cpp and /// ThermoFactory.cpp. + //@{ - - /*! - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase. - * - * @see importCTML.cpp - */ virtual void initThermo(); - /** * Import and initialize a ThermoPhase object * @@ -762,6 +662,7 @@ public: */ void initThermoXML(XML_Node& phaseNode, const std::string& id); + //@} //! Set the temperature (K), pressure (Pa), and molalities //!(gmol kg-1) of the solutes @@ -821,7 +722,6 @@ public: */ virtual std::string report(bool show_thermo = true) const; - protected: virtual void getCsvReportData(std::vector& names, @@ -953,8 +853,6 @@ private: * \f] * * where j is any one species. - * - * */ const int PHSCALE_PITZER = 0; @@ -980,15 +878,9 @@ const int PHSCALE_PITZER = 0; * * This is the NBS pH scale, which is used in all conventional pH * measurements. and is based on the Bates-Guggenheim equations. - * */ const int PHSCALE_NBS = 1; } #endif - - - - - diff --git a/include/cantera/thermo/MolarityIonicVPSSTP.h b/include/cantera/thermo/MolarityIonicVPSSTP.h index c268d390b..3bf46eb86 100644 --- a/include/cantera/thermo/MolarityIonicVPSSTP.h +++ b/include/cantera/thermo/MolarityIonicVPSSTP.h @@ -30,16 +30,15 @@ namespace Cantera */ /*! - * MolarityIonicVPSSTP is a derived class of ThermoPhase - * GibbsExcessVPSSTP that handles + * MolarityIonicVPSSTP is a derived class of GibbsExcessVPSSTP that handles * variable pressure standard state methods for calculating * thermodynamic properties that are further based on * expressing the Excess Gibbs free energy as a function of * the mole fractions (or pseudo mole fractions) of the constituents. * This category is the workhorse for describing ionic systems which are not on the molality scale. * - * This class adds additional functions onto the %ThermoPhase interface - * that handles the calculation of the excess Gibbs free energy. The %ThermoPhase + * This class adds additional functions onto the ThermoPhase interface + * that handles the calculation of the excess Gibbs free energy. The ThermoPhase * class includes a member function, ThermoPhase::activityConvention() * that indicates which convention the activities are based on. The * default is to assume activities are based on the molar convention. @@ -60,8 +59,7 @@ class MolarityIonicVPSSTP : public GibbsExcessVPSSTP { public: - - /// Constructors + /// Constructor /*! * This doesn't do much more than initialize constants with * default values for water at 25C. Water molecular weight @@ -73,13 +71,8 @@ public: MolarityIonicVPSSTP(); //! Construct and initialize a MolarityIonicVPSSTP ThermoPhase object - //! directly from an xml input file + //! directly from an XML input file /*! - * Working constructors - * - * The two constructors below are the normal way the phase initializes itself. They are shells that call - * the routine initThermo(), with a reference to the XML database to get the info for the phase. - * * @param inputFile Name of the input file containing the phase XML data * to set up the object * @param id ID of the phase in the input file. Defaults to the @@ -96,19 +89,14 @@ public: */ MolarityIonicVPSSTP(XML_Node& phaseRef, const std::string& id = ""); - //! Copy constructor /*! - * Note this stuff will not work until the underlying phase - * has a working copy constructor - * * @param b class to be copied */ MolarityIonicVPSSTP(const MolarityIonicVPSSTP& b); /// Assignment operator /*! - * * @param b class to be copied. */ MolarityIonicVPSSTP& operator=(const MolarityIonicVPSSTP& b); @@ -124,12 +112,8 @@ public: */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; - /** - * - * @name Utilities - * @{ - */ - + //! @name Utilities + //! @{ //! Equation of state type flag. /*! @@ -141,39 +125,6 @@ public: */ virtual int eosType() const; - /** - * @} - * @name Molar Thermodynamic Properties - * @{ - */ - - - /** - * @} - * @name Utilities for Solvent ID and Molality - * @{ - */ - - - - - /** - * @} - * @name Mechanical Properties - * @{ - */ - - /** - * @} - * @name Potential Energy - * - * Species may have an additional potential energy due to the - * presence of external gravitation or electric fields. These - * methods allow specifying a potential energy for individual - * species. - * @{ - */ - /** * @} * @name Activities, Standard States, and Activity Concentrations @@ -293,67 +244,18 @@ public: */ virtual void getPartialMolarVolumes(doublereal* vbar) const; - //@} - /// @name Properties of the Standard State of the Species in the Solution - //@{ - - - - //@} - /// @name Thermodynamic Values for the Species Reference States - //@{ - - - /////////////////////////////////////////////////////// - // - // The methods below are not virtual, and should not - // be overloaded. - // - ////////////////////////////////////////////////////// - - /** - * @name Specific Properties - * @{ - */ - - - /** - * @name Setting the State - * - * These methods set all or part of the thermodynamic - * state. - * @{ - */ //! Calculate pseudo binary mole fractions - /*! - * - */ virtual void calcPseudoBinaryMoleFractions() const; - - //@} - - /** - * @name Chemical Equilibrium - * Routines that implement the Chemical equilibrium capability - * for a single phase, based on the element-potential method. - * @{ - */ - - - - //@} - - - + /// @name Initialization /// The following methods are used in the process of constructing /// the phase and setting its parameters from a specification in an /// input file. They are not normally used in application programs. /// To see how they are used, see files importCTML.cpp and /// ThermoFactory.cpp. - + /// @{ /*! * @internal Initialize. This method is provided to allow @@ -370,7 +272,6 @@ public: */ virtual void initThermo(); - /** * Import and initialize a ThermoPhase object * @@ -386,7 +287,7 @@ public: * with the correct id. */ void initThermoXML(XML_Node& phaseNode, const std::string& id); - + //! @} //! returns a summary of the state of the phase as a string /*! @@ -395,10 +296,7 @@ public: */ virtual std::string report(bool show_thermo = true) const; - private: - - //! Initialize lengths of local variables after all species have been identified. void initLengths(); @@ -414,7 +312,6 @@ private: */ void readXMLBinarySpecies(XML_Node& xmlBinarySpecies); - //! Update the activity coefficients /*! * This function will be called to update the internally stored @@ -441,7 +338,6 @@ private: */ void s_update_dlnActCoeff_dX_() const; - private: //! Error function /*! @@ -452,13 +348,12 @@ private: doublereal err(const std::string& msg) const; protected: - // Pseudobinary type /*! - * PBTYPE_PASSTHROUGH All species are passthrough species - * PBTYPE_SINGLEANION there is only one anion in the mixture - * PBTYPE_SINGLECATION there is only one cation in the mixture - * PBTYPE_MULTICATIONANION Complex mixture + * - `PBTYPE_PASSTHROUGH` - All species are passthrough species + * - `PBTYPE_SINGLEANION` - there is only one anion in the mixture + * - `PBTYPE_SINGLECATION` - there is only one cation in the mixture + * - `PBTYPE_MULTICATIONANION` - Complex mixture */ int PBType_; @@ -484,10 +379,6 @@ protected: size_t neutralPBindexStart; mutable std::vector moleFractionsTmp_; - -private: - - }; #define PBTYPE_PASSTHROUGH 0 @@ -495,13 +386,6 @@ private: #define PBTYPE_SINGLECATION 2 #define PBTYPE_MULTICATIONANION 3 - - } #endif - - - - - diff --git a/include/cantera/thermo/PhaseCombo_Interaction.h b/include/cantera/thermo/PhaseCombo_Interaction.h index 352ce123a..e5b48d7f8 100644 --- a/include/cantera/thermo/PhaseCombo_Interaction.h +++ b/include/cantera/thermo/PhaseCombo_Interaction.h @@ -28,8 +28,7 @@ namespace Cantera //! the Margules approximation for the excess gibbs free energy while eliminating //! the entropy of mixing term. /*! - * - * %PhaseCombo_Interaction derives from class GibbsExcessVPSSTP which is derived from VPStandardStateTP, + * PhaseCombo_Interaction derives from class GibbsExcessVPSSTP which is derived from VPStandardStateTP, * and overloads the virtual methods defined there with ones that * use expressions appropriate for the Margules Excess gibbs free energy approximation. * The reader should refer to the MargulesVPSSTP class for information on that class. @@ -60,7 +59,6 @@ namespace Cantera * like a series of phases. That's why we named it PhaseCombo. * * - * *
*

Specification of Species Standard %State Properties

*
@@ -72,7 +70,6 @@ namespace Cantera * and pressure of the solution. I don't think it prevents, however, * some species from being dilute in the solution. * - * *
*

Specification of Solution Thermodynamic Properties

*
@@ -102,7 +99,7 @@ namespace Cantera * a_k = \gamma_k X_k * \f] * - * where + * where * * \f[ * R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i} @@ -227,29 +224,29 @@ namespace Cantera * \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT} * \f] * - * %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$, - * using the second and third part of the above expression as a definition for the concentration - * equilibrium constant. + * %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$, + * using the second and third part of the above expression as a definition for the concentration + * equilibrium constant. * - * For completeness, the pressure equilibrium constant may be obtained as well + * For completeness, the pressure equilibrium constant may be obtained as well * - * \f[ + * \f[ * \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) - * \f] + * \f] * - * \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. However, it isn't - * necessarily the simplest form of the equilibrium constant for other types of phases; \f$ K_c \f$ is - * used instead because it is completely general. + * \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. However, it isn't + * necessarily the simplest form of the equilibrium constant for other types of phases; \f$ K_c \f$ is + * used instead because it is completely general. * - * The reverse rate of progress may be written down as - * \f[ + * The reverse rate of progress may be written down as + * \f[ * R^{-1} = k^{-1} C_l^a = k^{-1} (C^o a_l) - * \f] + * \f] * * where we can use the concept of microscopic reversibility to * write the reverse rate constant in terms of the * forward reate constant and the concentration equilibrium - * constant, \f$ K_c \f$. + * constant, \f$ K_c \f$. * * \f[ * k^{-1} = k^1 K^1_c @@ -262,7 +259,6 @@ namespace Cantera *

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: @@ -276,13 +272,12 @@ namespace Cantera * * or by the following code * - * @code - * std::string id = "LiFeS_X"; + * @code + * std::string id = "LiFeS_X"; * Cantera::ThermoPhase *LiFeS_X_Phase = Cantera::newPhase("LiFeS_X_combo.xml", id); * PhaseCombo_Interaction *LiFeS_X_solid = dynamic_cast (l_tp); * @endcode * - * * or by the following constructor: * * @code @@ -298,51 +293,46 @@ namespace Cantera * An example of an XML Element named phase setting up a PhaseCombo_Interaction * object named LiFeS_X is given below. * + * @code + * + * + * Li Fe S + * + * + * LiTFe1S2(S) Li2Fe1S2(S) + * + * + * + * + * + * 84.67069219, -269.1959421 + * + * + * 100.7511565, -361.4222659 + * + * + * 0, 0 + * + * + * 0, 0 + * + * + * + * + * + * + * + * @endcode * - * @verbatim - - - - Li Fe S - - - LiTFe1S2(S) Li2Fe1S2(S) - - - - - - 84.67069219, -269.1959421 - - - 100.7511565, -361.4222659 - - - 0, 0 - - - 0, 0 - - - - - - - - - @endverbatim + * The model attribute "PhaseCombo_Interaction" of the thermo XML element identifies the phase as + * being of the type handled by the PhaseCombo_Interaction object. * - * The model attribute "PhaseCombo_Interaction" of the thermo XML element identifies the phase as - * being of the type handled by the PhaseCombo_Interaction object. + * @ingroup thermoprops * - * @ingroup thermoprops - * -*/ + */ class PhaseCombo_Interaction : public GibbsExcessVPSSTP { - public: - //! Constructor /*! * This doesn't do much more than initialize constants with @@ -357,13 +347,6 @@ public: //! Construct and initialize a PhaseCombo_Interaction ThermoPhase object //! directly from an xml input file /*! - * Working constructors - * - * The two constructors below are the normal way - * the phase initializes itself. They are shells that call - * the routine initThermo(), with a reference to the - * XML database to get the info for the phase. - * * @param inputFile Name of the input file containing the phase XML data * to set up the object * @param id ID of the phase in the input file. Defaults to the @@ -380,29 +363,22 @@ public: */ PhaseCombo_Interaction(XML_Node& phaseRef, const std::string& id = ""); - //! Special constructor for a hard-coded problem /*! - * - * @param testProb Hard-coded value. Only the value of 1 is - * used. It's for - * a LiKCl system - * -> test to predict the eutectic and liquidus correctly. + * @param testProb Hard-coded value. Only the value of 1 is used. It's + * for a LiKCl system -> test to predict the eutectic and + * liquidus correctly. */ PhaseCombo_Interaction(int testProb); //! Copy constructor /*! - * Note this stuff will not work until the underlying phase - * has a working copy constructor - * * @param b class to be copied */ PhaseCombo_Interaction(const PhaseCombo_Interaction& b); //! Assignment operator /*! - * * @param b class to be copied. */ PhaseCombo_Interaction& operator=(const PhaseCombo_Interaction& b); @@ -418,55 +394,32 @@ public: */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; - /** - * - * @name Utilities - * @{ - */ - + //! @name Utilities + //! @{ //! Equation of state type flag. /*! - * The ThermoPhase base class returns - * zero. Subclasses should define this to return a unique - * non-zero value. Known constants defined for this purpose are - * listed in mix_defs.h. The MolalityVPSSTP class also returns - * zero, as it is a non-complete class. + * The ThermoPhase base class returns zero. Subclasses should define this + * to return a unique non-zero value. Known constants defined for this + * purpose are listed in mix_defs.h. */ virtual int eosType() const; - /** - * @} - * @name Molar Thermodynamic Properties - * @{ - */ + //! @} + //! @name Molar Thermodynamic Properties + //! @{ + /// Molar enthalpy. Units: J/kmol. + virtual doublereal enthalpy_mole() const; - /** - * @} - * @name Utilities for Solvent ID and Molality - * @{ - */ + /// Molar entropy. Units: J/kmol. + virtual doublereal entropy_mole() const; + /// Molar heat capacity at constant pressure. Units: J/kmol/K. + virtual doublereal cp_mole() const; - - - /** - * @} - * @name Mechanical Properties - * @{ - */ - - /** - * @} - * @name Potential Energy - * - * Species may have an additional potential energy due to the - * presence of external gravitation or electric fields. These - * methods allow specifying a potential energy for individual - * species. - * @{ - */ + /// Molar heat capacity at constant volume. Units: J/kmol/K. + virtual doublereal cv_mole() const; /** * @} @@ -502,18 +455,6 @@ public: */ virtual void getChemPotentials(doublereal* mu) const; - /// Molar enthalpy. Units: J/kmol. - virtual doublereal enthalpy_mole() const; - - /// Molar entropy. Units: J/kmol. - virtual doublereal entropy_mole() const; - - /// Molar heat capacity at constant pressure. Units: J/kmol/K. - virtual doublereal cp_mole() const; - - /// Molar heat capacity at constant volume. Units: J/kmol/K. - virtual doublereal cv_mole() const; - //! Returns an array of partial molar enthalpies for the species //! in the mixture. /*! @@ -574,7 +515,6 @@ public: */ virtual void getPartialMolarCp(doublereal* cpbar) const; - //! Return an array of partial molar volumes for the //! species in the mixture. Units: m^3/kmol. /*! @@ -626,28 +566,14 @@ public: */ virtual void getdlnActCoeffdT(doublereal* dlnActCoeffdT) const; - - - //@} - /// @name Properties of the Standard State of the Species in the Solution - //@{ - - - - //@} - /// @name Thermodynamic Values for the Species Reference States - //@{ - - - - - + /// @} + /// @name Initialization /// The following methods are used in the process of constructing /// the phase and setting its parameters from a specification in an /// input file. They are not normally used in application programs. /// To see how they are used, see files importCTML.cpp and /// ThermoFactory.cpp. - + /// @{ /*! * @internal Initialize. This method is provided to allow @@ -664,7 +590,6 @@ public: */ virtual void initThermo(); - /** * Import and initialize a ThermoPhase object * @@ -681,11 +606,9 @@ public: */ void initThermoXML(XML_Node& phaseNode, const std::string& id); - /** - * @} - * @name Derivatives of Thermodynamic Variables needed for Applications - * @{ - */ + //! @} + //! @name Derivatives of Thermodynamic Variables needed for Applications + //! @{ //! Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along //! a line in parameter space or along a line in physical space @@ -734,7 +657,6 @@ public: */ virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const; - //! Get the array of derivatives of the log activity coefficients with respect to the ln species mole numbers /*! * Implementations should take the derivative of the logarithm of the activity coefficient with respect to a @@ -758,7 +680,6 @@ public: //@} private: - //! Process an XML node called "binaryNeutralSpeciesParameters" /*! * This node contains all of the parameters necessary to describe @@ -778,7 +699,6 @@ private: */ void resizeNumInteractions(const size_t num); - //! Initialize lengths of local variables after all species have //! been identified. void initLengths(); @@ -824,7 +744,6 @@ private: */ void s_update_dlnActCoeff_dlnN() const; - private: //! Error function /*! @@ -835,8 +754,6 @@ private: doublereal err(const std::string& msg) const; protected: - - //! number of binary interaction expressions size_t numBinaryInteractions_; @@ -888,8 +805,6 @@ protected: //! excess gibbs free energy expression mutable vector_fp m_VSE_d_ij; - - //! vector of species indices representing species A in the interaction /*! * Each Margules excess Gibbs free energy term involves two species, A and B. @@ -915,17 +830,8 @@ protected: * Currently there is only one form -> constant wrt temperature. */ int formTempModel_; - - }; - - } #endif - - - - - diff --git a/include/cantera/thermo/PseudoBinaryVPSSTP.h b/include/cantera/thermo/PseudoBinaryVPSSTP.h index 8813f70bb..e6713c44f 100644 --- a/include/cantera/thermo/PseudoBinaryVPSSTP.h +++ b/include/cantera/thermo/PseudoBinaryVPSSTP.h @@ -3,7 +3,7 @@ * Header for intermediate ThermoPhase object for phases which * employ gibbs excess free energy based formulations * (see \ref thermoprops - * and class \link Cantera::gibbsExcessVPSSTP gibbsExcessVPSSTP\endlink). + * and class \link Cantera::PseudoBinaryVPSSTP PseudoBinaryVPSSTP\endlink). * * Header file for a derived class of ThermoPhase that handles * variable pressure standard state methods for calculating @@ -23,7 +23,6 @@ namespace Cantera { - /** * @ingroup thermoprops */ @@ -40,14 +39,14 @@ namespace Cantera * and semi-miscible compounds. * * It includes - * . regular solutions - * . Margules expansions - * . NTRL equation - * . Wilson's equation - * . UNIQUAC equation of state. + * - regular solutions + * - Margules expansions + * - NTRL equation + * - Wilson's equation + * - UNIQUAC equation of state. * - * This class adds additional functions onto the %ThermoPhase interface - * that handles the calculation of the excess Gibbs free energy. The %ThermoPhase + * This class adds additional functions onto the ThermoPhase interface + * that handles the calculation of the excess Gibbs free energy. The ThermoPhase * class includes a member function, ThermoPhase::activityConvention() * that indicates which convention the activities are based on. The * default is to assume activities are based on the molar convention. @@ -62,15 +61,11 @@ namespace Cantera * The way that it collects the cation and anion based mole numbers * is via holding two extra ThermoPhase objects. These * can include standard states for salts. - * - * */ class PseudoBinaryVPSSTP : public GibbsExcessVPSSTP { - public: - - /// Constructors + /// Constructor /*! * This doesn't do much more than initialize constants with * default values for water at 25C. Water molecular weight @@ -83,16 +78,12 @@ public: //! Copy constructor /*! - * Note this stuff will not work until the underlying phase - * has a working copy constructor - * * @param b class to be copied */ PseudoBinaryVPSSTP(const PseudoBinaryVPSSTP& b); /// Assignment operator /*! - * * @param b class to be copied. */ PseudoBinaryVPSSTP& operator=(const PseudoBinaryVPSSTP& b); @@ -108,58 +99,18 @@ public: */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; - /** - * - * @name Utilities - * @{ - */ - + //! @name Utilities + //! @{ //! Equation of state type flag. /*! * The ThermoPhase base class returns * zero. Subclasses should define this to return a unique * non-zero value. Known constants defined for this purpose are - * listed in mix_defs.h. The MolalityVPSSTP class also returns - * zero, as it is a non-complete class. + * listed in mix_defs.h. */ virtual int eosType() const; - - - /** - * @} - * @name Molar Thermodynamic Properties - * @{ - */ - - - /** - * @} - * @name Utilities for Solvent ID and Molality - * @{ - */ - - - - - /** - * @} - * @name Mechanical Properties - * @{ - */ - - /** - * @} - * @name Potential Energy - * - * Species may have an additional potential energy due to the - * presence of external gravitation or electric fields. These - * methods allow specifying a potential energy for individual - * species. - * @{ - */ - /** * @} * @name Activities, Standard States, and Activity Concentrations @@ -172,9 +123,6 @@ public: * @{ */ - - - /** * The standard concentration \f$ C^0_k \f$ used to normalize * the generalized concentration. In many cases, this quantity @@ -197,15 +145,10 @@ public: * @param k species index */ virtual doublereal logStandardConc(size_t k=0) const; - - - - //@} /// @name Partial Molar Properties of the Solution //@{ - /** * Get the species electrochemical potentials. * These are partial molar quantities. @@ -218,69 +161,19 @@ public: * Length: m_kk. */ void getElectrochemPotentials(doublereal* mu) const; - - //@} - /// @name Properties of the Standard State of the Species in the Solution - //@{ - - - - //@} - /// @name Thermodynamic Values for the Species Reference States - //@{ - - - /////////////////////////////////////////////////////// - // - // The methods below are not virtual, and should not - // be overloaded. - // - ////////////////////////////////////////////////////// - - /** - * @name Specific Properties - * @{ - */ - - - /** - * @name Setting the State - * - * These methods set all or part of the thermodynamic - * state. - * @{ - */ //! Calculate pseudo binary mole fractions - /*! - * - */ virtual void calcPseudoBinaryMoleFractions() const; - //@} - - /** - * @name Chemical Equilibrium - * Routines that implement the Chemical equilibrium capability - * for a single phase, based on the element-potential method. - * @{ - */ - - - - //@} - - - + /// @name Initialization /// The following methods are used in the process of constructing /// the phase and setting its parameters from a specification in an /// input file. They are not normally used in application programs. /// To see how they are used, see files importCTML.cpp and /// ThermoFactory.cpp. - /*! * @internal Initialize. This method is provided to allow * subclasses to perform any initialization required after all @@ -296,7 +189,6 @@ public: */ virtual void initThermo(); - /** * Import and initialize a ThermoPhase object * @@ -313,7 +205,6 @@ public: */ void initThermoXML(XML_Node& phaseNode, const std::string& id); - //! returns a summary of the state of the phase as a string /*! * @param show_thermo If true, extra information is printed out @@ -321,17 +212,11 @@ public: */ virtual std::string report(bool show_thermo = true) const; - private: - - //! Initialize lengths of local variables after all species have //! been identified. void initLengths(); - - -private: //! Error function /*! * Print an error string and exit @@ -341,7 +226,6 @@ private: doublereal err(const std::string& msg) const; protected: - int PBType_; //! Number of pseudo binary species @@ -367,10 +251,6 @@ protected: ThermoPhase* anionPhase_; mutable std::vector moleFractionsTmp_; - -private: - - }; #define PBTYPE_PASSTHROUGH 0 @@ -383,8 +263,3 @@ private: } #endif - - - - - diff --git a/include/cantera/thermo/RedlichKisterVPSSTP.h b/include/cantera/thermo/RedlichKisterVPSSTP.h index 978cb6dd3..6914e88b3 100644 --- a/include/cantera/thermo/RedlichKisterVPSSTP.h +++ b/include/cantera/thermo/RedlichKisterVPSSTP.h @@ -33,7 +33,6 @@ namespace Cantera //! RedlichKisterVPSSTP is a derived class of GibbsExcessVPSSTP that employs //! the Redlich-Kister approximation for the excess gibbs free energy /*! - * * %RedlichKisterVPSSTP derives from class GibbsExcessVPSSTP which is derived * from VPStandardStateTP, and overloads the virtual methods defined there with ones that * use expressions appropriate for the Redlich Kister Excess gibbs free energy approximation. @@ -82,13 +81,13 @@ namespace Cantera * G^E = \sum_{i} G^E_{i} * \f] * - * where + * where * * \f[ * G^E_{i} = n X_{Ai} X_{Bi} \sum_m \left( A^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right) * \f] * - * and where we can break down the gibbs free energy contributions into enthalpy and entropy contributions + * and where we can break down the gibbs free energy contributions into enthalpy and entropy contributions * * \f[ * H^E_i = n X_{Ai} X_{Bi} \sum_m \left( H^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right) @@ -117,8 +116,6 @@ namespace Cantera * R T \ln( \gamma_k )= \sum_i \delta_{Ai,k} (1 - X_{Ai}) X_{Bi} \sum_m \left( A^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^m \right) * + \sum_i \delta_{Ai,k} X_{Ai} X_{Bi} \sum_m \left( A^{i}_0 + A^{i}_m {\left( X_{Ai} - X_{Bi} \right)}^{m-1} (1 - X_{Ai} + X_{Bi}) \right) * \f] - * where - * * * This object inherits from the class VPStandardStateTP. Therefore, the specification and * calculation of all standard state and reference state values are handled at that level. Various functional @@ -215,41 +212,41 @@ namespace Cantera * We can switch over to expressing the equilibrium constant in terms of the reference * state chemical potentials * - * \f[ - * K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P} - * \f] + * \f[ + * K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P} + * \f] * - * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over - * to activity concentrations. When this is done: + * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over + * to activity concentrations. When this is done: * - * \f[ + * \f[ * \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 = * \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT} - * \f] + * \f] * - * %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$, - * using the second and third part of the above expression as a definition for the concentration - * equilibrium constant. + * %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$, + * using the second and third part of the above expression as a definition for the concentration + * equilibrium constant. * - * For completeness, the pressure equilibrium constant may be obtained as well + * For completeness, the pressure equilibrium constant may be obtained as well * - * \f[ + * \f[ * \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) - * \f] + * \f] * - * \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. However, it isn't - * necessarily the simplest form of the equilibrium constant for other types of phases; \f$ K_c \f$ is - * used instead because it is completely general. + * \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. However, it isn't + * necessarily the simplest form of the equilibrium constant for other types of phases; \f$ K_c \f$ is + * used instead because it is completely general. * - * The reverse rate of progress may be written down as - * \f[ + * The reverse rate of progress may be written down as + * \f[ * R^{-1} = k^{-1} C_l^a = k^{-1} (C^o a_l) - * \f] + * \f] * * where we can use the concept of microscopic reversibility to * write the reverse rate constant in terms of the * forward reate constant and the concentration equilibrium - * constant, \f$ K_c \f$. + * constant, \f$ K_c \f$. * * \f[ * k^{-1} = k^1 K^1_c @@ -257,65 +254,12 @@ namespace Cantera * * \f$k^{-1} \f$ has units of s-1. * - * - *
- *

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: - * - * @code - * XML_Node *xc = get_XML_File("silane.xml"); - * XML_Node * const xs = xc->findNameID("phase", "silane"); - * ThermoPhase *silane_tp = newPhase(*xs); - * IdealGasPhase *silaneGas = dynamic_cast (silane_tp); - * @endcode - * - * or by the following constructor: - * - * @code - * XML_Node *xc = get_XML_File("silane.xml"); - * XML_Node * const xs = xc->findNameID("phase", "silane"); - * IdealGasPhase *silaneGas = new IdealGasPhase(*xs); - * @endcode - * - *
- *

XML Example

- *
- * An example of an XML Element named phase setting up a IdealGasPhase - * object named silane is given below. - * - * - * @verbatim - - - Si H He - - H2 H HE SIH4 SI SIH SIH2 SIH3 H3SISIH SI2H6 - H2SISIH2 SI3H8 SI2 SI3 - - - - - - - @endverbatim - * - * The model attribute "IdealGas" of the thermo XML element identifies the phase as - * being of the type handled by the IdealGasPhase object. - * * @ingroup thermoprops * - -*/ + */ class RedlichKisterVPSSTP : public GibbsExcessVPSSTP { - public: - //! Constructor /*! * This doesn't do much more than initialize constants with @@ -326,10 +270,6 @@ public: //! Construct and initialize a RedlichKisterVPSSTP ThermoPhase object //! directly from an xml input file /*! - * Working constructors - * - * The two constructors below are the normal way the phase initializes itself. They are shells that call - * the routine initThermo(), with a reference to the XML database to get the info for the phase. * * @param inputFile Name of the input file containing the phase XML data * to set up the object @@ -347,29 +287,22 @@ public: */ RedlichKisterVPSSTP(XML_Node& phaseRef, const std::string& id = ""); - //! Special constructor for a hard-coded problem /*! - * - * @param testProb Hard-coded value. Only the value of 1 is - * used. It's for - * a LiKCl system - * -> test to predict the eutectic and liquidus correctly. + * @param testProb Hard-coded value. Only the value of 1 is used. It's + * for a LiKCl system -> test to predict the eutectic and + * liquidus correctly. */ RedlichKisterVPSSTP(int testProb); //! Copy constructor /*! - * Note this stuff will not work until the underlying phase - * has a working copy constructor - * * @param b class to be copied */ RedlichKisterVPSSTP(const RedlichKisterVPSSTP& b); //! Assignment operator /*! - * * @param b class to be copied. */ RedlichKisterVPSSTP& operator=(const RedlichKisterVPSSTP& b); @@ -385,55 +318,33 @@ public: */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; - /** - * - * @name Utilities - * @{ - */ - + //! @name Utilities + //! @{ //! Equation of state type flag. /*! * The ThermoPhase base class returns * zero. Subclasses should define this to return a unique * non-zero value. Known constants defined for this purpose are - * listed in mix_defs.h. The MolalityVPSSTP class also returns - * zero, as it is a non-complete class. + * listed in mix_defs.h. */ virtual int eosType() const; - /** - * @} - * @name Molar Thermodynamic Properties - * @{ - */ + //! @} + //! @name Molar Thermodynamic Properties + //! @{ + /// Molar enthalpy. Units: J/kmol. + virtual doublereal enthalpy_mole() const; - /** - * @} - * @name Utilities for Solvent ID and Molality - * @{ - */ + /// Molar entropy. Units: J/kmol. + virtual doublereal entropy_mole() const; + /// Molar heat capacity at constant pressure. Units: J/kmol/K. + virtual doublereal cp_mole() const; - - - /** - * @} - * @name Mechanical Properties - * @{ - */ - - /** - * @} - * @name Potential Energy - * - * Species may have an additional potential energy due to the - * presence of external gravitation or electric fields. These - * methods allow specifying a potential energy for individual - * species. - * @{ - */ + /// Molar heat capacity at constant volume. Units: J/kmol/K. + virtual doublereal cv_mole() const; /** * @} @@ -469,18 +380,6 @@ public: */ virtual void getChemPotentials(doublereal* mu) const; - /// Molar enthalpy. Units: J/kmol. - virtual doublereal enthalpy_mole() const; - - /// Molar entropy. Units: J/kmol. - virtual doublereal entropy_mole() const; - - /// Molar heat capacity at constant pressure. Units: J/kmol/K. - virtual doublereal cp_mole() const; - - /// Molar heat capacity at constant volume. Units: J/kmol/K. - virtual doublereal cv_mole() const; - //! Returns an array of partial molar enthalpies for the species //! in the mixture. /*! @@ -541,7 +440,6 @@ public: */ virtual void getPartialMolarCp(doublereal* cpbar) const; - //! Return an array of partial molar volumes for the //! species in the mixture. Units: m^3/kmol. /*! @@ -576,7 +474,6 @@ public: * * @param d2lnActCoeffdT2 Output vector of temperature 2nd derivatives of the * log Activity Coefficients. length = m_kk - * */ virtual void getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const; @@ -589,68 +486,17 @@ public: * * @param dlnActCoeffdT Output vector of temperature derivatives of the * log Activity Coefficients. length = m_kk - * */ virtual void getdlnActCoeffdT(doublereal* dlnActCoeffdT) const; - - - //@} - /// @name Properties of the Standard State of the Species in the Solution - //@{ - - - - //@} - /// @name Thermodynamic Values for the Species Reference States - //@{ - - - /////////////////////////////////////////////////////// - // - // The methods below are not virtual, and should not - // be overloaded. - // - ////////////////////////////////////////////////////// - - /** - * @name Specific Properties - * @{ - */ - - - /** - * @name Setting the State - * - * These methods set all or part of the thermodynamic - * state. - * @{ - */ - - - - //@} - - /** - * @name Chemical Equilibrium - * Routines that implement the Chemical equilibrium capability - * for a single phase, based on the element-potential method. - * @{ - */ - - - - //@} - - - + /// @} + /// @name Initialization /// The following methods are used in the process of constructing /// the phase and setting its parameters from a specification in an /// input file. They are not normally used in application programs. /// To see how they are used, see files importCTML.cpp and /// ThermoFactory.cpp. - /*! * @internal Initialize. This method is provided to allow * subclasses to perform any initialization required after all @@ -666,7 +512,6 @@ public: */ virtual void initThermo(); - /** * Import and initialize a ThermoPhase object * @@ -683,11 +528,9 @@ public: */ void initThermoXML(XML_Node& phaseNode, const std::string& id); - /** - * @} - * @name Derivatives of Thermodynamic Variables needed for Applications - * @{ - */ + //! @} + //! @name Derivatives of Thermodynamic Variables needed for Applications + //! @{ //! Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along //! a line in parameter space or along a line in physical space @@ -736,7 +579,6 @@ public: */ virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const; - //! Get the array of derivatives of the ln activity coefficients with respect to the ln species mole numbers /*! * Implementations should take the derivative of the logarithm of the activity coefficient with respect to a @@ -760,7 +602,6 @@ public: //@} private: - //! Process an XML node called "binaryNeutralSpeciesParameters" /*! * This node contains all of the parameters necessary to describe @@ -780,7 +621,6 @@ private: */ void resizeNumInteractions(const size_t num); - //! Initialize lengths of local variables after all species have //! been identified. void initLengths(); @@ -831,7 +671,6 @@ private: doublereal err(const std::string& msg) const; protected: - //! number of binary interaction expressions size_t numBinaryInteractions_; @@ -849,16 +688,13 @@ protected: */ std::vector 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 mutable std::vector< vector_fp> m_HE_m_ij; - //! Entropy term for the binary mole fraction interaction of the //! excess gibbs free energy expression mutable std::vector< vector_fp> m_SE_m_ij; @@ -875,20 +711,10 @@ protected: */ int formTempModel_; - //! Two dimensional array of derivatives of activity coefficients wrt mole fractions mutable Array2D dlnActCoeff_dX_; - - }; - - } #endif - - - - - diff --git a/include/cantera/thermo/VPStandardStateTP.h b/include/cantera/thermo/VPStandardStateTP.h index 5fc273488..f7911aac4 100644 --- a/include/cantera/thermo/VPStandardStateTP.h +++ b/include/cantera/thermo/VPStandardStateTP.h @@ -60,12 +60,8 @@ class VPStandardStateTP : public ThermoPhase { public: + //! @name Constructors and Duplicators for %VPStandardStateTP - /*! - * - * @name Constructors and Duplicators for %VPStandardStateTP - * - */ /// Constructor. VPStandardStateTP(); @@ -84,16 +80,11 @@ public: //! Destructor. virtual ~VPStandardStateTP(); - /* - * Duplication routine - */ + //! Duplication routine virtual ThermoPhase* duplMyselfAsThermoPhase() const; //@} - - /** - * @name Utilities (VPStandardStateTP) - */ + //! @name Utilities (VPStandardStateTP) //@{ /** * Equation of state type flag. The base class returns @@ -110,12 +101,10 @@ public: //! temperature based, and variable pressure based. /*! * Currently, there are two standard state conventions: - * - Temperature-based activities - * cSS_CONVENTION_TEMPERATURE 0 - * - default - * - * - Variable Pressure and Temperature -based activities - * cSS_CONVENTION_VPSS 1 + * - Temperature-based activities, + * `cSS_CONVENTION_TEMPERATURE 0` (default) + * - Variable Pressure and Temperature-based activities, + * `cSS_CONVENTION_VPSS 1` */ virtual int standardStateConvention() const; @@ -141,17 +130,14 @@ public: err("getdlnActCoeffdlnN_diag"); } - //@} - /// @name Partial Molar Properties of the Solution (VPStandardStateTP) + /// @name Partial Molar Properties of the Solution (VPStandardStateTP) //@{ - - //! Get the array of non-dimensional species chemical potentials - //! These are partial molar Gibbs free energies. + //! Get the array of non-dimensional species chemical potentials. /*! + * These are partial molar Gibbs free energies, * \f$ \mu_k / \hat R T \f$. - * Units: unitless * * We close the loop on this function, here, calling * getChemPotentials() and then dividing by RT. No need for child @@ -165,14 +151,12 @@ public: //@} /*! - * @name Properties of the Standard State of the Species in the Solution - * (VPStandardStateTP) + * @name Properties of the Standard State of the Species in the Solution (VPStandardStateTP) * * Within VPStandardStateTP, these properties are calculated via a common routine, - * _updateStandardStateThermo(), - * which must be overloaded in inherited objects. - * The values are cached within this object, and are not recalculated unless - * the temperature or pressure changes. + * _updateStandardStateThermo(), which must be overloaded in inherited + * objects. The values are cached within this object, and are not + * recalculated unless the temperature or pressure changes. */ //@{ @@ -271,7 +255,6 @@ public: virtual void getStandardVolumes(doublereal* vol) const; virtual const vector_fp& getStandardVolumes() const; - //! Set the temperature of the phase /*! * Currently this passes down to setState_TP(). It does not @@ -282,7 +265,6 @@ public: */ virtual void setTemperature(const doublereal temp); - //! Set the internally stored pressure (Pa) at constant //! temperature and composition /*! @@ -405,7 +387,6 @@ public: */ //@{ - //! Returns the vector of nondimensional //! enthalpies of the reference state at the current temperature //! of the solution and the reference pressure for the species. @@ -434,7 +415,6 @@ public: //! Gibbs free energies of the reference state at the current temperature //! of the solution and the reference pressure for the species. /*! - * * @param grt Output vector contains the nondimensional Gibbs free energies * of the reference state of the species * length = m_kk, units = dimensionless. @@ -488,16 +468,9 @@ public: * Length: m_kk. */ virtual void getStandardVolumes_ref(doublereal* vol) const; - -protected: - - - //@} - public: - //! @name Initialization Methods - For Internal use (VPStandardState) /*! * The following methods are used in the process of constructing @@ -521,23 +494,6 @@ public: */ virtual void setParametersFromXML(const XML_Node& eosdata) {} - //! @internal Initialize the object - /*! - * This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called after calling installSpecies() - * for each species in the phase. It's called before calling - * initThermoXML() for the phase. Therefore, it's the correct - * place for initializing vectors which have lengths equal to the - * number of species. - * - * @see importCTML.cpp - */ virtual void initThermo(); //! Initialize a ThermoPhase object, potentially reading activity @@ -634,9 +590,7 @@ protected: */ std::vector m_PDSS_storage; - private: - //! VPStandardStateTP has its own err routine /*! * @param msg Error message string diff --git a/src/thermo/DebyeHuckel.cpp b/src/thermo/DebyeHuckel.cpp index b88105144..349027a44 100644 --- a/src/thermo/DebyeHuckel.cpp +++ b/src/thermo/DebyeHuckel.cpp @@ -30,9 +30,6 @@ using namespace ctml; namespace Cantera { -/* - * Default constructor - */ DebyeHuckel::DebyeHuckel() : MolalityVPSSTP(), m_formDH(DHFORM_DILUTE_LIMIT), @@ -55,14 +52,6 @@ DebyeHuckel::DebyeHuckel() : m_npActCoeff[2] = 1.545E-3; } -/* - * Working constructors - * - * The two constructors below are the normal way - * the phase initializes itself. They are shells that call - * the routine initThermo(), with a reference to the - * XML database to get the info for the phase. - */ DebyeHuckel::DebyeHuckel(const std::string& inputFile, const std::string& id) : MolalityVPSSTP(), @@ -108,12 +97,6 @@ DebyeHuckel::DebyeHuckel(XML_Node& phaseRoot, const std::string& id) : importPhase(*findXMLPhase(&phaseRoot, id), this); } -/* - * Copy Constructor: - * - * Note this stuff will not work until the underlying phase - * has a working copy constructor - */ DebyeHuckel::DebyeHuckel(const DebyeHuckel& b) : MolalityVPSSTP(), m_formDH(DHFORM_DILUTE_LIMIT), @@ -136,12 +119,6 @@ DebyeHuckel::DebyeHuckel(const DebyeHuckel& b) : *this = b; } -/* - * operator=() - * - * Note this stuff will not work until the underlying phase - * has a working assignment operator - */ DebyeHuckel& DebyeHuckel:: operator=(const DebyeHuckel& b) { @@ -187,13 +164,6 @@ operator=(const DebyeHuckel& b) return *this; } - -/* - * ~DebyeHuckel(): (virtual) - * - * Destructor for DebyeHuckel. Release objects that - * it owns. - */ DebyeHuckel::~DebyeHuckel() { if (m_waterProps) { @@ -202,24 +172,11 @@ DebyeHuckel::~DebyeHuckel() } } -/* - * duplMyselfAsThermoPhase(): - * - * This routine operates at the ThermoPhase level to - * duplicate the current object. It uses the copy constructor - * defined above. - */ ThermoPhase* DebyeHuckel::duplMyselfAsThermoPhase() const { return new DebyeHuckel(*this); } -/* - * Equation of state type flag. The base class returns - * zero. Subclasses should define this to return a unique - * non-zero value. Constants defined for this purpose are - * listed in mix_defs.h. - */ int DebyeHuckel::eosType() const { int res; @@ -243,23 +200,15 @@ int DebyeHuckel::eosType() const // // -------- Molar Thermodynamic Properties of the Solution --------------- // -/* - * Molar enthalpy of the solution. Units: J/kmol. - */ doublereal DebyeHuckel::enthalpy_mole() const { getPartialMolarEnthalpies(DATA_PTR(m_tmpV)); return mean_X(DATA_PTR(m_tmpV)); } -/* - * Molar internal energy of the solution. Units: J/kmol. - * - * This is calculated from the soln enthalpy and then - * subtracting pV. - */ doublereal DebyeHuckel::intEnergy_mole() const { + // This is calculated from the soln enthalpy and then subtracting pV. double hh = enthalpy_mole(); double pres = pressure(); double molarV = 1.0/molarDensity(); @@ -267,30 +216,18 @@ doublereal DebyeHuckel::intEnergy_mole() const return uu; } -/* - * Molar soln entropy at constant pressure. Units: J/kmol/K. - * - * This is calculated from the partial molar entropies. - */ doublereal DebyeHuckel::entropy_mole() const { getPartialMolarEntropies(DATA_PTR(m_tmpV)); return mean_X(DATA_PTR(m_tmpV)); } -// Molar Gibbs function. Units: J/kmol. doublereal DebyeHuckel::gibbs_mole() const { getChemPotentials(DATA_PTR(m_tmpV)); return mean_X(DATA_PTR(m_tmpV)); } -/* - * Molar heat capacity at constant pressure. Units: J/kmol/K. - * - * Returns the solution heat capacition at constant pressure. - * This is calculated from the partial molar heat capacities. - */ doublereal DebyeHuckel::cp_mole() const { getPartialMolarCp(DATA_PTR(m_tmpV)); @@ -298,7 +235,6 @@ doublereal DebyeHuckel::cp_mole() const return val; } -/// Molar heat capacity at constant volume. Units: J/kmol/K. doublereal DebyeHuckel::cv_mole() const { //getPartialMolarCv(m_tmpV.begin()); @@ -311,11 +247,6 @@ doublereal DebyeHuckel::cv_mole() const // ------- Mechanical Equation of State Properties ------------------------ // -/* - * Pressure. Units: Pa. - * For this incompressible system, we return the internally stored - * independent value of the pressure. - */ doublereal DebyeHuckel::pressure() const { return m_Pcurrent; @@ -348,27 +279,6 @@ void DebyeHuckel::setState_TP(doublereal t, doublereal p) calcDensity(); } -/* - * Calculate the density of the mixture using the partial - * molar volumes and mole fractions as input - * - * The formula for this is - * - * \f[ - * \rho = \frac{\sum_k{X_k W_k}}{\sum_k{X_k V_k}} - * \f] - * - * where \f$X_k\f$ are the mole fractions, \f$W_k\f$ are - * the molecular weights, and \f$V_k\f$ are the pure species - * molar volumes. - * - * Note, the basis behind this formula is that in an ideal - * solution the partial molar volumes are equal to the pure - * species molar volumes. We have additionally specified - * in this class that the pure species molar volumes are - * independent of temperature and pressure. - * - */ void DebyeHuckel::calcDensity() { if (m_waterSS) { @@ -392,17 +302,6 @@ void DebyeHuckel::calcDensity() Phase::setDensity(dd); } - -/* - * The isothermal compressibility. Units: 1/Pa. - * The isothermal compressibility is defined as - * \f[ - * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T - * \f] - * - * It's equal to zero for this model, since the molar volume - * doesn't change with pressure or temperature. - */ doublereal DebyeHuckel::isothermalCompressibility() const { throw CanteraError("DebyeHuckel::isothermalCompressibility", @@ -410,17 +309,6 @@ doublereal DebyeHuckel::isothermalCompressibility() const return 0.0; } -/* - * The thermal expansion coefficient. Units: 1/K. - * The thermal expansion coefficient is defined as - * - * \f[ - * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P - * \f] - * - * It's equal to zero for this model, since the molar volume - * doesn't change with pressure or temperature. - */ doublereal DebyeHuckel::thermalExpansionCoeff() const { throw CanteraError("DebyeHuckel::thermalExpansionCoeff", @@ -428,22 +316,6 @@ doublereal DebyeHuckel::thermalExpansionCoeff() const return 0.0; } -/* - * Overwritten setDensity() function is necessary because the - * density is not an independent variable. - * - * This function will now throw an error condition - * - * @internal May have to adjust the strategy here to make - * the eos for these materials slightly compressible, in order - * to create a condition where the density is a function of - * the pressure. - * - * This function will now throw an error condition. - * - * NOTE: This is an overwritten function from the State.h - * class - */ void DebyeHuckel::setDensity(doublereal rho) { double dens = density(); @@ -453,15 +325,6 @@ void DebyeHuckel::setDensity(doublereal rho) } } -/* - * Overwritten setMolarDensity() function is necessary because the - * density is not an independent variable. - * - * This function will now throw an error condition. - * - * NOTE: This is a virtual function, overwritten function from the State.h - * class - */ void DebyeHuckel::setMolarDensity(const doublereal conc) { double concI = molarDensity(); @@ -471,34 +334,15 @@ void DebyeHuckel::setMolarDensity(const doublereal conc) } } -/* - * Overwritten setTemperature(double) from State.h. This - * function sets the temperature, and makes sure that - * the value propagates to underlying objects. - */ void DebyeHuckel::setTemperature(const doublereal temp) { setState_TP(temp, m_Pcurrent); } - // // ------- Activities and Activity Concentrations // -/* - * This method returns an array of generalized concentrations - * \f$ C_k\f$ that are defined such that - * \f$ a_k = C_k / C^0_k, \f$ where \f$ C^0_k \f$ - * is a standard concentration - * defined below. These generalized concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. - * - * @param c Array of generalized concentrations. The - * units depend upon the implementation of the - * reaction rate expressions within the phase. - */ void DebyeHuckel::getActivityConcentrations(doublereal* c) const { double c_solvent = standardConcentration(); @@ -508,61 +352,18 @@ void DebyeHuckel::getActivityConcentrations(doublereal* c) const } } -/* - * The standard concentration \f$ C^0_k \f$ used to normalize - * the generalized concentration. In many cases, this quantity - * will be the same for all species in a phase - for example, - * for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this - * reason, this method returns a single value, instead of an - * array. However, for phases in which the standard - * concentration is species-specific (e.g. surface species of - * different sizes), this method may be called with an - * optional parameter indicating the species. - * - * For the time being we will use the concentration of pure - * solvent for the the standard concentration of all species. - * This has the effect of making reaction rates - * based on the molality of species proportional to the - * molality of the species. - */ doublereal DebyeHuckel::standardConcentration(size_t k) const { double mvSolvent = m_speciesSize[m_indexSolvent]; return 1.0 / mvSolvent; } -/* - * Returns the natural logarithm of the standard - * concentration of the kth species - */ doublereal DebyeHuckel::logStandardConc(size_t k) const { double c_solvent = standardConcentration(k); return log(c_solvent); } -/* - * Returns the units of the standard and general concentrations - * Note they have the same units, as their divisor is - * defined to be equal to the activity of the kth species - * in the solution, which is unitless. - * - * This routine is used in print out applications where the - * units are needed. Usually, MKS units are assumed throughout - * the program and in the XML input files. - * - * On return uA contains the powers of the units (MKS assumed) - * of the standard concentrations and generalized concentrations - * for the kth species. - * - * uA[0] = kmol units - default = 1 - * uA[1] = m units - default = -nDim(), the number of spatial - * dimensions in the Phase class. - * uA[2] = kg units - default = 0; - * uA[3] = Pa(pressure) units - default = 0; - * uA[4] = Temperature units - default = 0; - * uA[5] = time units - default = 0 - */ void DebyeHuckel::getUnitsStandardConc(double* uA, int k, int sizeUA) const { for (int i = 0; i < sizeUA; i++) { @@ -587,14 +388,6 @@ void DebyeHuckel::getUnitsStandardConc(double* uA, int k, int sizeUA) const } } - -/* - * Get the array of non-dimensional activities at - * the current solution temperature, pressure, and - * solution concentration. - * (note solvent activity coefficient is on the molar scale). - * - */ void DebyeHuckel::getActivities(doublereal* ac) const { _updateStandardStateThermo(); @@ -613,17 +406,6 @@ void DebyeHuckel::getActivities(doublereal* ac) const exp(m_lnActCoeffMolal[m_indexSolvent]) * xmolSolvent; } -/* - * getMolalityActivityCoefficients() (virtual, const) - * - * Get the array of non-dimensional Molality based - * activity coefficients at - * the current solution temperature, pressure, and - * solution concentration. - * (note solvent activity coefficient is on the molar scale). - * - * Note, most of the work is done in an internal private routine - */ void DebyeHuckel:: getMolalityActivityCoefficients(doublereal* acMolality) const { @@ -639,21 +421,6 @@ getMolalityActivityCoefficients(doublereal* acMolality) const // // ------ Partial Molar Properties of the Solution ----------------- // -/* - * Get the species chemical potentials. Units: J/kmol. - * - * This function returns a vector of chemical potentials of the - * species in solution. - * - * \f[ - * \mu_k = \mu^{o}_k(T,P) + R T ln(m_k) - * \f] - * - * \f[ - * \mu_solvent = \mu^{o}_solvent(T,P) + - * R T ((X_solvent - 1.0) / X_solvent) - * \f] - */ void DebyeHuckel::getChemPotentials(doublereal* mu) const { double xx; @@ -682,19 +449,6 @@ void DebyeHuckel::getChemPotentials(doublereal* mu) const RT * (log(xx) + m_lnActCoeffMolal[m_indexSolvent]); } - -/* - * Returns an array of partial molar enthalpies for the species - * in the mixture. - * Units (J/kmol) - * - * We calculate this quantity partially from the relation and - * partially by calling the standard state enthalpy function. - * - * hbar_i = - T**2 * d(chemPot_i/T)/dT - * - * We calculate - */ void DebyeHuckel::getPartialMolarEnthalpies(doublereal* hbar) const { /* @@ -729,35 +483,6 @@ void DebyeHuckel::getPartialMolarEnthalpies(doublereal* hbar) const } } -/* - * - * getPartialMolarEntropies() (virtual, const) - * - * Returns an array of partial molar entropies of the species in the - * solution. Units: J/kmol. - * - * Maxwell's equations provide an insight in how to calculate this - * (p.215 Smith and Van Ness) - * - * d(chemPot_i)/dT = -sbar_i - * - * For this phase, the partial molar entropies are equal to the - * SS species entropies plus the ideal solution contribution.following - * contribution: - * \f[ - * \bar s_k(T,P) = \hat s^0_k(T) - R log(M0 * molality[k]) - * \f] - * \f[ - * \bar s_solvent(T,P) = \hat s^0_solvent(T) - * - R ((xmolSolvent - 1.0) / xmolSolvent) - * \f] - * - * The reference-state pure-species entropies,\f$ \hat s^0_k(T) \f$, - * at the reference pressure, \f$ P_{ref} \f$, are computed by the - * species thermodynamic - * property manager. They are polynomial functions of temperature. - * @see SpeciesThermo - */ void DebyeHuckel:: getPartialMolarEntropies(doublereal* sbar) const { @@ -807,25 +532,6 @@ getPartialMolarEntropies(doublereal* sbar) const } } -/* - * getPartialMolarVolumes() (virtual, const) - * - * returns an array of partial molar volumes of the species - * in the solution. Units: m^3 kmol-1. - * - * For this solution, the partial molar volumes are normally - * equal to theconstant species molar volumes, except - * when the activity coefficients depend on pressure. - * - * The general relation is - * - * vbar_i = d(chemPot_i)/dP at const T, n - * - * = V0_i + d(Gex)/dP)_T,M - * - * = V0_i + RT d(lnActCoeffi)dP _T,M - * - */ void DebyeHuckel::getPartialMolarVolumes(doublereal* vbar) const { getStandardVolumes(vbar); @@ -841,15 +547,6 @@ void DebyeHuckel::getPartialMolarVolumes(doublereal* vbar) const } } -/* - * Partial molar heat capacity of the solution: - * The kth partial molar heat capacity is equal to - * the temperature derivative of the partial molar - * enthalpy of the kth species in the solution at constant - * P and composition (p. 220 Smith and Van Ness). - * - * Cp = -T d2(chemPot_i)/dT2 - */ void DebyeHuckel::getPartialMolarCp(doublereal* cpbar) const { /* @@ -886,19 +583,10 @@ void DebyeHuckel::getPartialMolarCp(doublereal* cpbar) const } } - - - /* * -------------- Utilities ------------------------------- */ -/* - * Initialization routine for a DebyeHuckel phase. - * - * This is a virtual routine. This routine will call initThermo() - * for the parent class as well. - */ void DebyeHuckel::initThermo() { MolalityVPSSTP::initThermo(); @@ -934,24 +622,6 @@ static int interp_est(const std::string& estString) return rval; } -/* - * Process the XML file after species are set up. - * - * This gets called from importPhase(). It processes the XML file - * after the species are set up. This is the main routine for - * reading in activity coefficient parameters. - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ void DebyeHuckel:: initThermoXML(XML_Node& phaseNode, const std::string& id) { @@ -1461,14 +1131,6 @@ initThermoXML(XML_Node& phaseNode, const std::string& id) } -/* - * @internal - * Set equation of state parameters. The number and meaning of - * these depends on the subclass. - * @param n number of parameters - * @param c array of \i n coefficients - * - */ void DebyeHuckel::setParameters(int n, doublereal* const c) { } @@ -1477,44 +1139,10 @@ void DebyeHuckel::getParameters(int& n, doublereal* const c) const { } -/* - * Set equation of state parameter values from XML - * entries. This method is called by function importPhase in - * file importCTML.cpp when processing a phase definition in - * an input file. It should be overloaded in subclasses to set - * any parameters that are specific to that particular phase - * model. - * - * @param eosdata An XML_Node object corresponding to - * the "thermo" entry for this phase in the input file. - * - * HKM -> Right now, the parameters are set elsewhere (initThermoXML) - * It just didn't seem to fit. - */ void DebyeHuckel::setParametersFromXML(const XML_Node& eosdata) { } -/* - * Report the molar volume of species k - * - * units - \f$ m^3 kmol^-1 \f$ - */ -// double DebyeHuckel::speciesMolarVolume(int k) const { -// return m_speciesSize[k]; -//} - - -/* - * A_Debye_TP() (virtual) - * - * Returns the A_Debye parameter as a function of temperature - * and pressure. - * - * The default is to assume that it is constant, given - * in the initialization process and stored in the - * member double, m_A_Debye - */ double DebyeHuckel::A_Debye_TP(double tempArg, double presArg) const { double T = temperature(); @@ -1542,16 +1170,6 @@ double DebyeHuckel::A_Debye_TP(double tempArg, double presArg) const return A; } -/* - * dA_DebyedT_TP() (virtual) - * - * Returns the derivative of the A_Debye parameter with - * respect to temperature as a function of temperature - * and pressure. - * - * units = A_Debye has units of sqrt(gmol kg-1). - * Temp has units of Kelvin. - */ double DebyeHuckel::dA_DebyedT_TP(double tempArg, double presArg) const { double T = temperature(); @@ -1577,16 +1195,6 @@ double DebyeHuckel::dA_DebyedT_TP(double tempArg, double presArg) const return dAdT; } -/* - * d2A_DebyedT2_TP() (virtual) - * - * Returns the 2nd derivative of the A_Debye parameter with - * respect to temperature as a function of temperature - * and pressure. - * - * units = A_Debye has units of sqrt(gmol kg-1). - * Temp has units of Kelvin. - */ double DebyeHuckel::d2A_DebyedT2_TP(double tempArg, double presArg) const { double T = temperature(); @@ -1612,16 +1220,6 @@ double DebyeHuckel::d2A_DebyedT2_TP(double tempArg, double presArg) const return d2AdT2; } -/* - * dA_DebyedP_TP() (virtual) - * - * Returns the derivative of the A_Debye parameter with - * respect to pressure, as a function of temperature - * and pressure. - * - * units = A_Debye has units of sqrt(gmol kg-1). - * Pressure has units of pascals. - */ double DebyeHuckel::dA_DebyedP_TP(double tempArg, double presArg) const { double T = temperature(); @@ -1647,13 +1245,10 @@ double DebyeHuckel::dA_DebyedP_TP(double tempArg, double presArg) const return dAdP; } -/* - * ----------- Critical State Properties -------------------------- - */ - /* * ---------- Other Property Functions */ + double DebyeHuckel::AionicRadius(int k) const { return m_Aionic[k]; @@ -1663,10 +1258,6 @@ double DebyeHuckel::AionicRadius(int k) const * ------------ Private and Restricted Functions ------------------ */ -/* - * Bail out of functions with an error exit if they are not - * implemented. - */ doublereal DebyeHuckel::err(const std::string& msg) const { throw CanteraError("DebyeHuckel", @@ -1674,13 +1265,6 @@ doublereal DebyeHuckel::err(const std::string& msg) const return 0.0; } - -/* - * initLengths(): - * - * This internal function adjusts the lengths of arrays based on - * the number of species - */ void DebyeHuckel::initLengths() { m_kk = nSpecies(); @@ -1705,13 +1289,6 @@ void DebyeHuckel::initLengths() } } -/* - * nonpolarActCoeff() (private) - * - * Static function that implements the non-polar species - * salt-out modifications. - * Returns the calculated activity coefficients. - */ double DebyeHuckel::_nonpolarActCoeff(double IionicMolality) const { double I2 = IionicMolality * IionicMolality; @@ -1722,16 +1299,7 @@ double DebyeHuckel::_nonpolarActCoeff(double IionicMolality) const return pow(10.0 , l10actCoeff); } - -/** - * _osmoticCoeffHelgesonFixedForm() - * - * Formula for the osmotic coefficient that occurs in - * the GWB. It is originally from Helgeson for a variable - * NaCl brine. It's to be used with extreme caution. - */ -double DebyeHuckel:: -_osmoticCoeffHelgesonFixedForm() const +double DebyeHuckel::_osmoticCoeffHelgesonFixedForm() const { const double a0 = 1.454; const double b0 = 0.02236; @@ -1750,17 +1318,7 @@ _osmoticCoeffHelgesonFixedForm() const return oc; } - -/* - * _activityWaterHelgesonFixedForm() - * - * Formula for the log of the activity of the water - * solvent that occurs in - * the GWB. It is originally from Helgeson for a variable - * NaCl brine. It's to be used with extreme caution. - */ -double DebyeHuckel:: -_lnactivityWaterHelgesonFixedForm() const +double DebyeHuckel::_lnactivityWaterHelgesonFixedForm() const { /* * Update the internally stored vector of molalities @@ -1780,19 +1338,6 @@ _lnactivityWaterHelgesonFixedForm() const return lac; } -/* - * s_update_lnMolalityActCoeff(): - * - * Using internally stored values, this function calculates - * the activity coefficients for all species. - * - * The ln(activity_solvent) is first calculated for the - * solvent. Then the molar based activity coefficient - * is calculated and returned. - * - * ( Note this is the main routine for implementing the - * activity coefficient formulation.) - */ void DebyeHuckel::s_update_lnMolalityActCoeff() const { double z_k, zs_k1, zs_k2; @@ -2051,18 +1596,6 @@ void DebyeHuckel::s_update_lnMolalityActCoeff() const lnActivitySolvent - log(xmolSolvent); } -/* - * s_update_dMolalityActCoeff_dT() (private, const ) - * - * Using internally stored values, this function calculates - * the temperature derivative of the logarithm of the - * activity coefficient for all species in the mechanism. - * - * We assume that the activity coefficients are current. - * - * solvent activity coefficient is on the molality - * scale. Its derivative is too. - */ void DebyeHuckel::s_update_dlnMolalityActCoeff_dT() const { double z_k, coeff, tmp, y, yp1, sigma, tmpLn; @@ -2190,19 +1723,6 @@ void DebyeHuckel::s_update_dlnMolalityActCoeff_dT() const } -/* - * s_update_d2lnMolalityActCoeff_dT2() (private, const ) - * - * Using internally stored values, this function calculates - * the temperature 2nd derivative of the logarithm of the - * activity coefficient - * for all species in the mechanism. - * - * We assume that the activity coefficients are current. - * - * solvent activity coefficient is on the molality - * scale. Its derivatives are too. - */ void DebyeHuckel::s_update_d2lnMolalityActCoeff_dT2() const { double z_k, coeff, tmp, y, yp1, sigma, tmpLn; @@ -2325,19 +1845,6 @@ void DebyeHuckel::s_update_d2lnMolalityActCoeff_dT2() const } } -/* - * s_update_dlnMolalityActCoeff_dP() (private, const ) - * - * Using internally stored values, this function calculates - * the pressure derivative of the logarithm of the - * activity coefficient for all species in the mechanism. - * - * We assume that the activity coefficients, molalities, - * and A_Debye are current. - * - * solvent activity coefficient is on the molality - * scale. Its derivatives are too. - */ void DebyeHuckel::s_update_dlnMolalityActCoeff_dP() const { double z_k, coeff, tmp, y, yp1, sigma, tmpLn; @@ -2464,25 +1971,4 @@ void DebyeHuckel::s_update_dlnMolalityActCoeff_dP() const } } -/* - * Updates the standard state thermodynamic functions at the current T and P of the solution. - * - * @internal - * - * This function gets called for every call to functions in this - * class. It checks to see whether the temperature or pressure has changed and - * thus the ss thermodynamics functions for all of the species - * must be recalculated. - */ -// void DebyeHuckel::_updateStandardStateThermo() const { -// doublereal tnow = temperature(); -// doublereal pnow = m_Pcurrent; -// if (m_waterSS) { -// m_waterSS->setTempPressure(tnow, pnow); -// } -// m_VPSS_ptr->setState_TP(tnow, pnow); -// VPStandardStateTP::updateStandardStateThermo(); - -//} - } diff --git a/src/thermo/GibbsExcessVPSSTP.cpp b/src/thermo/GibbsExcessVPSSTP.cpp index b9bd040fc..6429a0794 100644 --- a/src/thermo/GibbsExcessVPSSTP.cpp +++ b/src/thermo/GibbsExcessVPSSTP.cpp @@ -26,10 +26,6 @@ using namespace std; namespace Cantera { -/* - * Default constructor. - * - */ GibbsExcessVPSSTP::GibbsExcessVPSSTP() : VPStandardStateTP(), moleFractions_(0), @@ -43,12 +39,6 @@ GibbsExcessVPSSTP::GibbsExcessVPSSTP() : { } -/* - * Copy Constructor: - * - * Note this stuff will not work until the underlying phase - * has a working copy constructor - */ GibbsExcessVPSSTP::GibbsExcessVPSSTP(const GibbsExcessVPSSTP& b) : VPStandardStateTP(), moleFractions_(0), @@ -63,12 +53,6 @@ GibbsExcessVPSSTP::GibbsExcessVPSSTP(const GibbsExcessVPSSTP& b) : GibbsExcessVPSSTP::operator=(b); } -/* - * operator=() - * - * Note this stuff will not work until the underlying phase - * has a working assignment operator - */ GibbsExcessVPSSTP& GibbsExcessVPSSTP:: operator=(const GibbsExcessVPSSTP& b) { @@ -90,31 +74,16 @@ operator=(const GibbsExcessVPSSTP& b) return *this; } -/* - * - * ~GibbsExcessVPSSTP(): (virtual) - * - * Destructor: does nothing: - * - */ GibbsExcessVPSSTP::~GibbsExcessVPSSTP() { } -/* - * This routine duplicates the current object and returns - * a pointer to ThermoPhase. - */ ThermoPhase* GibbsExcessVPSSTP::duplMyselfAsThermoPhase() const { return new GibbsExcessVPSSTP(*this); } -/* - * -------------- Utilities ------------------------------- - */ - void GibbsExcessVPSSTP::setMassFractions(const doublereal* const y) { Phase::setMassFractions(y); @@ -139,44 +108,21 @@ void GibbsExcessVPSSTP::setMoleFractions_NoNorm(const doublereal* const x) getMoleFractions(DATA_PTR(moleFractions_)); } - void GibbsExcessVPSSTP::setConcentrations(const doublereal* const c) { Phase::setConcentrations(c); getMoleFractions(DATA_PTR(moleFractions_)); } - -// Equation of state type flag. -/* - * The ThermoPhase base class returns - * zero. Subclasses should define this to return a unique - * non-zero value. Known constants defined for this purpose are - * listed in mix_defs.h. The GibbsExcessVPSSTP class also returns - * zero, as it is a non-complete class. - */ int GibbsExcessVPSSTP::eosType() const { return 0; } - - /* - * ------------ Molar Thermodynamic Properties ---------------------- - */ - -/* - * * ------------ Mechanical Properties ------------------------------ - * */ -/* - * Set the pressure at constant temperature. Units: Pa. - * This method sets a constant within the object. - * The mass density is not a function of pressure. - */ void GibbsExcessVPSSTP::setPressure(doublereal p) { setState_TP(temperature(), p); @@ -215,17 +161,15 @@ void GibbsExcessVPSSTP::setState_TP(doublereal t, doublereal p) calcDensity(); } - - /* * - Activities, Standard States, Activity Concentrations ----------- */ + void GibbsExcessVPSSTP::getActivityConcentrations(doublereal* c) const { getActivities(c); } - doublereal GibbsExcessVPSSTP::standardConcentration(size_t k) const { return 1.0; @@ -261,7 +205,6 @@ void GibbsExcessVPSSTP::getActivityCoefficients(doublereal* const ac) const } } } -//==================================================================================================================== void GibbsExcessVPSSTP::getElectrochemPotentials(doublereal* mu) const { @@ -276,16 +219,6 @@ void GibbsExcessVPSSTP::getElectrochemPotentials(doublereal* mu) const * ------------ Partial Molar Properties of the Solution ------------ */ -// Return an array of partial molar volumes for the -// species in the mixture. Units: m^3/kmol. -/* - * Frequently, for this class of thermodynamics representations, - * the excess Volume due to mixing is zero. Here, we set it as - * a default. It may be overridden in derived classes. - * - * @param vbar Output vector of species partial molar volumes. - * Length = m_kk. units are m^3/kmol. - */ void GibbsExcessVPSSTP::getPartialMolarVolumes(doublereal* vbar) const { /* @@ -299,7 +232,6 @@ const vector_fp& GibbsExcessVPSSTP::getPartialMolarVolumes() const return getStandardVolumes(); } - doublereal GibbsExcessVPSSTP::err(const std::string& msg) const { throw CanteraError("GibbsExcessVPSSTP","Base class method " @@ -307,8 +239,6 @@ doublereal GibbsExcessVPSSTP::err(const std::string& msg) const return 0; } - - double GibbsExcessVPSSTP::checkMFSum(const doublereal* const x) const { doublereal norm = accumulate(x, x + m_kk, 0.0); @@ -319,28 +249,6 @@ double GibbsExcessVPSSTP::checkMFSum(const doublereal* const x) const return norm; } -/* - * Returns the units of the standard and general concentrations - * Note they have the same units, as their divisor is - * defined to be equal to the activity of the kth species - * in the solution, which is unitless. - * - * This routine is used in print out applications where the - * units are needed. Usually, MKS units are assumed throughout - * the program and in the XML input files. - * - * On return uA contains the powers of the units (MKS assumed) - * of the standard concentrations and generalized concentrations - * for the kth species. - * - * uA[0] = kmol units - default = 1 - * uA[1] = m units - default = -nDim(), the number of spatial - * dimensions in the Phase class. - * uA[2] = kg units - default = 0; - * uA[3] = Pa(pressure) units - default = 0; - * uA[4] = Temperature units - default = 0; - * uA[5] = time units - default = 0 - */ void GibbsExcessVPSSTP::getUnitsStandardConc(double* uA, int k, int sizeUA) const { for (int i = 0; i < sizeUA; i++) { @@ -365,20 +273,6 @@ void GibbsExcessVPSSTP::getUnitsStandardConc(double* uA, int k, int sizeUA) cons } } - -/* - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase. - * - * @see importCTML.cpp - */ void GibbsExcessVPSSTP::initThermo() { initLengths(); @@ -386,9 +280,6 @@ void GibbsExcessVPSSTP::initThermo() getMoleFractions(DATA_PTR(moleFractions_)); } - -// Initialize lengths of local variables after all species have -// been identified. void GibbsExcessVPSSTP::initLengths() { m_kk = nSpecies(); @@ -402,6 +293,4 @@ void GibbsExcessVPSSTP::initLengths() m_pp.resize(m_kk); } - } - diff --git a/src/thermo/HMWSoln.cpp b/src/thermo/HMWSoln.cpp index bcf3ef9e0..4d5d8ee6f 100644 --- a/src/thermo/HMWSoln.cpp +++ b/src/thermo/HMWSoln.cpp @@ -31,9 +31,6 @@ namespace Cantera { -/* - * Default constructor - */ HMWSoln::HMWSoln() : MolalityVPSSTP(), m_formPitzer(PITZERFORM_BASE), @@ -55,11 +52,11 @@ HMWSoln::HMWSoln() : IMS_gamma_k_min_(10.0), IMS_cCut_(0.05), IMS_slopefCut_(0.6), + IMS_slopegCut_(0.0), IMS_dfCut_(0.0), IMS_efCut_(0.0), IMS_afCut_(0.0), IMS_bfCut_(0.0), - IMS_slopegCut_(0.0), IMS_dgCut_(0.0), IMS_egCut_(0.0), IMS_agCut_(0.0), @@ -83,14 +80,7 @@ HMWSoln::HMWSoln() : elambda1[i] = 0.0; } } -/* - * Working constructors - * - * The two constructors below are the normal way - * the phase initializes itself. They are shells that call - * the routine initThermo(), with a reference to the - * XML database to get the info for the phase. - */ + HMWSoln::HMWSoln(const std::string& inputFile, const std::string& id) : MolalityVPSSTP(), m_formPitzer(PITZERFORM_BASE), @@ -112,11 +102,11 @@ HMWSoln::HMWSoln(const std::string& inputFile, const std::string& id) : IMS_gamma_k_min_(10.0), IMS_cCut_(0.05), IMS_slopefCut_(0.6), + IMS_slopegCut_(0.0), IMS_dfCut_(0.0), IMS_efCut_(0.0), IMS_afCut_(0.0), IMS_bfCut_(0.0), - IMS_slopegCut_(0.0), IMS_dgCut_(0.0), IMS_egCut_(0.0), IMS_agCut_(0.0), @@ -163,11 +153,11 @@ HMWSoln::HMWSoln(XML_Node& phaseRoot, const std::string& id) : IMS_gamma_k_min_(10.0), IMS_cCut_(0.05), IMS_slopefCut_(0.6), + IMS_slopegCut_(0.0), IMS_dfCut_(0.0), IMS_efCut_(0.0), IMS_afCut_(0.0), IMS_bfCut_(0.0), - IMS_slopegCut_(0.0), IMS_dgCut_(0.0), IMS_egCut_(0.0), IMS_agCut_(0.0), @@ -193,12 +183,6 @@ HMWSoln::HMWSoln(XML_Node& phaseRoot, const std::string& id) : importPhase(*findXMLPhase(&phaseRoot, id), this); } -/* - * Copy Constructor: - * - * Note this stuff will not work until the underlying phase - * has a working copy constructor - */ HMWSoln::HMWSoln(const HMWSoln& b) : MolalityVPSSTP(), m_formPitzer(PITZERFORM_BASE), @@ -220,11 +204,11 @@ HMWSoln::HMWSoln(const HMWSoln& b) : IMS_gamma_k_min_(10.0), IMS_cCut_(0.05), IMS_slopefCut_(0.6), + IMS_slopegCut_(0.0), IMS_dfCut_(0.0), IMS_efCut_(0.0), IMS_afCut_(0.0), IMS_bfCut_(0.0), - IMS_slopegCut_(0.0), IMS_dgCut_(0.0), IMS_egCut_(0.0), IMS_agCut_(0.0), @@ -250,12 +234,6 @@ HMWSoln::HMWSoln(const HMWSoln& b) : *this = b; } -/* - * operator=() - * - * Note this stuff will not work until the underlying phase - * has a working assignment operator - */ HMWSoln& HMWSoln:: operator=(const HMWSoln& b) { @@ -417,33 +395,6 @@ operator=(const HMWSoln& b) return *this; } - - -/* - * - * - * test problems: - * 1 = NaCl problem - 5 species - - * the thermo is read in from an XML file - * - * speci molality charge - * Cl- 6.0954 6.0997E+00 -1 - * H+ 1.0000E-08 2.1628E-09 1 - * Na+ 6.0954E+00 6.0997E+00 1 - * OH- 7.5982E-07 1.3977E-06 -1 - * HMW_params____beta0MX__beta1MX__beta2MX__CphiMX_____alphaMX__thetaij - * 10 - * 1 2 0.1775 0.2945 0.0 0.00080 2.0 0.0 - * 1 3 0.0765 0.2664 0.0 0.00127 2.0 0.0 - * 1 4 0.0 0.0 0.0 0.0 0.0 -0.050 - * 2 3 0.0 0.0 0.0 0.0 0.0 0.036 - * 2 4 0.0 0.0 0.0 0.0 0.0 0.0 - * 3 4 0.0864 0.253 0.0 0.0044 2.0 0.0 - * Triplet_interaction_parameters_psiaa'_or_psicc' - * 2 - * 1 2 3 -0.004 - * 1 3 4 -0.006 - */ HMWSoln::HMWSoln(int testProb) : MolalityVPSSTP(), m_formPitzer(PITZERFORM_BASE), @@ -465,11 +416,11 @@ HMWSoln::HMWSoln(int testProb) : IMS_gamma_k_min_(10.0), IMS_cCut_(0.05), IMS_slopefCut_(0.6), + IMS_slopegCut_(0.0), IMS_dfCut_(0.0), IMS_efCut_(0.0), IMS_afCut_(0.0), IMS_bfCut_(0.0), - IMS_slopegCut_(0.0), IMS_dgCut_(0.0), IMS_egCut_(0.0), IMS_agCut_(0.0), @@ -585,11 +536,6 @@ HMWSoln::HMWSoln(int testProb) : printCoeffs(); } -/* - * ~HMWSoln(): (virtual) - * - * Destructor: does nothing: - */ HMWSoln::~HMWSoln() { if (m_waterProps) { @@ -598,24 +544,11 @@ HMWSoln::~HMWSoln() } } -/* - * duplMyselfAsThermoPhase(): - * - * This routine operates at the ThermoPhase level to - * duplicate the current object. It uses the copy constructor - * defined above. - */ ThermoPhase* HMWSoln::duplMyselfAsThermoPhase() const { return new HMWSoln(*this); } -/* - * Equation of state type flag. The base class returns - * zero. Subclasses should define this to return a unique - * non-zero value. Constants defined for this purpose are - * listed in mix_defs.h. - */ int HMWSoln::eosType() const { int res; @@ -638,9 +571,6 @@ int HMWSoln::eosType() const // // -------- Molar Thermodynamic Properties of the Solution --------------- // -/* - * Molar enthalpy of the solution. Units: J/kmol. - */ doublereal HMWSoln::enthalpy_mole() const { getPartialMolarEnthalpies(DATA_PTR(m_tmpV)); @@ -662,8 +592,6 @@ doublereal HMWSoln::relative_enthalpy() const return (hbar - h0bar); } - - doublereal HMWSoln::relative_molal_enthalpy() const { double L = relative_enthalpy(); @@ -706,12 +634,6 @@ doublereal HMWSoln::relative_molal_enthalpy() const return L; } -/* - * Molar internal energy of the solution. Units: J/kmol. - * - * This is calculated from the soln enthalpy and then - * subtracting pV. - */ doublereal HMWSoln::intEnergy_mole() const { double hh = enthalpy_mole(); @@ -721,29 +643,18 @@ doublereal HMWSoln::intEnergy_mole() const return uu; } -/* - * Molar soln entropy at constant pressure. Units: J/kmol/K. - * - * This is calculated from the partial molar entropies. - */ doublereal HMWSoln::entropy_mole() const { getPartialMolarEntropies(DATA_PTR(m_tmpV)); return mean_X(DATA_PTR(m_tmpV)); } -/// Molar Gibbs function. Units: J/kmol. doublereal HMWSoln::gibbs_mole() const { getChemPotentials(DATA_PTR(m_tmpV)); return mean_X(DATA_PTR(m_tmpV)); } -/* Molar heat capacity at constant pressure. Units: J/kmol/K. - * - * Returns the solution heat capacition at constant pressure. - * This is calculated from the partial molar heat capacities. - */ doublereal HMWSoln::cp_mole() const { getPartialMolarCp(DATA_PTR(m_tmpV)); @@ -751,7 +662,6 @@ doublereal HMWSoln::cp_mole() const return val; } -// Molar heat capacity at constant volume. Units: J/kmol/K. doublereal HMWSoln::cv_mole() const { double kappa_t = isothermalCompressibility(); @@ -767,21 +677,11 @@ doublereal HMWSoln::cv_mole() const // ------- Mechanical Equation of State Properties ------------------------ // -/** - * Pressure. Units: Pa. - * For this incompressible system, we return the internally stored - * independent value of the pressure. - */ doublereal HMWSoln::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. - */ void HMWSoln::setPressure(doublereal p) { setState_TP(temperature(), p); @@ -801,16 +701,6 @@ void HMWSoln::calcDensity() Phase::setDensity(dd); } -/* - * The isothermal compressibility. Units: 1/Pa. - * The isothermal compressibility is defined as - * \f[ - * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T - * \f] - * - * It's equal to zero for this model, since the molar volume - * doesn't change with pressure or temperature. - */ doublereal HMWSoln::isothermalCompressibility() const { throw CanteraError("HMWSoln::isothermalCompressibility", @@ -818,17 +708,6 @@ doublereal HMWSoln::isothermalCompressibility() const return 0.0; } -/* - * The thermal expansion coefficient. Units: 1/K. - * The thermal expansion coefficient is defined as - * - * \f[ - * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P - * \f] - * - * It's equal to zero for this model, since the molar volume - * doesn't change with pressure or temperature. - */ doublereal HMWSoln::thermalExpansionCoeff() const { throw CanteraError("HMWSoln::thermalExpansionCoeff", @@ -842,26 +721,6 @@ double HMWSoln::density() const return Phase::density(); } -/* - * 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 - * - * @internal May have to adjust the strategy here to make - * the eos for these materials slightly compressible, in order - * to create a condition where the density is a function of - * the pressure. - * - * This function will now throw an error condition. - * - * NOTE: This is an overwritten function from the State.h - * class - */ void HMWSoln::setDensity(const doublereal rho) { double dens_old = density(); @@ -872,36 +731,17 @@ void HMWSoln::setDensity(const doublereal rho) } } -/* - * Overwritten setMolarDensity() function is necessary because the - * density is not an independent variable. - * - * This function will now throw an error condition. - * - * NOTE: This is an overwritten function from the State.h - * class - */ void HMWSoln::setMolarDensity(const doublereal rho) { throw CanteraError("HMWSoln::setMolarDensity", "Density is not an independent variable"); } -/* - * Overwritten setTemperature(double) from State.h. This - * function sets the temperature, and makes sure that - * the value propagates to underlying objects. - */ void HMWSoln::setTemperature(const doublereal temp) { setState_TP(temp, m_Pcurrent); } -/* - * Overwritten setTemperature(double) from State.h. This - * function sets the temperature, and makes sure that - * the value propagates to underlying objects. - */ void HMWSoln::setState_TP(doublereal temp, doublereal pres) { Phase::setTemperature(temp); @@ -932,19 +772,6 @@ void HMWSoln::setState_TP(doublereal temp, doublereal pres) // ------- Activities and Activity Concentrations // -/* - * This method returns an array of generalized concentrations - * \f$ C_k\f$ that are defined such that - * \f$ a_k = C_k / C^0_k, \f$ where \f$ C^0_k \f$ - * is a standard concentration - * defined below. These generalized concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. - * - * @param c Array of generalized concentrations. The - * units depend upon the implementation of the - * reaction rate expressions within the phase. - */ void HMWSoln::getActivityConcentrations(doublereal* c) const { double cs_solvent = standardConcentration(); @@ -958,28 +785,6 @@ void HMWSoln::getActivityConcentrations(doublereal* c) const } } -/* - * The standard concentration \f$ C^0_k \f$ used to normalize - * the generalized concentration. In many cases, this quantity - * will be the same for all species in a phase - for example, - * for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this - * reason, this method returns a single value, instead of an - * array. However, for phases in which the standard - * concentration is species-specific (e.g. surface species of - * different sizes), this method may be called with an - * optional parameter indicating the species. - * - * For the time being we will use the concentration of pure - * solvent for the the standard concentration of the solvent. - * We will use the concentration of the pure solvent - * multipled by Mnaught (kg solvent / gmol solvent) for - * the standard concentration of all solute species. - * This has the effect of making reaction rates - * based on the molality of species proportional to the - * molality of the species, but have units based on assuming - * all species concentrations have units of kmol/m3. - * - */ doublereal HMWSoln::standardConcentration(size_t k) const { getStandardVolumes(DATA_PTR(m_tmpV)); @@ -990,38 +795,12 @@ doublereal HMWSoln::standardConcentration(size_t k) const return 1.0 / mvSolvent; } -/* - * Returns the natural logarithm of the standard - * concentration of the kth species - */ doublereal HMWSoln::logStandardConc(size_t k) const { double c_solvent = standardConcentration(k); return log(c_solvent); } -/* - * Returns the units of the standard and general concentrations - * Note they have the same units, as their divisor is - * defined to be equal to the activity of the kth species - * in the solution, which is unitless. - * - * This routine is used in print out applications where the - * units are needed. Usually, MKS units are assumed throughout - * the program and in the XML input files. - * - * On return uA contains the powers of the units (MKS assumed) - * of the standard concentrations and generalized concentrations - * for the kth species. - * - * uA[0] = kmol units - default = 1 - * uA[1] = m units - default = -nDim(), the number of spatial - * dimensions in the Phase class. - * uA[2] = kg units - default = 0; - * uA[3] = Pa(pressure) units - default = 0; - * uA[4] = Temperature units - default = 0; - * uA[5] = time units - default = 0 - */ void HMWSoln::getUnitsStandardConc(double* uA, int k, int sizeUA) const { for (int i = 0; i < sizeUA; i++) { @@ -1046,13 +825,6 @@ void HMWSoln::getUnitsStandardConc(double* uA, int k, int sizeUA) const } } -/* - * Get the array of non-dimensional activities at - * the current solution temperature, pressure, and - * solution concentration. - * (note solvent activity coefficient is on the molar scale). - * - */ void HMWSoln::getActivities(doublereal* ac) const { updateStandardStateThermo(); @@ -1078,17 +850,6 @@ void HMWSoln::getActivities(doublereal* ac) const //applyphScale(ac); } -/* - * getUnscaledMolalityActivityCoefficients() (virtual, const) - * - * Get the array of non-dimensional Molality based - * activity coefficients at - * the current solution temperature, pressure, and - * solution concentration. - * (note solvent activity coefficient is on the molar scale). - * - * Note, most of the work is done in an internal private routine - */ void HMWSoln:: getUnscaledMolalityActivityCoefficients(doublereal* acMolality) const { @@ -1104,21 +865,7 @@ getUnscaledMolalityActivityCoefficients(doublereal* acMolality) const // // ------ Partial Molar Properties of the Solution ----------------- // -/* - * Get the species chemical potentials. Units: J/kmol. - * - * This function returns a vector of chemical potentials of the - * species in solution. - * - * \f[ - * \mu_k = \mu^{o}_k(T,P) + R T ln(m_k) - * \f] - * - * \f[ - * \mu_solvent = \mu^{o}_solvent(T,P) + - * R T ((X_solvent - 1.0) / X_solvent) - * \f] - */ + void HMWSoln::getChemPotentials(doublereal* mu) const { double xx; @@ -1147,26 +894,6 @@ void HMWSoln::getChemPotentials(doublereal* mu) const RT * (log(xx) + m_lnActCoeffMolal_Scaled[m_indexSolvent]); } - -/* - * 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^{\triangle}_k(T,P) - R T^2 \frac{d \ln(\gamma_k^\triangle)}{dT} - * \f] - * The solvent partial molar enthalpy is equal to - * \f[ - * \bar h_o(T,P) = h^{o}_o(T,P) - R T^2 \frac{d \ln(a_o)}{dT} - * \f] - * - * - */ void HMWSoln::getPartialMolarEnthalpies(doublereal* hbar) const { /* @@ -1193,35 +920,6 @@ void HMWSoln::getPartialMolarEnthalpies(doublereal* hbar) const } } -/* - * getPartialMolarEntropies() (virtual, const) - * - * Returns an array of partial molar entropies of the species in the - * solution. Units: J/kmol. - * - * Maxwell's equations provide an insight in how to calculate this - * (p.215 Smith and Van Ness) - * - * d(chemPot_i)/dT = -sbar_i - * - * Combining this with the expression H = G + TS yields: - * - * \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} - * \f] - * \f[ - * \bar s_o(T,P) = s^o_o(T,P) - R \ln(a_o) - * - R T \frac{d \ln(a_o)}{dT} - * \f] - * - * The reference-state pure-species entropies,\f$ \hat s^0_k(T) \f$, - * at the reference pressure, \f$ P_{ref} \f$, are computed by the - * species thermodynamic - * property manager. They are polynomial functions of temperature. - * @see SpeciesThermo - */ void HMWSoln:: getPartialMolarEntropies(doublereal* sbar) const { @@ -1268,24 +966,6 @@ getPartialMolarEntropies(doublereal* sbar) const } } -/* - * getPartialMolarVolumes() (virtual, const) - * - * Returns an array of partial molar volumes of the species - * in the solution. Units: m^3 kmol-1. - * - * For this solution, the partial molar volumes are a - * complex function of pressure. - * - * The general relation is - * - * vbar_i = d(chemPot_i)/dP at const T, n - * - * = V0_i + d(Gex)/dP)_T,M - * - * = V0_i + RT d(lnActCoeffi)dP _T,M - * - */ void HMWSoln::getPartialMolarVolumes(doublereal* vbar) const { /* @@ -1304,24 +984,6 @@ void HMWSoln::getPartialMolarVolumes(doublereal* vbar) const } } -/* - * Partial molar heat capacity of the solution: - * The kth partial molar heat capacity is equal to - * the temperature derivative of the partial molar - * enthalpy of the kth species in the solution at constant - * P and composition (p. 220 Smith and Van Ness). - * - * \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} - * \f] - * \f[ - * \bar C_{p,o}(T,P) = C^o_{p,o}(T,P) - * - 2 R T \frac{d \ln(a_o)}{dT} - * - R T^2 \frac{d^2 \ln(a_o)}{{dT}^2} - * \f] - */ void HMWSoln::getPartialMolarCp(doublereal* cpbar) const { /* @@ -1349,45 +1011,10 @@ void HMWSoln::getPartialMolarCp(doublereal* cpbar) const } } -/* - * Updates the standard state thermodynamic functions at the current T and - * P of the solution. - * - * @internal - * - * This function gets called for every call to functions in this - * class. It checks to see whether the temperature or pressure has changed and - * thus the ss thermodynamics functions for all of the species - * must be recalculated. - */ -// void HMWSoln::_updateStandardStateThermo() const { -//doublereal tnow = temperature(); -// doublereal pnow = m_Pcurrent; -// if (m_waterSS) { -// m_waterSS->setTempPressure(tnow, pnow); -// } -// m_VPSS_ptr->setState_TP(tnow, pnow); -// VPStandardStateTP::updateStandardStateThermo(); -//} - -/* - * ------ Thermodynamic Values for the Species Reference States --- - */ - -// -> This is handled by VPStandardStatesTP - /* * -------------- Utilities ------------------------------- */ -/* - * @internal - * Set equation of state parameters. The number and meaning of - * these depends on the subclass. - * @param n number of parameters - * @param c array of n coefficients - * - */ void HMWSoln::setParameters(int n, doublereal* const c) { } @@ -1395,32 +1022,11 @@ void HMWSoln::setParameters(int n, doublereal* const c) void HMWSoln::getParameters(int& n, doublereal* const c) const { } -/* - * Set equation of state parameter values from XML - * entries. This method is called by function importPhase in - * file importCTML.cpp when processing a phase definition in - * an input file. It should be overloaded in subclasses to set - * any parameters that are specific to that particular phase - * model. - * - * @param eosdata An XML_Node object corresponding to - * the "thermo" entry for this phase in the input file. - * - * HKM -> Right now, the parameters are set elsewhere (initThermoXML) - * It just didn't seem to fit. - */ + void HMWSoln::setParametersFromXML(const XML_Node& eosdata) { } -/* - * 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. - */ doublereal HMWSoln::satPressure(doublereal t) const { double p_old = pressure(); @@ -1433,26 +1039,6 @@ doublereal HMWSoln::satPressure(doublereal t) const return pres; } -/* - * A_Debye_TP() (virtual) - * - * Returns the A_Debye parameter as a function of temperature - * and pressure. This function also sets the internal value - * of the parameter within the object, if it is changeable. - * - * The default is to assume that it is constant, given - * in the initialization process and stored in the - * member double, m_A_Debye - * - * A_Debye = (1/(8 Pi)) sqrt(2 Na dw /1000) - * (e e/(epsilon R T))^3/2 - * - * where epsilon = e_rel * e_naught - * - * Note, this is SI units. Frequently, gaussian units are - * used in Pitzer's papers where D is used, D = epsilon/(4 Pi) - * units = A_Debye has units of sqrt(gmol kg-1). - */ double HMWSoln::A_Debye_TP(double tempArg, double presArg) const { double T = temperature(); @@ -1480,16 +1066,6 @@ double HMWSoln::A_Debye_TP(double tempArg, double presArg) const return A; } -/* - * dA_DebyedT_TP() (virtual) - * - * Returns the derivative of the A_Debye parameter with - * respect to temperature as a function of temperature - * and pressure. - * - * units = A_Debye has units of sqrt(gmol kg-1). - * Temp has units of Kelvin. - */ double HMWSoln::dA_DebyedT_TP(double tempArg, double presArg) const { doublereal T = temperature(); @@ -1516,16 +1092,6 @@ double HMWSoln::dA_DebyedT_TP(double tempArg, double presArg) const return dAdT; } -/* - * dA_DebyedP_TP() (virtual) - * - * Returns the derivative of the A_Debye parameter with - * respect to pressure, as a function of temperature - * and pressure. - * - * units = A_Debye has units of sqrt(gmol kg-1). - * Pressure has units of pascals. - */ double HMWSoln::dA_DebyedP_TP(double tempArg, double presArg) const { double T = temperature(); @@ -1551,17 +1117,6 @@ double HMWSoln::dA_DebyedP_TP(double tempArg, double presArg) const return dAdP; } - -/* - * Calculate the DH Parameter used for the Enthalpy calculations - * - * ADebye_L = 4 R T**2 d(Aphi) / dT - * - * where Aphi = A_Debye/3 - * - * units -> J / (kmolK) * sqrt( kg/gmol) - * - */ double HMWSoln::ADebye_L(double tempArg, double presArg) const { double dAdT = dA_DebyedT_TP(); @@ -1574,16 +1129,6 @@ double HMWSoln::ADebye_L(double tempArg, double presArg) const return retn; } -/* - * Calculate the DH Parameter used for the Volume calculations - * - * ADebye_V = - 4 R T d(Aphi) / dP - * - * where Aphi = A_Debye/3 - * - * units -> J / (kmolK) * sqrt( kg/gmol) - * - */ double HMWSoln::ADebye_V(double tempArg, double presArg) const { double dAdP = dA_DebyedP_TP(); @@ -1596,24 +1141,6 @@ double HMWSoln::ADebye_V(double tempArg, double presArg) const return retn; } -/* - * Return Pitzer's definition of A_J. This is basically the - * temperature derivative of A_L, and the second derivative - * of Aphi - * It's the DH parameter used in heat capacity calculations - * - * A_J = 2 A_L/T + 4 * R * T * T * d2(A_phi)/dT2 - * - * Units = sqrt(kg/gmol) (R) - * - * where - * ADebye_L = 4 R T**2 d(Aphi) / dT - * - * where Aphi = A_Debye/3 - * - * units -> J / (kmolK) * sqrt( kg/gmol) - * - */ double HMWSoln::ADebye_J(double tempArg, double presArg) const { double T = temperature(); @@ -1627,16 +1154,6 @@ double HMWSoln::ADebye_J(double tempArg, double presArg) const return retn; } -/* - * d2A_DebyedT2_TP() (virtual) - * - * Returns the 2nd derivative of the A_Debye parameter with - * respect to temperature as a function of temperature - * and pressure. - * - * units = A_Debye has units of sqrt(gmol kg-1). - * Temp has units of Kelvin. - */ double HMWSoln::d2A_DebyedT2_TP(double tempArg, double presArg) const { double T = temperature(); @@ -1662,10 +1179,6 @@ double HMWSoln::d2A_DebyedT2_TP(double tempArg, double presArg) const return d2AdT2; } -/* - * ----------- Critical State Properties -------------------------- - */ - /* * ---------- Other Property Functions */ @@ -1678,10 +1191,6 @@ double HMWSoln::AionicRadius(int k) const * ------------ Private and Restricted Functions ------------------ */ -/** - * Bail out of functions with an error exit if they are not - * implemented. - */ doublereal HMWSoln::err(const std::string& msg) const { throw CanteraError("HMWSoln", @@ -1689,15 +1198,6 @@ doublereal HMWSoln::err(const std::string& msg) const return 0.0; } - - -/* - * initLengths(): - * - * This internal function adjusts the lengths of arrays based on - * the number of species. This is done before these arrays are - * populated with parameter values. - */ void HMWSoln::initLengths() { m_kk = nSpecies(); @@ -1829,14 +1329,8 @@ void HMWSoln::initLengths() counterIJ_setup(); } -/** - * Calculate the natural log of the molality-based - * activity coefficients. - * - */ void HMWSoln::s_update_lnMolalityActCoeff() const { - /* * Calculate the molalities. Currently, the molalities * may not be current with respect to the contents of the @@ -1865,7 +1359,6 @@ void HMWSoln::s_update_lnMolalityActCoeff() const } } - /* * Update the temperature dependence of the pitzer coefficients * and their derivatives @@ -1922,10 +1415,6 @@ void HMWSoln::s_update_lnMolalityActCoeff() const s_updateScaling_pHScaling(); } - -/* - * Calculate cropped molalities - */ void HMWSoln::calcMolalitiesCropped() const { doublereal Imax = 0.0, Itmp; @@ -2091,13 +1580,6 @@ void HMWSoln::calcMolalitiesCropped() const } -/* - * Set up a counter variable for keeping track of symmetric binary - * interactions amongst the solute species. - * - * n = m_kk*i + j - * m_Counter[n] = counter - */ void HMWSoln::counterIJ_setup(void) const { size_t n, nc, i, j; @@ -2122,19 +1604,6 @@ void HMWSoln::counterIJ_setup(void) const } } -/* - * 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. - * - * @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 HMWSoln::s_updatePitzer_CoeffWRTemp(int doDerivs) const { @@ -2408,17 +1877,9 @@ void HMWSoln::s_updatePitzer_CoeffWRTemp(int doDerivs) const } -/* - * 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. - */ void HMWSoln:: s_updatePitzer_lnMolalityActCoeff() const { - /* * HKM -> Assumption is made that the solvent is * species 0. @@ -2575,7 +2036,6 @@ s_updatePitzer_lnMolalityActCoeff() const #endif /* - * * calculate g(x) and hfunc(x) for each cation-anion pair MX * In the original literature, hfunc, was called gprime. However, * it's not the derivative of g(x), so I renamed it. @@ -3452,18 +2912,6 @@ s_updatePitzer_lnMolalityActCoeff() const #endif } -/** - * s_update_dlnMolalityActCoeff_dT() (private, const ) - * - * Using internally stored values, this function calculates - * the temperature derivative of the logarithm of the - * activity coefficient for all species in the mechanism. - * - * We assume that the activity coefficients are current. - * - * solvent activity coefficient is on the molality - * scale. It's derivative is too. - */ void HMWSoln::s_update_dlnMolalityActCoeff_dT() const { /* @@ -3497,21 +2945,13 @@ void HMWSoln::s_update_dlnMolalityActCoeff_dT() const } -/*************************************************************************************/ - -/* - * Calculate the Pitzer portion of the temperature - * derivative of the log activity coefficients. - * This is an internal routine. - * - * It may be assumed that the - * Pitzer activity coefficient routine is called immediately - * preceding the calling of this routine. Therefore, some - * quantities do not need to be recalculated in this routine. - * - */ void HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dT() const { + /* + * It may be assumed that the Pitzer activity coefficient routine is + * called immediately preceding the calling of this routine. Therefore, + * some quantities do not need to be recalculated in this routine. + */ /* * HKM -> Assumption is made that the solvent is @@ -3651,7 +3091,6 @@ void HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dT() const #endif /* - * * calculate g(x) and hfunc(x) for each cation-anion pair MX * In the original literature, hfunc, was called gprime. However, * it's not the derivative of g(x), so I renamed it. @@ -4323,11 +3762,6 @@ void HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dT() const #endif } -/** - * This function calculates the temperature second derivative - * of the natural logarithm of the molality activity - * coefficients. - */ void HMWSoln::s_update_d2lnMolalityActCoeff_dT2() const { /* @@ -4359,33 +3793,10 @@ void HMWSoln::s_update_d2lnMolalityActCoeff_dT2() const s_updateScaling_pHScaling_dT2(); } -/*************************************************************************************/ - -/* - * s_updatePitzer_d2lnMolalityActCoeff_dT2() (private, const ) - * - * Using internally stored values, this function calculates - * the temperature 2nd derivative of the logarithm of the - * activity coefficient for all species in the mechanism. - * This is an internal routine - * - * We assume that the activity coefficients and first temperature - * derivatives of the activity coefficients are current. - * - * It may be assumed that the - * Pitzer activity coefficient and first deriv routine are called immediately - * preceding the calling of this routine. Therefore, some - * quantities do not need to be recalculated in this routine. - * - * solvent activity coefficient is on the molality - * scale. It's derivatives are too. - */ void HMWSoln::s_updatePitzer_d2lnMolalityActCoeff_dT2() const { - /* - * HKM -> Assumption is made that the solvent is - * species 0. + * HKM -> Assumption is made that the solvent is species 0. */ #ifdef DEBUG_MODE m_debugCalc = 0; @@ -5033,7 +4444,6 @@ void HMWSoln::s_updatePitzer_d2lnMolalityActCoeff_dT2() const /* * ------ SUBSECTION FOR CALCULATING THE d2 OSMOTIC COEFF dT2 --------- - * */ sum1 = 0.0; sum2 = 0.0; @@ -5207,26 +4617,11 @@ void HMWSoln::s_updatePitzer_d2lnMolalityActCoeff_dT2() const #endif } -/********************************************************************************************/ - -/* - * s_update_dlnMolalityActCoeff_dP() (private, const ) - * - * Using internally stored values, this function calculates - * the pressure derivative of the logarithm of the - * activity coefficient for all species in the mechanism. - * - * We assume that the activity coefficients are current. - * - * solvent activity coefficient is on the molality - * scale. Its derivative is too. - */ void HMWSoln::s_update_dlnMolalityActCoeff_dP() const { m_dlnActCoeffMolaldP_Unscaled.assign(m_kk, 0.0); s_updatePitzer_dlnMolalityActCoeff_dP(); - for (size_t k = 1; k < m_kk; k++) { if (CROP_speciesCropped_[k] == 2) { m_dlnActCoeffMolaldP_Unscaled[k] = 0.0; @@ -5237,34 +4632,13 @@ void HMWSoln::s_update_dlnMolalityActCoeff_dP() const m_dlnActCoeffMolaldP_Unscaled[0] = 0.0; } - s_updateScaling_pHScaling_dP(); } -/* - * s_updatePitzer_dlnMolalityActCoeff_dP() (private, const ) - * - * Using internally stored values, this function calculates - * the pressure derivative of the logarithm of the - * activity coefficient for all species in the mechanism. - * This is an internal routine - * - * We assume that the activity coefficients are current. - * - * It may be assumed that the - * Pitzer activity coefficient and first deriv routine are called immediately - * preceding the calling of this routine. Therefore, some - * quantities do not need to be recalculated in this routine. - * - * solvent activity coefficient is on the molality - * scale. Its derivatives are too. - */ void HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dP() const { - /* - * HKM -> Assumption is made that the solvent is - * species 0. + * HKM -> Assumption is made that the solvent is species 0. */ #ifdef DEBUG_MODE m_debugCalc = 0; @@ -5520,7 +4894,6 @@ void HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dP() const /* * --------- SUBSECTION TO CALCULATE CMX_P ---------- - * --------- */ #ifdef DEBUG_MODE if (m_debugCalc) { @@ -5670,7 +5043,6 @@ void HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dP() const /* * -------- SUBSECTION FOR CALCULATING THE dACTCOEFFdP FOR CATIONS ----- - * -- */ if (charge[i] > 0) { // species i is the cation (positive) to calc the actcoeff @@ -5773,7 +5145,6 @@ void HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dP() const /* * ------ SUBSECTION FOR CALCULATING THE dACTCOEFFdP FOR ANIONS ------ - * */ if (charge[i] < 0) { // species i is an anion (negative) @@ -5907,7 +5278,6 @@ void HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dP() const /* * ------ SUBSECTION FOR CALCULATING THE d OSMOTIC COEFF dP --------- - * */ sum1 = 0.0; sum2 = 0.0; @@ -6085,16 +5455,6 @@ void HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dP() const } -/**********************************************************************************************/ - -/* - * Calculate the lambda interactions. - * - * Calculate E-lambda terms for charge combinations of like sign, - * using method of Pitzer (1975). - * - * This code snippet is included from Bethke, Appendix 2. - */ void HMWSoln::calc_lambdas(double is) const { double aphi, dj, jfunc, jprime, t, x, zprod; @@ -6156,15 +5516,6 @@ void HMWSoln::calc_lambdas(double is) const } } -/* - * Calculate the etheta interaction. - * This interaction accounts for the mixing effects of like-signed - * ions with different charges. There is fairly extensive literature - * on this effect. See the notes. - * This interaction will be nonzero for species with the same charge. - * - * This code snippet is included from Bethke, Appendix 2. - */ void HMWSoln::calc_thetas(int z1, int z2, double* etheta, double* etheta_prime) const { @@ -6209,16 +5560,6 @@ void HMWSoln::calc_thetas(int z1, int z2, } } -// This function will be called to update the internally stored -// natural logarithm of the molality activity coefficients -/* - * Normally they are all one. However, sometimes they are not, - * due to stability schemes - * - * gamma_k_molar = gamma_k_molal / Xmol_solvent - * - * gamma_o_molar = gamma_o_molal - */ void HMWSoln::s_updateIMS_lnMolalityActCoeff() const { double tmp; @@ -6330,11 +5671,6 @@ void HMWSoln::s_updateIMS_lnMolalityActCoeff() const return; } - -/** - * This routine prints out the input pitzer coefficients for the - * current mechanism - */ void HMWSoln::printCoeffs() const { size_t i, j, k; @@ -6394,13 +5730,6 @@ void HMWSoln::printCoeffs() const } } -//! Apply the current phScale to a set of activity Coefficients or activities -/*! - * See the Eq3/6 Manual for a thorough discussion. - * - * @param acMolality input/Output vector containing the molality based - * activity coefficients. length: m_kk. - */ void HMWSoln::applyphScale(doublereal* acMolality) const { if (m_pHScalingType == PHSCALE_PITZER) { @@ -6415,13 +5744,6 @@ void HMWSoln::applyphScale(doublereal* acMolality) const } } -// Apply the current phScale to a set of activity Coefficients or activities -/* - * See the Eq3/6 Manual for a thorough discussion. - * - * @param acMolality input/Output vector containing the molality based - * activity coefficients. length: m_kk. - */ void HMWSoln::s_updateScaling_pHScaling() const { if (m_pHScalingType == PHSCALE_PITZER) { @@ -6437,12 +5759,6 @@ void HMWSoln::s_updateScaling_pHScaling() const } } -// Apply the current phScale to a set of derivativies of the activity Coefficients -// wrt temperature -/* - * See the Eq3/6 Manual for a thorough discussion of the need - * - */ void HMWSoln::s_updateScaling_pHScaling_dT() const { if (m_pHScalingType == PHSCALE_PITZER) { @@ -6458,12 +5774,6 @@ void HMWSoln::s_updateScaling_pHScaling_dT() const } } -// 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 HMWSoln::s_updateScaling_pHScaling_dT2() const { if (m_pHScalingType == PHSCALE_PITZER) { @@ -6479,11 +5789,6 @@ void HMWSoln::s_updateScaling_pHScaling_dT2() const } } -// 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 HMWSoln::s_updateScaling_pHScaling_dP() const { if (m_pHScalingType == PHSCALE_PITZER) { @@ -6499,10 +5804,6 @@ void HMWSoln::s_updateScaling_pHScaling_dP() const } } -// Calculate the temperature derivative of the Chlorine activity coefficient -/* - * We assume here that the m_IionicMolality variable is up to date. - */ doublereal HMWSoln::s_NBS_CLM_lnMolalityActCoeff() const { doublereal sqrtIs = sqrt(m_IionicMolality); @@ -6511,10 +5812,6 @@ doublereal HMWSoln::s_NBS_CLM_lnMolalityActCoeff() const return lnGammaClMs2; } -// Calculate the temperature derivative of the Chlorine activity coefficient -/* - * We assume here that the m_IionicMolality variable is up to date. - */ doublereal HMWSoln::s_NBS_CLM_dlnMolalityActCoeff_dT() const { doublereal sqrtIs = sqrt(m_IionicMolality); @@ -6523,10 +5820,6 @@ doublereal HMWSoln::s_NBS_CLM_dlnMolalityActCoeff_dT() const return d_lnGammaClM_dT; } -// Calculate the second temperature derivative of the Chlorine activity coefficient -/* - * We assume here that the m_IionicMolality variable is up to date. - */ doublereal HMWSoln::s_NBS_CLM_d2lnMolalityActCoeff_dT2() const { doublereal sqrtIs = sqrt(m_IionicMolality); @@ -6535,10 +5828,6 @@ doublereal HMWSoln::s_NBS_CLM_d2lnMolalityActCoeff_dT2() const return d_lnGammaClM_dT2; } -// Calculate the pressure derivative of the Chlorine activity coefficient -/* - * We assume here that the m_IionicMolality variable is up to date. - */ doublereal HMWSoln::s_NBS_CLM_dlnMolalityActCoeff_dP() const { doublereal sqrtIs = sqrt(m_IionicMolality); @@ -6557,4 +5846,3 @@ int HMWSoln::debugPrinting() } } -/*****************************************************************************/ diff --git a/src/thermo/HMWSoln_input.cpp b/src/thermo/HMWSoln_input.cpp index 5c600b32b..78216e38b 100644 --- a/src/thermo/HMWSoln_input.cpp +++ b/src/thermo/HMWSoln_input.cpp @@ -28,13 +28,6 @@ using namespace ctml; namespace Cantera { - - -//! utility function to assign an integer value from a string -//! for the ElectrolyteSpeciesType field. -/*! - * @param estString string name of the electrolyte species type - */ int HMWSoln::interp_est(const std::string& estString) { const char* cc = estString.c_str(); @@ -60,13 +53,6 @@ int HMWSoln::interp_est(const std::string& estString) return rval; } -/* - * Process an XML node called "SimpleSaltParameters. - * This node contains all of the parameters necessary to describe - * the Pitzer model for that particular binary salt. - * This function reads the XML file and writes the coefficients - * it finds to an internal data structures. - */ void HMWSoln::readXMLBinarySalt(XML_Node& BinSalt) { string xname = BinSalt.name(); @@ -268,11 +254,6 @@ void HMWSoln::readXMLBinarySalt(XML_Node& BinSalt) } } -/** - * Process an XML node called "thetaAnion". - * This node contains all of the parameters necessary to describe - * the binary interactions between two anions. - */ void HMWSoln::readXMLThetaAnion(XML_Node& BinSalt) { string xname = BinSalt.name(); @@ -355,11 +336,6 @@ void HMWSoln::readXMLThetaAnion(XML_Node& BinSalt) } } -/** - * Process an XML node called "thetaCation". - * This node contains all of the parameters necessary to describe - * the binary interactions between two cation. - */ void HMWSoln::readXMLThetaCation(XML_Node& BinSalt) { string xname = BinSalt.name(); @@ -442,11 +418,6 @@ void HMWSoln::readXMLThetaCation(XML_Node& BinSalt) } } -/* - * Process an XML node called "readXMLPsiCommonCation". - * This node contains all of the parameters necessary to describe - * the binary interactions between two anions and one common cation. - */ void HMWSoln::readXMLPsiCommonCation(XML_Node& BinSalt) { string xname = BinSalt.name(); @@ -588,11 +559,6 @@ void HMWSoln::readXMLPsiCommonCation(XML_Node& BinSalt) } } -/** - * Process an XML node called "PsiCommonAnion". - * This node contains all of the parameters necessary to describe - * the binary interactions between two cations and one common anion. - */ void HMWSoln::readXMLPsiCommonAnion(XML_Node& BinSalt) { string xname = BinSalt.name(); @@ -735,14 +701,6 @@ void HMWSoln::readXMLPsiCommonAnion(XML_Node& BinSalt) } } - - -/** - * Process an XML node called "LambdaNeutral". - * This node contains all of the parameters necessary to describe - * the binary interactions between one neutral species and - * any other species (neutral or otherwise) in the mechanism. - */ void HMWSoln::readXMLLambdaNeutral(XML_Node& BinSalt) { string xname = BinSalt.name(); @@ -824,11 +782,6 @@ void HMWSoln::readXMLLambdaNeutral(XML_Node& BinSalt) } } -/** - * Process an XML node called "MunnnNeutral". - * This node contains all of the parameters necessary to describe - * the self-ternary interactions for one neutral species. - */ void HMWSoln::readXMLMunnnNeutral(XML_Node& BinSalt) { string xname = BinSalt.name(); @@ -899,11 +852,6 @@ void HMWSoln::readXMLMunnnNeutral(XML_Node& BinSalt) } } -/* - * Process an XML node called "readXMLZetaCation". - * This node contains all of the parameters necessary to describe - * the ternary interactions between a neutral, a cation and an anion - */ void HMWSoln::readXMLZetaCation(const XML_Node& BinSalt) { string xname = BinSalt.name(); @@ -1004,11 +952,6 @@ void HMWSoln::readXMLZetaCation(const XML_Node& BinSalt) } } -// Process an XML node called "croppingCoefficients" -// for the cropping coefficients values -/* - * @param acNode Activity Coefficient XML Node - */ void HMWSoln::readXMLCroppingCoefficients(const XML_Node& acNode) { @@ -1035,32 +978,12 @@ void HMWSoln::readXMLCroppingCoefficients(const XML_Node& acNode) } } -/* - * Initialization routine for a HMWSoln phase. - * - * This is a virtual routine. This routine will call initThermo() - * for the parent class as well. - */ void HMWSoln::initThermo() { MolalityVPSSTP::initThermo(); initLengths(); } -/* - * Import, construct, and initialize a HMWSoln phase - * specification from an XML tree into the current object. - * - * This routine is a precursor to constructPhaseXML(XML_Node*) - * routine, which does most of the work. - * - * @param infile XML file containing the description of the - * phase - * - * @param id Optional parameter identifying the name of the - * phase. If none is given, the first XML - * phase element will be used. - */ void HMWSoln::constructPhaseFile(std::string inputFile, std::string id) { @@ -1092,33 +1015,6 @@ void HMWSoln::constructPhaseFile(std::string inputFile, std::string id) delete fxml; } -/* - * Import, construct, and initialize a HMWSoln phase - * specification from an XML tree into the current object. - * - * Most of the work is carried out by the cantera base - * routine, importPhase(). That routine imports all of the - * species and element data, including the standard states - * of the species. - * - * Then, In this routine, we read the information - * particular to the specification of the activity - * coefficient model for the Pitzer parameterization. - * - * We also read information about the molar volumes of the - * standard states if present in the XML file. - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ void HMWSoln::constructPhaseXML(XML_Node& phaseNode, std::string id) { string stemp; @@ -1247,26 +1143,6 @@ void HMWSoln::constructPhaseXML(XML_Node& phaseNode, std::string id) } - - -/** - * Process the XML file after species are set up. - * - * This gets called from importPhase(). It processes the XML file - * after the species are set up. This is the main routine for - * reading in activity coefficient parameters. - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ void HMWSoln:: initThermoXML(XML_Node& phaseNode, const std::string& id) { @@ -1825,8 +1701,7 @@ initThermoXML(XML_Node& phaseNode, const std::string& id) //} } -//==================================================================================================================== -// Precalculate the IMS Cutoff parameters for typeCutoff = 2 + void HMWSoln::calcIMSCutoffParams_() { IMS_afCut_ = 1.0 / (std::exp(1.0) * IMS_gamma_k_min_); @@ -1877,7 +1752,6 @@ void HMWSoln::calcIMSCutoffParams_() } } -// Precalculate the MC Cutoff parameters void HMWSoln::calcMCCutoffParams_() { MC_X_o_min_ = 0.35; diff --git a/src/thermo/IdealMolalSoln.cpp b/src/thermo/IdealMolalSoln.cpp index 1af5eee2d..60cf55f14 100644 --- a/src/thermo/IdealMolalSoln.cpp +++ b/src/thermo/IdealMolalSoln.cpp @@ -28,9 +28,6 @@ using namespace ctml; namespace Cantera { -/* - * Default constructor - */ IdealMolalSoln::IdealMolalSoln() : MolalityVPSSTP(), m_formGC(2), @@ -38,13 +35,13 @@ IdealMolalSoln::IdealMolalSoln() : IMS_X_o_cutoff_(0.20), IMS_gamma_o_min_(0.00001), IMS_gamma_k_min_(10.0), - IMS_cCut_(.05), IMS_slopefCut_(0.6), + IMS_slopegCut_(0.0), + IMS_cCut_(.05), IMS_dfCut_(0.0), IMS_efCut_(0.0), IMS_afCut_(0.0), IMS_bfCut_(0.0), - IMS_slopegCut_(0.0), IMS_dgCut_(0.0), IMS_egCut_(0.0), IMS_agCut_(0.0), @@ -52,12 +49,6 @@ IdealMolalSoln::IdealMolalSoln() : { } -/* - * Copy Constructor: - * - * Note this stuff will not work until the underlying phase - * has a working copy constructor - */ IdealMolalSoln::IdealMolalSoln(const IdealMolalSoln& b) : MolalityVPSSTP(b) { @@ -68,12 +59,6 @@ IdealMolalSoln::IdealMolalSoln(const IdealMolalSoln& b) : *this = b; } -/* - * operator=() - * - * Note this stuff will not work until the underlying phase - * has a working assignment operator - */ IdealMolalSoln& IdealMolalSoln:: operator=(const IdealMolalSoln& b) { @@ -111,13 +96,13 @@ IdealMolalSoln::IdealMolalSoln(const std::string& inputFile, IMS_X_o_cutoff_(0.2), IMS_gamma_o_min_(0.00001), IMS_gamma_k_min_(10.0), - IMS_cCut_(.05), IMS_slopefCut_(0.6), + IMS_slopegCut_(0.0), + IMS_cCut_(.05), IMS_dfCut_(0.0), IMS_efCut_(0.0), IMS_afCut_(0.0), IMS_bfCut_(0.0), - IMS_slopegCut_(0.0), IMS_dgCut_(0.0), IMS_egCut_(0.0), IMS_agCut_(0.0), @@ -133,13 +118,13 @@ IdealMolalSoln::IdealMolalSoln(XML_Node& root, const std::string& id) : IMS_X_o_cutoff_(0.2), IMS_gamma_o_min_(0.00001), IMS_gamma_k_min_(10.0), - IMS_cCut_(.05), IMS_slopefCut_(0.6), + IMS_slopegCut_(0.0), + IMS_cCut_(.05), IMS_dfCut_(0.0), IMS_efCut_(0.0), IMS_afCut_(0.0), IMS_bfCut_(0.0), - IMS_slopegCut_(0.0), IMS_dgCut_(0.0), IMS_egCut_(0.0), IMS_agCut_(0.0), @@ -148,43 +133,15 @@ IdealMolalSoln::IdealMolalSoln(XML_Node& root, const std::string& id) : importPhase(*findXMLPhase(&root, id), this); } -/* - * - * ~IdealMolalSoln(): (virtual) - * - * Destructor: does nothing: - * - */ IdealMolalSoln::~IdealMolalSoln() { } -/** - * - */ ThermoPhase* IdealMolalSoln::duplMyselfAsThermoPhase() const { return new IdealMolalSoln(*this); } -// -// -------- Molar Thermodynamic Properties of the Solution --------------- -// -/* - * Molar enthalpy of the solution: Units: J/kmol. - * - * Returns the amount of enthalpy per mole of solution. - * For an ideal molal solution, - * \f[ - * \bar{h}(T, P, X_k) = \sum_k X_k \bar{h}_k(T) - * \f] - * The formula is written in terms of the partial molar enthalpies. - * \f$ \bar{h}_k(T, p, m_k) \f$. - * See the partial molar enthalpy function, getPartialMolarEnthalpies(), - * for details. - * - * Units: J/kmol - */ doublereal IdealMolalSoln::enthalpy_mole() const { getPartialMolarEnthalpies(DATA_PTR(m_tmpV)); @@ -193,70 +150,24 @@ doublereal IdealMolalSoln::enthalpy_mole() const return val; } -/* - * Molar internal energy of the solution: Units: J/kmol. - * - * Returns the amount of internal energy per mole of solution. - * For an ideal molal solution, - * \f[ - * \bar{u}(T, P, X_k) = \sum_k X_k \bar{u}_k(T) - * \f] - * The formula is written in terms of the partial molar internal energy. - * \f$ \bar{u}_k(T, p, m_k) \f$. - */ doublereal IdealMolalSoln::intEnergy_mole() const { getPartialMolarEnthalpies(DATA_PTR(m_tmpV)); return mean_X(DATA_PTR(m_tmpV)); } -/* - * Molar entropy of the solution: Units J/kmol/K. - * - * Returns the amount of entropy per mole of solution. - * For an ideal molal solution, - * \f[ - * \bar{s}(T, P, X_k) = \sum_k X_k \bar{s}_k(T) - * \f] - * The formula is written in terms of the partial molar entropies. - * \f$ \bar{s}_k(T, p, m_k) \f$. - * See the partial molar entropies function, getPartialMolarEntropies(), - * for details. - * - * Units: J/kmol/K. - */ doublereal IdealMolalSoln::entropy_mole() const { getPartialMolarEntropies(DATA_PTR(m_tmpV)); return mean_X(DATA_PTR(m_tmpV)); } -/* - * Molar Gibbs function for the solution: Units J/kmol. - * - * Returns the gibbs free energy of the solution per mole - * of the solution. - * - * \f[ - * \bar{g}(T, P, X_k) = \sum_k X_k \mu_k(T) - * \f] - * - * Units: J/kmol - */ doublereal IdealMolalSoln::gibbs_mole() const { getChemPotentials(DATA_PTR(m_tmpV)); return mean_X(DATA_PTR(m_tmpV)); } -/* - * Molar heat capacity at constant pressure: Units: J/kmol/K. - * * \f[ - * \bar{c}_p(T, P, X_k) = \sum_k X_k \bar{c}_{p,k}(T) - * \f] - * - * Units: J/kmol/K - */ doublereal IdealMolalSoln::cp_mole() const { getPartialMolarCp(DATA_PTR(m_tmpV)); @@ -264,11 +175,6 @@ doublereal IdealMolalSoln::cp_mole() const return val; } -/* - * Molar heat capacity at constant volume: Units: J/kmol/K. - * NOT IMPLEMENTED. - * Units: J/kmol/K - */ doublereal IdealMolalSoln::cv_mole() const { return err("not implemented"); @@ -278,13 +184,6 @@ doublereal IdealMolalSoln::cv_mole() const // ------- Mechanical Equation of State Properties ------------------------ // - - -/* - * Set the pressure at constant temperature. Units: Pa. - * This method sets a constant within the object. - * The mass density is not a function of pressure. - */ void IdealMolalSoln::setPressure(doublereal p) { setState_TP(temperature(), p); @@ -304,53 +203,16 @@ void IdealMolalSoln::calcDensity() Phase::setDensity(dd); } -/* - * The isothermal compressibility. Units: 1/Pa. - * The isothermal compressibility is defined as - * \f[ - * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T - * \f] - * - * It's equal to zero for this model, since the molar volume - * doesn't change with pressure or temperature. - */ doublereal IdealMolalSoln::isothermalCompressibility() const { return 0.0; } -/* - * The thermal expansion coefficient. Units: 1/K. - * The thermal expansion coefficient is defined as - * - * \f[ - * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P - * \f] - * - * It's equal to zero for this model, since the molar volume - * doesn't change with pressure or temperature. - */ doublereal IdealMolalSoln::thermalExpansionCoeff() const { return 0.0; } -/* - * Overwritten setDensity() function is necessary because the - * density is not an independent variable. - * - * This function will now throw an error condition - * - * @internal May have to adjust the strategy here to make - * the eos for these materials slightly compressible, in order - * to create a condition where the density is a function of - * the pressure. - * - * This function will now throw an error condition. - * - * NOTE: This is an overwritten function from the State.h - * class - */ void IdealMolalSoln::setDensity(const doublereal rho) { double dens = density(); @@ -360,15 +222,6 @@ void IdealMolalSoln::setDensity(const doublereal rho) } } -/* - * Overwritten setMolarDensity() function is necessary because the - * density is not an independent variable. - * - * This function will now throw an error condition. - * - * NOTE: This is a virtual function, overwritten function from the State.h - * class - */ void IdealMolalSoln::setMolarDensity(const doublereal conc) { double concI = Phase::molarDensity(); @@ -391,19 +244,6 @@ void IdealMolalSoln::setState_TP(doublereal temp, doublereal pres) // ------- Activities and Activity Concentrations // -/* - * This method returns an array of activity concentrations \f$ C^a_k\f$. - * \f$ C^a_k\f$ are defined such that - * \f$ a_k = C^a_k / C^s_k, \f$ where \f$ C^s_k \f$ - * is a standard concentration - * defined below. These activity concentrations are used - * by kinetics manager classes to compute the forward and - * reverse rates of elementary reactions. - * - * @param c Array of activity concentrations. The - * units depend upon the implementation of the - * reaction rate expressions within the phase. - */ void IdealMolalSoln::getActivityConcentrations(doublereal* c) const { if (m_formGC != 1) { @@ -421,18 +261,6 @@ void IdealMolalSoln::getActivityConcentrations(doublereal* c) const } } -/* - * The standard concentration \f$ C^s_k \f$ used to normalize - * the activity concentration. In many cases, this quantity - * will be the same for all species in a phase - for example, - * for an ideal gas \f$ C^s_k = P/\hat R T \f$. For this - * reason, this method returns a single value, instead of an - * array. However, for phases in which the standard - * concentration is species-specific (e.g. surface species of - * different sizes), this method may be called with an - * optional parameter indicating the species. - * - */ doublereal IdealMolalSoln::standardConcentration(size_t k) const { double c0 = 1.0, mvSolvent; @@ -450,38 +278,12 @@ doublereal IdealMolalSoln::standardConcentration(size_t k) const return c0; } -/* - * Returns the natural logarithm of the standard - * concentration of the kth species - */ doublereal IdealMolalSoln::logStandardConc(size_t k) const { double c0 = standardConcentration(k); return log(c0); } -/* - * Returns the units of the standard and general concentrations - * Note they have the same units, as their divisor is - * defined to be equal to the activity of the kth species - * in the solution, which is unitless. - * - * This routine is used in print out applications where the - * units are needed. Usually, MKS units are assumed throughout - * the program and in the XML input files. - * - * On return uA contains the powers of the units (MKS assumed) - * of the standard concentrations and generalized concentrations - * for the kth species. - * - * uA[0] = kmol units - default = 1 - * uA[1] = m units - default = -nDim(), the number of spatial - * dimensions in the Phase class. - * uA[2] = kg units - default = 0; - * uA[3] = Pa(pressure) units - default = 0; - * uA[4] = Temperature units - default = 0; - * uA[5] = time units - default = 0 - */ void IdealMolalSoln::getUnitsStandardConc(double* uA, int k, int sizeUA) const { int eos = eosType(); @@ -513,14 +315,6 @@ void IdealMolalSoln::getUnitsStandardConc(double* uA, int k, int sizeUA) const } } -/* - * Get the array of non-dimensional molality-based - * activities at the current solution temperature, - * pressure, and solution concentration. - * - * The max against xmolSolventMIN is to limit the activity - * coefficient to be finite as the solvent mf goes to zero. - */ void IdealMolalSoln::getActivities(doublereal* ac) const { _updateStandardStateThermo(); @@ -534,6 +328,8 @@ void IdealMolalSoln::getActivities(doublereal* ac) const ac[k] = m_molalities[k]; } double xmolSolvent = moleFraction(m_indexSolvent); + // Limit the activity coefficient to be finite as the solvent mole + // fraction goes to zero. xmolSolvent = std::max(m_xmolSolventMIN, xmolSolvent); ac[m_indexSolvent] = exp((xmolSolvent - 1.0)/xmolSolvent); @@ -553,17 +349,6 @@ void IdealMolalSoln::getActivities(doublereal* ac) const } } -/* - * Get the array of non-dimensional Molality based - * activity coefficients at - * the current solution temperature, pressure, and - * solution concentration. - * See Denbigh - * (note solvent activity coefficient is on the molar scale). - * - * The max against xmolSolventMIN is to limit the activity - * coefficient to be finite as the solvent mf goes to zero. - */ void IdealMolalSoln:: getMolalityActivityCoefficients(doublereal* acMolality) const { @@ -572,6 +357,8 @@ getMolalityActivityCoefficients(doublereal* acMolality) const acMolality[k] = 1.0; } double xmolSolvent = moleFraction(m_indexSolvent); + // Limit the activity coefficient to be finite as the solvent mole + // fraction goes to zero. xmolSolvent = std::max(m_xmolSolventMIN, xmolSolvent); acMolality[m_indexSolvent] = exp((xmolSolvent - 1.0)/xmolSolvent) / xmolSolvent; @@ -588,27 +375,6 @@ getMolalityActivityCoefficients(doublereal* acMolality) const // ------ Partial Molar Properties of the Solution ----------------- // -/* - * Get the species chemical potentials: Units: J/kmol. - * - * This function returns a vector of chemical potentials of the - * species in solution. - * - * \f[ - * \mu_k = \mu^{o}_k(T,P) + R T \ln(\frac{m_k}{m^\Delta}) - * \f] - * \f[ - * \mu_w = \mu^{o}_w(T,P) + - * R T ((X_w - 1.0) / X_w) - * \f] - * - * \f$ w \f$ refers to the solvent species. - * \f$ X_w \f$ is the mole fraction of the solvent. - * \f$ m_k \f$ is the molality of the kth solute. - * \f$ m^\Delta is 1 gmol solute per kg solvent. \f$ - * - * Units: J/kmol. - */ void IdealMolalSoln::getChemPotentials(doublereal* mu) const { double xx; @@ -667,11 +433,6 @@ void IdealMolalSoln::getChemPotentials(doublereal* mu) const } -/* - * Returns an array of partial molar enthalpies for the species - * in the mixture: Units (J/kmol). - * - */ void IdealMolalSoln::getPartialMolarEnthalpies(doublereal* hbar) const { getEnthalpy_RT(hbar); @@ -681,33 +442,6 @@ void IdealMolalSoln::getPartialMolarEnthalpies(doublereal* hbar) const } } -/* - * Returns an array of partial molar entropies of the species in the - * solution: Units: J/kmol. - * - * Maxwell's equations provide an insight in how to calculate this - * (p.215 Smith and Van Ness) - * \f[ - * \frac{d(\mu_k)}{dT} = -\bar{s}_i - * \f] - * For this phase, the partial molar entropies are equal to the - * standard state species entropies plus the ideal molal solution contribution. - * - * \f[ - * \bar{s}_k(T,P) = s^0_k(T) - R log( m_k ) - * \f] - * \f[ - * \bar{s}_w(T,P) = s^0_w(T) - R ((X_w - 1.0) / X_w) - * \f] - * - * The subscript, w, refers to the solvent species. \f$ X_w \f$ is - * the mole fraction of solvent. - * The reference-state pure-species entropies,\f$ s^0_k(T) \f$, - * at the reference pressure, \f$ P_{ref} \f$, are computed by the - * species thermodynamic - * property manager. They are polynomial functions of temperature. - * @see SpeciesThermo - */ void IdealMolalSoln::getPartialMolarEntropies(doublereal* sbar) const { getEntropy_R(sbar); @@ -747,36 +481,11 @@ void IdealMolalSoln::getPartialMolarEntropies(doublereal* sbar) const } } -/* - * Returns an array of partial molar volumes of the species - * in the solution: Units: m^3 kmol-1. - * - * For this solution, the partial molar volumes are equal to the - * constant species molar volumes. - * - * Units: m^3 kmol-1. - */ void IdealMolalSoln::getPartialMolarVolumes(doublereal* vbar) const { getStandardVolumes(vbar); } -/* - * Partial molar heat capacity of the solution: Units: J/kmol/K. - * - * The kth partial molar heat capacity is equal to - * the temperature derivative of the partial molar - * enthalpy of the kth species in the solution at constant - * P and composition (p. 220 Smith and Van Ness). - * \f[ - * \bar{Cp}_k(T,P) = {Cp}^0_k(T) - * \f] - * - * For this solution, this is equal to the reference state - * heat capacities. - * - * Units: J/kmol/K - */ void IdealMolalSoln::getPartialMolarCp(doublereal* cpbar) const { /* @@ -790,54 +499,16 @@ void IdealMolalSoln::getPartialMolarCp(doublereal* cpbar) const } } -/* - * -------- Properties of the Standard State of the Species - * in the Solution ------------------ - */ - - - -/* - * ------ Thermodynamic Values for the Species Reference States --- - */ - -// -> This is handled by VPStandardStatesTP - /* * -------------- Utilities ------------------------------- */ -/* - * Initialization routine for an IdealMolalSoln phase. - * - * This is a virtual routine. This routine will call initThermo() - * for the parent class as well. - */ void IdealMolalSoln::initThermo() { initLengths(); MolalityVPSSTP::initThermo(); } -/* - * Import and initialize an IdealMolalSoln phase - * specification in an XML tree into the current object. - * - * This routine is called from importPhase() to finish - * up the initialization of the thermo object. It reads in the - * species molar volumes. - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ void IdealMolalSoln::initThermoXML(XML_Node& phaseNode, const std::string& id) { /* @@ -1010,14 +681,6 @@ void IdealMolalSoln::initThermoXML(XML_Node& phaseNode, const std::string& id) } -/* - * @internal - * Set equation of state parameters. The number and meaning of - * these depends on the subclass. - * @param n number of parameters - * @param c array of \i n coefficients - * - */ void IdealMolalSoln::setParameters(int n, doublereal* const c) { } @@ -1026,28 +689,10 @@ void IdealMolalSoln::getParameters(int& n, doublereal* const c) const { } -/* - * Set equation of state parameter values from XML - * entries. This method is called by function importPhase in - * file importCTML.cpp when processing a phase definition in - * an input file. It should be overloaded in subclasses to set - * any parameters that are specific to that particular phase - * model. - * - * @param eosdata An XML_Node object corresponding to - * the "thermo" entry for this phase in the input file. - * - * HKM -> Right now, the parameters are set elsewhere (initThermo) - * It just didn't seem to fit. - */ void IdealMolalSoln::setParametersFromXML(const XML_Node& eosdata) { } -/* - * ----------- Critical State Properties -------------------------- - */ - /* * ------------ Private and Restricted Functions ------------------ */ @@ -1063,18 +708,6 @@ doublereal IdealMolalSoln::err(const std::string& msg) const return 0.0; } - - -// This function will be called to update the internally stored -// natural logarithm of the molality activity coefficients -/* - * Normally they are all one. However, sometimes they are not, - * due to stability schemes - * - * gamma_k_molar = gamma_k_molal / Xmol_solvent - * - * gamma_o_molar = gamma_o_molal - */ void IdealMolalSoln::s_updateIMS_lnMolalityActCoeff() const { double tmp; @@ -1187,11 +820,6 @@ void IdealMolalSoln::s_updateIMS_lnMolalityActCoeff() const return; } -/* - * This internal function adjusts the lengths of arrays. - * - * This function is not virtual nor is it inherited - */ void IdealMolalSoln::initLengths() { m_kk = nSpecies(); @@ -1205,7 +833,6 @@ void IdealMolalSoln::initLengths() IMS_lnActCoeffMolal_.resize(m_kk); } - void IdealMolalSoln::calcIMSCutoffParams_() { IMS_afCut_ = 1.0 / (std::exp(1.0) * IMS_gamma_k_min_); @@ -1257,4 +884,3 @@ void IdealMolalSoln::calcIMSCutoffParams_() } } - diff --git a/src/thermo/IdealSolnGasVPSS.cpp b/src/thermo/IdealSolnGasVPSS.cpp index 254bcad70..52053009f 100644 --- a/src/thermo/IdealSolnGasVPSS.cpp +++ b/src/thermo/IdealSolnGasVPSS.cpp @@ -24,9 +24,6 @@ using namespace std; namespace Cantera { -/* - * Default constructor - */ IdealSolnGasVPSS::IdealSolnGasVPSS() : VPStandardStateTP(), m_idealGas(0), @@ -34,7 +31,6 @@ IdealSolnGasVPSS::IdealSolnGasVPSS() : { } - IdealSolnGasVPSS::IdealSolnGasVPSS(const std::string& infile, std::string id) : VPStandardStateTP(), m_idealGas(0), @@ -52,15 +48,6 @@ IdealSolnGasVPSS::IdealSolnGasVPSS(const std::string& infile, std::string id) : importPhase(*xphase, this); } -/* - * Copy Constructor: - * - * Note this stuff will not work until the underlying phase - * has a working copy constructor. - * - * The copy constructor just calls the assignment operator - * to do the heavy lifting. - */ IdealSolnGasVPSS::IdealSolnGasVPSS(const IdealSolnGasVPSS& b) : VPStandardStateTP(), m_idealGas(0), @@ -69,12 +56,6 @@ IdealSolnGasVPSS::IdealSolnGasVPSS(const IdealSolnGasVPSS& b) : *this = b; } -/* - * operator=() - * - * Note this stuff will not work until the underlying phase - * has a working assignment operator - */ IdealSolnGasVPSS& IdealSolnGasVPSS:: operator=(const IdealSolnGasVPSS& b) { @@ -93,18 +74,10 @@ operator=(const IdealSolnGasVPSS& b) return *this; } -/* - * ~IdealSolnGasVPSS(): (virtual) - * - */ IdealSolnGasVPSS::~IdealSolnGasVPSS() { } -/* - * Duplication function. - * This calls the copy constructor for this object. - */ ThermoPhase* IdealSolnGasVPSS::duplMyselfAsThermoPhase() const { return new IdealSolnGasVPSS(*this); @@ -118,12 +91,10 @@ int IdealSolnGasVPSS::eosType() const return cIdealSolnGasVPSS_iscv; } - /* * ------------Molar Thermodynamic Properties ------------------------- */ -/// Molar enthalpy. Units: J/kmol. doublereal IdealSolnGasVPSS::enthalpy_mole() const { updateStandardStateThermo(); @@ -132,7 +103,6 @@ doublereal IdealSolnGasVPSS::enthalpy_mole() const mean_X(DATA_PTR(enth_RT))); } -/// Molar internal energy. Units: J/kmol. doublereal IdealSolnGasVPSS::intEnergy_mole() const { doublereal p0 = pressure(); @@ -140,7 +110,6 @@ doublereal IdealSolnGasVPSS::intEnergy_mole() const return (enthalpy_mole() - p0 / md); } -/// Molar entropy. Units: J/kmol/K. doublereal IdealSolnGasVPSS::entropy_mole() const { updateStandardStateThermo(); @@ -149,13 +118,11 @@ doublereal IdealSolnGasVPSS::entropy_mole() const } -/// Molar Gibbs function. Units: J/kmol. doublereal IdealSolnGasVPSS::gibbs_mole() const { return enthalpy_mole() - temperature() * entropy_mole(); } -/// Molar heat capacity at constant pressure. Units: J/kmol/K. doublereal IdealSolnGasVPSS::cp_mole() const { updateStandardStateThermo(); @@ -163,11 +130,9 @@ doublereal IdealSolnGasVPSS::cp_mole() const return GasConstant * (mean_X(DATA_PTR(cp_R))); } -/// Molar heat capacity at constant volume. Units: J/kmol/K. doublereal IdealSolnGasVPSS::cv_mole() const { return cp_mole() - GasConstant; - } void IdealSolnGasVPSS::setPressure(doublereal p) @@ -236,10 +201,6 @@ void IdealSolnGasVPSS::getActivityConcentrations(doublereal* c) const } } -/* - * Returns the standard concentration \f$ C^0_k \f$, which is used to normalize - * the generalized concentration. - */ doublereal IdealSolnGasVPSS::standardConcentration(size_t k) const { if (m_idealGas) { @@ -260,10 +221,6 @@ doublereal IdealSolnGasVPSS::standardConcentration(size_t k) const } } -/* - * Returns the natural logarithm of the standard - * concentration of the kth species - */ doublereal IdealSolnGasVPSS::logStandardConc(size_t k) const { double c = standardConcentration(k); @@ -271,32 +228,6 @@ doublereal IdealSolnGasVPSS::logStandardConc(size_t k) const return lc; } -/* - * - * getUnitsStandardConcentration() - * - * Returns the units of the standard and general concentrations - * Note they have the same units, as their divisor is - * defined to be equal to the activity of the kth species - * in the solution, which is unitless. - * - * This routine is used in print out applications where the - * units are needed. Usually, MKS units are assumed throughout - * the program and in the XML input files. - * - * uA[0] = kmol units - default = 1 - * uA[1] = m units - default = -nDim(), the number of spatial - * dimensions in the Phase class. - * uA[2] = kg units - default = 0; - * uA[3] = Pa(pressure) units - default = 0; - * uA[4] = Temperature units - default = 0; - * uA[5] = time units - default = 0 - * - * For EOS types other than cIdealSolidSolnPhase1, the default - * kmol/m3 holds for standard concentration units. For - * cIdealSolidSolnPhase0 type, the standard concentration is - * unitless. - */ void IdealSolnGasVPSS::getUnitsStandardConc(double* uA, int, int sizeUA) const { int eos = eosType(); @@ -328,10 +259,6 @@ void IdealSolnGasVPSS::getUnitsStandardConc(double* uA, int, int sizeUA) const } } - -/* - * Get the array of non-dimensional activity coefficients - */ void IdealSolnGasVPSS::getActivityCoefficients(doublereal* ac) const { for (size_t k = 0; k < m_kk; k++) { @@ -343,15 +270,6 @@ void IdealSolnGasVPSS::getActivityCoefficients(doublereal* ac) const * ---- Partial Molar Properties of the Solution ----------------- */ -/* - * Get the array of non-dimensional species chemical potentials - * These are partial molar Gibbs free energies. - * \f$ \mu_k / \hat R T \f$. - * Units: unitless - * - * We close the loop on this function, here, calling - * getChemPotentials() and then dividing by RT. - */ void IdealSolnGasVPSS::getChemPotentials_RT(doublereal* muRT) const { getChemPotentials(muRT); @@ -372,7 +290,6 @@ void IdealSolnGasVPSS::getChemPotentials(doublereal* mu) const } } - void IdealSolnGasVPSS::getPartialMolarEnthalpies(doublereal* hbar) const { getEnthalpy_RT(hbar); @@ -410,24 +327,12 @@ void IdealSolnGasVPSS::getPartialMolarVolumes(doublereal* vbar) const getStandardVolumes(vbar); } -/* - * ----- Thermodynamic Values for the Species Reference States ---- - */ - - - - -/* - * Perform initializations after all species have been - * added. - */ void IdealSolnGasVPSS::initThermo() { initLengths(); VPStandardStateTP::initThermo(); } - void IdealSolnGasVPSS::setToEquilState(const doublereal* mu_RT) { double tmp, tmp2; @@ -461,33 +366,12 @@ void IdealSolnGasVPSS::setToEquilState(const doublereal* mu_RT) setState_PX(pres, &m_pp[0]); } -/* - * Initialize the internal lengths. - * (this is not a virtual function) - */ void IdealSolnGasVPSS::initLengths() { m_kk = nSpecies(); m_pp.resize(m_kk, 0.0); } -/* - * Import and initialize a ThermoPhase object - * - * param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - * - * This routine initializes the lengths in the current object and - * then calls the parent routine. - */ void IdealSolnGasVPSS::initThermoXML(XML_Node& phaseNode, const std::string& id) { IdealSolnGasVPSS::initLengths(); @@ -555,5 +439,3 @@ void IdealSolnGasVPSS::setParametersFromXML(const XML_Node& thermoNode) } } - - diff --git a/src/thermo/IonsFromNeutralVPSSTP.cpp b/src/thermo/IonsFromNeutralVPSSTP.cpp index 8cab5f1a4..68050281e 100644 --- a/src/thermo/IonsFromNeutralVPSSTP.cpp +++ b/src/thermo/IonsFromNeutralVPSSTP.cpp @@ -31,11 +31,6 @@ using namespace std; namespace Cantera { -//==================================================================================================================== -/* - * Default constructor. - * - */ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP() : GibbsExcessVPSSTP(), ionSolnType_(cIonSolnType_SINGLEANION), @@ -54,32 +49,6 @@ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP() : { } -//==================================================================================================================== -// Construct and initialize an IonsFromNeutralVPSSTP object -// directly from an ASCII input file -/* - * Working constructors - * - * The two constructors below are the normal way - * the phase initializes itself. They are shells that call - * the routine initThermo(), with a reference to the - * XML database to get the info for the phase. - * - * @param inputFile Name of the input file containing the phase XML data - * to set up the object - * @param id ID of the phase in the input file. Defaults to the - * empty string. - * @param neutralPhase The object takes a neutralPhase ThermoPhase - * object as input. It can either take a pointer - * to an existing object in the parameter list, - * in which case it does not own the object, or - * it can construct a neutral Phase as a slave - * object, in which case, it does own the slave - * object, for purposes of who gets to destroy - * the object. - * If this parameter is zero, then a slave - * neutral phase object is created and used. - */ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(const std::string& inputFile, const std::string& id, ThermoPhase* neutralPhase) : @@ -107,7 +76,7 @@ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(const std::string& inputFile, //dlnActCoeff_NeutralMolecule.resize(numNeutMolSpec); //dX_NeutralMolecule.resize(numNeutMolSpec); } -//==================================================================================================================== + IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(XML_Node& phaseRoot, const std::string& id, ThermoPhase* neutralPhase) : GibbsExcessVPSSTP(), @@ -136,14 +105,6 @@ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(XML_Node& phaseRoot, dX_NeutralMolecule.resize(numNeutMolSpec); } -//==================================================================================================================== - -/* - * Copy Constructor: - * - * Note this stuff will not work until the underlying phase - * has a working copy constructor - */ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(const IonsFromNeutralVPSSTP& b) : GibbsExcessVPSSTP(), ionSolnType_(cIonSolnType_SINGLEANION), @@ -163,13 +124,7 @@ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(const IonsFromNeutralVPSSTP& b) : { IonsFromNeutralVPSSTP::operator=(b); } -//==================================================================================================================== -/* - * operator=() - * - * Note this stuff will not work until the underlying phase - * has a working assignment operator - */ + IonsFromNeutralVPSSTP& IonsFromNeutralVPSSTP:: operator=(const IonsFromNeutralVPSSTP& b) { @@ -232,13 +187,6 @@ operator=(const IonsFromNeutralVPSSTP& b) return *this; } -/* - * - * ~IonsFromNeutralVPSSTP(): (virtual) - * - * Destructor: does nothing: - * - */ IonsFromNeutralVPSSTP::~IonsFromNeutralVPSSTP() { if (IOwnNThermoPhase_) { @@ -247,30 +195,12 @@ IonsFromNeutralVPSSTP::~IonsFromNeutralVPSSTP() } } -/* - * This routine duplicates the current object and returns - * a pointer to ThermoPhase. - */ ThermoPhase* IonsFromNeutralVPSSTP::duplMyselfAsThermoPhase() const { return new IonsFromNeutralVPSSTP(*this); } -/* - * Import, construct, and initialize a phase - * specification from an XML tree into the current object. - * - * This routine is a precursor to constructPhaseXML(XML_Node*) - * routine, which does most of the work. - * - * @param infile XML file containing the description of the - * phase - * - * @param id Optional parameter identifying the name of the - * phase. If none is given, the first XML - * phase element will be used. - */ void IonsFromNeutralVPSSTP::constructPhaseFile(std::string inputFile, std::string id) { @@ -302,34 +232,6 @@ void IonsFromNeutralVPSSTP::constructPhaseFile(std::string inputFile, std::strin delete fxml; } -/* - * Import, construct, and initialize a HMWSoln phase - * specification from an XML tree into the current object. - * - * Most of the work is carried out by the cantera base - * routine, importPhase(). That routine imports all of the - * species and element data, including the standard states - * of the species. - * - * Then, In this routine, we read the information - * particular to the specification of the activity - * coefficient model for the Pitzer parameterization. - * - * We also read information about the molar volumes of the - * standard states if present in the XML file. - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ - void IonsFromNeutralVPSSTP::constructPhaseXML(XML_Node& phaseNode, std::string id) { string stemp; @@ -398,45 +300,25 @@ void IonsFromNeutralVPSSTP::constructPhaseXML(XML_Node& phaseNode, std::string i } - /* * -------------- Utilities ------------------------------- */ - -// Equation of state type flag. -/* - * The ThermoPhase base class returns - * zero. Subclasses should define this to return a unique - * non-zero value. Known constants defined for this purpose are - * listed in mix_defs.h. The IonsFromNeutralVPSSTP class also returns - * zero, as it is a non-complete class. - */ int IonsFromNeutralVPSSTP::eosType() const { return cIonsFromNeutral; } - - /* * ------------ Molar Thermodynamic Properties ---------------------- */ -/* - * Molar enthalpy of the solution. Units: J/kmol. - */ + doublereal IonsFromNeutralVPSSTP::enthalpy_mole() const { getPartialMolarEnthalpies(DATA_PTR(m_pp)); return mean_X(DATA_PTR(m_pp)); } -/** - * Molar internal energy of the solution. Units: J/kmol. - * - * This is calculated from the soln enthalpy and then - * subtracting pV. - */ doublereal IonsFromNeutralVPSSTP::intEnergy_mole() const { double hh = enthalpy_mole(); @@ -446,28 +328,18 @@ doublereal IonsFromNeutralVPSSTP::intEnergy_mole() const return uu; } -/** - * Molar soln entropy at constant pressure. Units: J/kmol/K. - * - * This is calculated from the partial molar entropies. - */ doublereal IonsFromNeutralVPSSTP::entropy_mole() const { getPartialMolarEntropies(DATA_PTR(m_pp)); return mean_X(DATA_PTR(m_pp)); } -/// Molar Gibbs function. Units: J/kmol. doublereal IonsFromNeutralVPSSTP::gibbs_mole() const { getChemPotentials(DATA_PTR(m_pp)); return mean_X(DATA_PTR(m_pp)); } -/** Molar heat capacity at constant pressure. Units: J/kmol/K. - * - * Returns the solution heat capacition at constant pressure. - * This is calculated from the partial molar heat capacities. - */ + doublereal IonsFromNeutralVPSSTP::cp_mole() const { getPartialMolarCp(DATA_PTR(m_pp)); @@ -475,7 +347,6 @@ doublereal IonsFromNeutralVPSSTP::cp_mole() const return val; } -/// Molar heat capacity at constant volume. Units: J/kmol/K. doublereal IonsFromNeutralVPSSTP::cv_mole() const { // Need to revisit this, as it is wrong @@ -484,11 +355,11 @@ doublereal IonsFromNeutralVPSSTP::cv_mole() const //err("not implemented"); //return 0.0; } -//=========================================================================================================== + /* * - Activities, Standard States, Activity Concentrations ----------- */ -//=========================================================================================================== + void IonsFromNeutralVPSSTP::getDissociationCoeffs(vector_fp& coeffs, vector_fp& charges, std::vector& neutMolIndex) const { @@ -496,12 +367,7 @@ void IonsFromNeutralVPSSTP::getDissociationCoeffs(vector_fp& coeffs, charges = m_speciesCharge; neutMolIndex = fm_invert_ionForNeutral; } -//=========================================================================================================== -// Get the array of non-dimensional molar-based activity coefficients at -// the current solution temperature, pressure, and solution concentration. -/* - * @param ac Output vector of activity coefficients. Length: m_kk. - */ + void IonsFromNeutralVPSSTP::getActivityCoefficients(doublereal* ac) const { @@ -524,20 +390,10 @@ void IonsFromNeutralVPSSTP::getActivityCoefficients(doublereal* ac) const } /* - * --------- Partial Molar Properties of the Solution ------------------------------- + * --------- Partial Molar Properties of the Solution ------------- */ -// Get the species chemical potentials. Units: J/kmol. -/* - * This function returns a vector of chemical potentials of the - * species in solution at the current temperature, pressure - * and mole fraction of the solution. - * - * @param mu Output vector of species chemical - * potentials. Length: m_kk. Units: J/kmol - */ -void -IonsFromNeutralVPSSTP::getChemPotentials(doublereal* mu) const +void IonsFromNeutralVPSSTP::getChemPotentials(doublereal* mu) const { size_t icat, jNeut; doublereal xx, fact2; @@ -602,21 +458,6 @@ IonsFromNeutralVPSSTP::getChemPotentials(doublereal* mu) const } } - -// Returns an array of partial molar enthalpies for the species -// in the mixture. -/* - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * molality-based activity coefficient wrt temperature - * - * \f[ - * \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] - * - */ void IonsFromNeutralVPSSTP::getPartialMolarEnthalpies(doublereal* hbar) const { /* @@ -643,20 +484,6 @@ void IonsFromNeutralVPSSTP::getPartialMolarEnthalpies(doublereal* hbar) const } } -// Returns an array of partial molar entropies for the species -// in the mixture. -/* - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature - * - * \f[ - * \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] - * - */ void IonsFromNeutralVPSSTP::getPartialMolarEntropies(doublereal* sbar) const { double xx; @@ -684,26 +511,6 @@ void IonsFromNeutralVPSSTP::getPartialMolarEntropies(doublereal* sbar) const } } - -// Get the array of log concentration-like derivatives of the -// log activity coefficients -/* - * This function is a virtual method. For ideal mixtures - * (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the - * logarithm of the activity coefficient with respect to the - * logarithm of the concentration-like variable (i.e. mole fraction, - * molality, etc.) that represents the standard state. - * This quantity is to be used in conjunction with derivatives of - * that concentration-like variable when the derivative of the chemical - * potential is taken. - * - * units = dimensionless - * - * @param dlnActCoeffdlnX Output vector of log(mole fraction) - * derivatives of the log Activity Coefficients. - * length = m_kk - */ void IonsFromNeutralVPSSTP::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const { s_update_lnActCoeff(); @@ -713,26 +520,7 @@ void IonsFromNeutralVPSSTP::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_ dlnActCoeffdlnX_diag[k] = dlnActCoeffdlnX_diag_[k]; } } -//==================================================================================================================== -// Get the array of log concentration-like derivatives of the -// log activity coefficients -/* - * This function is a virtual method. For ideal mixtures - * (unity activity coefficients), this can return zero. - * Implementations should take the derivative of the - * logarithm of the activity coefficient with respect to the - * logarithm of the concentration-like variable (i.e. moles) - * that represents the standard state. - * This quantity is to be used in conjunction with derivatives of - * that concentration-like variable when the derivative of the chemical - * potential is taken. - * - * units = dimensionless - * - * @param dlnActCoeffdlnN_diag Output vector of log(mole fraction) - * derivatives of the log Activity Coefficients. - * length = m_kk - */ + void IonsFromNeutralVPSSTP::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const { s_update_lnActCoeff(); @@ -742,7 +530,7 @@ void IonsFromNeutralVPSSTP::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_ dlnActCoeffdlnN_diag[k] = dlnActCoeffdlnN_diag_[k]; } } -//==================================================================================================================== + void IonsFromNeutralVPSSTP::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeffdlnN) { s_update_lnActCoeff(); @@ -754,26 +542,19 @@ void IonsFromNeutralVPSSTP::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnA } } } -//==================================================================================================================== + void IonsFromNeutralVPSSTP::setTemperature(const doublereal temp) { double p = pressure(); IonsFromNeutralVPSSTP::setState_TP(temp, p); } -//==================================================================================================================== + void IonsFromNeutralVPSSTP::setPressure(doublereal p) { double t = temperature(); IonsFromNeutralVPSSTP::setState_TP(t, p); } -//==================================================================================================================== -// Set the temperature (K) and pressure (Pa) -/* - * Setting the pressure may involve the solution of a nonlinear equation. - * - * @param t Temperature (K) - * @param p Pressure (Pa) - */ + void IonsFromNeutralVPSSTP::setState_TP(doublereal t, doublereal p) { /* @@ -792,11 +573,6 @@ void IonsFromNeutralVPSSTP::setState_TP(doublereal t, doublereal p) Phase::setDensity(dd); } -// Calculate ion mole fractions from neutral molecule -// mole fractions. -/* - * @param mf Dump the mole fractions into this vector. - */ void IonsFromNeutralVPSSTP::calcIonMoleFractions(doublereal* const mf) const { doublereal fmij; @@ -833,21 +609,7 @@ void IonsFromNeutralVPSSTP::calcIonMoleFractions(doublereal* const mf) const } } -//==================================================================================================================== -// Calculate neutral molecule mole fractions -/* - * This routine calculates the neutral molecule mole - * fraction given the vector of ion mole fractions, - * i.e., the mole fractions from this ThermoPhase. - * Note, this routine basically assumes that there - * is charge neutrality. If there isn't, then it wouldn't - * make much sense. - * - * for the case of cIonSolnType_SINGLEANION, some slough - * in the charge neutrality is allowed. The cation number - * is followed, while the difference in charge neutrality - * is dumped into the anion mole number to fix the imbalance. - */ + void IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions() const { size_t icat, jNeut; @@ -956,21 +718,7 @@ void IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions() const } } -//==================================================================================================================== -// Calculate neutral molecule mole fractions -/* - * This routine calculates the neutral molecule mole - * fraction given the vector of ion mole fractions, - * i.e., the mole fractions from this ThermoPhase. - * Note, this routine basically assumes that there - * is charge neutrality. If there isn't, then it wouldn't - * make much sense. - * - * for the case of cIonSolnType_SINGLEANION, some slough - * in the charge neutrality is allowed. The cation number - * is followed, while the difference in charge neutrality - * is dumped into the anion mole number to fix the imbalance. - */ + void IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads(const doublereal* const dx, doublereal* const dy) const { doublereal fmij; @@ -1075,7 +823,6 @@ void IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads(const doublereal* const } } - void IonsFromNeutralVPSSTP::setMassFractions(const doublereal* const y) { GibbsExcessVPSSTP::setMassFractions(y); @@ -1104,7 +851,6 @@ void IonsFromNeutralVPSSTP::setMoleFractions_NoNorm(const doublereal* const x) neutralMoleculePhase_->setMoleFractions_NoNorm(DATA_PTR(NeutralMolecMoleFractions_)); } - void IonsFromNeutralVPSSTP::setConcentrations(const doublereal* const c) { GibbsExcessVPSSTP::setConcentrations(c); @@ -1116,7 +862,6 @@ void IonsFromNeutralVPSSTP::setConcentrations(const doublereal* const c) * ------------ Partial Molar Properties of the Solution ------------ */ - doublereal IonsFromNeutralVPSSTP::err(const std::string& msg) const { throw CanteraError("IonsFromNeutralVPSSTP","Base class method " @@ -1124,29 +869,12 @@ doublereal IonsFromNeutralVPSSTP::err(const std::string& msg) const return 0; } -//==================================================================================================================== -/* - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase. - * - * @see importCTML.cpp - */ void IonsFromNeutralVPSSTP::initThermo() { initLengths(); GibbsExcessVPSSTP::initThermo(); } -//==================================================================================================================== -// Initialize lengths of local variables after all species have -// been identified. void IonsFromNeutralVPSSTP::initLengths() { m_kk = nSpecies(); @@ -1171,7 +899,7 @@ void IonsFromNeutralVPSSTP::initLengths() dX_NeutralMolecule.resize(numNeutralMoleculeSpecies_, 0.0); } -//==================================================================================================================== + //! Return the factor overlap /*! * @param elnamesVN @@ -1180,7 +908,6 @@ void IonsFromNeutralVPSSTP::initLengths() * @param elnamesVI * @param elemVectorI * @param nElementsI - * */ static double factorOverlap(const std::vector& elnamesVN , const std::vector& elemVectorN, @@ -1207,22 +934,7 @@ static double factorOverlap(const std::vector& elnamesVN , } return fMax; } -//==================================================================================================================== -/* - * initThermoXML() (virtual from ThermoPhase) - * Import and initialize a ThermoPhase object - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ + void IonsFromNeutralVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { string stemp; @@ -1426,13 +1138,7 @@ void IonsFromNeutralVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string * have charge conservation. */ } -//==================================================================================================================== -// Update the activity coefficients -/* - * This function will be called to update the internally stored - * natural logarithm of the activity coefficients - * - */ + void IonsFromNeutralVPSSTP::s_update_lnActCoeff() const { size_t icat, jNeut; @@ -1481,17 +1187,7 @@ void IonsFromNeutralVPSSTP::s_update_lnActCoeff() const } } -//==================================================================================================================== -// Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along -// a line in parameter space or along a line in physical space -/* - * - * @param dTds Input of temperature change along the path - * @param dXds Input vector of changes in mole fraction along the path. length = m_kk - * Along the path length it must be the case that the mole fractions sum to one. - * @param dlnActCoeffds Output vector of the directional derivatives of the - * log Activity Coefficients along the path. length = m_kk - */ + void IonsFromNeutralVPSSTP::getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const { @@ -1556,12 +1252,7 @@ void IonsFromNeutralVPSSTP::getdlnActCoeffds(const doublereal dTds, const double } } -//==================================================================================================================== -// Update the temperature derivative of the ln activity coefficients -/* - * This function will be called to update the internally stored - * temperature derivative of the natural logarithm of the activity coefficients - */ + void IonsFromNeutralVPSSTP::s_update_dlnActCoeffdT() const { size_t icat, jNeut; @@ -1615,11 +1306,7 @@ void IonsFromNeutralVPSSTP::s_update_dlnActCoeffdT() const } } -//==================================================================================================================== -/* - * This function will be called to update the internally stored - * temperature derivative of the natural logarithm of the activity coefficients - */ + void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnX_diag() const { size_t icat, jNeut; @@ -1673,11 +1360,7 @@ void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnX_diag() const } } -//==================================================================================================================== -/* - * This function will be called to update the internally stored - * temperature derivative of the natural logarithm of the activity coefficients - */ + void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN_diag() const { size_t icat, jNeut; @@ -1731,14 +1414,7 @@ void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN_diag() const } } -//==================================================================================================================== -// Update the derivative of the log of the activity coefficients -// wrt log(number of moles) - diagonal components -/* - * This function will be called to update the internally stored - * derivative of the natural logarithm of the activity coefficients - * wrt logarithm of the number of moles of given species. - */ + void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN() const { size_t kcat = 0, kNeut = 0, mcat = 0, mNeut = 0; @@ -1823,6 +1499,5 @@ void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN() const break; } } -//==================================================================================================================== + } -//====================================================================================================================== diff --git a/src/thermo/MargulesVPSSTP.cpp b/src/thermo/MargulesVPSSTP.cpp index db945481d..c5b05a63f 100644 --- a/src/thermo/MargulesVPSSTP.cpp +++ b/src/thermo/MargulesVPSSTP.cpp @@ -4,7 +4,6 @@ * employ excess gibbs free energy formulations related to Margules * expansions (see \ref thermoprops * and class \link Cantera::MargulesVPSSTP MargulesVPSSTP\endlink). - * */ /* * Copyright (2009) Sandia Corporation. Under the terms of @@ -22,11 +21,6 @@ using namespace std; namespace Cantera { - -/* - * Default constructor. - * - */ MargulesVPSSTP::MargulesVPSSTP() : GibbsExcessVPSSTP(), numBinaryInteractions_(0), @@ -35,15 +29,6 @@ MargulesVPSSTP::MargulesVPSSTP() : { } -/* - * Working constructors - * - * The two constructors below are the normal way - * the phase initializes itself. They are shells that call - * the routine initThermo(), with a reference to the - * XML database to get the info for the phase. - - */ MargulesVPSSTP::MargulesVPSSTP(const std::string& inputFile, const std::string& id) : GibbsExcessVPSSTP(), numBinaryInteractions_(0), @@ -62,25 +47,12 @@ MargulesVPSSTP::MargulesVPSSTP(XML_Node& phaseRoot, const std::string& id) : importPhase(*findXMLPhase(&phaseRoot, id), this); } - -/* - * Copy Constructor: - * - * Note this stuff will not work until the underlying phase - * has a working copy constructor - */ MargulesVPSSTP::MargulesVPSSTP(const MargulesVPSSTP& b) : GibbsExcessVPSSTP() { MargulesVPSSTP::operator=(b); } -/* - * operator=() - * - * Note this stuff will not work until the underlying phase - * has a working assignment operator - */ MargulesVPSSTP& MargulesVPSSTP:: operator=(const MargulesVPSSTP& b) { @@ -111,34 +83,16 @@ operator=(const MargulesVPSSTP& b) return *this; } -/** - * - * ~MargulesVPSSTP(): (virtual) - * - * Destructor: does nothing: - * - */ MargulesVPSSTP::~MargulesVPSSTP() { } -/* - * This routine duplicates the current object and returns - * a pointer to ThermoPhase. - */ ThermoPhase* MargulesVPSSTP::duplMyselfAsThermoPhase() const { return new MargulesVPSSTP(*this); } -// Special constructor for a hard-coded problem -/* - * - * LiKCl treating the PseudoBinary layer as passthrough. - * -> test to predict the eutectic and liquidus correctly. - * - */ MargulesVPSSTP::MargulesVPSSTP(int testProb) : GibbsExcessVPSSTP(), numBinaryInteractions_(0), @@ -197,41 +151,19 @@ MargulesVPSSTP::MargulesVPSSTP(int testProb) : m_pSpecies_A_ij[0] = iKCl; } - /* * -------------- Utilities ------------------------------- */ - -// Equation of state type flag. -/* - * The ThermoPhase base class returns - * zero. Subclasses should define this to return a unique - * non-zero value. Known constants defined for this purpose are - * listed in mix_defs.h. The MargulesVPSSTP class also returns - * zero, as it is a non-complete class. - */ int MargulesVPSSTP::eosType() const { return 0; } -/* - * ------------ Molar Thermodynamic Properties ---------------------- - */ - - /* * - Activities, Standard States, Activity Concentrations ----------- */ - -//==================================================================================================================== -// Get the array of non-dimensional molar-based ln activity coefficients at -// the current solution temperature, pressure, and solution concentration. -/* - * @param lnac Output vector of ln activity coefficients. Length: m_kk. - */ void MargulesVPSSTP::getLnActivityCoefficients(doublereal* lnac) const { /* @@ -246,13 +178,11 @@ void MargulesVPSSTP::getLnActivityCoefficients(doublereal* lnac) const lnac[k] = lnActCoeff_Scaled_[k]; } } -//==================================================================================================================== + /* * ------------ Partial Molar Properties of the Solution ------------ */ - - void MargulesVPSSTP::getElectrochemPotentials(doublereal* mu) const { getChemPotentials(mu); @@ -262,7 +192,6 @@ void MargulesVPSSTP::getElectrochemPotentials(doublereal* mu) const } } - void MargulesVPSSTP::getChemPotentials(doublereal* mu) const { doublereal xx; @@ -284,7 +213,6 @@ void MargulesVPSSTP::getChemPotentials(doublereal* mu) const } } -/// Molar enthalpy. Units: J/kmol. doublereal MargulesVPSSTP::enthalpy_mole() const { size_t kk = nSpecies(); @@ -297,7 +225,6 @@ doublereal MargulesVPSSTP::enthalpy_mole() const return h; } -/// Molar entropy. Units: J/kmol. doublereal MargulesVPSSTP::entropy_mole() const { size_t kk = nSpecies(); @@ -310,7 +237,6 @@ doublereal MargulesVPSSTP::entropy_mole() const return s; } -/// Molar heat capacity at constant pressure. Units: J/kmol/K. doublereal MargulesVPSSTP::cp_mole() const { size_t kk = nSpecies(); @@ -323,26 +249,11 @@ doublereal MargulesVPSSTP::cp_mole() const return cp; } -/// Molar heat capacity at constant volume. Units: J/kmol/K. doublereal MargulesVPSSTP::cv_mole() const { return cp_mole() - GasConstant; } -// Returns an array of partial molar enthalpies for the species -// in the mixture. -/* - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * molality-based activity coefficient wrt temperature - * - * \f[ - * \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] - * - */ void MargulesVPSSTP::getPartialMolarEnthalpies(doublereal* hbar) const { /* @@ -369,20 +280,6 @@ void MargulesVPSSTP::getPartialMolarEnthalpies(doublereal* hbar) const } } -// Returns an array of partial molar heat capacities for the species -// in the mixture. -/* - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature - * - * \f[ - * ??????????? \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] - * - */ void MargulesVPSSTP::getPartialMolarCp(doublereal* cpbar) const { /* @@ -408,20 +305,6 @@ void MargulesVPSSTP::getPartialMolarCp(doublereal* cpbar) const } } -// Returns an array of partial molar entropies for the species -// in the mixture. -/* - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature - * - * \f[ - * \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] - * - */ void MargulesVPSSTP::getPartialMolarEntropies(doublereal* sbar) const { double xx; @@ -449,20 +332,6 @@ void MargulesVPSSTP::getPartialMolarEntropies(doublereal* sbar) const } } -/* - * ------------ Partial Molar Properties of the Solution ------------ - */ - -// Return an array of partial molar volumes for the -// species in the mixture. Units: m^3/kmol. -/* - * Frequently, for this class of thermodynamics representations, - * the excess Volume due to mixing is zero. Here, we set it as - * a default. It may be overridden in derived classes. - * - * @param vbar Output vector of species partial molar volumes. - * Length = m_kk. units are m^3/kmol. - */ void MargulesVPSSTP::getPartialMolarVolumes(doublereal* vbar) const { @@ -505,50 +374,18 @@ doublereal MargulesVPSSTP::err(const std::string& msg) const return 0; } - -/* - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase. - * - * @see importCTML.cpp - */ void MargulesVPSSTP::initThermo() { initLengths(); GibbsExcessVPSSTP::initThermo(); } - -// Initialize lengths of local variables after all species have -// been identified. void MargulesVPSSTP::initLengths() { m_kk = nSpecies(); dlnActCoeffdlnN_.resize(m_kk, m_kk); } -/* - * initThermoXML() (virtual from ThermoPhase) - * Import and initialize a ThermoPhase object - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ void MargulesVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { string stemp; @@ -617,15 +454,7 @@ void MargulesVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id) } -//=================================================================================================================== -// Update the activity coefficients -/* - * This function will be called to update the internally stored - * natural logarithm of the activity coefficients - * - * he = X_A X_B(B + C X_B) - */ void MargulesVPSSTP::s_update_lnActCoeff() const { size_t iA, iB, iK; @@ -653,14 +482,7 @@ void MargulesVPSSTP::s_update_lnActCoeff() const lnActCoeff_Scaled_[iB] += XA * g0g1XB + XAXB * g1; } } -//=================================================================================================================== -// Update the derivative of the log of the activity coefficients wrt T -/* - * This function will be called to update the internally stored - * natural logarithm of the activity coefficients - * - * he = X_A X_B(B + C X_B) - */ + void MargulesVPSSTP::s_update_dlnActCoeff_dT() const { size_t iA, iB, iK; @@ -696,7 +518,7 @@ void MargulesVPSSTP::s_update_dlnActCoeff_dT() const d2lnActCoeffdT2_Scaled_[iB] -= mult * XA * g0g1XB + XAXB * g1; } } -//==================================================================================================================== + void MargulesVPSSTP::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const { s_update_dlnActCoeff_dT(); @@ -704,7 +526,7 @@ void MargulesVPSSTP::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const dlnActCoeffdT[k] = dlnActCoeffdT_Scaled_[k]; } } -//==================================================================================================================== + void MargulesVPSSTP::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const { s_update_dlnActCoeff_dT(); @@ -712,24 +534,10 @@ void MargulesVPSSTP::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const d2lnActCoeffdT2[k] = d2lnActCoeffdT2_Scaled_[k]; } } -//==================================================================================================================== -// Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along -// a line in parameter space or along a line in physical space -/* - * - * @param dTds Input of temperature change along the path - * @param dXds Input vector of changes in mole fraction along the path. length = m_kk - * Along the path length it must be the case that the mole fractions sum to one. - * @param dlnActCoeffds Output vector of the directional derivatives of the - * log Activity Coefficients along the path. length = m_kk - * units are 1/units(s). if s is a physical coordinate then the units are 1/m. - */ void MargulesVPSSTP::getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const { - - size_t iA, iB, iK; double XA, XB, g0 , g1, dXA, dXB; double T = temperature(); @@ -763,15 +571,7 @@ void MargulesVPSSTP::getdlnActCoeffds(const doublereal dTds, const doublereal* dlnActCoeffds[iB] += dXA * g02g1XB + g2XAdXB; } } -//==================================================================================================================== -// Update the derivative of the log of the activity coefficients wrt dlnN -/* - * This function will be called to update the internally stored gradients of the - * logarithm of the activity coefficients. These are used in the determination - * of the diffusion coefficients. - * - * he = X_A X_B(B + C X_B) - */ + void MargulesVPSSTP::s_update_dlnActCoeff_dlnN_diag() const { size_t iA, iB, iK, delAK, delBK; @@ -827,14 +627,6 @@ void MargulesVPSSTP::s_update_dlnActCoeff_dlnN_diag() const } } -//==================================================================================================================== -// Update the derivative of the log of the activity coefficients wrt dlnN -/* - * This function will be called to update the internally stored gradients of the - * logarithm of the activity coefficients. These are used in the determination - * of the diffusion coefficients. - * - */ void MargulesVPSSTP::s_update_dlnActCoeff_dlnN() const { size_t iA, iB; @@ -902,7 +694,7 @@ void MargulesVPSSTP::s_update_dlnActCoeff_dlnN() const } } } -//==================================================================================================================== + void MargulesVPSSTP::s_update_dlnActCoeff_dlnX_diag() const { doublereal T = temperature(); @@ -924,7 +716,6 @@ void MargulesVPSSTP::s_update_dlnActCoeff_dlnX_diag() const } } -//==================================================================================================================== void MargulesVPSSTP::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const { s_update_dlnActCoeff_dlnN_diag(); @@ -932,7 +723,7 @@ void MargulesVPSSTP::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) c dlnActCoeffdlnN_diag[k] = dlnActCoeffdlnN_diag_[k]; } } -//==================================================================================================================== + void MargulesVPSSTP::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const { s_update_dlnActCoeff_dlnX_diag(); @@ -940,7 +731,7 @@ void MargulesVPSSTP::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) c dlnActCoeffdlnX_diag[k] = dlnActCoeffdlnX_diag_[k]; } } -//==================================================================================================================== + void MargulesVPSSTP::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeffdlnN) { s_update_dlnActCoeff_dlnN(); @@ -951,7 +742,7 @@ void MargulesVPSSTP::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeff } } } -//==================================================================================================================== + void MargulesVPSSTP::resizeNumInteractions(const size_t num) { numBinaryInteractions_ = num; @@ -970,17 +761,8 @@ void MargulesVPSSTP::resizeNumInteractions(const size_t num) m_pSpecies_A_ij.resize(num, npos); m_pSpecies_B_ij.resize(num, npos); - } -//==================================================================================================================== -/* - * Process an XML node called "binaryNeutralSpeciesParameters" - * This node contains all of the parameters necessary to describe - * the Margules Interaction for a single binary interaction - * This function reads the XML file and writes the coefficients - * it finds to an internal data structures. - */ void MargulesVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies) { string xname = xmLBinarySpecies.name(); @@ -1096,11 +878,7 @@ void MargulesVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies) m_VSE_b_ij[iSpot] = vParams[0]; m_VSE_c_ij[iSpot] = vParams[1]; } - - } - } } - diff --git a/src/thermo/MixedSolventElectrolyte.cpp b/src/thermo/MixedSolventElectrolyte.cpp index 2c4177092..de7d9eb84 100644 --- a/src/thermo/MixedSolventElectrolyte.cpp +++ b/src/thermo/MixedSolventElectrolyte.cpp @@ -23,11 +23,6 @@ using namespace std; namespace Cantera { - -/* - * Default constructor. - * - */ MixedSolventElectrolyte::MixedSolventElectrolyte() : MolarityIonicVPSSTP(), numBinaryInteractions_(0), @@ -36,15 +31,6 @@ MixedSolventElectrolyte::MixedSolventElectrolyte() : { } -/* - * Working constructors - * - * The two constructors below are the normal way - * the phase initializes itself. They are shells that call - * the routine initThermo(), with a reference to the - * XML database to get the info for the phase. - - */ MixedSolventElectrolyte::MixedSolventElectrolyte(const std::string& inputFile, const std::string& id) : MolarityIonicVPSSTP(), @@ -65,25 +51,12 @@ MixedSolventElectrolyte::MixedSolventElectrolyte(XML_Node& phaseRoot, importPhase(*findXMLPhase(&phaseRoot, id), this); } - -/* - * Copy Constructor: - * - * Note this stuff will not work until the underlying phase - * has a working copy constructor - */ MixedSolventElectrolyte::MixedSolventElectrolyte(const MixedSolventElectrolyte& b) : MolarityIonicVPSSTP() { MixedSolventElectrolyte::operator=(b); } -/* - * operator=() - * - * Note this stuff will not work until the underlying phase - * has a working assignment operator - */ MixedSolventElectrolyte& MixedSolventElectrolyte:: operator=(const MixedSolventElectrolyte& b) { @@ -114,42 +87,22 @@ operator=(const MixedSolventElectrolyte& b) return *this; } -/** - * - * ~MixedSolventElectrolyte(): (virtual) - * - * Destructor: does nothing: - * - */ MixedSolventElectrolyte::~MixedSolventElectrolyte() { } -/* - * This routine duplicates the current object and returns - * a pointer to ThermoPhase. - */ ThermoPhase* MixedSolventElectrolyte::duplMyselfAsThermoPhase() const { return new MixedSolventElectrolyte(*this); } -// Special constructor for a hard-coded problem -/* - * - * LiKCl treating the PseudoBinary layer as passthrough. - * -> test to predict the eutectic and liquidus correctly. - * - */ MixedSolventElectrolyte::MixedSolventElectrolyte(int testProb) : MolarityIonicVPSSTP(), numBinaryInteractions_(0), formMargules_(0), formTempModel_(0) { - - initThermoFile("LiKCl_liquid.xml", ""); @@ -201,39 +154,19 @@ MixedSolventElectrolyte::MixedSolventElectrolyte(int testProb) : m_pSpecies_A_ij[0] = iKCl; } - /* * -------------- Utilities ------------------------------- */ - -// Equation of state type flag. -/* - * The ThermoPhase base class returns - * zero. Subclasses should define this to return a unique - * non-zero value. Known constants defined for this purpose are - * listed in mix_defs.h. The MixedSolventElectrolyte class also returns - * zero, as it is a non-complete class. - */ int MixedSolventElectrolyte::eosType() const { return 0; } -//==================================================================================================================== -/* - * ------------ Molar Thermodynamic Properties ---------------------- - */ -//==================================================================================================================== /* * - Activities, Standard States, Activity Concentrations ----------- */ -//==================================================================================================================== -// Get the array of non-dimensional molar-based activity coefficients at -// the current solution temperature, pressure, and solution concentration. -/* - * @param ac Output vector of activity coefficients. Length: m_kk. - */ + void MixedSolventElectrolyte::getActivityCoefficients(doublereal* ac) const { /* @@ -248,13 +181,11 @@ void MixedSolventElectrolyte::getActivityCoefficients(doublereal* ac) const ac[k] = exp(lnActCoeff_Scaled_[k]); } } -//==================================================================================================================== + /* * ------------ Partial Molar Properties of the Solution ------------ */ - - void MixedSolventElectrolyte::getElectrochemPotentials(doublereal* mu) const { getChemPotentials(mu); @@ -264,7 +195,6 @@ void MixedSolventElectrolyte::getElectrochemPotentials(doublereal* mu) const } } - void MixedSolventElectrolyte::getChemPotentials(doublereal* mu) const { doublereal xx; @@ -289,7 +219,6 @@ void MixedSolventElectrolyte::getChemPotentials(doublereal* mu) const } } -/// Molar enthalpy. Units: J/kmol. doublereal MixedSolventElectrolyte::enthalpy_mole() const { size_t kk = nSpecies(); @@ -302,7 +231,6 @@ doublereal MixedSolventElectrolyte::enthalpy_mole() const return h; } -/// Molar entropy. Units: J/kmol. doublereal MixedSolventElectrolyte::entropy_mole() const { size_t kk = nSpecies(); @@ -315,7 +243,6 @@ doublereal MixedSolventElectrolyte::entropy_mole() const return s; } -/// Molar heat capacity at constant pressure. Units: J/kmol/K. doublereal MixedSolventElectrolyte::cp_mole() const { size_t kk = nSpecies(); @@ -328,26 +255,11 @@ doublereal MixedSolventElectrolyte::cp_mole() const return cp; } -/// Molar heat capacity at constant volume. Units: J/kmol/K. doublereal MixedSolventElectrolyte::cv_mole() const { return cp_mole() - GasConstant; } -// Returns an array of partial molar enthalpies for the species -// in the mixture. -/* - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * molality-based activity coefficient wrt temperature - * - * \f[ - * \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] - * - */ void MixedSolventElectrolyte::getPartialMolarEnthalpies(doublereal* hbar) const { /* @@ -374,20 +286,6 @@ void MixedSolventElectrolyte::getPartialMolarEnthalpies(doublereal* hbar) const } } -// Returns an array of partial molar heat capacities for the species -// in the mixture. -/* - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature - * - * \f[ - * ??????????? \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] - * - */ void MixedSolventElectrolyte::getPartialMolarCp(doublereal* cpbar) const { /* @@ -413,20 +311,6 @@ void MixedSolventElectrolyte::getPartialMolarCp(doublereal* cpbar) const } } -// Returns an array of partial molar entropies for the species -// in the mixture. -/* - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature - * - * \f[ - * \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] - * - */ void MixedSolventElectrolyte::getPartialMolarEntropies(doublereal* sbar) const { double xx; @@ -454,20 +338,6 @@ void MixedSolventElectrolyte::getPartialMolarEntropies(doublereal* sbar) const } } -/* - * ------------ Partial Molar Properties of the Solution ------------ - */ - -// Return an array of partial molar volumes for the -// species in the mixture. Units: m^3/kmol. -/* - * Frequently, for this class of thermodynamics representations, - * the excess Volume due to mixing is zero. Here, we set it as - * a default. It may be overridden in derived classes. - * - * @param vbar Output vector of species partial molar volumes. - * Length = m_kk. units are m^3/kmol. - */ void MixedSolventElectrolyte::getPartialMolarVolumes(doublereal* vbar) const { int delAK, delBK; @@ -510,50 +380,18 @@ doublereal MixedSolventElectrolyte::err(const std::string& msg) const return 0; } - -/* - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase. - * - * @see importCTML.cpp - */ void MixedSolventElectrolyte::initThermo() { initLengths(); MolarityIonicVPSSTP::initThermo(); } - -// Initialize lengths of local variables after all species have -// been identified. void MixedSolventElectrolyte::initLengths() { m_kk = nSpecies(); dlnActCoeffdlnN_.resize(m_kk, m_kk); } -/* - * initThermoXML() (virtual from ThermoPhase) - * Import and initialize a ThermoPhase object - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ void MixedSolventElectrolyte::initThermoXML(XML_Node& phaseNode, const std::string& id) { string subname = "MixedSolventElectrolyte::initThermoXML"; @@ -618,15 +456,7 @@ void MixedSolventElectrolyte::initThermoXML(XML_Node& phaseNode, const std::stri } -//=================================================================================================================== -// Update the activity coefficients -/* - * This function will be called to update the internally stored - * natural logarithm of the activity coefficients - * - * he = X_A X_B(B + C X_B) - */ void MixedSolventElectrolyte::s_update_lnActCoeff() const { int delAK, delBK; @@ -653,14 +483,7 @@ void MixedSolventElectrolyte::s_update_lnActCoeff() const } } } -//=================================================================================================================== -// Update the derivative of the log of the activity coefficients wrt T -/* - * This function will be called to update the internally stored - * natural logarithm of the activity coefficients - * - * he = X_A X_B(B + C X_B) - */ + void MixedSolventElectrolyte::s_update_dlnActCoeff_dT() const { int delAK, delBK; @@ -690,7 +513,7 @@ void MixedSolventElectrolyte::s_update_dlnActCoeff_dT() const } } } -//==================================================================================================================== + void MixedSolventElectrolyte::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const { s_update_dlnActCoeff_dT(); @@ -698,7 +521,7 @@ void MixedSolventElectrolyte::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const dlnActCoeffdT[k] = dlnActCoeffdT_Scaled_[k]; } } -//==================================================================================================================== + void MixedSolventElectrolyte::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const { s_update_dlnActCoeff_dT(); @@ -706,19 +529,7 @@ void MixedSolventElectrolyte::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) co d2lnActCoeffdT2[k] = d2lnActCoeffdT2_Scaled_[k]; } } -//==================================================================================================================== -// Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along -// a line in parameter space or along a line in physical space -/* - * - * @param dTds Input of temperature change along the path - * @param dXds Input vector of changes in mole fraction along the path. length = m_kk - * Along the path length it must be the case that the mole fractions sum to one. - * @param dlnActCoeffds Output vector of the directional derivatives of the - * log Activity Coefficients along the path. length = m_kk - * units are 1/units(s). if s is a physical coordinate then the units are 1/m. - */ void MixedSolventElectrolyte::getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const { @@ -760,15 +571,7 @@ void MixedSolventElectrolyte::getdlnActCoeffds(const doublereal dTds, const dou } } } -//==================================================================================================================== -// Update the derivative of the log of the activity coefficients wrt dlnN -/* - * This function will be called to update the internally stored gradients of the - * logarithm of the activity coefficients. These are used in the determination - * of the diffusion coefficients. - * - * he = X_A X_B(B + C X_B) - */ + void MixedSolventElectrolyte::s_update_dlnActCoeff_dlnN_diag() const { int delAK, delBK; @@ -824,14 +627,6 @@ void MixedSolventElectrolyte::s_update_dlnActCoeff_dlnN_diag() const } } -//==================================================================================================================== -// Update the derivative of the log of the activity coefficients wrt dlnN -/* - * This function will be called to update the internally stored gradients of the - * logarithm of the activity coefficients. These are used in the determination - * of the diffusion coefficients. - * - */ void MixedSolventElectrolyte::s_update_dlnActCoeff_dlnN() const { doublereal delAK, delBK; @@ -897,7 +692,7 @@ void MixedSolventElectrolyte::s_update_dlnActCoeff_dlnN() const } } } -//==================================================================================================================== + void MixedSolventElectrolyte::s_update_dlnActCoeff_dlnX_diag() const { doublereal XA, XB, g0 , g1; @@ -922,7 +717,7 @@ void MixedSolventElectrolyte::s_update_dlnActCoeff_dlnX_diag() const } } -//==================================================================================================================== + void MixedSolventElectrolyte::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const { s_update_dlnActCoeff_dlnN_diag(); @@ -930,7 +725,7 @@ void MixedSolventElectrolyte::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdln dlnActCoeffdlnN_diag[k] = dlnActCoeffdlnN_diag_[k]; } } -//==================================================================================================================== + void MixedSolventElectrolyte::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const { s_update_dlnActCoeff_dlnX_diag(); @@ -938,7 +733,7 @@ void MixedSolventElectrolyte::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdln dlnActCoeffdlnX_diag[k] = dlnActCoeffdlnX_diag_[k]; } } -//==================================================================================================================== + void MixedSolventElectrolyte::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeffdlnN) { s_update_dlnActCoeff_dlnN(); @@ -949,7 +744,7 @@ void MixedSolventElectrolyte::getdlnActCoeffdlnN(const size_t ld, doublereal* dl } } } -//==================================================================================================================== + void MixedSolventElectrolyte::resizeNumInteractions(const size_t num) { numBinaryInteractions_ = num; @@ -970,15 +765,7 @@ void MixedSolventElectrolyte::resizeNumInteractions(const size_t num) m_pSpecies_B_ij.resize(num, npos); } -//==================================================================================================================== -/* - * Process an XML node called "binaryNeutralSpeciesParameters" - * This node contains all of the parameters necessary to describe - * the Margules Interaction for a single binary interaction - * This function reads the XML file and writes the coefficients - * it finds to an internal data structures. - */ void MixedSolventElectrolyte::readXMLBinarySpecies(XML_Node& xmLBinarySpecies) { string xname = xmLBinarySpecies.name(); @@ -1095,11 +882,7 @@ void MixedSolventElectrolyte::readXMLBinarySpecies(XML_Node& xmLBinarySpecies) m_VSE_b_ij[iSpot] = vParams[0]; m_VSE_c_ij[iSpot] = vParams[1]; } - - } - } } - diff --git a/src/thermo/MolalityVPSSTP.cpp b/src/thermo/MolalityVPSSTP.cpp index 7aab875ca..6e8e33090 100644 --- a/src/thermo/MolalityVPSSTP.cpp +++ b/src/thermo/MolalityVPSSTP.cpp @@ -28,16 +28,6 @@ using namespace std; namespace Cantera { -/* - * Default constructor. - * - * This doesn't do much more than initialize constants with - * default values for water at 25C. Water molecular weight - * comes from the default elements.xml file. It actually - * differs slightly from the IAPWS95 value of 18.015268. However, - * density conservation and therefore element conservation - * is the more important principle to follow. - */ MolalityVPSSTP::MolalityVPSSTP() : VPStandardStateTP(), m_indexSolvent(0), @@ -55,12 +45,6 @@ MolalityVPSSTP::MolalityVPSSTP() : m_chargeNeutralityNecessary = true; } -/* - * Copy Constructor: - * - * Note this stuff will not work until the underlying phase - * has a working copy constructor - */ MolalityVPSSTP::MolalityVPSSTP(const MolalityVPSSTP& b) : VPStandardStateTP(), m_indexSolvent(b.m_indexSolvent), @@ -73,12 +57,6 @@ MolalityVPSSTP::MolalityVPSSTP(const MolalityVPSSTP& b) : *this = operator=(b); } -/* - * operator=() - * - * Note this stuff will not work until the underlying phase - * has a working assignment operator - */ MolalityVPSSTP& MolalityVPSSTP:: operator=(const MolalityVPSSTP& b) { @@ -95,21 +73,10 @@ operator=(const MolalityVPSSTP& b) return *this; } -/** - * - * ~MolalityVPSSTP(): (virtual) - * - * Destructor: does nothing: - * - */ MolalityVPSSTP::~MolalityVPSSTP() { } -/* - * This routine duplicates the current object and returns - * a pointer to ThermoPhase. - */ ThermoPhase* MolalityVPSSTP::duplMyselfAsThermoPhase() const { @@ -120,25 +87,11 @@ MolalityVPSSTP::duplMyselfAsThermoPhase() const * -------------- Utilities ------------------------------- */ -// Equation of state type flag. -/* - * The ThermoPhase base class returns - * zero. Subclasses should define this to return a unique - * non-zero value. Known constants defined for this purpose are - * listed in mix_defs.h. The MolalityVPSSTP class also returns - * zero, as it is a non-complete class. - */ int MolalityVPSSTP::eosType() const { return 0; } -// Set the pH scale, which determines the scale for single-ion activity -// coefficients. -/* - * Single ion activity coefficients are not unique in terms of the - * representing actual measurable quantities. - */ void MolalityVPSSTP::setpHScale(const int pHscaleType) { m_pHScalingType = pHscaleType; @@ -148,24 +101,11 @@ void MolalityVPSSTP::setpHScale(const int pHscaleType) } } -// Reports the pH scale, which determines the scale for single-ion activity -// coefficients. -/* - * Single ion activity coefficients are not unique in terms of the - * representing actual measurable quantities. - */ int MolalityVPSSTP::pHScale() const { return m_pHScalingType; } -/* - * setSolvent(): - * Utilities for Solvent ID and Molality - * Here we also calculate and store the molecular weight - * of the solvent and the m_Mnaught parameter. - * @param k index of the solvent. - */ void MolalityVPSSTP::setSolvent(size_t k) { if (k >= m_kk) { @@ -179,18 +119,11 @@ void MolalityVPSSTP::setSolvent(size_t k) m_Mnaught = m_weightSolvent / 1000.; } -/* - * return the solvent id index number. - */ size_t MolalityVPSSTP::solventIndex() const { return m_indexSolvent; } -/* - * Sets the minimum mole fraction in the molality formulation. The - * minimum mole fraction must be in the range 0 to 0.9. - */ void MolalityVPSSTP:: setMoleFSolventMin(doublereal xmolSolventMIN) { @@ -202,29 +135,11 @@ setMoleFSolventMin(doublereal xmolSolventMIN) m_xmolSolventMIN = xmolSolventMIN; } -/** - * Returns the minimum mole fraction in the molality formulation. - */ doublereal MolalityVPSSTP::moleFSolventMin() const { return m_xmolSolventMIN; } -/* - * calcMolalities(): - * We calculate the vector of molalities of the species - * in the phase and store the result internally: - * \f[ - * m_i = (n_i) / (1000 * M_o * n_{o,p}) - * \f] - * where - * - \f$ M_o \f$ is the molecular weight of the solvent - * - \f$ n_o \f$ is the mole fraction of the solvent - * - \f$ n_i \f$ is the mole fraction of the solute. - * - \f$ n_{o,p} = max (n_{o, min}, n_o) \f$ - * - \f$ n_{o,min} \f$ = minimum mole fraction of solvent allowed - * in the denominator. - */ void MolalityVPSSTP::calcMolalities() const { getMoleFractions(DATA_PTR(m_molalities)); @@ -238,21 +153,6 @@ void MolalityVPSSTP::calcMolalities() const } } -/* - * getMolalities(): - * We calculate the vector of molalities of the species - * in the phase - * \f[ - * m_i = (n_i) / (1000 * M_o * n_{o,p}) - * \f] - * where - * - \f$ M_o \f$ is the molecular weight of the solvent - * - \f$ n_o \f$ is the mole fraction of the solvent - * - \f$ n_i \f$ is the mole fraction of the solute. - * - \f$ n_{o,p} = max (n_{o, min}, n_o) \f$ - * - \f$ n_{o,min} \f$ = minimum mole fraction of solvent allowed - * in the denominator. - */ void MolalityVPSSTP::getMolalities(doublereal* const molal) const { calcMolalities(); @@ -261,24 +161,8 @@ void MolalityVPSSTP::getMolalities(doublereal* const molal) const } } -/* - * setMolalities(): - * We are supplied with the molalities of all of the - * solute species. We then calculate the mole fractions of all - * species and update the ThermoPhase object. - * - * m_i = (n_i) / (W_o/1000 * n_o_p) - * - * where M_o is the molecular weight of the solvent - * n_o is the mole fraction of the solvent - * n_i is the mole fraction of the solute. - * n_o_p = max (n_o_min, n_o) - * n_o_min = minimum mole fraction of solvent allowed - * in the denominator. - */ void MolalityVPSSTP::setMolalities(const doublereal* const molal) { - double Lsum = 1.0 / m_Mnaught; for (size_t k = 1; k < m_kk; k++) { m_molalities[k] = molal[k]; @@ -306,16 +190,13 @@ void MolalityVPSSTP::setMolalities(const doublereal* const molal) calcMolalities(); } -/* - * setMolalitiesByName() - * - * This routine sets the molalities by name - * HKM -> Might need to be more complicated here, setting - * neutrals so that the existing mole fractions are - * preserved. - */ void MolalityVPSSTP::setMolalitiesByName(compositionMap& mMap) { + /* + * HKM -> Might need to be more complicated here, setting + * neutrals so that the existing mole fractions are + * preserved. + */ size_t kk = nSpecies(); doublereal x; /* @@ -396,46 +277,16 @@ void MolalityVPSSTP::setMolalitiesByName(compositionMap& mMap) calcMolalities(); } -/* - * setMolalitiesByNames() - * - * Set the molalities of the solutes by name - */ void MolalityVPSSTP::setMolalitiesByName(const std::string& x) { compositionMap xx = parseCompString(x, speciesNames()); setMolalitiesByName(xx); } - -/* - * ------------ Molar Thermodynamic Properties ---------------------- - */ - - /* * - Activities, Standard States, Activity Concentrations ----------- */ -/* - * This method returns the activity convention. - * Currently, there are two activity conventions - * Molar-based activities - * Unit activity of species at either a hypothetical pure - * solution of the species or at a hypothetical - * pure ideal solution at infinite dilution - * cAC_CONVENTION_MOLAR 0 - * - default - * - * Molality based activities - * (unit activity of solutes at a hypothetical 1 molal - * solution referenced to infinite dilution at all - * pressures and temperatures). - * (solvent is still on molar basis). - * cAC_CONVENTION_MOLALITY 1 - * - * We set the convention to molality here. - */ int MolalityVPSSTP::activityConvention() const { return cAC_CONVENTION_MOLALITY; @@ -463,19 +314,6 @@ void MolalityVPSSTP::getActivities(doublereal* ac) const err("getActivities"); } -/* - * Get the array of non-dimensional activity coefficients at - * the current solution temperature, pressure, and - * solution concentration. - * These are mole fraction based activity coefficients. In this - * object, their calculation is based on translating the values - * of Molality based activity coefficients. - * See Denbigh p. 278 for a thorough discussion. - * - * Note, the solvent is treated differently. getMolalityActivityCoeff() - * returns the molar based solvent activity coefficient already. - * Therefore, we do not have to divide by x_s here. - */ void MolalityVPSSTP::getActivityCoefficients(doublereal* ac) const { getMolalityActivityCoefficients(ac); @@ -489,38 +327,12 @@ void MolalityVPSSTP::getActivityCoefficients(doublereal* ac) const } } -// Get the array of non-dimensional molality based -// activity coefficients at the current solution temperature, -// pressure, and solution concentration. -/* - * See Denbigh p. 278 for a thorough discussion. This class must be overwritten in - * classes which derive from %MolalityVPSSTP. This function takes over from the - * molar-based activity coefficient calculation, getActivityCoefficients(), in - * derived classes. - * - * Note these activity coefficients have the current pH scale applied to them. - * - * @param acMolality Output vector containing the molality based activity coefficients. - * length: m_kk. - */ void MolalityVPSSTP::getMolalityActivityCoefficients(doublereal* acMolality) const { getUnscaledMolalityActivityCoefficients(acMolality); applyphScale(acMolality); } -/* - * osmotic coefficient: - * - * Calculate the osmotic coefficient of the solvent. Note there - * are lots of definitions of the osmotic coefficient floating - * around. We use the one defined in the Pitzer's book: - * (Activity Coeff in Electrolyte Solutions, K. S. Pitzer - * CRC Press, Boca Raton, 1991, p. 85, Eqn. 28). - * - * Definition: - * - sum(m_i) * Mnaught * oc = ln(activity_solvent) - */ doublereal MolalityVPSSTP::osmoticCoefficient() const { /* @@ -543,7 +355,6 @@ doublereal MolalityVPSSTP::osmoticCoefficient() const return oc; } - void MolalityVPSSTP::getElectrochemPotentials(doublereal* mu) const { getChemPotentials(mu); @@ -553,11 +364,6 @@ void MolalityVPSSTP::getElectrochemPotentials(doublereal* mu) const } } -/* - * ------------ Partial Molar Properties of the Solution ------------ - */ - - doublereal MolalityVPSSTP::err(const std::string& msg) const { throw CanteraError("MolalityVPSSTP","Base class method " @@ -565,28 +371,6 @@ doublereal MolalityVPSSTP::err(const std::string& msg) const return 0; } -/* - * Returns the units of the standard and general concentrations - * Note they have the same units, as their divisor is - * defined to be equal to the activity of the kth species - * in the solution, which is unitless. - * - * This routine is used in print out applications where the - * units are needed. Usually, MKS units are assumed throughout - * the program and in the XML input files. - * - * On return uA contains the powers of the units (MKS assumed) - * of the standard concentrations and generalized concentrations - * for the kth species. - * - * uA[0] = kmol units - default = 1 - * uA[1] = m units - default = -nDim(), the number of spatial - * dimensions in the Phase class. - * uA[2] = kg units - default = 0; - * uA[3] = Pa(pressure) units - default = 0; - * uA[4] = Temperature units - default = 0; - * uA[5] = time units - default = 0 - */ void MolalityVPSSTP::getUnitsStandardConc(double* uA, int k, int sizeUA) const { for (int i = 0; i < sizeUA; i++) { @@ -617,9 +401,6 @@ void MolalityVPSSTP::setToEquilState(const doublereal* lambda_RT) err("setToEquilState"); } -/* - * Set the thermodynamic state. - */ void MolalityVPSSTP::setStateFromXML(const XML_Node& state) { VPStandardStateTP::setStateFromXML(state); @@ -633,10 +414,6 @@ void MolalityVPSSTP::setStateFromXML(const XML_Node& state) } } -/* - * Set the temperature (K), pressure (Pa), and molalities - * (gmol kg-1) of the solutes - */ void MolalityVPSSTP::setState_TPM(doublereal t, doublereal p, const doublereal* const molalities) { @@ -644,18 +421,12 @@ void MolalityVPSSTP::setState_TPM(doublereal t, doublereal p, setState_TP(t, p); } -/* - * Set the temperature (K), pressure (Pa), and molalities. - */ void MolalityVPSSTP::setState_TPM(doublereal t, doublereal p, compositionMap& m) { setMolalitiesByName(m); setState_TP(t, p); } -/* - * Set the temperature (K), pressure (Pa), and molality. - */ void MolalityVPSSTP::setState_TPM(doublereal t, doublereal p, const std::string& m) { setMolalitiesByName(m); @@ -663,19 +434,6 @@ void MolalityVPSSTP::setState_TPM(doublereal t, doublereal p, const std::string& } -/* - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase. - * - * @see importCTML.cpp - */ void MolalityVPSSTP::initThermo() { initLengths(); @@ -691,48 +449,16 @@ void MolalityVPSSTP::initThermo() m_indexCLM = findCLMIndex(); } -// Get the array of unscaled non-dimensional molality based -// activity coefficients at the current solution temperature, -// pressure, and solution concentration. -/* - * See Denbigh p. 278 for a thorough discussion. This class must be overwritten in - * classes which derive from %MolalityVPSSTP. This function takes over from the - * molar-based activity coefficient calculation, getActivityCoefficients(), in - * derived classes. - * - * @param acMolality Output vector containing the molality based activity coefficients. - * length: m_kk. - */ void MolalityVPSSTP::getUnscaledMolalityActivityCoefficients(doublereal* acMolality) const { err("getUnscaledMolalityActivityCoefficients"); } -// Apply the current phScale to a set of activity Coefficients or activities -/* - * See the Eq3/6 Manual for a thorough discussion. - * - * @param acMolality input/Output vector containing the molality based - * activity coefficients. length: m_kk. - */ void MolalityVPSSTP::applyphScale(doublereal* acMolality) const { err("applyphScale"); } -// Returns the index of the Cl- species. -/* - * The Cl- species is special in the sense that its single ion - * molality-based activity coefficient is used in the specification - * of the pH scale for single ions. Therefore, we need to know - * what species index Cl- is. If the species isn't in the species - * list then this routine returns -1, and we can't use the NBS - * pH scale. - * - * Right now we use a restrictive interpretation. The species - * must be named "Cl-". It must consist of exactly one Cl and one E - * atom. - */ size_t MolalityVPSSTP::findCLMIndex() const { size_t indexCLM = npos; @@ -798,21 +524,6 @@ void MolalityVPSSTP::initLengths() m_molalities.resize(m_kk); } -/* - * initThermoXML() (virtual from ThermoPhase) - * Import and initialize a ThermoPhase object - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ void MolalityVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { @@ -830,8 +541,6 @@ void MolalityVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id) */ std::string MolalityVPSSTP::report(bool show_thermo) const { - - char p[800]; string s = ""; try { @@ -947,9 +656,6 @@ std::string MolalityVPSSTP::report(bool show_thermo) const return s; } -/* - * Format a summary of the mixture state for output. - */ void MolalityVPSSTP::getCsvReportData(std::vector& names, std::vector& data) const { diff --git a/src/thermo/MolarityIonicVPSSTP.cpp b/src/thermo/MolarityIonicVPSSTP.cpp index b59642a3f..83aec4a4c 100644 --- a/src/thermo/MolarityIonicVPSSTP.cpp +++ b/src/thermo/MolarityIonicVPSSTP.cpp @@ -27,11 +27,7 @@ using namespace std; namespace Cantera { -//==================================================================================================================== -/* - * Default constructor. - * - */ + MolarityIonicVPSSTP::MolarityIonicVPSSTP() : GibbsExcessVPSSTP(), PBType_(PBTYPE_PASSTHROUGH), @@ -43,15 +39,7 @@ MolarityIonicVPSSTP::MolarityIonicVPSSTP() : neutralPBindexStart(0) { } -//==================================================================================================================== -/* - * Working constructors - * - * The two constructors below are the normal way - * the phase initializes itself. They are shells that call - * the routine initThermo(), with a reference to the - * XML database to get the info for the phase. - */ + MolarityIonicVPSSTP::MolarityIonicVPSSTP(const std::string& inputFile, const std::string& id) : GibbsExcessVPSSTP(), @@ -65,7 +53,7 @@ MolarityIonicVPSSTP::MolarityIonicVPSSTP(const std::string& inputFile, { initThermoFile(inputFile, id); } -//==================================================================================================================== + MolarityIonicVPSSTP::MolarityIonicVPSSTP(XML_Node& phaseRoot, const std::string& id) : GibbsExcessVPSSTP(), @@ -79,13 +67,7 @@ MolarityIonicVPSSTP::MolarityIonicVPSSTP(XML_Node& phaseRoot, { importPhase(*findXMLPhase(&phaseRoot, id), this); } -//==================================================================================================================== -/* - * Copy Constructor: - * - * Note this stuff will not work until the underlying phase - * has a working copy constructor - */ + MolarityIonicVPSSTP::MolarityIonicVPSSTP(const MolarityIonicVPSSTP& b) : GibbsExcessVPSSTP(), PBType_(PBTYPE_PASSTHROUGH), @@ -98,13 +80,7 @@ MolarityIonicVPSSTP::MolarityIonicVPSSTP(const MolarityIonicVPSSTP& b) : { *this = operator=(b); } -//==================================================================================================================== -/* - * operator=() - * - * Note this stuff will not work until the underlying phase - * has a working assignment operator - */ + MolarityIonicVPSSTP& MolarityIonicVPSSTP:: operator=(const MolarityIonicVPSSTP& b) { @@ -127,22 +103,11 @@ operator=(const MolarityIonicVPSSTP& b) return *this; } -//==================================================================================================================== -/** - * - * ~MolarityIonicVPSSTP(): (virtual) - * - * Destructor: does nothing: - * - */ + MolarityIonicVPSSTP::~MolarityIonicVPSSTP() { } -/* - * This routine duplicates the current object and returns - * a pointer to ThermoPhase. - */ ThermoPhase* MolarityIonicVPSSTP::duplMyselfAsThermoPhase() const { @@ -152,30 +117,15 @@ MolarityIonicVPSSTP::duplMyselfAsThermoPhase() const /* * -------------- Utilities ------------------------------- */ -//==================================================================================================================== -// Equation of state type flag. -/* - * The ThermoPhase base class returns - * zero. Subclasses should define this to return a unique - * non-zero value. Known constants defined for this purpose are - * listed in mix_defs.h. The MolarityIonicVPSSTP class also returns - * zero, as it is a non-complete class. - */ int MolarityIonicVPSSTP::eosType() const { return 0; } -//==================================================================================================================== -/* - * ------------ Molar Thermodynamic Properties ---------------------- - */ -//==================================================================================================================== /* * - Activities, Standard States, Activity Concentrations ----------- */ -//==================================================================================================================== void MolarityIonicVPSSTP::getLnActivityCoefficients(doublereal* lnac) const { @@ -191,7 +141,7 @@ void MolarityIonicVPSSTP::getLnActivityCoefficients(doublereal* lnac) const lnac[k] = lnActCoeff_Scaled_[k]; } } -//==================================================================================================================== + void MolarityIonicVPSSTP::getChemPotentials(doublereal* mu) const { doublereal xx; @@ -215,7 +165,6 @@ void MolarityIonicVPSSTP::getChemPotentials(doublereal* mu) const mu[k] += RT * (log(xx) + lnActCoeff_Scaled_[k]); } } -//==================================================================================================================== void MolarityIonicVPSSTP::getElectrochemPotentials(doublereal* mu) const { @@ -226,21 +175,6 @@ void MolarityIonicVPSSTP::getElectrochemPotentials(doublereal* mu) const } } -//==================================================================================================================== -// Returns an array of partial molar enthalpies for the species -// in the mixture. -/* - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * molality-based activity coefficient wrt temperature - * - * \f[ - * \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] - * - */ void MolarityIonicVPSSTP::getPartialMolarEnthalpies(doublereal* hbar) const { /* @@ -266,21 +200,7 @@ void MolarityIonicVPSSTP::getPartialMolarEnthalpies(doublereal* hbar) const hbar[k] -= RTT * dlnActCoeffdT_Scaled_[k]; } } -//==================================================================================================================== -// Returns an array of partial molar heat capacities for the species -// in the mixture. -/* - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature - * - * \f[ - * ??????????? \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] - * - */ + void MolarityIonicVPSSTP::getPartialMolarCp(doublereal* cpbar) const { /* @@ -305,21 +225,7 @@ void MolarityIonicVPSSTP::getPartialMolarCp(doublereal* cpbar) const cpbar[k] *= GasConstant; } } -//==================================================================================================================== -// Returns an array of partial molar entropies for the species -// in the mixture. -/* - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature - * - * \f[ - * \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] - * - */ + void MolarityIonicVPSSTP::getPartialMolarEntropies(doublereal* sbar) const { double xx; @@ -346,16 +252,7 @@ void MolarityIonicVPSSTP::getPartialMolarEntropies(doublereal* sbar) const sbar[k] *= GasConstant; } } -// Return an array of partial molar volumes for the -// species in the mixture. Units: m^3/kmol. -/* - * Frequently, for this class of thermodynamics representations, - * the excess Volume due to mixing is zero. Here, we set it as - * a default. It may be overridden in derived classes. - * - * @param vbar Output vector of species partial molar volumes. - * Length = m_kk. units are m^3/kmol. - */ + void MolarityIonicVPSSTP::getPartialMolarVolumes(doublereal* vbar) const { /* @@ -366,7 +263,7 @@ void MolarityIonicVPSSTP::getPartialMolarVolumes(doublereal* vbar) const vbar[iK] += 0.0; } } -//==================================================================================================================== + void MolarityIonicVPSSTP::calcPseudoBinaryMoleFractions() const { size_t k; @@ -447,65 +344,36 @@ void MolarityIonicVPSSTP::calcPseudoBinaryMoleFractions() const } } -//==================================================================================================================== -// Update the activity coefficients -/* - * This function will be called to update the internally stored - * natural logarithm of the activity coefficients - * - */ void MolarityIonicVPSSTP::s_update_lnActCoeff() const { for (size_t k = 0; k < m_kk; k++) { lnActCoeff_Scaled_[k] = 0.0; } } -//==================================================================================================================== + void MolarityIonicVPSSTP::s_update_dlnActCoeff_dT() const { } -//==================================================================================================================== -// Internal routine that calculates the derivative of the activity coefficients wrt -// the mole fractions. -/* - * This routine calculates the the derivative of the activity coefficients wrt to mole fraction - * with all other mole fractions held constant. This is strictly not permitted. However, if the - * resulting matrix is multiplied by a permissible deltaX vector then everything is ok. - * - * This is the natural way to handle concentration derivatives in this routine. - */ + void MolarityIonicVPSSTP::s_update_dlnActCoeff_dX_() const { } -//==================================================================================================================== + /* * ------------ Partial Molar Properties of the Solution ------------ */ -//==================================================================================================================== + doublereal MolarityIonicVPSSTP::err(const std::string& msg) const { throw CanteraError("MolarityIonicVPSSTP","Base class method " +msg+" called. Equation of state type: "+int2str(eosType())); return 0; } -//==================================================================================================================== -/* - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase. - * - * @see importCTML.cpp - */ + void MolarityIonicVPSSTP::initThermo() { GibbsExcessVPSSTP::initThermo(); @@ -543,29 +411,13 @@ void MolarityIonicVPSSTP::initThermo() PBType_ = PBTYPE_PASSTHROUGH; } } -//==================================================================================================================== -// Initialize lengths of local variables after all species have been identified. + void MolarityIonicVPSSTP::initLengths() { m_kk = nSpecies(); moleFractionsTmp_.resize(m_kk); } -//==================================================================================================================== -/* - * initThermoXML() (virtual from ThermoPhase) - * Import and initialize a ThermoPhase object - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ + void MolarityIonicVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { std::string subname = "MolarityIonicVPSSTP::initThermoXML"; @@ -628,22 +480,13 @@ void MolarityIonicVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& */ GibbsExcessVPSSTP::initThermoXML(phaseNode, id); } -//==================================================================================================================== -// Process an XML node called "binaryNeutralSpeciesParameters" -/* - * This node contains all of the parameters necessary to describe - * a single binary interaction. This function reads the XML file and writes the coefficients - * it finds to an internal data structures. - */ + void MolarityIonicVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies) { std::string xname = xmLBinarySpecies.name(); } -//==================================================================================================================== -/* - * Format a summary of the mixture state for output. - */ + std::string MolarityIonicVPSSTP::report(bool show_thermo) const { char p[800]; @@ -718,6 +561,5 @@ std::string MolarityIonicVPSSTP::report(bool show_thermo) const } return s; } -//==================================================================================================================== -} +} diff --git a/src/thermo/PhaseCombo_Interaction.cpp b/src/thermo/PhaseCombo_Interaction.cpp index cd8e92d44..2fe88733c 100644 --- a/src/thermo/PhaseCombo_Interaction.cpp +++ b/src/thermo/PhaseCombo_Interaction.cpp @@ -1,6 +1,5 @@ /** * @file - * */ /* * Copyright (2009) Sandia Corporation. Under the terms of @@ -19,13 +18,6 @@ using namespace std; namespace Cantera { - -//==================================================================================================================== -/* - * Default constructor. - * - * HKM - Checked for Transition - */ PhaseCombo_Interaction::PhaseCombo_Interaction() : GibbsExcessVPSSTP(), numBinaryInteractions_(0), @@ -33,17 +25,7 @@ PhaseCombo_Interaction::PhaseCombo_Interaction() : formTempModel_(0) { } -//==================================================================================================================== -/* - * Working constructors - * - * The two constructors below are the normal way - * the phase initializes itself. They are shells that call\ - * the routine initThermo(), with a reference to the - * XML database to get the info for the phase. - * - * HKM - Checked for Transition - */ + PhaseCombo_Interaction::PhaseCombo_Interaction(const std::string& inputFile, const std::string& id) : GibbsExcessVPSSTP(), @@ -53,12 +35,7 @@ PhaseCombo_Interaction::PhaseCombo_Interaction(const std::string& inputFile, { initThermoFile(inputFile, id); } -//==================================================================================================================== -// -/* - * - * HKM - Checked for Transition - */ + PhaseCombo_Interaction::PhaseCombo_Interaction(XML_Node& phaseRoot, const std::string& id) : GibbsExcessVPSSTP(), @@ -69,29 +46,12 @@ PhaseCombo_Interaction::PhaseCombo_Interaction(XML_Node& phaseRoot, importPhase(*findXMLPhase(&phaseRoot, id), this); } -//==================================================================================================================== -/* - * Copy Constructor: - * - * Note this stuff will not work until the underlying phase - * has a working copy constructor - * - * HKM - Checked for Transition - */ PhaseCombo_Interaction::PhaseCombo_Interaction(const PhaseCombo_Interaction& b) : GibbsExcessVPSSTP() { PhaseCombo_Interaction::operator=(b); } -//==================================================================================================================== -/* - * operator=() - * - * Note this stuff will not work until the underlying phase - * has a working assignment operator - * - * HKM - Checked for Transition - */ + PhaseCombo_Interaction& PhaseCombo_Interaction:: operator=(const PhaseCombo_Interaction& b) { @@ -121,37 +81,17 @@ operator=(const PhaseCombo_Interaction& b) return *this; } -//==================================================================================================================== -/** - * - * ~PhaseCombo_Interaction(): (virtual) - * - * Destructor: does nothing: - * - * HKM - Checked for Transition - */ + PhaseCombo_Interaction::~PhaseCombo_Interaction() { } -//==================================================================================================================== -/* - * This routine duplicates the current object and returnsa pointer to ThermoPhase. - * - * HKM - Checked for Transition - */ + ThermoPhase* PhaseCombo_Interaction::duplMyselfAsThermoPhase() const { return new PhaseCombo_Interaction(*this); } -//==================================================================================================================== -// Special constructor for a hard-coded problem -/* - * - * LiKCl treating the PseudoBinary layer as passthrough. - * -> test to predict the eutectic and liquidus correctly. - * - */ + PhaseCombo_Interaction::PhaseCombo_Interaction(int testProb) : GibbsExcessVPSSTP(), numBinaryInteractions_(0), @@ -211,40 +151,20 @@ PhaseCombo_Interaction::PhaseCombo_Interaction(int testProb) : m_pSpecies_B_ij[0] = iLi2; throw CanteraError("", "unimplemented"); } -//==================================================================================================================== /* * -------------- Utilities ------------------------------- */ - -// Equation of state type flag. -/* - * The ThermoPhase base class returns - * zero. Subclasses should define this to return a unique - * non-zero value. Known constants defined for this purpose are - * listed in mix_defs.h. The PhaseCombo_Interaction class also returns - * zero, as it is a non-complete class. - */ int PhaseCombo_Interaction::eosType() const { return cPhaseCombo_Interaction; } -//==================================================================================================================== -/* - * ------------ Molar Thermodynamic Properties ---------------------- - */ -//==================================================================================================================== /* * - Activities, Standard States, Activity Concentrations ----------- */ -//==================================================================================================================== -// Get the array of non-dimensional molar-based activity coefficients at -// the current solution temperature, pressure, and solution concentration. -/* - * @param ac Output vector of activity coefficients. Length: m_kk. - */ + void PhaseCombo_Interaction::getActivityCoefficients(doublereal* ac) const { /* @@ -264,8 +184,6 @@ void PhaseCombo_Interaction::getActivityCoefficients(doublereal* ac) const * ------------ Partial Molar Properties of the Solution ------------ */ -//==================================================================================================================== - void PhaseCombo_Interaction::getElectrochemPotentials(doublereal* mu) const { getChemPotentials(mu); @@ -275,7 +193,6 @@ void PhaseCombo_Interaction::getElectrochemPotentials(doublereal* mu) const } } -//==================================================================================================================== void PhaseCombo_Interaction::getChemPotentials(doublereal* mu) const { doublereal xx; @@ -299,8 +216,7 @@ void PhaseCombo_Interaction::getChemPotentials(doublereal* mu) const mu[k] += RT * (log(xx) + lnActCoeff_Scaled_[k]); } } -//==================================================================================================================== -// Molar enthalpy. Units: J/kmol. + doublereal PhaseCombo_Interaction::enthalpy_mole() const { size_t kk = nSpecies(); @@ -312,8 +228,7 @@ doublereal PhaseCombo_Interaction::enthalpy_mole() const } return h; } -//==================================================================================================================== -// Molar entropy. Units: J/kmol. + doublereal PhaseCombo_Interaction::entropy_mole() const { size_t kk = nSpecies(); @@ -325,8 +240,7 @@ doublereal PhaseCombo_Interaction::entropy_mole() const } return s; } -//==================================================================================================================== -// Molar heat capacity at constant pressure. Units: J/kmol/K. + doublereal PhaseCombo_Interaction::cp_mole() const { size_t kk = nSpecies(); @@ -338,27 +252,12 @@ doublereal PhaseCombo_Interaction::cp_mole() const } return cp; } -//==================================================================================================================== -// Molar heat capacity at constant volume. Units: J/kmol/K. + doublereal PhaseCombo_Interaction::cv_mole() const { return cp_mole() - GasConstant; } -//==================================================================================================================== -// Returns an array of partial molar enthalpies for the species -// in the mixture. -/* - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * molality-based activity coefficient wrt temperature - * - * \f[ - * \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] - * - */ + void PhaseCombo_Interaction::getPartialMolarEnthalpies(doublereal* hbar) const { /* @@ -384,20 +283,7 @@ void PhaseCombo_Interaction::getPartialMolarEnthalpies(doublereal* hbar) const hbar[k] -= RTT * dlnActCoeffdT_Scaled_[k]; } } -//==================================================================================================================== -// Returns an array of partial molar heat capacities for the species in the mixture. -/* - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature - * - * \f[ - * ??????????? \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] - * - */ + void PhaseCombo_Interaction::getPartialMolarCp(doublereal* cpbar) const { /* @@ -422,21 +308,7 @@ void PhaseCombo_Interaction::getPartialMolarCp(doublereal* cpbar) const cpbar[k] *= GasConstant; } } -//==================================================================================================================== -// Returns an array of partial molar entropies for the species -// in the mixture. -/* - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature - * - * \f[ - * \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] - * - */ + void PhaseCombo_Interaction::getPartialMolarEntropies(doublereal* sbar) const { double xx; @@ -463,20 +335,7 @@ void PhaseCombo_Interaction::getPartialMolarEntropies(doublereal* sbar) const sbar[k] *= GasConstant; } } -//==================================================================================================================== -/* - * ------------ Partial Molar Properties of the Solution ------------ - */ -// Return an array of partial molar volumes for the species in the mixture. Units: m^3/kmol. -/* - * Frequently, for this class of thermodynamics representations, - * the excess Volume due to mixing is zero. Here, we set it as - * a default. It may be overridden in derived classes. - * - * @param vbar Output vector of species partial molar volumes. - * Length = m_kk. units are m^3/kmol. - */ void PhaseCombo_Interaction::getPartialMolarVolumes(doublereal* vbar) const { int delAK, delBK; @@ -512,7 +371,7 @@ void PhaseCombo_Interaction::getPartialMolarVolumes(doublereal* vbar) const } } } -//==================================================================================================================== + doublereal PhaseCombo_Interaction::err(const std::string& msg) const { throw CanteraError("PhaseCombo_Interaction","Base class method " @@ -520,50 +379,18 @@ doublereal PhaseCombo_Interaction::err(const std::string& msg) const return 0; } -//==================================================================================================================== -/* - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase. - * - * @see importCTML.cpp - */ void PhaseCombo_Interaction::initThermo() { initLengths(); GibbsExcessVPSSTP::initThermo(); } -//==================================================================================================================== -// Initialize lengths of local variables after all species have -// been identified. void PhaseCombo_Interaction::initLengths() { m_kk = nSpecies(); dlnActCoeffdlnN_.resize(m_kk, m_kk); } -//==================================================================================================================== -/* - * initThermoXML() (virtual from ThermoPhase) - * Import and initialize a ThermoPhase object - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ + void PhaseCombo_Interaction::initThermoXML(XML_Node& phaseNode, const std::string& id) { string subname = "PhaseCombo_Interaction::initThermoXML"; @@ -630,16 +457,7 @@ void PhaseCombo_Interaction::initThermoXML(XML_Node& phaseNode, const std::strin } -//=================================================================================================================== -// Update the activity coefficients -/* - * This function will be called to update the internally stored - * natural logarithm of the activity coefficients - * - * he = X_A X_B(B + C X_B) - * - * HKM - Checked for Transition - */ + void PhaseCombo_Interaction::s_update_lnActCoeff() const { int delAK, delBK; @@ -680,16 +498,7 @@ void PhaseCombo_Interaction::s_update_lnActCoeff() const } } } -//=================================================================================================================== -// Update the derivative of the log of the activity coefficients wrt T -/* - * This function will be called to update the internally stored - * natural logarithm of the activity coefficients - * - * he = X_A X_B(B + C X_B) - * - * HKM - Checked for Transition - */ + void PhaseCombo_Interaction::s_update_dlnActCoeff_dT() const { int delAK, delBK; @@ -719,11 +528,7 @@ void PhaseCombo_Interaction::s_update_dlnActCoeff_dT() const } } } -//==================================================================================================================== -// -/* - * HKM - Checked for Transition - */ + void PhaseCombo_Interaction::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const { s_update_dlnActCoeff_dT(); @@ -731,11 +536,7 @@ void PhaseCombo_Interaction::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const dlnActCoeffdT[k] = dlnActCoeffdT_Scaled_[k]; } } -//==================================================================================================================== -// -/* - * HKM - Checked for Transition - */ + void PhaseCombo_Interaction::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const { s_update_dlnActCoeff_dT(); @@ -743,21 +544,7 @@ void PhaseCombo_Interaction::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) con d2lnActCoeffdT2[k] = d2lnActCoeffdT2_Scaled_[k]; } } -//==================================================================================================================== -// Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along -// a line in parameter space or along a line in physical space -/* - * - * @param dTds Input of temperature change along the path - * @param dXds Input vector of changes in mole fraction along the path. length = m_kk - * Along the path length it must be the case that the mole fractions sum to one. - * @param dlnActCoeffds Output vector of the directional derivatives of the - * log Activity Coefficients along the path. length = m_kk - * units are 1/units(s). if s is a physical coordinate then the units are 1/m. - * - * HKM - Checked for Transition - */ void PhaseCombo_Interaction::getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const { @@ -809,19 +596,7 @@ void PhaseCombo_Interaction::getdlnActCoeffds(const doublereal dTds, const doub } } } -//==================================================================================================================== -// Update the derivative of the log of the activity coefficients wrt the log of the corresponding species number density -/* - * This function will be called to update the internally stored gradients of the - * logarithm of the activity coefficients. These are used in the determination - * of the diffusion coefficients. - * - * he = X_A X_B(B + C X_B) - * - * This function only carries out the diagonal calculation - * - * HKM - Checked for Transition - */ + void PhaseCombo_Interaction::s_update_dlnActCoeff_dlnN_diag() const { int delAK, delBK; @@ -872,15 +647,7 @@ void PhaseCombo_Interaction::s_update_dlnActCoeff_dlnN_diag() const } } -//==================================================================================================================== -// Update the derivative of the log of the activity coefficients wrt ln N_k -/* - * This function will be called to update the internally stored gradients of the - * logarithm of the activity coefficients. These are used in the determination - * of the diffusion coefficients. - * - * HKM - Checked for Transition - */ + void PhaseCombo_Interaction::s_update_dlnActCoeff_dlnN() const { doublereal delAK, delBK; @@ -947,7 +714,7 @@ void PhaseCombo_Interaction::s_update_dlnActCoeff_dlnN() const } } } -//==================================================================================================================== + void PhaseCombo_Interaction::s_update_dlnActCoeff_dlnX_diag() const { doublereal XA, XB, g0 , g1; @@ -972,11 +739,6 @@ void PhaseCombo_Interaction::s_update_dlnActCoeff_dlnX_diag() const throw CanteraError("", "unimplemented"); } -//==================================================================================================================== -// -/* - * HKM - Checked for Transition - */ void PhaseCombo_Interaction::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const { s_update_dlnActCoeff_dlnN_diag(); @@ -984,11 +746,7 @@ void PhaseCombo_Interaction::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN dlnActCoeffdlnN_diag[k] = dlnActCoeffdlnN_diag_[k]; } } -//==================================================================================================================== -// -/* - * HKM - Checked for Transition - */ + void PhaseCombo_Interaction::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const { s_update_dlnActCoeff_dlnX_diag(); @@ -996,11 +754,7 @@ void PhaseCombo_Interaction::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX dlnActCoeffdlnX_diag[k] = dlnActCoeffdlnX_diag_[k]; } } -//==================================================================================================================== -// -/* - * HKM - Checked for Transition - */ + void PhaseCombo_Interaction::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeffdlnN) { s_update_dlnActCoeff_dlnN(); @@ -1011,11 +765,7 @@ void PhaseCombo_Interaction::getdlnActCoeffdlnN(const size_t ld, doublereal* dln } } } -//==================================================================================================================== -// -/* - * HKM - Checked for Transition - */ + void PhaseCombo_Interaction::resizeNumInteractions(const size_t num) { numBinaryInteractions_ = num; @@ -1035,15 +785,7 @@ void PhaseCombo_Interaction::resizeNumInteractions(const size_t num) m_pSpecies_A_ij.resize(num, npos); m_pSpecies_B_ij.resize(num, npos); } -//==================================================================================================================== -/* - * Process an XML node called "binaryNeutralSpeciesParameters" - * This node contains all of the parameters necessary to describe - * the Margules Interaction for a single binary interaction - * This function reads the XML file and writes the coefficients - * it finds to an internal data structures. - */ void PhaseCombo_Interaction::readXMLBinarySpecies(XML_Node& xmLBinarySpecies) { string xname = xmLBinarySpecies.name(); @@ -1160,10 +902,7 @@ void PhaseCombo_Interaction::readXMLBinarySpecies(XML_Node& xmLBinarySpecies) m_VSE_b_ij[iSpot] = vParams[0]; m_VSE_c_ij[iSpot] = vParams[1]; } - - } } -//==================================================================================================================== + } -//====================================================================================================================== diff --git a/src/thermo/PseudoBinaryVPSSTP.cpp b/src/thermo/PseudoBinaryVPSSTP.cpp index 4740d2edd..8af453b4e 100644 --- a/src/thermo/PseudoBinaryVPSSTP.cpp +++ b/src/thermo/PseudoBinaryVPSSTP.cpp @@ -26,11 +26,6 @@ using namespace std; namespace Cantera { - -/* - * Default constructor. - * - */ PseudoBinaryVPSSTP::PseudoBinaryVPSSTP() : GibbsExcessVPSSTP(), PBType_(PBTYPE_PASSTHROUGH), @@ -45,12 +40,6 @@ PseudoBinaryVPSSTP::PseudoBinaryVPSSTP() : { } -/* - * Copy Constructor: - * - * Note this stuff will not work until the underlying phase - * has a working copy constructor - */ PseudoBinaryVPSSTP::PseudoBinaryVPSSTP(const PseudoBinaryVPSSTP& b) : GibbsExcessVPSSTP(), PBType_(PBTYPE_PASSTHROUGH), @@ -66,12 +55,6 @@ PseudoBinaryVPSSTP::PseudoBinaryVPSSTP(const PseudoBinaryVPSSTP& b) : *this = operator=(b); } -/* - * operator=() - * - * Note this stuff will not work until the underlying phase - * has a working assignment operator - */ PseudoBinaryVPSSTP& PseudoBinaryVPSSTP:: operator=(const PseudoBinaryVPSSTP& b) { @@ -97,57 +80,21 @@ operator=(const PseudoBinaryVPSSTP& b) return *this; } -/** - * - * ~PseudoBinaryVPSSTP(): (virtual) - * - * Destructor: does nothing: - * - */ PseudoBinaryVPSSTP::~PseudoBinaryVPSSTP() { } -/* - * This routine duplicates the current object and returns - * a pointer to ThermoPhase. - */ ThermoPhase* PseudoBinaryVPSSTP::duplMyselfAsThermoPhase() const { return new PseudoBinaryVPSSTP(*this); } -/* - * -------------- Utilities ------------------------------- - */ - - -// Equation of state type flag. -/* - * The ThermoPhase base class returns - * zero. Subclasses should define this to return a unique - * non-zero value. Known constants defined for this purpose are - * listed in mix_defs.h. The PseudoBinaryVPSSTP class also returns - * zero, as it is a non-complete class. - */ int PseudoBinaryVPSSTP::eosType() const { return 0; } - - -/* - * ------------ Molar Thermodynamic Properties ---------------------- - */ - - -/* - * - Activities, Standard States, Activity Concentrations ----------- - */ - - doublereal PseudoBinaryVPSSTP::standardConcentration(size_t k) const { err("standardConcentration"); @@ -160,8 +107,6 @@ doublereal PseudoBinaryVPSSTP::logStandardConc(size_t k) const return -1.0; } - - void PseudoBinaryVPSSTP::getElectrochemPotentials(doublereal* mu) const { getChemPotentials(mu); @@ -231,11 +176,6 @@ void PseudoBinaryVPSSTP::calcPseudoBinaryMoleFractions() const } } -/* - * ------------ Partial Molar Properties of the Solution ------------ - */ - - doublereal PseudoBinaryVPSSTP::err(const std::string& msg) const { throw CanteraError("PseudoBinaryVPSSTP","Base class method " @@ -243,64 +183,25 @@ doublereal PseudoBinaryVPSSTP::err(const std::string& msg) const return 0; } - -/* - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase. - * - * @see importCTML.cpp - */ void PseudoBinaryVPSSTP::initThermo() { initLengths(); GibbsExcessVPSSTP::initThermo(); } - -// Initialize lengths of local variables after all species have -// been identified. void PseudoBinaryVPSSTP::initLengths() { m_kk = nSpecies(); moleFractions_.resize(m_kk); } -/* - * initThermoXML() (virtual from ThermoPhase) - * Import and initialize a ThermoPhase object - * - * @param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - */ void PseudoBinaryVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { - - GibbsExcessVPSSTP::initThermoXML(phaseNode, id); } -/** - * Format a summary of the mixture state for output. - */ std::string PseudoBinaryVPSSTP::report(bool show_thermo) const { - - char p[800]; string s = ""; try { @@ -374,6 +275,4 @@ std::string PseudoBinaryVPSSTP::report(bool show_thermo) const return s; } - } - diff --git a/src/thermo/RedlichKisterVPSSTP.cpp b/src/thermo/RedlichKisterVPSSTP.cpp index d887e8fe1..b6c9ea0ee 100644 --- a/src/thermo/RedlichKisterVPSSTP.cpp +++ b/src/thermo/RedlichKisterVPSSTP.cpp @@ -23,12 +23,6 @@ using namespace std; namespace Cantera { - -//==================================================================================================================== -/* - * Default constructor. - * - */ RedlichKisterVPSSTP::RedlichKisterVPSSTP() : GibbsExcessVPSSTP(), numBinaryInteractions_(0), @@ -42,16 +36,7 @@ RedlichKisterVPSSTP::RedlichKisterVPSSTP() : dlnActCoeff_dX_() { } -//==================================================================================================================== -/* - * Working constructors - * - * The two constructors below are the normal way - * the phase initializes itself. They are shells that call - * the routine initThermo(), with a reference to the - * XML database to get the info for the phase. - */ RedlichKisterVPSSTP::RedlichKisterVPSSTP(const std::string& inputFile, const std::string& id) : GibbsExcessVPSSTP(), @@ -67,7 +52,7 @@ RedlichKisterVPSSTP::RedlichKisterVPSSTP(const std::string& inputFile, { initThermoFile(inputFile, id); } -//==================================================================================================================== + RedlichKisterVPSSTP::RedlichKisterVPSSTP(XML_Node& phaseRoot, const std::string& id) : GibbsExcessVPSSTP(), @@ -83,14 +68,7 @@ RedlichKisterVPSSTP::RedlichKisterVPSSTP(XML_Node& phaseRoot, { importPhase(*findXMLPhase(&phaseRoot, id), this); } -//==================================================================================================================== -// Special constructor for a hard-coded problem -/* - * - * LiKCl treating the PseudoBinary layer as passthrough. - * -> test to predict the eutectic and liquidus correctly. - * - */ + RedlichKisterVPSSTP::RedlichKisterVPSSTP(int testProb) : GibbsExcessVPSSTP(), numBinaryInteractions_(0), @@ -136,16 +114,8 @@ RedlichKisterVPSSTP::RedlichKisterVPSSTP(int testProb) : "Unable to find VLi"); } m_pSpecies_B_ij[0] = iVLi; - - } -//==================================================================================================================== -/* - * Copy Constructor: - * - * Note this stuff will not work until the underlying phase - * has a working copy constructor - */ + RedlichKisterVPSSTP::RedlichKisterVPSSTP(const RedlichKisterVPSSTP& b) : GibbsExcessVPSSTP(), numBinaryInteractions_(0), @@ -160,13 +130,7 @@ RedlichKisterVPSSTP::RedlichKisterVPSSTP(const RedlichKisterVPSSTP& b) : { RedlichKisterVPSSTP::operator=(b); } -//==================================================================================================================== -/* - * operator=() - * - * Note this stuff will not work until the underlying phase - * has a working assignment operator - */ + RedlichKisterVPSSTP& RedlichKisterVPSSTP:: operator=(const RedlichKisterVPSSTP& b) { @@ -188,51 +152,25 @@ operator=(const RedlichKisterVPSSTP& b) return *this; } -//==================================================================================================================== -/* - * - * ~RedlichKisterVPSSTP(): (virtual) - * - * Destructor: does nothing: - * - */ + RedlichKisterVPSSTP::~RedlichKisterVPSSTP() { } -//==================================================================================================================== -/* - * This routine duplicates the current object and returns - * a pointer to ThermoPhase. - */ + ThermoPhase* RedlichKisterVPSSTP::duplMyselfAsThermoPhase() const { return new RedlichKisterVPSSTP(*this); } -//==================================================================================================================== -// Equation of state type flag. -/* - * The ThermoPhase base class returns - * zero. Subclasses should define this to return a unique - * non-zero value. Known constants defined for this purpose are - * listed in mix_defs.h. The RedlichKisterVPSSTP class also returns - * zero, as it is a non-complete class. - */ int RedlichKisterVPSSTP::eosType() const { return 0; } -//==================================================================================================================== -/* - * ------------ Molar Thermodynamic Properties ---------------------- - */ -//==================================================================================================================== /* * - Activities, Standard States, Activity Concentrations ----------- */ -//==================================================================================================================== void RedlichKisterVPSSTP::getLnActivityCoefficients(doublereal* lnac) const { @@ -248,11 +186,11 @@ void RedlichKisterVPSSTP::getLnActivityCoefficients(doublereal* lnac) const lnac[k] = lnActCoeff_Scaled_[k]; } } -//==================================================================================================================== + /* * ------------ Partial Molar Properties of the Solution ------------ */ -//==================================================================================================================== + void RedlichKisterVPSSTP::getElectrochemPotentials(doublereal* mu) const { getChemPotentials(mu); @@ -261,7 +199,7 @@ void RedlichKisterVPSSTP::getElectrochemPotentials(doublereal* mu) const mu[k] += ve*charge(k); } } -//==================================================================================================================== + void RedlichKisterVPSSTP::getChemPotentials(doublereal* mu) const { doublereal xx; @@ -285,8 +223,7 @@ void RedlichKisterVPSSTP::getChemPotentials(doublereal* mu) const mu[k] += RT * (log(xx) + lnActCoeff_Scaled_[k]); } } -//==================================================================================================================== -//Molar enthalpy. Units: J/kmol. + doublereal RedlichKisterVPSSTP::enthalpy_mole() const { size_t kk = nSpecies(); @@ -298,8 +235,7 @@ doublereal RedlichKisterVPSSTP::enthalpy_mole() const } return h; } -//==================================================================================================================== -/// Molar entropy. Units: J/kmol. + doublereal RedlichKisterVPSSTP::entropy_mole() const { size_t kk = nSpecies(); @@ -311,8 +247,7 @@ doublereal RedlichKisterVPSSTP::entropy_mole() const } return s; } -//==================================================================================================================== -/// Molar heat capacity at constant pressure. Units: J/kmol/K. + doublereal RedlichKisterVPSSTP::cp_mole() const { size_t kk = nSpecies(); @@ -324,27 +259,12 @@ doublereal RedlichKisterVPSSTP::cp_mole() const } return cp; } -//==================================================================================================================== -/// Molar heat capacity at constant volume. Units: J/kmol/K. + doublereal RedlichKisterVPSSTP::cv_mole() const { return cp_mole() - GasConstant; } -//==================================================================================================================== -// Returns an array of partial molar enthalpies for the species -// in the mixture. -/* - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * molality-based activity coefficient wrt temperature - * - * \f[ - * \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] - * - */ + void RedlichKisterVPSSTP::getPartialMolarEnthalpies(doublereal* hbar) const { /* @@ -370,21 +290,7 @@ void RedlichKisterVPSSTP::getPartialMolarEnthalpies(doublereal* hbar) const hbar[k] -= RTT * dlnActCoeffdT_Scaled_[k]; } } -//==================================================================================================================== -// Returns an array of partial molar heat capacities for the species -// in the mixture. -/* - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature - * - * \f[ - * ??????????? \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] - * - */ + void RedlichKisterVPSSTP::getPartialMolarCp(doublereal* cpbar) const { /* @@ -409,21 +315,7 @@ void RedlichKisterVPSSTP::getPartialMolarCp(doublereal* cpbar) const cpbar[k] *= GasConstant; } } -//==================================================================================================================== -// Returns an array of partial molar entropies for the species -// in the mixture. -/* - * Units (J/kmol) - * - * For this phase, the partial molar enthalpies are equal to the - * standard state enthalpies modified by the derivative of the - * activity coefficient wrt temperature - * - * \f[ - * \bar s_k(T,P) = s^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} - * \f] - * - */ + void RedlichKisterVPSSTP::getPartialMolarEntropies(doublereal* sbar) const { double xx; @@ -451,20 +343,6 @@ void RedlichKisterVPSSTP::getPartialMolarEntropies(doublereal* sbar) const } } -/* - * ------------ Partial Molar Properties of the Solution ------------ - */ -//==================================================================================================================== -// Return an array of partial molar volumes for the -// species in the mixture. Units: m^3/kmol. -/* - * Frequently, for this class of thermodynamics representations, - * the excess Volume due to mixing is zero. Here, we set it as - * a default. It may be overridden in derived classes. - * - * @param vbar Output vector of species partial molar volumes. - * Length = m_kk. units are m^3/kmol. - */ void RedlichKisterVPSSTP::getPartialMolarVolumes(doublereal* vbar) const { /* @@ -476,52 +354,26 @@ void RedlichKisterVPSSTP::getPartialMolarVolumes(doublereal* vbar) const vbar[iK] += 0.0; } } -//==================================================================================================================== + doublereal RedlichKisterVPSSTP::err(const std::string& msg) const { throw CanteraError("RedlichKisterVPSSTP","Base class method " +msg+" called. Equation of state type: "+int2str(eosType())); return 0; } -//==================================================================================================================== -/* - * @internal Initialize. This method is provided to allow - * subclasses to perform any initialization required after all - * species have been added. For example, it might be used to - * resize internal work arrays that must have an entry for - * each species. The base class implementation does nothing, - * and subclasses that do not require initialization do not - * need to overload this method. When importing a CTML phase - * description, this method is called just prior to returning - * from function importPhase. - * - * @see importCTML.cpp - */ + void RedlichKisterVPSSTP::initThermo() { initLengths(); GibbsExcessVPSSTP::initThermo(); } -//==================================================================================================================== -// Initialize lengths of local variables after all species have -// been identified. + void RedlichKisterVPSSTP::initLengths() { m_kk = nSpecies(); dlnActCoeffdlnN_.resize(m_kk, m_kk); } -//==================================================================================================================== -/* - * initThermoXML() (virtual from ThermoPhase) - * Import and initialize a ThermoPhase object - * - * @param phaseNode This object must be the phase node of a complete XML tree - * description of the phase, including all of the species data. In other words while "phase" must - * point to an XML phase object, it must have sibling nodes "speciesData" that describe - * the species in the phase. - * @param id ID of the phase. If nonnull, a check is done to see if phaseNode is pointing to the phase - * with the correct id. - */ + void RedlichKisterVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { std::string subname = "RedlichKisterVPSSTP::initThermoXML"; @@ -583,13 +435,7 @@ void RedlichKisterVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& */ GibbsExcessVPSSTP::initThermoXML(phaseNode, id); } -//=================================================================================================================== -// Update the activity coefficients -/* - * This function will be called to update the internally stored - * natural logarithm of the activity coefficients - * - */ + void RedlichKisterVPSSTP::s_update_lnActCoeff() const { doublereal XA, XB; @@ -660,14 +506,7 @@ void RedlichKisterVPSSTP::s_update_lnActCoeff() const } } -//=================================================================================================================== -// Update the derivative of the log of the activity coefficients wrt T -/* - * This function will be called to update the internally stored - * natural logarithm of the activity coefficients - * - */ void RedlichKisterVPSSTP::s_update_dlnActCoeff_dT() const { doublereal XA, XB; @@ -713,7 +552,7 @@ void RedlichKisterVPSSTP::s_update_dlnActCoeff_dT() const } } } -//==================================================================================================================== + void RedlichKisterVPSSTP::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const { s_update_dlnActCoeff_dT(); @@ -721,7 +560,7 @@ void RedlichKisterVPSSTP::getdlnActCoeffdT(doublereal* dlnActCoeffdT) const dlnActCoeffdT[k] = dlnActCoeffdT_Scaled_[k]; } } -//==================================================================================================================== + void RedlichKisterVPSSTP::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const { s_update_dlnActCoeff_dT(); @@ -729,7 +568,7 @@ void RedlichKisterVPSSTP::getd2lnActCoeffdT2(doublereal* d2lnActCoeffdT2) const d2lnActCoeffdT2[k] = d2lnActCoeffdT2_Scaled_[k]; } } -//==================================================================================================================== + void RedlichKisterVPSSTP::s_update_dlnActCoeff_dX_() const { doublereal XA, XB; @@ -800,18 +639,7 @@ void RedlichKisterVPSSTP::s_update_dlnActCoeff_dX_() const } } } -//==================================================================================================================== -// Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along -// a line in parameter space or along a line in physical space -/* - * - * @param dTds Input of temperature change along the path - * @param dXds Input vector of changes in mole fraction along the path. length = m_kk - * Along the path length it must be the case that the mole fractions sum to one. - * @param dlnActCoeffds Output vector of the directional derivatives of the - * log Activity Coefficients along the path. length = m_kk - * units are 1/units(s). if s is a physical coordinate then the units are 1/m. - */ + void RedlichKisterVPSSTP::getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const { @@ -825,7 +653,6 @@ void RedlichKisterVPSSTP::getdlnActCoeffds(const doublereal dTds, const doublere } } -//==================================================================================================================== void RedlichKisterVPSSTP::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const { s_update_dlnActCoeff_dX_(); @@ -836,7 +663,7 @@ void RedlichKisterVPSSTP::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_di } } } -//==================================================================================================================== + void RedlichKisterVPSSTP::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const { s_update_dlnActCoeff_dX_(); @@ -844,7 +671,7 @@ void RedlichKisterVPSSTP::getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_di dlnActCoeffdlnX_diag[k] = dlnActCoeffdlnX_diag_[k]; } } -//==================================================================================================================== + void RedlichKisterVPSSTP::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnActCoeffdlnN) { s_update_dlnActCoeff_dX_(); @@ -855,7 +682,7 @@ void RedlichKisterVPSSTP::getdlnActCoeffdlnN(const size_t ld, doublereal* dlnAct } } } -//==================================================================================================================== + void RedlichKisterVPSSTP::resizeNumInteractions(const size_t num) { numBinaryInteractions_ = num; @@ -866,13 +693,7 @@ void RedlichKisterVPSSTP::resizeNumInteractions(const size_t num) m_SE_m_ij.resize(num); dlnActCoeff_dX_.resize(num, num, 0.0); } -//==================================================================================================================== -// Process an XML node called "binaryNeutralSpeciesParameters" -/* - * This node contains all of the parameters necessary to describe the RedlichKister Interaction for - * a single binary interaction. This function reads the XML file and writes the coefficients - * it finds to an internal data structures. - */ + void RedlichKisterVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies) { std::string xname = xmLBinarySpecies.name(); @@ -961,7 +782,7 @@ void RedlichKisterVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies) m_N_ij.push_back(Npoly); resizeNumInteractions(numBinaryInteractions_); } -//==================================================================================================================== + #ifdef DEBUG_MODE void RedlichKisterVPSSTP::Vint(double& VintOut, double& voltsOut) { @@ -1010,6 +831,4 @@ void RedlichKisterVPSSTP::Vint(double& VintOut, double& voltsOut) voltsOut = Volts + termp; } #endif -//==================================================================================================================== } - diff --git a/src/thermo/VPStandardStateTP.cpp b/src/thermo/VPStandardStateTP.cpp index 0d5ebf71f..9dfe6a44f 100644 --- a/src/thermo/VPStandardStateTP.cpp +++ b/src/thermo/VPStandardStateTP.cpp @@ -34,15 +34,6 @@ VPStandardStateTP::VPStandardStateTP() : { } -/* - * Copy Constructor: - * - * Note this stuff will not work until the underlying phase - * has a working copy constructor. - * - * The copy constructor just calls the assignment operator - * to do the heavy lifting. - */ VPStandardStateTP::VPStandardStateTP(const VPStandardStateTP& b) : ThermoPhase(), m_Pcurrent(OneAtm), @@ -54,12 +45,6 @@ VPStandardStateTP::VPStandardStateTP(const VPStandardStateTP& b) : VPStandardStateTP::operator=(b); } -/* - * operator=() - * - * Note this stuff will not work until the underlying phase - * has a working assignment operator - */ VPStandardStateTP& VPStandardStateTP::operator=(const VPStandardStateTP& b) { @@ -126,10 +111,6 @@ VPStandardStateTP::operator=(const VPStandardStateTP& b) return *this; } //==================================================================================================================== -/* - * ~VPStandardStateTP(): (virtual) - * - */ VPStandardStateTP::~VPStandardStateTP() { for (int k = 0; k < (int) m_PDSS_storage.size(); k++) { @@ -138,38 +119,16 @@ VPStandardStateTP::~VPStandardStateTP() delete m_VPSS_ptr; } -/* - * Duplication function. - * This calls the copy constructor for this object. - */ ThermoPhase* VPStandardStateTP::duplMyselfAsThermoPhase() const { return new VPStandardStateTP(*this); } -// This method returns the convention used in specification -// of the standard state, of which there are currently two, -// temperature based, and variable pressure based. -/* - * Currently, there are two standard state conventions: - * - Temperature-based activities - * cSS_CONVENTION_TEMPERATURE 0 - * - default - * - * - Variable Pressure and Temperature -based activities - * cSS_CONVENTION_VPSS 1 - */ int VPStandardStateTP::standardStateConvention() const { return cSS_CONVENTION_VPSS; } - -/* - * ------------Molar Thermodynamic Properties ------------------------- - */ - - doublereal VPStandardStateTP::err(const std::string& msg) const { throw CanteraError("VPStandardStateTP","Base class method " @@ -177,19 +136,6 @@ doublereal VPStandardStateTP::err(const std::string& msg) const return 0; } -/* - * ---- Partial Molar Properties of the Solution ----------------- - */ - -/* - * Get the array of non-dimensional species chemical potentials - * These are partial molar Gibbs free energies. - * \f$ \mu_k / \hat R T \f$. - * Units: unitless - * - * We close the loop on this function, here, calling - * getChemPotentials() and then dividing by RT. - */ void VPStandardStateTP::getChemPotentials_RT(doublereal* muRT) const { getChemPotentials(muRT); @@ -220,14 +166,6 @@ void VPStandardStateTP::getEnthalpy_RT(doublereal* hrt) const //================================================================================================ #ifdef H298MODIFY_CAPABILITY -// Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1) -/* - * The 298K heat of formation is defined as the enthalpy change to create the standard state - * of the species from its constituent elements in their standard states at 298 K and 1 bar. - * - * @param k Species k - * @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar - */ void VPStandardStateTP::modifyOneHf298SS(const size_t& k, const doublereal Hf298New) { m_spthermo->modifyOneHf298(k, Hf298New); @@ -282,37 +220,18 @@ const vector_fp& VPStandardStateTP::getStandardVolumes() const * ----- Thermodynamic Values for the Species Reference States ---- */ -/* - * Returns the vector of nondimensional enthalpies of the - * reference state at the current temperature of the solution and - * the reference pressure for the species. - */ void VPStandardStateTP::getEnthalpy_RT_ref(doublereal* hrt) const { updateStandardStateThermo(); m_VPSS_ptr->getEnthalpy_RT_ref(hrt); } -/* - * Returns the vector of nondimensional - * enthalpies of the reference state at the current temperature - * of the solution and the reference pressure for the species. - */ void VPStandardStateTP::getGibbs_RT_ref(doublereal* grt) const { updateStandardStateThermo(); m_VPSS_ptr->getGibbs_RT_ref(grt); } -/* - * Returns the vector of the - * gibbs function of the reference state at the current temperature - * of the solution and the reference pressure for the species. - * units = J/kmol - * - * This is filled in here so that derived classes don't have to - * take care of it. - */ void VPStandardStateTP::getGibbs_ref(doublereal* g) const { updateStandardStateThermo(); @@ -325,45 +244,24 @@ const vector_fp& VPStandardStateTP::Gibbs_RT_ref() const return m_VPSS_ptr->Gibbs_RT_ref(); } -/* - * Returns the vector of nondimensional - * entropies of the reference state at the current temperature - * of the solution and the reference pressure for the species. - */ void VPStandardStateTP::getEntropy_R_ref(doublereal* er) const { updateStandardStateThermo(); m_VPSS_ptr->getEntropy_R_ref(er); } -/* - * Returns the vector of nondimensional - * constant pressure heat capacities of the reference state - * at the current temperature of the solution - * and reference pressure for the species. - */ void VPStandardStateTP::getCp_R_ref(doublereal* cpr) const { updateStandardStateThermo(); m_VPSS_ptr->getCp_R_ref(cpr); } -/* - * Get the molar volumes of the species reference states at the current - * T and P_ref of the solution. - * - * units = m^3 / kmol - */ void VPStandardStateTP::getStandardVolumes_ref(doublereal* vol) const { updateStandardStateThermo(); m_VPSS_ptr->getStandardVolumes_ref(vol); } -/* - * Perform initializations after all species have been - * added. - */ void VPStandardStateTP::initThermo() { initLengths(); @@ -465,25 +363,10 @@ VPStandardStateTP::providePDSS(size_t k) const return m_PDSS_storage[k]; } -/* - * Import and initialize a ThermoPhase object - * - * param phaseNode This object must be the phase node of a - * complete XML tree - * description of the phase, including all of the - * species data. In other words while "phase" must - * point to an XML phase object, it must have - * sibling nodes "speciesData" that describe - * the species in the phase. - * param id ID of the phase. If nonnull, a check is done - * to see if phaseNode is pointing to the phase - * with the correct id. - * - * This routine initializes the lengths in the current object and - * then calls the parent routine. - */ void VPStandardStateTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { + // initialize the lengths in the current object and then call the parent + // routine. VPStandardStateTP::initLengths(); //m_VPSS_ptr->initThermo(); @@ -504,20 +387,6 @@ VPSSMgr* VPStandardStateTP::provideVPSSMgr() return m_VPSS_ptr; } -/* - * void _updateStandardStateThermo() (protected, virtual, const) - * - * If m_useTmpStandardStateStorage is true, - * This function must be called for every call to functions in this - * class that need standard state properties. - * Child classes may require that it be called even if m_useTmpStandardStateStorage - * is not true. - * It checks to see whether the temperature has changed and - * thus the ss thermodynamics functions for all of the species - * must be recalculated. - * - * This - */ void VPStandardStateTP::_updateStandardStateThermo() const { double Tnow = temperature(); @@ -536,5 +405,3 @@ void VPStandardStateTP::updateStandardStateThermo() const } } } - -