Cantera  4.0.0a1
Loading...
Searching...
No Matches
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
56 //! @{
57
58 // See PDSS.h for documentation of functions overridden from Class PDSS
59
60 double enthalpy_mole() const override;
61 double intEnergy_mole() const override;
62 double entropy_mole() const override;
63 double gibbs_mole() const override;
64 double cp_mole() const override;
65 double cv_mole() const override;
66 double molarVolume() const override;
67 double density() const override;
68 double dVdT() const override;
69 double dVdP() const override;
70
71 //! @}
72 //! @name Properties of the Reference State of the Species in the Solution
73 //! @{
74
75 //! Returns a reference pressure value that can be safely calculated by the
76 //! underlying real equation of state for water
77 /*!
78 * Note, this function is needed because trying to calculate a one atm value
79 * around the critical point will cause a crash
80 *
81 * @param temp Temperature (Kelvin)
82 */
83 double pref_safe(double temp) const;
84
85 double gibbs_RT_ref() const override;
86 double enthalpy_RT_ref() const override;
87 double entropy_R_ref() const override;
88 double cp_R_ref() const override;
89 double molarVolume_ref() const override;
90
91 //! @}
92 //! @name Mechanical Equation of State Properties
93 //! @{
94
95 double pressure() const override;
96 void setPressure(double pres) override;
97 void setTemperature(double temp) override;
98 void setState_TP(double temp, double pres) override;
99
100 //! Set the density of the water phase
101 /*!
102 * This is a non-virtual function because it specific to this object.
103 *
104 * @param dens Density of the water (kg/m3)
105 */
106 void setDensity(double dens);
107
108 double thermalExpansionCoeff() const override;
109
110 //! Return the derivative of the volumetric thermal expansion coefficient.
111 //! Units: 1/K2.
112 /*!
113 * The thermal expansion coefficient is defined as
114 * @f[
115 * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
116 * @f]
117 */
118 double dthermalExpansionCoeffdT() const;
119
120 //! Returns the isothermal compressibility. Units: 1/Pa.
121 /*!
122 * The isothermal compressibility is defined as
123 * @f[
124 * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
125 * @f]
126 * or
127 * @f[
128 * \kappa_T = \frac{1}{\rho}\left(\frac{\partial \rho}{\partial P}\right)_T
129 * @f]
130 */
131 double isothermalCompressibility() const;
132
133 //! @}
134 //! @name Miscellaneous properties of the standard state
135 //! @{
136
137 double critTemperature() const override;
138 double critPressure() const override;
139 double critDensity() const override;
140 double satPressure(double t) override;
141
142 //! Get a pointer to a changeable WaterPropsIAPWS object
144 return &m_sub;
145 }
146
147 //! Get a pointer to a changeable WaterPropsIAPWS object
149 return &m_waterProps;
150 }
151
152 void getParameters(AnyMap& eosNode) const override;
153
154 //! @}
155
156private:
157 //! Pointer to the WaterPropsIAPWS object, which does the actual calculations
158 //! for the real equation of state
159 /*!
160 * This object owns m_sub
161 */
163
164 //! Pointer to the WaterProps object
165 /*!
166 * This class is used to house several approximation
167 * routines for properties of water.
168 *
169 * This object owns m_waterProps, and the WaterPropsIAPWS object used by
170 * WaterProps is m_sub, which is defined above.
171 */
173
174 //! State of the system - density
175 /*!
176 * Density is the independent variable here, but it's hidden behind the
177 * object's interface.
178 */
179 double m_dens;
180
181 //! state of the fluid
182 /*!
183 * @code
184 * 0 WATER_GAS
185 * 1 WATER_LIQUID
186 * 2 WATER_SUPERCRIT
187 * 3 WATER_UNSTABLELIQUID
188 * 4 WATER_UNSTABLEGAS
189 * @endcode
190 */
191 int m_iState = WATER_LIQUID;
192
193 /**
194 * Offset constants used to obtain consistency with the NIST database.
195 * This is added to all internal energy and enthalpy results.
196 * units = J kmol-1.
197 */
198 double EW_Offset = 0.0;
199
200 /**
201 * Offset constant used to obtain consistency with NIST convention.
202 * This is added to all internal entropy results.
203 * units = J kmol-1 K-1.
204 */
205 double SW_Offset = 0.0;
206
207public:
208 /**
209 * Since this phase represents a liquid phase, it's an error to
210 * return a gas-phase answer. However, if the below is true, then
211 * a gas-phase answer is allowed. This is used to check the thermodynamic
212 * consistency with ideal-gas thermo functions for example.
213 */
214 bool m_allowGasPhase = false;
215};
216
217}
218
219#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:431
Base class for PDSS classes which compute molar properties directly.
Definition PDSS.h:440
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:172
void setPressure(double pres) override
Sets the pressure in the object.
double molarVolume() const override
Return the molar volume at standard state.
void setTemperature(double temp) override
Set the internal temperature.
double enthalpy_mole() const override
Return the molar enthalpy in units of J kmol-1.
double thermalExpansionCoeff() const override
Return the volumetric thermal expansion coefficient. Units: 1/K.
WaterPropsIAPWS m_sub
Pointer to the WaterPropsIAPWS object, which does the actual calculations for the real equation of st...
Definition PDSS_Water.h:162
double pressure() const override
Returns the pressure (Pa)
double critPressure() const override
critical pressure
double SW_Offset
Offset constant used to obtain consistency with NIST convention.
Definition PDSS_Water.h:205
double critDensity() const override
critical density
WaterPropsIAPWS * getWater()
Get a pointer to a changeable WaterPropsIAPWS object.
Definition PDSS_Water.h:143
double gibbs_RT_ref() const override
Return the molar Gibbs free energy divided by RT at reference pressure.
double critTemperature() const override
critical temperature
double isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
double entropy_R_ref() const override
Return the molar entropy divided by R at reference pressure.
double dthermalExpansionCoeffdT() const
Return the derivative of the volumetric thermal expansion coefficient.
double dVdP() const override
Return the pressure derivative of the standard state molar volume at constant temperature [m³/kmol/Pa...
double enthalpy_RT_ref() const override
Return the molar enthalpy divided by RT at reference pressure.
double cv_mole() const override
Return the molar const volume heat capacity in units of J kmol-1 K-1.
void getParameters(AnyMap &eosNode) const override
Store the parameters needed to reconstruct a copy of this PDSS object.
double EW_Offset
Offset constants used to obtain consistency with the NIST database.
Definition PDSS_Water.h:198
double intEnergy_mole() const override
Return the molar internal Energy in units of J kmol-1.
double entropy_mole() const override
Return the molar entropy in units of J kmol-1 K-1.
void setState_TP(double temp, double pres) override
Set the internal temperature and pressure.
int m_iState
state of the fluid
Definition PDSS_Water.h:191
double cp_mole() const override
Return the molar const pressure heat capacity in units of J kmol-1 K-1.
double m_dens
State of the system - density.
Definition PDSS_Water.h:179
double pref_safe(double temp) const
Returns a reference pressure value that can be safely calculated by the underlying real equation of s...
WaterProps * getWaterProps()
Get a pointer to a changeable WaterPropsIAPWS object.
Definition PDSS_Water.h:148
double density() const override
Return the standard state density at standard state.
double gibbs_mole() const override
Return the molar Gibbs free energy in units of J kmol-1.
bool m_allowGasPhase
Since this phase represents a liquid phase, it's an error to return a gas-phase answer.
Definition PDSS_Water.h:214
double molarVolume_ref() const override
Return the molar volume at reference pressure.
void setDensity(double dens)
Set the density of the water phase.
PDSS_Water()
Default constructor.
double dVdT() const override
Return the temperature derivative of the standard state molar volume at constant pressure [m³/kmol/K]...
double satPressure(double t) override
saturation pressure
double cp_R_ref() const override
Return the molar heat capacity divided by R at reference pressure.
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:38
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595