From a4f1ab3d748675086417d5c70fd58ecc90fa2218 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Wed, 28 Feb 2007 22:17:12 +0000 Subject: [PATCH] Added getStandardVolumes_ref() to ThermoPhase.h I had started to put similar routines in in child routines, but it deserves to be here to fill out the suite. Added DebyeHuckel to doxygen - unfinished. took out getSpeciesMolarVolume() from DebyeHuckel. --- Cantera/src/ThermoPhase.h | 131 +++++++++------- Cantera/src/thermo/DebyeHuckel.cpp | 19 ++- Cantera/src/thermo/DebyeHuckel.h | 189 +++++++++++++++++++---- Cantera/src/thermo/StoichSubstanceSSTP.h | 2 +- tools/doc/Cantera.cfg.in | 3 +- 5 files changed, 246 insertions(+), 98 deletions(-) diff --git a/Cantera/src/ThermoPhase.h b/Cantera/src/ThermoPhase.h index 7e423a17e..0e1beffdf 100755 --- a/Cantera/src/ThermoPhase.h +++ b/Cantera/src/ThermoPhase.h @@ -701,17 +701,17 @@ namespace Cantera { err("getCp_R"); } - //! Get the molar volumes of the species standard states at the current - //! T and P of the solution. - /*! - * units = m^3 / kmol - * - * @param vol Output vector containing the standard state volumes. - * Length: m_kk. - */ - virtual void getStandardVolumes(doublereal *vol) const { - err("getStandardVolumes"); - } + //! Get the molar volumes of the species standard states at the current + //! T and P of the solution. + /*! + * units = m^3 / kmol + * + * @param vol Output vector containing the standard state volumes. + * Length: m_kk. + */ + virtual void getStandardVolumes(doublereal *vol) const { + err("getStandardVolumes"); + } //@} /// @name Thermodynamic Values for the Species Reference States @@ -793,62 +793,73 @@ namespace Cantera { err("getCp_R_ref()"); } + //! Get the molar volumes of the species reference states at the current + //! T and P_ref of the solution. + /*! + * units = m^3 / kmol + * + * @param vol Output vector containing the standard state volumes. + * Length: m_kk. + */ + virtual void getStandardVolumes_ref(doublereal *vol) const { + err("getStandardVolumes_ref"); + } - /////////////////////////////////////////////////////// - // - // The methods below are not virtual, and should not - // be overloaded. - // - ////////////////////////////////////////////////////// - - /** - * @} - * @name Specific Properties - * @{ - */ + /////////////////////////////////////////////////////// + // + // The methods below are not virtual, and should not + // be overloaded. + // + ////////////////////////////////////////////////////// + + /** + * @} + * @name Specific Properties + * @{ + */ - /** - * Specific enthalpy. Units: J/kg. - */ - doublereal enthalpy_mass() const { - return enthalpy_mole()/meanMolecularWeight(); - } + /** + * Specific enthalpy. Units: J/kg. + */ + doublereal enthalpy_mass() const { + return enthalpy_mole()/meanMolecularWeight(); + } - /** - * Specific internal energy. Units: J/kg. - */ - doublereal intEnergy_mass() const { - return intEnergy_mole()/meanMolecularWeight(); - } + /** + * Specific internal energy. Units: J/kg. + */ + doublereal intEnergy_mass() const { + return intEnergy_mole()/meanMolecularWeight(); + } - /** - * Specific entropy. Units: J/kg/K. - */ - doublereal entropy_mass() const { - return entropy_mole()/meanMolecularWeight(); - } + /** + * Specific entropy. Units: J/kg/K. + */ + doublereal entropy_mass() const { + return entropy_mole()/meanMolecularWeight(); + } - /** - * Specific Gibbs function. Units: J/kg. - */ - doublereal gibbs_mass() const { - return gibbs_mole()/meanMolecularWeight(); - } + /** + * Specific Gibbs function. Units: J/kg. + */ + doublereal gibbs_mass() const { + return gibbs_mole()/meanMolecularWeight(); + } - /** - * Specific heat at constant pressure. Units: J/kg/K. - */ - doublereal cp_mass() const { - return cp_mole()/meanMolecularWeight(); - } + /** + * Specific heat at constant pressure. Units: J/kg/K. + */ + doublereal cp_mass() const { + return cp_mole()/meanMolecularWeight(); + } - /** - * Specific heat at constant volume. Units: J/kg/K. - */ - doublereal cv_mass() const { - return cv_mole()/meanMolecularWeight(); - } - //@} + /** + * Specific heat at constant volume. Units: J/kg/K. + */ + doublereal cv_mass() const { + return cv_mole()/meanMolecularWeight(); + } + //@} //! Return the Gas Constant multiplied by the current temperature /*! diff --git a/Cantera/src/thermo/DebyeHuckel.cpp b/Cantera/src/thermo/DebyeHuckel.cpp index 5a114a25c..a56fa15ca 100644 --- a/Cantera/src/thermo/DebyeHuckel.cpp +++ b/Cantera/src/thermo/DebyeHuckel.cpp @@ -1,5 +1,7 @@ /** * @file DebyeHuckel.cpp + * + * Definitions of the DebyeHuckel object. */ /* * Copywrite (2006) Sandia Corporation. Under the terms of @@ -23,7 +25,7 @@ using namespace std; namespace Cantera { - /** + /* * Default constructor */ DebyeHuckel::DebyeHuckel() : @@ -47,7 +49,8 @@ namespace Cantera { m_npActCoeff[1] = -0.01049; m_npActCoeff[2] = 1.545E-3; } - /** + + /* * Working constructors * * The two constructors below are the normal way @@ -101,7 +104,7 @@ namespace Cantera { constructPhaseXML(phaseRoot, id); } - /** + /* * Copy Constructor: * * Note this stuff will not work until the underlying phase @@ -391,7 +394,7 @@ namespace Cantera { return 0.0; } - /** + /* * Overwritten setDensity() function is necessary because the * density is not an indendent variable. * @@ -432,7 +435,7 @@ namespace Cantera { } } - /** + /* * Overwritten setTemperature(double) from State.h. This * function sets the temperature, and makes sure that * the value propagates to underlying objects. @@ -1734,9 +1737,9 @@ namespace Cantera { * * units - \f$ m^3 kmol^-1 \f$ */ - double DebyeHuckel::speciesMolarVolume(int k) const { - return m_speciesSize[k]; - } + // double DebyeHuckel::speciesMolarVolume(int k) const { + // return m_speciesSize[k]; + //} /** diff --git a/Cantera/src/thermo/DebyeHuckel.h b/Cantera/src/thermo/DebyeHuckel.h index d4a2acae2..4f33c2d3c 100644 --- a/Cantera/src/thermo/DebyeHuckel.h +++ b/Cantera/src/thermo/DebyeHuckel.h @@ -1,6 +1,7 @@ /** * @file DebyeHuckel.h * + * Declarations for the DebyeHuckel phase */ /* * Copywrite (2006) Sandia Corporation. Under the terms of @@ -20,14 +21,9 @@ namespace Cantera { - /** - * @defgroup thermoprops Thermodynamic Properties - * - * These classes are used to compute thermodynamic properties. - */ - /** - * DebyeHuckel.h + /*! + * * Major Parameters: * @@ -100,7 +96,140 @@ namespace Cantera { class WaterPDSS; /** - * Definition of the DebyeHuckel object + * @ingroup thermoprops + * + * Class %DebyeHuckel represents a dilute liquid electrolyte phase which + * obeys the Debye Huckel formulation for nonideality. + * + * + * + * Specification of Species Standard %State Properties + * + * + * It is assumed that the reference state thermodynamics may be + * obtained by a pointer to a populated species thermodynamic property + * manager class (see ThermoPhase::m_spthermo). How to relate pressure + * changes to the reference state thermodynamics is resolved at this level. + * + * For an incompressible, + * stoichiometric substance, the molar internal energy is + * independent of pressure. Since the thermodynamic properties + * are specified by giving the standard-state enthalpy, the + * term \f$ P_0 \hat v\f$ is subtracted from the specified molar + * enthalpy to compute the molar internal energy. The entropy is + * assumed to be independent of the pressure. + * + * The enthalpy function is given by the following relation. + * + * \f[ + * \raggedright h^o_k(T,P) = h^{ref}_k(T) + \tilde v \left( P - P_{ref} \right) + * \f] + * + * For an incompressible, + * stoichiometric substance, the molar internal energy is + * independent of pressure. Since the thermodynamic properties + * are specified by giving the standard-state enthalpy, the + * term \f$ P_{ref} \tilde v\f$ is subtracted from the specified reference molar + * enthalpy to compute the molar internal energy. + * + * \f[ + * u^o_k(T,P) = h^{ref}_k(T) - P_{ref} \tilde v + * \f] + * + * The standard state heat capacity and entropy are independent + * of pressure. The standard state gibbs free energy is obtained + * from the enthalpy and entropy functions. + * + * + * Specification of Solution Thermodynamic Properties + * + * All solution properties are obtained from the standard state + * species functions, since there is only one species in the phase. + * + * Application within %Kinetics Managers + * + * The standard concentration is equal to 1.0. This means that the + * kinetics operator works on an (activities basis). Since this + * is a stoichiometric substance, this means that the concentration + * of this phase drops out of kinetics expressions. + * + * An example of a reaction using this is a sticking coefficient + * reaction of a substance in an ideal gas phase on a surface with a bulk phase + * species in this phase. In this case, the rate of progress for this + * reaction, \f$ R_s \f$, may be expressed via the following equation: + * \f[ + * R_s = k_s C_{gas} + * \f] + * where the units for \f$ R_s \f$ are kmol m-2 s-1. \f$ C_{gas} \f$ has units + * of kmol m-3. Therefore, the kinetic rate constant, \f$ k_s \f$, has + * units of m s-1. Nowhere does the concentration of the bulk phase + * appear in the rate constant expression, since it's a stoichiometric + * phase and the activity is always equal to 1.0. + * + * Instanteation of the Class + * + * The constructor for this phase is NOT located in the default ThermoFactory + * for %Cantera. However, a new %StoichSubstanceSSTP may be created by + * the following code snippets: + * + * @code + * sprintf(file_ID,"%s#NaCl(S)", iFile); + * XML_Node *xm = get_XML_NameID("phase", file_ID, 0); + * StoichSubstanceSSTP *solid = new StoichSubstanceSSTP(*xm); + * @endcode + * + * or by the following call to importPhase(): + * + * @code + * sprintf(file_ID,"%s#NaCl(S)", iFile); + * XML_Node *xm = get_XML_NameID("phase", file_ID, 0); + * StoichSubstanceSSTP solid; + * importPhase(*xm, &solid); + * @endcode + * + * XML Example + * + * The phase model name for this is called StoichSubstance. It must be supplied + * as the model attribute of the thermo XML element entry. + * Within the phase XML block, + * the density of the phase must be specified. An example of an XML file + * this phase is given below. + * + * @verbatim + + + + Na Cl + + NaCl(S) + + 2.165 + + + + + + + + + + Na:1 Cl:1 + + + + 50.72389, 6.672267, -2.517167, + 10.15934, -0.200675, -427.2115, + 130.3973 + + + + 2.165 + + @endverbatim + * + * The model attribute, "StoichSubstanceSSTP", on the thermo element identifies the phase as being + * a StoichSubstanceSSTP object. + * */ class DebyeHuckel : public MolalityVPSSTP { @@ -243,7 +372,8 @@ namespace Cantera { */ void calcDensity(); - /** + //! Set the internally storred molar density (kmol/m^3) of the phase. + /*! * Overwritten setDensity() function is necessary because the * density is not an indendent variable. * @@ -254,28 +384,44 @@ namespace Cantera { * to create a condition where the density is a function of * the pressure. * - * This function will now throw an error condition. + * 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 density Input density (kg/m^3). */ void setDensity(doublereal rho); + //! Set the internally storred molar density (kmol/m^3) of the phase. /** * Overwritten setMolarDensity() function is necessary because the * density is not an indendent variable. * - * This function will now throw an error condition. + * 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(doublereal conc); - /** + //! Set the temperature (K) + /*! * Overwritten setTemperature(double) from State.h. This * function sets the temperature, and makes sure that - * the value propagates to underlying objects. + * the value propagates to underlying objects, such as + * the water standard state model. + * + * @param temp Temperature in kelvin */ virtual void setTemperature(doublereal temp); @@ -711,20 +857,7 @@ namespace Cantera { //@{ - /// Critical temperature (K). - virtual doublereal critTemperature() const { - err("critTemperature"); return -1.0; - } - - /// Critical pressure (Pa). - virtual doublereal critPressure() const { - err("critPressure"); return -1.0; - } - - /// Critical density (kg/m3). - virtual doublereal critDensity() const { - err("critDensity"); return -1.0; - } + //@} @@ -843,7 +976,7 @@ namespace Cantera { * * units - \f$ m^3 kmol^-1 \f$ */ - double speciesMolarVolume(int k) const; + //double speciesMolarVolume(int k) const; /** * Fill in a return vector containing the species molar volumes diff --git a/Cantera/src/thermo/StoichSubstanceSSTP.h b/Cantera/src/thermo/StoichSubstanceSSTP.h index 905d7e9c7..43ee19734 100644 --- a/Cantera/src/thermo/StoichSubstanceSSTP.h +++ b/Cantera/src/thermo/StoichSubstanceSSTP.h @@ -55,7 +55,7 @@ namespace Cantera { * The enthalpy function is given by the following relation. * * \f[ - * h^o_k(T,P) = h^{ref}_k(T) + \tilde v \left( P - P_{ref} \right) + * \raggedright h^o_k(T,P) = h^{ref}_k(T) + \tilde v \left( P - P_{ref} \right) * \f] * * For an incompressible, diff --git a/tools/doc/Cantera.cfg.in b/tools/doc/Cantera.cfg.in index 1a088bb6e..b8e11c70b 100755 --- a/tools/doc/Cantera.cfg.in +++ b/tools/doc/Cantera.cfg.in @@ -115,7 +115,8 @@ FILE_PATTERNS = Kinetics.h Kinetics.cpp \ MolalityVPSSTP.h MolalityVPSSTP.cpp \ IdealMolalSoln.h IdealMolalSoln.cpp \ IdealSolidSolnPhase.h IdealSolidSolnPhase.cpp \ - StoichSubstanceSSTP.h StoichSubstanceSSTP.cpp + StoichSubstanceSSTP.h StoichSubstanceSSTP.cpp \ + DebyeHuckel.h DebyeHuckel.cpp RECURSIVE = NO EXCLUDE = CVS examples converters zeroD EXCLUDE_SYMLINKS = NO