Cantera 2.6.0
PDSS_Water.h
Go to the documentation of this file.
1/**
2 * @file PDSS_Water.h
3 * Implementation of a pressure dependent standard state
4 * virtual function for a Pure Water Phase
5 * (see \ref pdssthermo and class \link Cantera::PDSS_Water PDSS_Water\endlink).
6 */
7
8// This file is part of Cantera. See License.txt in the top-level directory or
9// at https://cantera.org/license.txt for license and copyright information.
10
11#ifndef CT_PDSS_WATER_H
12#define CT_PDSS_WATER_H
13
14#include "PDSS.h"
15#include "WaterPropsIAPWS.h"
16#include "WaterProps.h"
17
18namespace Cantera
19{
20//! Class for the liquid water pressure dependent
21//! standard state
22/*!
23 * Notes:
24 *
25 * Base state for thermodynamic properties:
26 *
27 * The thermodynamic base state for water is set to the NIST basis here by
28 * specifying constants EW_Offset and SW_Offset. These offsets are specified so
29 * that the following properties hold:
30 *
31 * Delta_Hfo_gas(298.15) = -241.826 kJ/gmol
32 * So_gas(298.15, 1bar) = 188.835 J/gmolK
33 *
34 * (http://webbook.nist.gov)
35 *
36 * The "o" here refers to a hypothetical ideal gas state. The way we achieve
37 * this in practice is to evaluate at a very low pressure and then use the
38 * theoretical ideal gas results to scale up to higher pressures:
39 *
40 * Ho(1bar) = H(P0)
41 *
42 * So(1bar) = S(P0) + RT ln(1bar/P0)
43 *
44 * The offsets used in the steam tables are different than NIST's. They assume
45 * u_liq(TP) = 0.0, s_liq(TP) = 0.0, where TP is the triple point conditions.
46 *
47 * @ingroup pdssthermo
48 */
49class PDSS_Water : public PDSS_Molar
50{
51public:
52 //! Default constructor
53 PDSS_Water();
54
55 //! @name Molar Thermodynamic Properties of the Species Standard State in the Solution
56 //! @{
57
58 // See PDSS.h for documentation of functions overridden from Class PDSS
59
60 virtual doublereal enthalpy_mole() const;
61 virtual doublereal intEnergy_mole() const;
62 virtual doublereal entropy_mole() const;
63 virtual doublereal gibbs_mole() const;
64 virtual doublereal cp_mole() const;
65 virtual doublereal cv_mole() const;
66 virtual doublereal molarVolume() const;
67 virtual doublereal density() const;
68
69 //! @}
70 //! @name Properties of the Reference State of the Species in the Solution
71 //! @{
72
73 //! Returns a reference pressure value that can be safely calculated by the
74 //! underlying real equation of state for water
75 /*!
76 * Note, this function is needed because trying to calculate a one atm value
77 * around the critical point will cause a crash
78 *
79 * @param temp Temperature (Kelvin)
80 */
81 doublereal pref_safe(doublereal temp) const;
82
83 virtual doublereal gibbs_RT_ref() const;
84 virtual doublereal enthalpy_RT_ref() const;
85 virtual doublereal entropy_R_ref() const;
86 virtual doublereal cp_R_ref() const;
87 virtual doublereal molarVolume_ref() const;
88
89 //! @}
90 //! @name Mechanical Equation of State Properties
91 //! @{
92
93 virtual doublereal pressure() const;
94 virtual void setPressure(doublereal pres);
95 virtual void setTemperature(doublereal temp);
96 virtual void setState_TP(doublereal temp, doublereal pres);
97 virtual void setState_TR(doublereal temp, doublereal rho);
98
99 //! Set the density of the water phase
100 /*!
101 * This is a non-virtual function because it specific to this object.
102 *
103 * @param dens Density of the water (kg/m3)
104 */
105 void setDensity(doublereal dens);
106
107 virtual doublereal thermalExpansionCoeff() const;
108
109 //! Return the derivative of the volumetric thermal expansion coefficient.
110 //! Units: 1/K2.
111 /*!
112 * The thermal expansion coefficient is defined as
113 * \f[
114 * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
115 * \f]
116 */
117 virtual doublereal dthermalExpansionCoeffdT() const;
118
119 //! Returns the isothermal compressibility. Units: 1/Pa.
120 /*!
121 * The isothermal compressibility is defined as
122 * \f[
123 * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
124 * \f]
125 * or
126 * \f[
127 * \kappa_T = \frac{1}{\rho}\left(\frac{\partial \rho}{\partial P}\right)_T
128 * \f]
129 */
130 virtual doublereal isothermalCompressibility() const;
131
132 //! @}
133 //! @name Miscellaneous properties of the standard state
134 //! @{
135
136 virtual doublereal critTemperature() const;
137 virtual doublereal critPressure() const;
138 virtual doublereal critDensity() const;
139 virtual doublereal satPressure(doublereal t);
140
141 //! Get a pointer to a changeable WaterPropsIAPWS object
143 return &m_sub;
144 }
145
146 //! Get a pointer to a changeable WaterPropsIAPWS object
148 return &m_waterProps;
149 }
150
151 virtual void getParameters(AnyMap& eosNode) const;
152
153 //! @}
154
155private:
156 //! Pointer to the WaterPropsIAPWS object, which does the actual calculations
157 //! for the real equation of state
158 /*!
159 * This object owns m_sub
160 */
162
163 //! Pointer to the WaterProps object
164 /*!
165 * This class is used to house several approximation
166 * routines for properties of water.
167 *
168 * This object owns m_waterProps, and the WaterPropsIAPWS object used by
169 * WaterProps is m_sub, which is defined above.
170 */
172
173 //! State of the system - density
174 /*!
175 * Density is the independent variable here, but it's hidden behind the
176 * object's interface.
177 */
178 doublereal m_dens;
179
180 //! state of the fluid
181 /*!
182 * @code
183 * 0 WATER_GAS
184 * 1 WATER_LIQUID
185 * 2 WATER_SUPERCRIT
186 * 3 WATER_UNSTABLELIQUID
187 * 4 WATER_UNSTABLEGAS
188 * @endcode
189 */
191
192 /**
193 * Offset constants used to obtain consistency with the NIST database.
194 * This is added to all internal energy and enthalpy results.
195 * units = J kmol-1.
196 */
197 doublereal EW_Offset;
198
199 /**
200 * Offset constant used to obtain consistency with NIST convention.
201 * This is added to all internal entropy results.
202 * units = J kmol-1 K-1.
203 */
204 doublereal SW_Offset;
205
206public:
207 /**
208 * Since this phase represents a liquid phase, it's an error to
209 * return a gas-phase answer. However, if the below is true, then
210 * a gas-phase answer is allowed. This is used to check the thermodynamic
211 * consistency with ideal-gas thermo functions for example.
212 */
214};
215
216}
217
218#endif
Declarations for the virtual base class PDSS (pressure dependent standard state) which handles calcul...
Headers for a class for calculating the equation of state of water from the IAPWS 1995 Formulation ba...
Header for a class used to house several approximation routines for properties of water.
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:399
Base class for PDSS classes which compute molar properties directly.
Definition: PDSS.h:483
Class for the liquid water pressure dependent standard state.
Definition: PDSS_Water.h:50
WaterProps m_waterProps
Pointer to the WaterProps object.
Definition: PDSS_Water.h:171
virtual void getParameters(AnyMap &eosNode) const
Store the parameters needed to reconstruct a copy of this PDSS object.
Definition: PDSS_Water.cpp:262
virtual doublereal cp_R_ref() const
Return the molar heat capacity divided by R at reference pressure.
Definition: PDSS_Water.cpp:119
WaterPropsIAPWS m_sub
Pointer to the WaterPropsIAPWS object, which does the actual calculations for the real equation of st...
Definition: PDSS_Water.h:161
virtual doublereal pressure() const
Returns the pressure (Pa)
Definition: PDSS_Water.cpp:137
WaterPropsIAPWS * getWater()
Get a pointer to a changeable WaterPropsIAPWS object.
Definition: PDSS_Water.h:142
virtual doublereal cp_mole() const
Return the molar const pressure heat capacity in units of J kmol-1 K-1.
Definition: PDSS_Water.cpp:77
doublereal pref_safe(doublereal temp) const
Returns a reference pressure value that can be safely calculated by the underlying real equation of s...
Definition: PDSS_Water.cpp:241
virtual doublereal critPressure() const
critical pressure
Definition: PDSS_Water.cpp:201
virtual doublereal enthalpy_mole() const
Return the molar enthalpy in units of J kmol-1.
Definition: PDSS_Water.cpp:57
virtual void setPressure(doublereal pres)
Sets the pressure in the object.
Definition: PDSS_Water.cpp:143
virtual void setState_TP(doublereal temp, doublereal pres)
Set the internal temperature and pressure.
Definition: PDSS_Water.cpp:228
doublereal EW_Offset
Offset constants used to obtain consistency with the NIST database.
Definition: PDSS_Water.h:197
virtual doublereal cv_mole() const
Return the molar const volume heat capacity in units of J kmol-1 K-1.
Definition: PDSS_Water.cpp:82
virtual doublereal thermalExpansionCoeff() const
Return the volumetric thermal expansion coefficient. Units: 1/K.
Definition: PDSS_Water.cpp:170
virtual void setTemperature(doublereal temp)
Set the internal temperature.
Definition: PDSS_Water.cpp:222
virtual doublereal dthermalExpansionCoeffdT() const
Return the derivative of the volumetric thermal expansion coefficient.
Definition: PDSS_Water.cpp:175
virtual doublereal entropy_mole() const
Return the molar entropy in units of J kmol-1 K-1.
Definition: PDSS_Water.cpp:67
void setDensity(doublereal dens)
Set the density of the water phase.
Definition: PDSS_Water.cpp:211
virtual doublereal molarVolume_ref() const
Return the molar volume at reference pressure.
Definition: PDSS_Water.cpp:128
virtual doublereal critTemperature() const
critical temperature
Definition: PDSS_Water.cpp:196
virtual doublereal molarVolume() const
Return the molar volume at standard state.
Definition: PDSS_Water.cpp:87
virtual doublereal gibbs_mole() const
Return the molar Gibbs free energy in units of J kmol-1.
Definition: PDSS_Water.cpp:72
int m_iState
state of the fluid
Definition: PDSS_Water.h:190
virtual doublereal enthalpy_RT_ref() const
Return the molar enthalpy divided by RT at reference pressure.
Definition: PDSS_Water.cpp:101
virtual void setState_TR(doublereal temp, doublereal rho)
Set the internal temperature and density.
Definition: PDSS_Water.cpp:234
virtual doublereal density() const
Return the standard state density at standard state.
Definition: PDSS_Water.cpp:217
WaterProps * getWaterProps()
Get a pointer to a changeable WaterPropsIAPWS object.
Definition: PDSS_Water.h:147
virtual doublereal entropy_R_ref() const
Return the molar entropy divided by R at reference pressure.
Definition: PDSS_Water.cpp:110
virtual doublereal satPressure(doublereal t)
saturation pressure
Definition: PDSS_Water.cpp:254
doublereal m_dens
State of the system - density.
Definition: PDSS_Water.h:178
virtual doublereal gibbs_RT_ref() const
Return the molar Gibbs free energy divided by RT at reference pressure.
Definition: PDSS_Water.cpp:92
doublereal SW_Offset
Offset constant used to obtain consistency with NIST convention.
Definition: PDSS_Water.h:204
bool m_allowGasPhase
Since this phase represents a liquid phase, it's an error to return a gas-phase answer.
Definition: PDSS_Water.h:213
virtual doublereal critDensity() const
critical density
Definition: PDSS_Water.cpp:206
PDSS_Water()
Default constructor.
Definition: PDSS_Water.cpp:16
virtual doublereal intEnergy_mole() const
Return the molar internal Energy in units of J kmol-1.
Definition: PDSS_Water.cpp:62
virtual doublereal isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
Definition: PDSS_Water.cpp:191
Class for calculating the equation of state of water.
The WaterProps class is used to house several approximation routines for properties of water.
Definition: WaterProps.h:100
Namespace for the Cantera kernel.
Definition: AnyMap.h:29