From 75656f51986e0b0cdc75287c2801d057f212817d Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Wed, 11 Feb 2009 20:03:06 +0000 Subject: [PATCH] Changes to the destructors for error handling. changes to the activityconcentration format for aqueous species. --- Cantera/src/thermo/HMWSoln.cpp | 15 +++++-- Cantera/src/thermo/HMWSoln.h | 49 ++++++++++++++++------- Cantera/src/thermo/IdealSolidSolnPhase.h | 2 +- Cantera/src/thermo/SpeciesThermoFactory.h | 2 +- Cantera/src/thermo/SpeciesThermoMgr.h | 4 +- Cantera/src/thermo/ThermoFactory.h | 2 +- Cantera/src/thermo/ThermoPhase.h | 5 +-- Cantera/src/thermo/VPSSMgrFactory.h | 2 +- 8 files changed, 54 insertions(+), 27 deletions(-) diff --git a/Cantera/src/thermo/HMWSoln.cpp b/Cantera/src/thermo/HMWSoln.cpp index 14eac7ddf..c2e960772 100644 --- a/Cantera/src/thermo/HMWSoln.cpp +++ b/Cantera/src/thermo/HMWSoln.cpp @@ -932,13 +932,22 @@ namespace Cantera { * 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. + * 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. + * molality of the species, but have units based on assuming + * all species concentrations have units of kmol/m3. + * */ doublereal HMWSoln::standardConcentration(int k) const { - double mvSolvent = m_speciesSize[m_indexSolvent]; + getStandardVolumes(DATA_PTR(m_tmpV)); + double mvSolvent = m_tmpV[m_indexSolvent]; + if (k > 0) { + return m_Mnaught / mvSolvent; + } return 1.0 / mvSolvent; } diff --git a/Cantera/src/thermo/HMWSoln.h b/Cantera/src/thermo/HMWSoln.h index 881fa8f42..b4effe879 100644 --- a/Cantera/src/thermo/HMWSoln.h +++ b/Cantera/src/thermo/HMWSoln.h @@ -1023,34 +1023,52 @@ namespace Cantera { *

%Application within %Kinetics Managers

*
* - * For the time being, we have set the standard concentration for all species in - * this phase equal to the default concentration of the solvent at 298 K and 1 atm. + * For the time being, we have set the standard concentration for all solute + * species in + * this phase equal to the default concentration of the solvent at the system temperature + * and pressure multiplied by Mnaught (kg solvent / gmol solvent). The solvent + * standard concentration is just equal to its standard state concentration. * This means that the - * kinetics operator essentially works on an activities basis, with units for the - * kinetic rate constant specified - * as if all reactants were on a concentration basis. + * kinetics operator essentially works on an generalized concentration basis (kg / m3), + * with units for the kinetic rate constant specified + * as if all reactants (solvent or solute) are on a concentration basis (kg /m3). + * The concentration will be modified by the activity coefficients. * - * For example, a bulk-phase binary reaction between liquid species + * For example, a bulk-phase binary reaction between liquid solute species * j and k, producing - * a new liquid species l would have the + * a new liquid solute species l would have the * following equation for its rate of progress variable, \f$ R^1 \f$, which has * units of kmol m-3 s-1. * * * \f[ - * R^1 = k^1 C_j^a C_k^a = k^1 (C_o a_j) (C_o a_k) + * R^1 = k^1 C_j^a C_k^a = k^1 (C_o \tilde{M}_o a_j) (C_o \tilde{M}_o a_k) * \f] * where * \f[ - * C_j^a = C_o a_j \quad and \quad C_k^a = C_o a_k + * C_j^a = C_o \tilde{M}_o a_j \quad and \quad C_k^a = C_o \tilde{M}_o a_k * \f] * * \f$ C_j^a \f$ is the activity concentration of species j, and * \f$ C_k^a \f$ is the activity concentration of species k. \f$ C_o \f$ - * is the concentration of water at 298 K and 1 atm. \f$ a_j \f$ is + * is the concentration of water at 298 K and 1 atm. \f$ \tilde{M}_o \f$ is + * has units of kg solvent per gmol solvent and is equal to + * + * \f[ + * \tilde{M}_o = \frac{M_o}{1000} + * \f] + * + * + * \f$ a_j \f$ is * the activity of species j at the current temperature and pressure - * and concentration of the liquid phase. \f$k^1 \f$ has units of m3 - * kmol-1 s-1. + * and concentration of the liquid phase is given by the molality based + * activity coefficient multiplied by the molality of the jth species. + * + * \f[ + * a_j = \gamma_j^\triangle m_j + * \f] + * + * \f$k^1 \f$ has units of m3 kmol-1 s-1. * * * The reverse rate constant can then be obtained from the law of microscopic reversibility @@ -1063,13 +1081,13 @@ namespace Cantera { * \f$ K^{o,1} \f$ is the dimensionless form of the equilibrium constant. * * \f[ - * R^{-1} = k^{-1} C_l^a = k^{-1} (C_o a_l) + * R^{-1} = k^{-1} C_l^a = k^{-1} (C_o \tilde{M}_o a_l) * \f] * * where * * \f[ - * k^{-1} = k^1 K^{o,1} C_o + * k^{-1} = k^1 K^{o,1} C_o \tilde{M}_o * \f] * * \f$ k^{-1} \f$ has units of s-1. @@ -1581,7 +1599,8 @@ namespace Cantera { * the activity (i.e., generalized) concentration for use * * For the time being, we will use the concentration of pure - * solvent for the the standard concentration of all species. + * solvent at the temperature and pressure of the solution + * for the the standard concentration of all species. * This has the effect of making mass-action reaction rates * based on the molality of species proportional to the * molality of the species. diff --git a/Cantera/src/thermo/IdealSolidSolnPhase.h b/Cantera/src/thermo/IdealSolidSolnPhase.h index e8cc3f4df..ba318d84f 100644 --- a/Cantera/src/thermo/IdealSolidSolnPhase.h +++ b/Cantera/src/thermo/IdealSolidSolnPhase.h @@ -425,7 +425,7 @@ namespace Cantera { * concentrations. The generalized concentrations are used * in the evaluation of the rates of progress for reactions * involving species in this phase. The generalized - * concentration dividied by the standard concentration is also + * concentration divided by the standard concentration is also * equal to the activity of species. * * For this implentation the activity is defined to be the diff --git a/Cantera/src/thermo/SpeciesThermoFactory.h b/Cantera/src/thermo/SpeciesThermoFactory.h index 1c0d676ea..172b0f939 100755 --- a/Cantera/src/thermo/SpeciesThermoFactory.h +++ b/Cantera/src/thermo/SpeciesThermoFactory.h @@ -48,7 +48,7 @@ namespace Cantera { + speciesThermoModel + " does not match any known type.") {} //! destructor - virtual ~UnknownSpeciesThermoModel() {} + virtual ~UnknownSpeciesThermoModel() throw() {} }; //! Factory to build instances of classes that manage the diff --git a/Cantera/src/thermo/SpeciesThermoMgr.h b/Cantera/src/thermo/SpeciesThermoMgr.h index 0dc405c9b..14d5347c3 100755 --- a/Cantera/src/thermo/SpeciesThermoMgr.h +++ b/Cantera/src/thermo/SpeciesThermoMgr.h @@ -116,7 +116,7 @@ namespace Cantera { + fp2str(prnew) + ") does not match previously-defined " + "reference pressure (" + fp2str(prold) + ")") {} //! destructor - virtual ~RefPressureMismatch() {} + virtual ~RefPressureMismatch() throw() {} }; //! Unknown species thermo manager string error @@ -144,7 +144,7 @@ namespace Cantera { CanteraError(proc, "Specified species parameterization type (" + stype + ") does not match any known type.") {} //! destructor - virtual ~UnknownSpeciesThermo() {} + virtual ~UnknownSpeciesThermo() throw() {} }; diff --git a/Cantera/src/thermo/ThermoFactory.h b/Cantera/src/thermo/ThermoFactory.h index badebb692..b9a034086 100644 --- a/Cantera/src/thermo/ThermoFactory.h +++ b/Cantera/src/thermo/ThermoFactory.h @@ -56,7 +56,7 @@ namespace Cantera { + thermoModel + " does not match any known type.") {} //! destructor - virtual ~UnknownThermoPhaseModel() {} + virtual ~UnknownThermoPhaseModel() throw() {} }; diff --git a/Cantera/src/thermo/ThermoPhase.h b/Cantera/src/thermo/ThermoPhase.h index 02d90f277..36f4ab14e 100755 --- a/Cantera/src/thermo/ThermoPhase.h +++ b/Cantera/src/thermo/ThermoPhase.h @@ -712,10 +712,9 @@ namespace Cantera { //!Copy Constructor for the %ThermoPhase object. /*! - * Currently, this is not fully implemented. If called it will - * throw an exception. + * @param right ThermoPhase to be copied */ - ThermoPhase(const ThermoPhase &); + ThermoPhase(const ThermoPhase &right); //! Assignment operator /*! diff --git a/Cantera/src/thermo/VPSSMgrFactory.h b/Cantera/src/thermo/VPSSMgrFactory.h index e137cc155..5683608b3 100644 --- a/Cantera/src/thermo/VPSSMgrFactory.h +++ b/Cantera/src/thermo/VPSSMgrFactory.h @@ -47,7 +47,7 @@ namespace Cantera { + VPSSMgrModel + " does not match any known type.") {} //! destructor - virtual ~UnknownVPSSMgrModel() {} + virtual ~UnknownVPSSMgrModel() throw() {} }; //! Factory to build instances of classes that manage the