Cleaned up Doxygen documentation for class WaterProps and friends

This commit is contained in:
Ray Speth 2013-03-07 18:51:17 +00:00
parent b4506cebe1
commit e7f580148f
6 changed files with 225 additions and 765 deletions

View file

@ -23,82 +23,70 @@ class PDSS_Water;
/**
* @defgroup relatedProps Electric Properties of Phases
*
* <H3> Treatment of the %Phase Potential and the electrochemical potential of
* a species </H3>
*
* <H3>
* Treatment of the %Phase Potential and the electrochemical potential of a species
* </H3>
*
*
* The electrochemical potential of species <I>k</I> in a phase <I>p</I>, \f$ \zeta_k \f$,
* is related to the chemical potential via
* the following equation,
* The electrochemical potential of species *k* in a phase *p*, \f$ \zeta_k \f$,
* is related to the chemical potential via the following equation,
*
* \f[
* \zeta_{k}(T,P) = \mu_{k}(T,P) + z_k \phi_p
* \f]
*
* where \f$ \nu_k \f$ is the charge of species <I>k</I>, and \f$ \phi_p \f$ is
* the electric potential of phase <I>p</I>.
* where \f$ \nu_k \f$ is the charge of species *k*, and \f$ \phi_p \f$ is
* the electric potential of phase *p*.
*
* The potential \f$ \phi_p \f$ is tracked and internally stored within
* the base %ThermoPhase object. It constitutes a specification of the
* internal state of the phase; it's the third state variable, the first
* two being temperature and density (or, pressure, for incompressible
* equations of state). It may be set with the function,
* ThermoPhase::setElectricPotential(),
* and may be queried with the function ThermoPhase::electricPotential().
* The potential \f$ \phi_p \f$ is tracked and internally stored within the
* base ThermoPhase object. It constitutes a specification of the internal
* state of the phase; it's the third state variable, the first two being
* temperature and density (or, pressure, for incompressible equations of
* state). It may be set with the function,
* ThermoPhase::setElectricPotential(), and may be queried with the function
* ThermoPhase::electricPotential().
*
* Note, the overall electrochemical potential of a phase may not be
* changed by the potential because many phases enforce charge
* neutrality:
* Note, the overall electrochemical potential of a phase may not be changed
* by the potential because many phases enforce charge neutrality:
*
* \f[
* 0 = \sum_k z_k X_k
* \f]
*
* Whether charge neutrality is necessary for a phase is also specified
* within the ThermoPhase object, by the function call
* ThermoPhase::chargeNeutralityNecessary(). Note, that it is not
* necessary for the IdealGas phase, currently. However, it is
* necessary for liquid phases such as Cantera::DebyeHuckel and
* Cantera::HMWSoln for the proper specification of the chemical potentials.
* Whether charge neutrality is necessary for a phase is also specified within
* the ThermoPhase object, by the function call
* ThermoPhase::chargeNeutralityNecessary(). Note, that it is not necessary
* for the IdealGas phase, currently. However, it is necessary for liquid
* phases such as Cantera::DebyeHuckel and Cantera::HMWSoln for the proper
* specification of the chemical potentials.
*
* This equation, when applied to the \f$ \zeta_k \f$ equation described
* above, results in a zero net change in the effective Gibbs free energy of
* the phase. However, specific charged species in the phase may increase or
* decrease their electrochemical potentials, which will have an effect on
* interfacial reactions involving charged species, when there is a potential
* drop between phases. This effect is used within the
* Cantera::InterfaceKinetics and Cantera::EdgeKinetics kinetics objects
* classes.
*
* This equation, when applied to the \f$ \zeta_k \f$ equation described
* above, results in a zero net change in the effective Gibbs free
* energy of the phase. However, specific charged species in the phase
* may increase or decrease their electrochemical potentials, which will
* have an effect on interfacial reactions involving charged species,
* when there is a potential drop between phases. This effect is used
* within the Cantera::InterfaceKinetics and Cantera::EdgeKinetics kinetics
* objects classes.
* <H3> Electrothermochemical Properties of Phases of Matter. </H3>
*
* The following classes are used to compute the electrical and
* electrothermochemical properties of phases of matter. The main property
* currently is the dielectric constant, which is an important parameter for
* electrolyte solutions. The class WaterProps calculate the dielectric
* constant of water as a function of temperature and pressure.
*
* <H3>
* Electrothermochemical Properties of Phases of Matter.
* </H3>
*
* The following classes are used to compute the electrical and electrothermochemical properties of
* phases of matter. The main property currently is the dielectric
* constant, which is an important parameter for electrolyte solutions.
* The class WaterProps calculate the dielectric constant of water as a function of
* temperature and pressure.
*
* WaterProps also calculate the constant A_debye used in the Debye Huckel
* and Pitzer activity coefficient calculations.
*
* WaterProps also calculate the constant A_debye used in the Debye Huckel and
* Pitzer activity coefficient calculations.
*
* @ingroup phases
*/
//@{
//! The WaterProps class is used to
//! house several approximation routines for properties of water.
//! The WaterProps class is used to house several approximation routines for
//! properties of water.
/*!
* The class is also a wrapper around the WaterPropsIAPWS class
* which provides the calculations for the equation of
* state properties for water.
* The class is also a wrapper around the WaterPropsIAPWS class which
* provides the calculations for the equation of state properties for water.
*
* In particular, this class house routine for the calculation
* of the dielectric constant of water
@ -107,13 +95,11 @@ class PDSS_Water;
*/
class WaterProps
{
public:
//! Default constructor
WaterProps();
//! Constructor with pointer to Water PDSS object
//! Constructor
/*!
* @param wptr Pointer to WaterPropsIAPWS object
*/
@ -126,25 +112,17 @@ public:
WaterProps(PDSS_Water* wptr);
//! Copy Constructor
/*!
* @param b Object to be copied
*/
WaterProps(const WaterProps& b);
//! destructor
virtual ~WaterProps();
//! Assignment operator
/*!
* @param b Object to be copied
*/
WaterProps& operator=(const WaterProps& b);
//! Simple calculation of water density at atmospheric pressure.
//! Valid up to boiling point.
/*!
* static function.
* This formulation has no dependence on the pressure and shouldn't
* be used where accuracy is needed.
*
@ -153,10 +131,10 @@ public:
* @param ifunc changes what's returned
*
* @return value returned depends on ifunc value:
* ifunc = 0 Returns the density in kg/m^3
* ifunc = 1 returns the derivative of the density wrt T.
* ifunc = 2 returns the 2nd derivative of the density wrt T
* ifunc = 3 returns the derivative of the density wrt P.
* - ifunc = 0 Returns the density in kg/m^3
* - ifunc = 1 returns the derivative of the density wrt T.
* - ifunc = 2 returns the 2nd derivative of the density wrt T
* - ifunc = 3 returns the derivative of the density wrt P.
*
* Verification:
* Agrees with the CRC values (6-10) for up to 4 sig digits.
@ -165,31 +143,23 @@ public:
*/
static doublereal density_T(doublereal T, doublereal P, int ifunc);
//! Bradley-Pitzer equation for the dielectric constant
//! of water as a function of temperature and pressure.
//! Bradley-Pitzer equation for the dielectric constant
//! of water as a function of temperature and pressure.
/*!
* Returns the dimensionless relative dielectric constant
* and its derivatives.
*
*
* Range of validity: 0 to 350C, 0 to 1 kbar pressure
*
* @param T temperature (kelvin)
* @param P_pascal pressure in pascal
* @param ifunc changes what's returned from the function
* - ifunc = 0 return value
* - ifunc = 1 return temperature derivative
* - ifunc = 2 return temperature second derivative
* - ifunc = 3 return pressure first derivative
* .
*
* @return Depends on the value of ifunc:
* - ifunc = 0 return value
* - ifunc = 1 return temperature derivative
* - ifunc = 2 return temperature second derivative
* - ifunc = 3 return pressure first derivative
* .
*
* Validation:
* Numerical experiments indicate that this function agrees with
@ -197,11 +167,9 @@ public:
* digits shown (0 to 100C).
*
* value at 25C and 1 atm, relEps = 78.38
*
*/
doublereal relEpsilon(doublereal T, doublereal P_pascal, int ifunc = 0);
//! ADebye calculates the value of A_Debye as a function
//! of temperature and pressure according to relations
//! that take into account the temperature and pressure
@ -213,35 +181,27 @@ public:
* most be recalculated whenever T or P changes.
* The units returned by this expression are sqrt(kg/gmol).
*
*
* \f[
* A_{Debye} = \frac{1}{8 \pi} \sqrt{\frac{2 N_{Avog} \rho_w}{1000}}
* {\left(\frac{e^2}{\epsilon k_{boltz} T}\right)}^{\frac{3}{2}}
* \f]
*
* Nominal value at 25C and 1atm = 1.172576 sqrt(kg/gmol).
*
* Nominal value at 25C and 1atm = 1.172576 sqrt(kg/gmol).
*
* Based on:
* epsilon/epsilon_0 = 78.54 (water at 25C)
* T = 298.15 K
* B_Debye = 3.28640E9 sqrt(kg/gmol)/m
* Based on:
* - epsilon/epsilon_0 = 78.54 (water at 25C)
* - T = 298.15 K
* - B_Debye = 3.28640E9 sqrt(kg/gmol)/m
*
* @param T Temperature (kelvin)
* @param P pressure (pascal)
* @param ifunc Changes what's returned from the routine:
* - ifunc = 0 return value
* - ifunc = 1 return temperature derivative
* - ifunc = 2 return temperature second derivative
* - ifunc = 3 return pressure first derivative
* .
* @param ifunc Changes what's returned from the routine
*
* @return Returns a single doublereal whose meaning depends on ifunc:
* - ifunc = 0 return value
* - ifunc = 1 return temperature derivative
* - ifunc = 2 return temperature second derivative
* - ifunc = 3 return pressure first derivative
* .
*
* Verification:
*
@ -253,7 +213,6 @@ public:
*/
doublereal ADebye(doublereal T, doublereal P, int ifunc);
//! Returns the saturation pressure given the temperature
/*!
* @param T temperature (kelvin)
@ -261,7 +220,6 @@ public:
*/
doublereal satPressure(doublereal T);
//! Returns the density of water
/*!
* This function sets the internal temperature and pressure
@ -279,7 +237,6 @@ public:
*/
doublereal density_IAPWS() const;
//! returns the coefficient of thermal expansion
/*!
* @param T Temperature (kelvin)
@ -328,16 +285,8 @@ public:
*/
doublereal thermalConductivityWater() const;
protected:
//! Pointer to the WaterPropsIAPWS object
/*!
* this pointer points to the water object.
*/
WaterPropsIAPWS* m_waterIAPWS;
//! true if we own the WaterPropsIAPWS object
@ -347,5 +296,4 @@ protected:
//@}
}
#endif

View file

@ -39,93 +39,95 @@ namespace Cantera
//! Class for calculating the equation of state of water.
/*!
* The reference is W. Wagner, A. Prub, "The IAPWS Formulation 1995 for the
* Thermodynamic Properties of Ordinary Water Substance for General and
* Scientific Use," J. Phys. Chem. Ref. Dat, 31, 387, 2002.
*
* The reference is W. Wagner, A. Prub, "The IAPWS Formulation 1995 for the Thermodynamic
* Properties of Ordinary Water Substance for General and Scientific Use,"
* J. Phys. Chem. Ref. Dat, 31, 387, 2002.
* This class provides a very complicated polynomial for the specific
* Helmholtz free energy of water, as a function of temperature and density.
*
* This class provides a very complicated polynomial for the specific helmholtz free
* energy of water, as a function of temperature and density.
* \f[
* \frac{M\hat{f}(\rho,T)}{R T} = \phi(\delta, \tau) =
* \phi^o(\delta, \tau) + \phi^r(\delta, \tau)
* \f]
*
* \f[
* \frac{M\hat{f}(\rho,T)}{R T} = \phi(\delta, \tau) =
* \phi^o(\delta, \tau) + \phi^r(\delta, \tau)
* \f]
* where
*
* where
* \f[
* \delta = \rho / \rho_c \quad \mathrm{and} \quad \tau = T_c / T
* \f]
*
* \f[
* \delta = \rho / \rho_c \mbox{\qquad and \qquad} \tau = T_c / T
* \f]
* The following constants are assumed
*
* The following constants are assumed
* \f[
* T_c = 647.096\mathrm{\;K}
* \f]
* \f[
* \rho_c = 322 \mathrm{\;kg\,m^{-3}}
* \f]
* \f[
* R/M = 0.46151805 \mathrm{\;kJ\,kg^{-1}\,K^{-1}}
* \f]
*
* \f[
* T_c = 647.096\mbox{\ K}
* \f]
* \f[
* \rho_c = 322 \mbox{\ kg\ m$^{-3}$}
* \f]
* \f[
* R/M = 0.46151805 \mbox{\ kJ\ kg$^{-1}$\ K$^{-1}$}
* \f]
* The free energy is a unique single-valued function of the temperature and
* density over its entire range.
*
* The free energy is a unique single-valued function of the temperature and density
* over its entire range.
* Note, the base thermodynamic state for this class is the one used in the
* steam tables, i.e., the liquid at the triple point for water has the
* following properties:
*
* Note, the base thermodynamic state for this class is the one
* used in the steam tables, i.e., the liquid at the triple point
* for water has the following properties:
* - u(273.16, rho) = 0.0
* - s(273.16, rho) = 0.0
* - psat(273.16) = 611.655 Pascal
* - rho(273.16, psat) = 999.793 kg m-3
*
* - u(273.16, rho) = 0.0
* - s(273.16, rho) = 0.0
* - psat(273.16) = 611.655 Pascal
* - rho(273.16, psat) = 999.793 kg m-3
*
* Therefore, to use this class within %Cantera, offsets to u() and s() must be used
* to put the water class onto the same basis as other thermodynamic quantities.
* For example, in the WaterSSTP class, these offsets are calculated in the following way.
* The thermodynamic base state for water is set to the NIST basis here
* by specifying constants EW_Offset and SW_Offset. These offsets are
* calculated on the fly so that the following properties hold:
* Therefore, to use this class within %Cantera, offsets to u() and s() must
* be used to put the water class onto the same basis as other thermodynamic
* quantities. For example, in the WaterSSTP class, these offsets are
* calculated in the following way. The thermodynamic base state for water is
* set to the NIST basis here by specifying constants EW_Offset and SW_Offset.
* These offsets are calculated on the fly so that the following properties
* hold:
*
* - Delta_Hfo_idealGas(298.15, 1bar) = -241.826 kJ/gmol
* - So_idealGas(298.15, 1bar) = 188.835 J/gmolK
*
* The offsets are calculated by actually computing the above quantities and then
* calculating the correction factor.
* The offsets are calculated by actually computing the above quantities and
* then calculating the correction factor.
*
* This class provides an interface to the #WaterPropsIAPWSphi class, which actually
* calculates the \f$ \phi^o(\delta, \tau) \f$ and the \f$ \phi^r(\delta, \tau) \f$
* polynomials in dimensionless form.
* This class provides an interface to the WaterPropsIAPWSphi class, which
* actually calculates the \f$ \phi^o(\delta, \tau) \f$ and the
* \f$ \phi^r(\delta, \tau) \f$ polynomials in dimensionless form.
*
* All thermodynamic results from this class are returned in dimensional form. This
* is because the gas constant (and molecular weight) used within this class is allowed to be potentially
* different than that used elsewhere in %Cantera. Therefore, everything has to be
* in dimensional units. Note, however, the thermodynamic basis is set to that used
* in the steam tables. (u = s = 0 for liquid water at the triple point).
* All thermodynamic results from this class are returned in dimensional form.
* This is because the gas constant (and molecular weight) used within this
* class is allowed to be potentially different than that used elsewhere in
* %Cantera. Therefore, everything has to be in dimensional units. Note,
* however, the thermodynamic basis is set to that used in the steam tables.
* (u = s = 0 for liquid water at the triple point).
*
* This class is not a %ThermoPhase. However, it does maintain an internal state of
* the object that is dependent on temperature and density. The internal state
* is characterized by an internally stored \f$ \tau\f$ and a \f$ \delta \f$ value,
* and an iState value, which indicates whether the point is a liquid, a gas,
* or a supercritical fluid.
* Along with that the \f$ \tau\f$ and a \f$ \delta \f$ values are polynomials of
* \f$ \tau\f$ and a \f$ \delta \f$ that are kept by the #WaterPropsIAPWSphi class.
* Therefore, whenever \f$ \tau\f$ or \f$ \delta \f$ is changed, the function setState()
* must be called in order for the internal state to be kept up to date.
* This class is not a %ThermoPhase. However, it does maintain an internal
* state of the object that is dependent on temperature and density. The
* internal state is characterized by an internally stored \f$ \tau\f$ and a
* \f$ \delta \f$ value, and an iState value, which indicates whether the
* point is a liquid, a gas, or a supercritical fluid. Along with that the
* \f$ \tau\f$ and a \f$ \delta \f$ values are polynomials of \f$ \tau\f$ and
* a \f$ \delta \f$ that are kept by the WaterPropsIAPWSphi class. Therefore,
* whenever \f$ \tau\f$ or \f$ \delta \f$ is changed, the function setState()
* must be called in order for the internal state to be kept up to date.
*
* The class is pretty straightforward. However, one function deserves mention.
* the #density() function calculates the density that is consistent with
* a particular value of the temperature and pressure. It may therefore be
* multivalued or potentially there may be no answer from this function. It therefore
* takes a phase guess and a density guess as optional parameters. If no guesses are
* supplied to density(), a gas phase guess is assumed. This may or may not be what
* is wanted. Therefore, density() should usually at least be supplied with a phase
* guess so that it may manufacture an appropriate density guess.
* #density() manufactures the initial density guess, nondimensionalizes everything,
* and then calls #WaterPropsIAPWSphi::dfind(), which does the iterative calculation
* to find the density condition that matches the desired input pressure.
* The class is pretty straightforward. However, one function deserves
* mention. The density() function calculates the density that is consistent
* with a particular value of the temperature and pressure. It may therefore
* be multivalued or potentially there may be no answer from this function. It
* therefore takes a phase guess and a density guess as optional parameters.
* If no guesses are supplied to density(), a gas phase guess is assumed. This
* may or may not be what is wanted. Therefore, density() should usually at
* least be supplied with a phase guess so that it may manufacture an
* appropriate density guess. density() manufactures the initial density
* guess, nondimensionalizes everything, and then calls
* WaterPropsIAPWSphi::dfind(), which does the iterative calculation to find
* the density condition that matches the desired input pressure.
*
* The phase guess defines are located in the .h file. they are
*
@ -133,45 +135,37 @@ namespace Cantera
* - WATER_LIQUID
* - WATER_SUPERCRIT
*
* There are only three functions which actually change the value of the internal
* state of this object after it's been instantiated
* There are only three functions which actually change the value of the
* internal state of this object after it's been instantiated
*
* - setState_TR(temperature, rho)
* - density(temperature, pressure, phase, rhoguess)
* - psat(temperature, waterState);
*
* The setState_TR() is the main function that sets the temperature and rho value.
* The density() function serves as a setState_TP() function, in that it sets
* internal state to a temperature and pressure. However, note that this is potentially
* multivalued. Therefore, we need to supply in addition a phase guess and a rho guess
* to the input temperature and pressure.
* The psat() function sets the internal state to the saturated liquid or saturated gas
* state, depending on the waterState parameter.
* The setState_TR() is the main function that sets the temperature and rho
* value. The density() function serves as a setState_TP() function, in that
* it sets internal state to a temperature and pressure. However, note that
* this is potentially multivalued. Therefore, we need to supply in addition a
* phase guess and a rho guess to the input temperature and pressure. The
* psat() function sets the internal state to the saturated liquid or
* saturated gas state, depending on the waterState parameter.
*
* Because the underlying object WaterPropsIAPWSphi is privately held, you can be
* sure that the underlying state of this object doesn't change except due to the
* three function calls listed above.
* Because the underlying object WaterPropsIAPWSphi is privately held, you can
* be sure that the underlying state of this object doesn't change except due
* to the three function calls listed above.
*
* @ingroup thermoprops
*
*/
class WaterPropsIAPWS
{
public:
//! Base constructor
WaterPropsIAPWS();
//! Copy constructor
/*!
* @param right Object to be copied
*/
WaterPropsIAPWS(const WaterPropsIAPWS& right);
//! assignment constructor
/*!
* @param right Object to be copied
*/
WaterPropsIAPWS& operator=(const WaterPropsIAPWS& right);
//! destructor
@ -229,16 +223,17 @@ public:
/*!
* Note, below T_c, this is a multivalued function.
*
* The #density() function calculates the density that is consistent with
* The density() function calculates the density that is consistent with
* a particular value of the temperature and pressure. It may therefore be
* multivalued or potentially there may be no answer from this function. It therefore
* takes a phase guess and a density guess as optional parameters. If no guesses are
* supplied to density(), a gas phase guess is assumed. This may or may not be what
* is wanted. Therefore, density() should usually at least be supplied with a phase
* guess so that it may manufacture an appropriate density guess.
* #density() manufactures the initial density guess, nondimensionalizes everything,
* and then calls #WaterPropsIAPWSphi::dfind(), which does the iterative calculation
* to find the density condition that matches the desired input pressure.
* multivalued or potentially there may be no answer from this function.
* It therefore takes a phase guess and a density guess as optional
* parameters. If no guesses are supplied to density(), a gas phase guess
* is assumed. This may or may not be what is wanted. Therefore, density()
* should usually at least be supplied with a phase guess so that it may
* manufacture an appropriate density guess. density() manufactures the
* initial density guess, nondimensionalizes everything, and then calls
* WaterPropsIAPWSphi::dfind(), which does the iterative calculation to
* find the density condition that matches the desired input pressure.
*
* @param temperature: Kelvin
* @param pressure : Pressure in Pascals (Newton/m**2)
@ -258,17 +253,17 @@ public:
/*!
* Note, below T_c, this is a multivalued function.
*
* The #density() function calculates the density that is consistent with
* a particular value of the temperature and pressure. It may therefore be
* multivalued or potentially there may be no answer from this function. It therefore
* takes a phase guess and a density guess as optional parameters. If no guesses are
* supplied to density(), a gas phase guess is assumed. This may or may not be what
* is wanted. Therefore, density() should usually at least be supplied with a phase
* guess so that it may manufacture an appropriate density guess.
* #density() manufactures the initial density guess, nondimensionalizes everything,
* and then calls #WaterPropsIAPWSphi::dfind(), which does the iterative calculation
* to find the density condition that matches the desired input pressure.
* The density() function calculates the density that is consistent with a
* particular value of the temperature and pressure. It may therefore be
* multivalued or potentially there may be no answer from this function.
* It therefore takes a phase guess and a density guess as optional
* parameters. If no guesses are supplied to density(), a gas phase guess
* is assumed. This may or may not be what is wanted. Therefore, density()
* should usually at least be supplied with a phase guess so that it may
* manufacture an appropriate density guess. density() manufactures the
* initial density guess, nondimensionalizes everything, and then calls
* WaterPropsIAPWSphi::dfind(), which does the iterative calculation to
* find the density condition that matches the desired input pressure.
*
* @param pressure : Pressure in Pascals (Newton/m**2)
* @param phase : guessed phase of water
@ -306,13 +301,12 @@ public:
//! Returns the isochoric pressure derivative wrt temperature
/*!
*
* beta = M / (rho * Rgas) (d (pressure) / dT) at constant rho
* beta = M / (rho * Rgas) (d (pressure) / dT) at constant rho
*
* Note for ideal gases this is equal to one.
*
* beta = delta (phi0_d() + phiR_d())
* - tau delta (phi0_dt() + phiR_dt())
* beta = delta (phi0_d() + phiR_d())
* - tau delta (phi0_dt() + phiR_dt())
*/
doublereal coeffPresExp() const;
@ -350,23 +344,23 @@ public:
*/
doublereal psat_est(doublereal temperature) const;
//! This function returns the saturation pressure given the
//! temperature as an input parameter, and sets the internal state to the saturated
//! This function returns the saturation pressure given the temperature as
//! an input parameter, and sets the internal state to the saturated
//! conditions.
/*!
* Note this function will return the saturation pressure, given the temperature.
* It will then set the state of the system to the saturation condition. The input
* parameter waterState is used to either specify the liquid state or the
* gas state at the desired temperature and saturated pressure.
* Note this function will return the saturation pressure, given the
* temperature. It will then set the state of the system to the
* saturation condition. The input parameter waterState is used to either
* specify the liquid state or the gas state at the desired temperature
* and saturated pressure.
*
* If the input temperature, T, is above T_c, this routine will set the internal
* state to T and the pressure to P_c. Then, return P_c.
* If the input temperature, T, is above T_c, this routine will set the
* internal state to T and the pressure to P_c. Then, return P_c.
*
* @param temperature input temperature (kelvin)
* @param waterState integer specifying the water state
*
* @return Returns the saturation pressure
* units = Pascal
* @return Returns the saturation pressure. units = Pascal
*/
doublereal psat(doublereal temperature, int waterState = WATER_LIQUID);
@ -386,13 +380,13 @@ public:
//! Returns the Phase State flag for the current state of the object
/*!
* @param checkState If true, this function does a complete check to see where
* in parameters space we are
* @param checkState If true, this function does a complete check to see
* where in parameters space we are
*
* There are three values:
* WATER_GAS below the critical temperature but below the critical density
* WATER_LIQUID below the critical temperature but above the critical density
* WATER_SUPERCRIT above the critical temperature
* - WATER_GAS below the critical temperature but below the critical density
* - WATER_LIQUID below the critical temperature but above the critical density
* - WATER_SUPERCRIT above the critical temperature
*/
int phaseState(bool checkState = false) const ;
@ -423,8 +417,6 @@ public:
private:
//! Calculate the dimensionless temp and rho and store internally.
/*!
* Private routine
*
* @param temperature input temperature (kelvin)
* @param rho density in kg m-3
*/
@ -432,7 +424,7 @@ private:
//! Utility routine in the calculation of the saturation pressure
/*!
* Private routine
* Calculate the Gibbs free energy in mks units of J kmol-1 K-1.
*
* @param temperature temperature (kelvin)
* @param pressure pressure (Pascal)
@ -445,8 +437,6 @@ private:
//! Utility routine in the calculation of the saturation pressure
/*!
* Private routine
*
* @param temperature temperature (kelvin)
* @param pressure pressure (Pascal)
* @param densLiq Output density of liquid
@ -456,8 +446,6 @@ private:
void corr1(doublereal temperature, doublereal pressure, doublereal& densLiq,
doublereal& densGas, doublereal& pcorr);
private:
//! pointer to the underlying object that does the calculations.
WaterPropsIAPWSphi* m_phi;

View file

@ -1,9 +1,10 @@
/**
* @file WaterPropsIAPWSphi.h
* Header for Lowest level of the classes which support a real water model
* (see class \link Cantera::WaterPropsIAPWS WaterPropsIAPWS\endlink and class \link WaterPropsIAPWSphi WaterPropsIAPWSphi\endlink).
* Header for Lowest level of the classes which support a real water model
* (see class \link Cantera::WaterPropsIAPWS WaterPropsIAPWS\endlink and class
* \link Cantera::WaterPropsIAPWSphi WaterPropsIAPWSphi\endlink).
*
* This class calculates dimensionless quantities.
* This class calculates dimensionless quantities.
*/
/*
* Copyright (2006) Sandia Corporation. Under the terms of
@ -18,36 +19,31 @@
namespace Cantera
{
//! Low level class for the real description of water.
/*!
* the WaterPropsIAPSWSphi class support low level calls for
* the real description of water.
*
* The reference is W. Wagner, A. Prub, "The IAPWS Formulation 1995 for the Thermodynamic
* Properties of Ordinary Water Substance for General and Scientific Use,"
* J. Phys. Chem. Ref. Dat, 31, 387, 2002.
* The reference is W. Wagner, A. Prub, "The IAPWS Formulation 1995 for the
* Thermodynamic Properties of Ordinary Water Substance for General and
* Scientific Use," J. Phys. Chem. Ref. Dat, 31, 387, 2002.
*
* Units Note: This class works with reduced units exclusively.
*/
class WaterPropsIAPWSphi
{
public:
//! Base constructor
WaterPropsIAPWSphi();
//! Calculate the Phi function, which is the base function
/*!
* The phi function is basically the helmholtz free energy
* Eqn. (6.4)
* All internal polynomials are recalculated.
* The phi function is basically the helmholtz free energy Eqn. (6.4) All
* internal polynomials are recalculated.
*
* @param tau Dimensionless temperature = T_c/T
* @param delta Dimensionless density = delta = rho / Rho_c
*/
doublereal phi(doublereal tau, doublereal delta);
//! Delta derivative of phi
//! Calculate derivative of phi wrt delta
/*!
* @param tau Dimensionless temperature = T_c/T
* @param delta Dimensionless density = delta = rho / Rho_c
@ -83,7 +79,6 @@ public:
//! Calculate the dimensionless pressure at tau and delta;
/*!
*
* pM/(rhoRT) = delta * phi_d() = 1.0 + delta phiR_d()
*
* @param tau Dimensionless temperature = T_c/T
@ -114,10 +109,10 @@ public:
doublereal dimdpdT(doublereal tau, doublereal delta);
/**
* This program computes the reduced density, given the reduced pressure
* and the reduced temperature, tau. It takes an initial guess, deltaGuess.
* DeltaGuess is important as this is a multivalued function below the
* critical point.
* This function computes the reduced density, given the reduced pressure
* and the reduced temperature, tau. It takes an initial guess,
* deltaGuess. DeltaGuess is important as this is a multivalued function
* below the critical point.
*
* @param p_red Value of the dimensionless pressure
* @param tau Dimensionless temperature = T_c/T
@ -128,37 +123,24 @@ public:
*/
doublereal dfind(doublereal p_red, doublereal tau, doublereal deltaGuess);
/**
* Calculate the dimensionless gibbs free energy
*/
//! Calculate the dimensionless gibbs free energy
doublereal gibbs_RT() const;
/**
* Calculate the dimensionless enthalpy, h/RT
*/
//! Calculate the dimensionless enthalpy, h/RT
doublereal enthalpy_RT() const;
/**
* Calculate the dimensionless entropy, s/R
*/
//! Calculate the dimensionless entropy, s/R
doublereal entropy_R() const;
/**
* Calculate the dimensionless internal energy, u/RT
*/
//! Calculate the dimensionless internal energy, u/RT
doublereal intEnergy_RT() const;
/**
* Calculate the dimensionless constant volume heat capacity, Cv/R
*/
//! Calculate the dimensionless constant volume heat capacity, Cv/R
doublereal cv_R() const;
/**
* Calculate the dimensionless constant pressure heat capacity, Cv/R
*/
//! Calculate the dimensionless constant pressure heat capacity, Cv/R
doublereal cp_R() const;
//! Calculates internal polynomials in tau and delta.
/*!
* This routine is used to store the internal state of tau and delta
@ -169,46 +151,48 @@ public:
*/
void tdpolycalc(doublereal tau, doublereal delta);
//! Return the value of phiR(), res
/*!
* Calculate Equation 6.6 for phiR, the residual part of the
* dimensionless Helmholtz free energy.
*/
doublereal phiR() const;
private:
//! nau calculation
//! Calculate Equation 6.5 for phi0, the ideal gas part of the
//! dimensionless Helmholtz free energy.
doublereal phi0() const;
//! calculation of d_phiR/d_d
//! Calculate d_phiR_d(delta), the first derivative of phiR wrt delta
doublereal phiR_d() const;
//! calculation of d_nau/d_d
//! Calculate d_phi0_d(delta), the first derivative of phi0 wrt delta
doublereal phi0_d() const;
//! calculation of d2_res/d_dd
//! Calculate d2_phiR_dd(delta), the second derivative of phiR wrt delta
doublereal phiR_dd() const;
//! calculation of d2_nau/d_dd
//! Calculate d2_phi0_dd(delta), the second derivative of phi0 wrt delta
doublereal phi0_dd() const;
//! calculation of d_nau/d_t
//! Calculate d_phi0/d(tau)
doublereal phi0_t() const;
//! calculation of d_res/d_t
//! Calculate Equation 6.6 for dphiRdtau, the derivative residual part of
//! the dimensionless Helmholtz free energy wrt temperature
doublereal phiR_t() const;
//! calculation of d2_res/d_tt
//! Calculate Equation 6.6 for dphiRdtau, the second derivative residual
//! part of the dimensionless Helmholtz free energy wrt temperature
doublereal phiR_tt() const;
//! calculation of d2_nau/d_tt
//! Calculate d2_phi0/dtau2
doublereal phi0_tt() const;
//! calculation of d2_res/d_dt
//! Calculate the mixed derivative d2_phiR/(dtau ddelta)
doublereal phiR_dt() const;
//! calculation of d2_nau/d_dt
//! Calculate the mixed derivative d2_phi0/(dtau ddelta)
doublereal phi0_dt() const;
/**
* intCheck() calculates all of the functions at a one point and
* prints out the result. It's used for conducting the internal
* check.
* Calculates all of the functions at a one point and prints out the
* result. It's used for conducting the internal check.
*
* @param tau Dimensionless temperature = T_c/T
* @param delta Dimensionless density = delta = rho / Rho_c
*/
void intCheck(doublereal tau, doublereal delta);
private:
//! Value of internally calculated polynomials of powers of TAU
doublereal TAUp[52];

View file

@ -17,28 +17,21 @@
namespace Cantera
{
/*
* default constructor -> object owns its own water evaluator
*/
WaterProps::WaterProps():
m_waterIAPWS(0),
m_own_sub(false)
{
// object owns its own water evaluator
m_waterIAPWS = new WaterPropsIAPWS();
m_own_sub = true;
}
/*
* constructor -> object in slave mode, It doesn't own its
* own water evaluator.
*/
WaterProps::WaterProps(PDSS_Water* wptr) :
m_waterIAPWS(0),
m_own_sub(false)
{
if (wptr) {
// object in slave mode; it doesn't own its own water evaluator.
m_waterIAPWS = wptr->getWater();
m_own_sub = false;
} else {
@ -60,9 +53,6 @@ WaterProps::WaterProps(WaterPropsIAPWS* waterIAPWS) :
}
}
/**
* Copy constructor
*/
WaterProps::WaterProps(const WaterProps& b) :
m_waterIAPWS(0),
m_own_sub(false)
@ -70,9 +60,6 @@ WaterProps::WaterProps(const WaterProps& b) :
*this = b;
}
/**
* Destructor
*/
WaterProps::~WaterProps()
{
if (m_own_sub) {
@ -80,9 +67,6 @@ WaterProps::~WaterProps()
}
}
/**
* Assignment operator
*/
WaterProps& WaterProps::operator=(const WaterProps& b)
{
if (&b == this) {
@ -106,27 +90,6 @@ WaterProps& WaterProps::operator=(const WaterProps& b)
return *this;
}
// Simple calculation of water density at atmospheric pressure.
// Valid up to boiling point.
/*
* This formulation has no dependence on the pressure and shouldn't
* be used where accuracy is needed.
*
* @param T temperature in kelvin
* @param P Pressure in pascal
* @param ifunc changes what's returned
*
* @return value returned depends on ifunc value:
* ifunc = 0 Returns the density in kg/m^3
* ifunc = 1 returns the derivative of the density wrt T.
* ifunc = 2 returns the 2nd derivative of the density wrt T
* ifunc = 3 returns the derivative of the density wrt P.
*
* Verification:
* Agrees with the CRC values (6-10) for up to 4 sig digits.
*
* units = returns density in kg m-3.
*/
doublereal WaterProps::density_T(doublereal T, doublereal P, int ifunc)
{
doublereal Tc = T - 273.15;
@ -179,37 +142,6 @@ doublereal WaterProps::density_T(doublereal T, doublereal P, int ifunc)
return rho;
}
// Bradley-Pitzer equation for the dielectric constant
// of water as a function of temperature and pressure.
/*!
* Returns the dimensionless relative dielectric constant
* and its derivatives.
*
* ifunc = 0 value
* ifunc = 1 Temperature derivative
* ifunc = 2 second temperature derivative
* ifunc = 3 return pressure first derivative
*
* Range of validity 0 to 350C, 0 to 1 kbar pressure
*
* @param T temperature (kelvin)
* @param P_pascal pressure in pascal
* @param ifunc changes what's returned from the function
*
* @return Depends on the value of ifunc:
* ifunc = 0 return value
* ifunc = 1 return temperature derivative
* ifunc = 2 return second temperature derivative
* ifunc = 3 return pressure first derivative
*
* Validation:
* Numerical experiments indicate that this function agrees with
* the Archer and Wang data in the CRC p. 6-10 to all 4 significant
* digits shown (0 to 100C).
*
* value at 25C, relEps = 78.38
*
*/
doublereal WaterProps::relEpsilon(doublereal T, doublereal P_pascal,
int ifunc)
{
@ -397,24 +329,11 @@ doublereal WaterProps::satPressure(doublereal T)
return m_waterIAPWS->psat(T);
}
// Returns the density of water
/*
* This function sets the internal temperature and pressure
* of the underlying object at the same time.
*
* @param T Temperature (kelvin)
* @param P pressure (pascal)
*/
doublereal WaterProps::density_IAPWS(doublereal temp, doublereal press)
{
return m_waterIAPWS->density(temp, press, WATER_LIQUID);
}
// Returns the density of water
/*
* This function uses the internal state of the
* underlying water object
*/
doublereal WaterProps::density_IAPWS() const
{
return m_waterIAPWS->density();
@ -440,10 +359,6 @@ doublereal WaterProps::isothermalCompressibility_IAPWS(doublereal temp, doublere
return m_waterIAPWS->isothermalCompressibility();
}
// Parameters for the viscosityWater() function
// \cond
@ -467,25 +382,8 @@ const doublereal presStar = 22.115E6; // Pa
const doublereal muStar = 55.071E-6; //Pa s
// \endcond
// Returns the viscosity of water at the current conditions
// (kg/m/s)
/*
* This function calculates the value of the viscosity of pure
* water at the current T and P.
*
* The formulas used are from the paper
*
* J. V. Sengers, J. T. R. Watson, "Improved International
* Formulations for the Viscosity and Thermal Conductivity of
* Water Substance", J. Phys. Chem. Ref. Data, 15, 1291 (1986).
*
* The formulation is accurate for all temperatures and pressures,
* for steam and for water, even near the critical point.
* Pressures above 500 MPa and temperature above 900 C are suspect.
*/
doublereal WaterProps::viscosityWater() const
{
doublereal temp = m_waterIAPWS->temperature();
doublereal dens = m_waterIAPWS->density();
@ -548,21 +446,6 @@ doublereal WaterProps::viscosityWater() const
return mubar * muStar;
}
//! Returns the thermal conductivity of water at the current conditions
//! (W/m/K)
/*!
* This function calculates the value of the thermal conductivity of
* water at the current T and P.
*
* The formulas used are from the paper
* J. V. Sengers, J. T. R. Watson, "Improved International
* Formulations for the Viscosity and Thermal Conductivity of
* Water Substance", J. Phys. Chem. Ref. Data, 15, 1291 (1986).
*
* The formulation is accurate for all temperatures and pressures,
* for steam and for water, even near the critical point.
* Pressures above 500 MPa and temperature above 900 C are suspect.
*/
doublereal WaterProps::thermalConductivityWater() const
{
static const doublereal Tstar = 647.27;
@ -658,5 +541,4 @@ doublereal WaterProps::thermalConductivityWater() const
return (lambda0bar * lambda1bar + lambda2bar) * lambdastar;
}
}

View file

@ -49,10 +49,6 @@ WaterPropsIAPWS:: WaterPropsIAPWS() :
m_phi = new WaterPropsIAPWSphi();
}
// Copy constructor
/*
* @param b Object to be copied
*/
WaterPropsIAPWS::WaterPropsIAPWS(const WaterPropsIAPWS& b) :
m_phi(0),
tau(b.tau),
@ -63,10 +59,6 @@ WaterPropsIAPWS::WaterPropsIAPWS(const WaterPropsIAPWS& b) :
m_phi->tdpolycalc(tau, delta);
}
// assignment constructor
/*
* @param right Object to be copied
*/
WaterPropsIAPWS& WaterPropsIAPWS::operator=(const WaterPropsIAPWS& b)
{
if (this == &b) {
@ -79,21 +71,12 @@ WaterPropsIAPWS& WaterPropsIAPWS::operator=(const WaterPropsIAPWS& b)
return *this;
}
// destructor
WaterPropsIAPWS::~WaterPropsIAPWS()
{
delete m_phi;
m_phi = 0;
}
/*
* Calculate the dimensionless temp and rho and store internally.
*
* @param temperature input temperature (kelvin)
* @param rho density in kg m-3
*
* this is a private function
*/
void WaterPropsIAPWS::calcDim(doublereal temperature, doublereal rho)
{
tau = T_c / temperature;
@ -112,8 +95,6 @@ void WaterPropsIAPWS::calcDim(doublereal temperature, doublereal rho)
}
}
// Calculate the Helmholtz free energy in mks units of J kmol-1 K-1,
// using the last temperature and density
doublereal WaterPropsIAPWS::helmholtzFE() const
{
doublereal retn = m_phi->phi(tau, delta);
@ -122,12 +103,6 @@ doublereal WaterPropsIAPWS::helmholtzFE() const
return retn * RT;
}
/*
* Calculate the pressure (Pascals), using the
* current internally stored temperature and density
* Temperature: kelvin
* rho: density in kg m-3
*/
doublereal WaterPropsIAPWS::pressure() const
{
doublereal retn = m_phi->pressureM_rhoRT(tau, delta);
@ -136,25 +111,9 @@ doublereal WaterPropsIAPWS::pressure() const
return retn * rho * Rgas * temperature/M_water;
}
/*
* Calculates the density given the temperature and the pressure,
* and a guess at the density. Note, below T_c, this is a
* multivalued function.
*
* parameters:
* temperature: Kelvin
* pressure : Pressure in Pascals (Newton/m**2)
* phase : guessed phase of water
* : -1: no guessed phase
* rhoguess : guessed density of the water
* : -1.0 no guessed density
*
* If a problem is encountered, a negative 1 is returned.
*/
doublereal WaterPropsIAPWS::density(doublereal temperature, doublereal pressure,
int phase, doublereal rhoguess)
{
doublereal deltaGuess = 0.0;
if (rhoguess == -1.0) {
if (phase != -1) {
@ -211,32 +170,6 @@ doublereal WaterPropsIAPWS::density(doublereal temperature, doublereal pressure,
return density_retn;
}
// Calculates the density given the temperature and the pressure,
// and a guess at the density, while not changing the internal state
/*
* Note, below T_c, this is a multivalued function.
*
* The #density() function calculates the density that is consistent with
* a particular value of the temperature and pressure. It may therefore be
* multivalued or potentially there may be no answer from this function. It therefore
* takes a phase guess and a density guess as optional parameters. If no guesses are
*
* supplied to density(), a gas phase guess is assumed. This may or may not be what
* is wanted. Therefore, density() should usually at least be supplied with a phase
* guess so that it may manufacture an appropriate density guess.
* #density() manufactures the initial density guess, nondimensionalizes everything,
* and then calls #WaterPropsIAPWSphi::dfind(), which does the iterative calculation
* to find the density condition that matches the desired input pressure.
*
* @param pressure : Pressure in Pascals (Newton/m**2)
* @param phase : guessed phase of water
* : -1: no guessed phase
* @param rhoguess : guessed density of the water
* : -1.0 no guessed density
* @return
* Returns the density. If an error is encountered in the calculation
* the value of -1.0 is returned.
*/
doublereal WaterPropsIAPWS::density_const(doublereal pressure,
int phase, doublereal rhoguess) const
{
@ -299,40 +232,18 @@ doublereal WaterPropsIAPWS::density_const(doublereal pressure,
return density_retn;
}
// Returns the density (kg m-3)
/*
* The density is an independent variable in the underlying equation of state
*
* @return Returns the density (kg m-3)
*/
doublereal WaterPropsIAPWS::density() const
{
return delta * Rho_c;
}
// Returns the temperature (Kelvin)
/*
* @return Returns the internally stored temperature
*/
doublereal WaterPropsIAPWS::temperature() const
{
return T_c / tau;
}
/*
* psat_est provides a rough estimate of the saturation
* pressure given the temperature. This is used as an initial
* guess for refining the pressure.
*
* Input
* temperature (kelvin)
*
* return:
* psat (Pascals)
*/
doublereal WaterPropsIAPWS::psat_est(doublereal temperature) const
{
static const doublereal A[8] = {
-7.8889166E0,
2.5514255E0,
@ -366,11 +277,6 @@ doublereal WaterPropsIAPWS::psat_est(doublereal temperature) const
return ps;
}
/*
* Returns the coefficient of isothermal compressibility
* of temperature and pressure.
* kappa = - d (ln V) / dP at constant T.
*/
doublereal WaterPropsIAPWS::isothermalCompressibility() const
{
doublereal dpdrho_val = dpdrho();
@ -378,13 +284,6 @@ doublereal WaterPropsIAPWS::isothermalCompressibility() const
return 1.0 / (dens * dpdrho_val);
}
// Returns the value of dp / drho at constant T at the current
// state of the object
/*
* units - Joules / kg
*
* @return returns dpdrho
*/
doublereal WaterPropsIAPWS::dpdrho() const
{
doublereal retn = m_phi->dimdpdrho(tau, delta);
@ -392,26 +291,11 @@ doublereal WaterPropsIAPWS::dpdrho() const
return retn * Rgas * temperature / M_water;
}
// Returns the isochoric pressure derivative wrt temperature
/*
* beta = M / (rho * Rgas) (d (pressure) / dT) at constant rho
*
* Note for ideal gases this is equal to one.
*
* beta = delta (phi0_d() + phiR_d())
* - tau delta (phi0_dt() + phiR_dt())
*/
doublereal WaterPropsIAPWS:: coeffPresExp() const
{
return m_phi->dimdpdT(tau, delta);
}
// Returns the coefficient of thermal expansion.
/*
* alpha = d (ln V) / dT at constant P.
*
* @return Returns the coefficient of thermal expansion
*/
doublereal WaterPropsIAPWS:: coeffThermExp() const
{
doublereal kappa = isothermalCompressibility();
@ -420,8 +304,6 @@ doublereal WaterPropsIAPWS:: coeffThermExp() const
return kappa * dens * Rgas * beta / M_water;
}
// Calculate the Gibbs free energy in mks units of J kmol-1 K-1.
// using the last temperature and density
doublereal WaterPropsIAPWS::Gibbs() const
{
doublereal gRT = m_phi->gibbs_RT();
@ -429,20 +311,6 @@ doublereal WaterPropsIAPWS::Gibbs() const
return gRT * Rgas * temperature;
}
// Utility routine in the calculation of the saturation pressure
/*
* Private routine
*
* Calculate the Gibbs free energy in mks units of
* J kmol-1 K-1.
*
* @param temperature temperature (kelvin)
* @param pressure pressure (Pascal)
* @param densLiq Output density of liquid
* @param densGas output Density of gas
* @param delGRT output delGRT
*/
void WaterPropsIAPWS::
corr(doublereal temperature, doublereal pressure, doublereal& densLiq,
doublereal& densGas, doublereal& delGRT)
@ -469,16 +337,6 @@ corr(doublereal temperature, doublereal pressure, doublereal& densLiq,
delGRT = gibbsLiqRT - gibbsGasRT;
}
// Utility routine in the calculation of the saturation pressure
/*
* Private routine
*
* @param temperature temperature (kelvin)
* @param pressure pressure (Pascal)
* @param densLiq Output density of liquid
* @param densGas output Density of gas
* @param pcorr output corrected pressure
*/
void WaterPropsIAPWS::
corr1(doublereal temperature, doublereal pressure, doublereal& densLiq,
doublereal& densGas, doublereal& pcorr)
@ -508,25 +366,6 @@ corr1(doublereal temperature, doublereal pressure, doublereal& densLiq,
pcorr = rhs * Rgas * temperature / M_water;
}
// This function returns the saturation pressure given the
// temperature as an input parameter, and sets the internal state to the saturated
// conditions.
/*
* Note this function will return the saturation pressure, given the temperature.
* It will then set the state of the system to the saturation condition. The input
* parameter waterState is used to either specify the liquid state or the
* gas state at the desired temperature and saturated pressure.
*
* If the input temperature, T, is above T_c, this routine will set the internal
* state to T and the pressure to P_c. Then, return P_c.
*
* @param temperature input temperature (kelvin)
* @param waterState integer specifying the water state
*
* @return Returns the saturation pressure
* units = Pascal
*/
doublereal WaterPropsIAPWS::psat(doublereal temperature, int waterState)
{
static int method = 1;
@ -569,16 +408,6 @@ doublereal WaterPropsIAPWS::psat(doublereal temperature, int waterState)
return p;
}
// Returns the Phase State flag for the current state of the object
/*
* @param checkState If true, this function does a complete check to see where
* in parameter space we are
*
* There are three values:
* WATER_GAS below the critical temperature but below the critical density
* WATER_LIQUID below the critical temperature but above the critical density
* WATER_SUPERCRIT above the critical temperature
*/
int WaterPropsIAPWS::phaseState(bool checkState) const
{
if (checkState) {
@ -624,11 +453,6 @@ int WaterPropsIAPWS::phaseState(bool checkState) const
return iState;
}
// Return the value of the density at the water spinodal point (on the liquid side)
// for the current temperature.
/*
* @return returns the density with units of kg m-3
*/
doublereal WaterPropsIAPWS::densSpinodalWater() const
{
doublereal temperature = T_c/tau;
@ -721,11 +545,6 @@ doublereal WaterPropsIAPWS::densSpinodalWater() const
return dens_new;
}
// Return the value of the density at the water spinodal point (on the gas side)
// for the current temperature.
/*
* @return returns the density with units of kg m-3
*/
doublereal WaterPropsIAPWS::densSpinodalSteam() const
{
doublereal temperature = T_c/tau;
@ -820,20 +639,12 @@ doublereal WaterPropsIAPWS::densSpinodalSteam() const
return dens_new;
}
/*
* Sets the internal state of the object to the
* specified temperature and density.
*/
void WaterPropsIAPWS::setState_TR(doublereal temperature, doublereal rho)
{
calcDim(temperature, rho);
m_phi->tdpolycalc(tau, delta);
}
/*
* Calculate the enthalpy in mks units of
* J kmol-1 K-1.
*/
doublereal WaterPropsIAPWS::enthalpy() const
{
doublereal temperature = T_c/tau;
@ -841,10 +652,6 @@ doublereal WaterPropsIAPWS::enthalpy() const
return hRT * Rgas * temperature;
}
/*
* Calculate the internal Energy in mks units of
* J kmol-1 K-1.
*/
doublereal WaterPropsIAPWS::intEnergy() const
{
doublereal temperature = T_c / tau;
@ -852,36 +659,24 @@ doublereal WaterPropsIAPWS::intEnergy() const
return uRT * Rgas * temperature;
}
/*
* Calculate the enthalpy in mks units of356
* J kmol-1 K-1.
*/
doublereal WaterPropsIAPWS::entropy() const
{
doublereal sR = m_phi->entropy_R();
return sR * Rgas;
}
/*
* Calculate heat capacity at constant volume
* J kmol-1 K-1.
*/
doublereal WaterPropsIAPWS::cv() const
{
doublereal cvR = m_phi->cv_R();
return cvR * Rgas;
}
// Calculate the constant pressure heat capacity in mks units of J kmol-1 K-1
// at the last temperature and density
doublereal WaterPropsIAPWS::cp() const
{
doublereal cpR = m_phi->cp_R();
return cpR * Rgas;
}
// Calculate the molar volume (kmol m-3)
// at the last temperature and density
doublereal WaterPropsIAPWS::molarVolume() const
{
doublereal rho = delta * Rho_c;

View file

@ -1,7 +1,8 @@
/**
* @file WaterPropsIAPWSphi.cpp
* Definitions for Lowest level of the classes which support a real water model
* (see class \link Cantera::WaterPropsIAPWS WaterPropsIAPWS\endlink and class #WaterPropsIAPWSphi).
* Definitions for Lowest level of the classes which support a real water
* model (see class \link Cantera::WaterPropsIAPWS WaterPropsIAPWS\endlink and
* class \link Cantera::WaterPropsIAPWSphi WaterPropsIAPWSphi \endlink).
*/
/*
* Copyright (2006) Sandia Corporation. Under the terms of
@ -242,6 +243,7 @@ static const int tiR[55] = {
1,
4 // 54
};
static const doublereal ni[57] = {
+0.0,
+0.12533547935523E-1, // 1
@ -302,7 +304,6 @@ static const doublereal ni[57] = {
+0.31806110878444E0 // 56
};
static const doublereal alphai[3] = {
+20.,
+20.,
@ -363,9 +364,6 @@ static const doublereal Bbetai[2] = {
};
// \endcond
/*
* Constructor for the object.
*/
WaterPropsIAPWSphi::WaterPropsIAPWSphi() :
TAUsave(-1.0),
TAUsqrt(-1.0),
@ -379,11 +377,6 @@ WaterPropsIAPWSphi::WaterPropsIAPWSphi() :
}
}
/*
* intCheck() calculates all of the functions at a one point and
* prints out the result. It's used for conducting the internal
* check.
*/
void WaterPropsIAPWSphi::intCheck(doublereal tau, doublereal delta)
{
tdpolycalc(tau, delta);
@ -428,10 +421,6 @@ void WaterPropsIAPWSphi::check2()
intCheck(tau, delta);
}
/*
* Calculate the polynomials in tau and delta, and store them in static
* storage.
*/
void WaterPropsIAPWSphi::tdpolycalc(doublereal tau, doublereal delta)
{
if ((tau != TAUsave) || 1) {
@ -451,10 +440,6 @@ void WaterPropsIAPWSphi::tdpolycalc(doublereal tau, doublereal delta)
}
}
/*
* Calculate Eqn. 6.5 for phi0, the ideal gas part of the
* dimensionless Helmholtz free energy.
*/
doublereal WaterPropsIAPWSphi::phi0() const
{
doublereal tau = TAUsave;
@ -469,13 +454,6 @@ doublereal WaterPropsIAPWSphi::phi0() const
return retn;
}
/*
* Calculate Eqn. 6.6 for phiR, the residual part of the
* dimensionless Helmholtz free energy.
*
* tau = dimensionless temperature
* delta = dimensionless pressure
*/
doublereal WaterPropsIAPWSphi::phiR() const
{
doublereal tau = TAUsave;
@ -532,10 +510,6 @@ doublereal WaterPropsIAPWSphi::phiR() const
return val;
}
/*
* Calculate the Phi function, which is basically the helmholtz free energy
* Eqn. (6.4)
*/
doublereal WaterPropsIAPWSphi::phi(doublereal tau, doublereal delta)
{
tdpolycalc(tau, delta);
@ -544,14 +518,6 @@ doublereal WaterPropsIAPWSphi::phi(doublereal tau, doublereal delta)
return nau + res;
}
/*
* Calculate d_phiR_d(delta), the first derivative of phiR
* wrt delta
*
* tau = dimensionless temperature
* delta = dimensionless pressure
*/
doublereal WaterPropsIAPWSphi::phiR_d() const
{
doublereal tau = TAUsave;
@ -622,24 +588,12 @@ doublereal WaterPropsIAPWSphi::phiR_d() const
return val;
}
/*
* Calculate d_phi0_d(delta), the first derivative of phi0
* wrt delta
*
* tau = dimensionless temperature
* delta = dimensionless pressure
*/
doublereal WaterPropsIAPWSphi::phi0_d() const
{
doublereal delta = DELTAsave;
return 1.0/delta;
}
/*
* Calculate the dPhidDelta function, which is basically the derivative
* of helmholtz free energy wrt delta
* Eqn. (6.4)
*/
doublereal WaterPropsIAPWSphi::phi_d(doublereal tau, doublereal delta)
{
tdpolycalc(tau, delta);
@ -648,13 +602,6 @@ doublereal WaterPropsIAPWSphi::phi_d(doublereal tau, doublereal delta)
return nau + res;
}
/*
* Calculate the dimensionless pressure at tau and delta;
*
* p/(rhoRT) = delta * phi_d()
*
* note: this is done so much, we have a separate routine.
*/
doublereal WaterPropsIAPWSphi::pressureM_rhoRT(doublereal tau, doublereal delta)
{
tdpolycalc(tau, delta);
@ -662,13 +609,6 @@ doublereal WaterPropsIAPWSphi::pressureM_rhoRT(doublereal tau, doublereal del
return 1.0 + delta * res;
}
/*
* Calculate d2_phiR_dd(delta), the second derivative of phiR
* wrt delta
*
* tau = dimensionless temperature
* delta = dimensionless pressure
*/
doublereal WaterPropsIAPWSphi::phiR_dd() const
{
doublereal tau = TAUsave;
@ -769,24 +709,12 @@ doublereal WaterPropsIAPWSphi::phiR_dd() const
return val;
}
/*
* Calculate d2_phi0_dd(delta), the second derivative of phi0
* wrt delta
*
* tau = dimensionless temperature
* delta = dimensionless pressure
*/
doublereal WaterPropsIAPWSphi::phi0_dd() const
{
doublereal delta = DELTAsave;
return -1.0/(delta*delta);
}
/*
* Calculate the d2_PhidDelta2 function, which is the second derivative
* of helmholtz free energy wrt delta
* Eqn. (6.4)
*/
doublereal WaterPropsIAPWSphi::phi_dd(doublereal tau, doublereal delta)
{
tdpolycalc(tau, delta);
@ -811,9 +739,6 @@ doublereal WaterPropsIAPWSphi::dimdpdT(doublereal tau, doublereal delta)
return (1.0 + delta * res1) - tau * delta * (res2);
}
/*
* Calculate d_phi0/d(tau)
*/
doublereal WaterPropsIAPWSphi::phi0_t() const
{
doublereal tau = TAUsave;
@ -826,13 +751,6 @@ doublereal WaterPropsIAPWSphi::phi0_t() const
return retn;
}
/*
* Calculate Eqn. 6.6 for dphiRdtau, the derivative residual part of the
* dimensionless Helmholtz free energy wrt temperature
*
* tau = dimensionless temperature
* delta = dimensionless pressure
*/
doublereal WaterPropsIAPWSphi::phiR_t() const
{
doublereal tau = TAUsave;
@ -898,11 +816,6 @@ doublereal WaterPropsIAPWSphi::phiR_t() const
return val;
}
/*
* Calculate the dPhidtau function, which is basically the derivative
* of helmholtz free energy wrt tau
* Eqn. (6.4)
*/
doublereal WaterPropsIAPWSphi::phi_t(doublereal tau, doublereal delta)
{
tdpolycalc(tau, delta);
@ -911,9 +824,6 @@ doublereal WaterPropsIAPWSphi::phi_t(doublereal tau, doublereal delta)
return nau + res;
}
/*
* Calculate d2_phi0/dtau2
*/
doublereal WaterPropsIAPWSphi::phi0_tt() const
{
doublereal tau = TAUsave;
@ -927,13 +837,6 @@ doublereal WaterPropsIAPWSphi::phi0_tt() const
return retn;
}
/*
* Calculate Eqn. 6.6 for dphiRdtau, the second derivative residual part of the
* dimensionless Helmholtz free energy wrt temperature
*
* tau = dimensionless temperature
* delta = dimensionless pressure
*/
doublereal WaterPropsIAPWSphi::phiR_tt() const
{
doublereal tau = TAUsave;
@ -1010,11 +913,6 @@ doublereal WaterPropsIAPWSphi::phiR_tt() const
return val;
}
/*
* Calculate the d2Phidtau2 function, which is basically the second derivative
* of helmholtz free energy wrt tau
* Eqn. (6.4)
*/
doublereal WaterPropsIAPWSphi::phi_tt(doublereal tau, doublereal delta)
{
tdpolycalc(tau, delta);
@ -1023,21 +921,11 @@ doublereal WaterPropsIAPWSphi::phi_tt(doublereal tau, doublereal delta)
return nau + res;
}
/**
* Calculate d2_phi0/dtauddelta
*/
doublereal WaterPropsIAPWSphi::phi0_dt() const
{
return 0.0;
}
/*
* Calculate d2_phiR_d(delta)d(tau), the mixed derivative of phi
* wrt delta and tau.
*
* tau = dimensionless temperature
* delta = dimensionless pressure
*/
doublereal WaterPropsIAPWSphi::phiR_dt() const
{
doublereal tau = TAUsave;
@ -1124,13 +1012,6 @@ doublereal WaterPropsIAPWSphi::phiR_dt() const
return val;
}
/*
* This program computes the reduced density, given the reduced pressure
* and the reduced temperature, tau. It takes an initial guess, deltaGuess.
* DeltaGuess is important as this is a multivalued function below the
* critical point.
*
*/
doublereal WaterPropsIAPWSphi::dfind(doublereal p_red, doublereal tau, doublereal deltaGuess)
{
doublereal dd = deltaGuess;
@ -1222,9 +1103,6 @@ doublereal WaterPropsIAPWSphi::dfind(doublereal p_red, doublereal tau, double
return dd;
}
/**
* Calculate the dimensionless gibbs free energy g/RT.
*/
doublereal WaterPropsIAPWSphi::gibbs_RT() const
{
doublereal delta = DELTAsave;
@ -1232,9 +1110,6 @@ doublereal WaterPropsIAPWSphi::gibbs_RT() const
return 1.0 + phi0() + phiR() + delta * rd;
}
/**
* Calculate the dimensionless enthalpy h/RT.
*/
doublereal WaterPropsIAPWSphi::enthalpy_RT() const
{
doublereal delta = DELTAsave;
@ -1245,9 +1120,6 @@ doublereal WaterPropsIAPWSphi::enthalpy_RT() const
return 1.0 + tau * (nt + rt) + delta * rd;
}
/*
* Calculate the dimensionless entropy s/R.
*/
doublereal WaterPropsIAPWSphi::entropy_R() const
{
doublereal tau = TAUsave;
@ -1258,9 +1130,6 @@ doublereal WaterPropsIAPWSphi::entropy_R() const
return tau * (nt + rt) - p0 - pR;
}
/*
* Calculate the dimensionless internal energy, u/RT.
*/
doublereal WaterPropsIAPWSphi::intEnergy_RT() const
{
doublereal tau = TAUsave;
@ -1269,9 +1138,6 @@ doublereal WaterPropsIAPWSphi::intEnergy_RT() const
return tau * (nt + rt);
}
/*
* Calculate the dimensionless constant volume Heat Capacity, Cv/R
*/
doublereal WaterPropsIAPWSphi::cv_R() const
{
doublereal tau = TAUsave;
@ -1280,9 +1146,6 @@ doublereal WaterPropsIAPWSphi::cv_R() const
return - tau * tau * (ntt + rtt);
}
/*
* Calculate the dimensionless constant pressure Heat Capacity, Cp/R
*/
doublereal WaterPropsIAPWSphi::cp_R() const
{
doublereal tau = TAUsave;