Cantera
Install
User Guide
Examples
Reference
Develop
Community
4.0.0a2
Toggle main menu visibility
Loading...
Searching...
No Matches
WaterSSTP.h
Go to the documentation of this file.
1
/**
2
* @file WaterSSTP.h
3
* Declares a ThermoPhase class consisting of pure water (see @ref thermoprops
4
* and class @link Cantera::WaterSSTP WaterSSTP@endlink).
5
*/
6
7
// This file is part of Cantera. See License.txt in the top-level directory or
8
// at https://cantera.org/license.txt for license and copyright information.
9
10
#ifndef CT_WATERSSTP_H
11
#define CT_WATERSSTP_H
12
13
#include "
SingleSpeciesTP.h
"
14
#include "
cantera/thermo/WaterPropsIAPWS.h
"
15
#include "
cantera/thermo/WaterProps.h
"
16
17
namespace
Cantera
18
{
19
20
class
WaterPropsIAPWS
;
21
class
WaterProps
;
22
//! Class for single-component water. This is designed to cover just the liquid
23
//! and supercritical phases of water.
24
/*!
25
* The reference is W. Wagner, A. Pruss, "The IAPWS Formulation 1995 for the
26
* Thermodynamic Properties of Ordinary Water Substance for General and
27
* Scientific Use," J. Phys. Chem. Ref. Dat, 31, 387, 2002.
28
*
29
* ## Specification of Species Standard State Properties
30
*
31
* The offsets used in the steam tables are different than NIST's. They assume
32
* u_liq(TP) = 0.0, s_liq(TP) = 0.0, where TP is the triple point conditions:
33
*
34
* - u(273.16, rho) = 0.0
35
* - s(273.16, rho) = 0.0
36
* - psat(273.16) = 611.655 Pascal
37
* - rho(273.16, psat) = 999.793 kg m-3
38
*
39
* These "steam table" assumptions are used by the WaterPropsIAPWS class.
40
* Therefore, offsets must be calculated to make the thermodynamic properties
41
* calculated within this class to be consistent with thermo properties within
42
* Cantera.
43
*
44
* The thermodynamic base state for water is set to the NIST basis here by
45
* specifying constants, #EW_Offset and #SW_Offset, one for energy quantities
46
* and one for entropy quantities. The offsets are specified so that the
47
* following properties hold:
48
*
49
* - Delta_Hfo_idealgas(298.15) = -241.826 kJ/gmol
50
* - So_idealgas(298.15, 1bar) = 188.835 J/gmolK
51
*
52
* (From http://webbook.nist.gov)
53
*
54
* The "o" here refers to a hypothetical ideal gas state. The way we achieve
55
* this in practice is to evaluate at a very low pressure and then use the
56
* theoretical ideal gas results to scale up to higher pressures:
57
*
58
* Ho(1bar) = H(P0)
59
*
60
* So(1bar) = S(P0) + RT ln(1bar/P0)
61
*
62
* ## Application within Kinetics Managers
63
*
64
* This is unimplemented.
65
*
66
* @ingroup thermoprops
67
*/
68
class
WaterSSTP
:
public
SingleSpeciesTP
69
{
70
public
:
71
//! Full constructor for a water phase
72
/*!
73
* @param inputFile String name of the input file
74
* @param id string id of the phase name
75
*/
76
explicit
WaterSSTP
(
const
string
& inputFile=
""
,
const
string
&
id
=
""
);
77
78
string
type
()
const override
{
79
return
"liquid-water-IAPWS95"
;
80
}
81
82
string
phaseOfMatter
()
const override
;
83
84
//! @name Molar Thermodynamic Properties of the Solution
85
//! @{
86
87
double
cv_mole
()
const override
;
88
89
//! @}
90
//! @name Mechanical Equation of State Properties
91
//! @{
92
93
double
pressure
()
const override
;
94
void
setPressure
(
double
p)
override
;
95
double
isothermalCompressibility
()
const override
;
96
double
thermalExpansionCoeff
()
const override
;
97
98
//! Return the derivative of the volumetric thermal expansion coefficient.
99
//! Units: 1/K2.
100
double
dthermalExpansionCoeffdT
()
const
;
101
102
//! @}
103
//! @name Properties of the Standard State of the Species in the Solution
104
//! @{
105
106
void
getStandardChemPotentials
(span<double> gss)
const override
;
107
void
getGibbs_RT
(span<double> grt)
const override
;
108
void
getEnthalpy_RT
(span<double> hrt)
const override
;
109
void
getEntropy_R
(span<double> sr)
const override
;
110
void
getCp_R
(span<double> cpr)
const override
;
111
void
getIntEnergy_RT
(span<double> urt)
const override
;
112
113
//! @}
114
//! @name Thermodynamic Values for the Species Reference State
115
//!
116
//! All functions in this group need to be overridden, because the
117
//! m_spthermo MultiSpeciesThermo function is not adequate for the real
118
//! equation of state.
119
//! @{
120
121
void
getEnthalpy_RT_ref
(span<double> hrt)
const override
;
122
void
getGibbs_RT_ref
(span<double> grt)
const override
;
123
void
getGibbs_ref
(span<double> g)
const override
;
124
void
getEntropy_R_ref
(span<double> er)
const override
;
125
void
getCp_R_ref
(span<double> cprt)
const override
;
126
void
getStandardVolumes_ref
(span<double> vol)
const override
;
127
//! @}
128
129
double
critTemperature
()
const override
;
130
double
critPressure
()
const override
;
131
double
critDensity
()
const override
;
132
133
double
satPressure
(
double
t)
override
;
134
135
bool
compatibleWithMultiPhase
()
const override
{
136
return
false
;
137
}
138
139
//! Return the fraction of vapor at the current conditions
140
/*!
141
* Below Tcrit, this routine will always return 0, by definition of the
142
* functionality of the routine. Above Tcrit, we query the density to toggle
143
* between 0 and 1.
144
*/
145
double
vaporFraction
()
const override
;
146
147
//! Set the temperature of the phase
148
/*!
149
* The density and composition of the phase is constant during this
150
* operator.
151
*
152
* @param temp Temperature (Kelvin)
153
*/
154
void
setTemperature
(
const
double
temp)
override
;
155
156
//! Set the density of the phase
157
/*!
158
* The temperature and composition of the phase is constant during this
159
* operator.
160
*
161
* @param dens value of the density in kg m-3
162
*/
163
void
setDensity
(
const
double
dens)
override
;
164
165
void
initThermo
()
override
;
166
167
//! Get a pointer to a changeable WaterPropsIAPWS object
168
WaterPropsIAPWS
*
getWater
() {
169
return
&
m_sub
;
170
}
171
172
//! Get a pointer to a changeable WaterPropsIAPWS object
173
WaterProps
*
getWaterProps
() {
174
return
m_waterProps
.get();
175
}
176
177
//! Switch that enables calculations in the gas phase
178
/**
179
* Since this phase represents a liquid (or supercritical) phase, it is an
180
* error to return a gas-phase answer. The sole intended use for this
181
* member function is to check the thermodynamic consistency of the
182
* underlying WaterProps class with ideal-gas thermo functions.
183
*/
184
void
_allowGasPhase
(
bool
flag) {
m_allowGasPhase
= flag; }
185
186
protected
:
187
//! This routine must be overridden because it is not applicable.
188
void
_updateThermo
()
const
;
189
190
private
:
191
//! WaterPropsIAPWS that calculates the real properties of water.
192
mutable
WaterPropsIAPWS
m_sub
;
193
194
//! Pointer to the WaterProps object
195
/*!
196
* This class is used to house several approximation routines for properties
197
* of water. This object owns m_waterProps, and the WaterPropsIAPWS object
198
* used by WaterProps is m_sub, which is defined above.
199
*/
200
unique_ptr<WaterProps>
m_waterProps
;
201
202
//! Molecular weight of Water -> %Cantera assumption
203
double
m_mw
= 0.0;
204
205
//! Offset constants used to obtain consistency with the NIST database.
206
/*!
207
* This is added to all internal energy and enthalpy results.
208
* units = J kmol-1.
209
*/
210
double
EW_Offset
= 0.0;
211
212
//! Offset constant used to obtain consistency with NIST convention.
213
/*!
214
* This is added to all internal entropy results.
215
* units = J kmol-1 K-1.
216
*/
217
double
SW_Offset
= 0.0;
218
219
//! Boolean is true if object has been properly initialized for calculation
220
bool
m_ready
=
false
;
221
222
/**
223
* Since this phase represents a liquid (or supercritical) phase, it is an
224
* error to return a gas-phase answer. However, if the below is true, then
225
* a gas-phase answer is allowed. This is used to check the thermodynamic
226
* consistency with ideal-gas thermo functions for example.
227
*/
228
bool
m_allowGasPhase
=
false
;
229
};
230
231
}
232
233
#endif
SingleSpeciesTP.h
Header for the SingleSpeciesTP class, which is a filter class for ThermoPhase, that eases the constru...
WaterPropsIAPWS.h
Headers for a class for calculating the equation of state of water from the IAPWS 1995 Formulation ba...
WaterProps.h
Header for a class used to house several approximation routines for properties of water.
Cantera::SingleSpeciesTP::SingleSpeciesTP
SingleSpeciesTP()=default
Base empty constructor.
Cantera::WaterPropsIAPWS
Class for calculating the equation of state of water.
Definition
WaterPropsIAPWS.h:162
Cantera::WaterProps
The WaterProps class is used to house several approximation routines for properties of water.
Definition
WaterProps.h:38
Cantera::WaterSSTP::setDensity
void setDensity(const double dens) override
Set the density of the phase.
Definition
WaterSSTP.cpp:323
Cantera::WaterSSTP::getGibbs_ref
void getGibbs_ref(span< double > g) const override
Returns the vector of the Gibbs function of the reference state at the current temperature of the sol...
Definition
WaterSSTP.cpp:170
Cantera::WaterSSTP::m_waterProps
unique_ptr< WaterProps > m_waterProps
Pointer to the WaterProps object.
Definition
WaterSSTP.h:200
Cantera::WaterSSTP::getCp_R
void getCp_R(span< double > cpr) const override
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
Definition
WaterSSTP.cpp:118
Cantera::WaterSSTP::thermalExpansionCoeff
double thermalExpansionCoeff() const override
Return the volumetric thermal expansion coefficient. Units: 1/K.
Definition
WaterSSTP.cpp:275
Cantera::WaterSSTP::m_sub
WaterPropsIAPWS m_sub
WaterPropsIAPWS that calculates the real properties of water.
Definition
WaterSSTP.h:192
Cantera::WaterSSTP::getEntropy_R_ref
void getEntropy_R_ref(span< double > er) const override
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
Definition
WaterSSTP.cpp:178
Cantera::WaterSSTP::m_ready
bool m_ready
Boolean is true if object has been properly initialized for calculation.
Definition
WaterSSTP.h:220
Cantera::WaterSSTP::pressure
double pressure() const override
Return the thermodynamic pressure (Pa).
Definition
WaterSSTP.cpp:241
Cantera::WaterSSTP::getIntEnergy_RT
void getIntEnergy_RT(span< double > urt) const override
Returns the vector of nondimensional Internal Energies of the standard state species at the current T...
Definition
WaterSSTP.cpp:86
Cantera::WaterSSTP::critPressure
double critPressure() const override
Critical pressure (Pa).
Definition
WaterSSTP.cpp:302
Cantera::WaterSSTP::SW_Offset
double SW_Offset
Offset constant used to obtain consistency with NIST convention.
Definition
WaterSSTP.h:217
Cantera::WaterSSTP::critDensity
double critDensity() const override
Critical density (kg/m3).
Definition
WaterSSTP.cpp:307
Cantera::WaterSSTP::getWater
WaterPropsIAPWS * getWater()
Get a pointer to a changeable WaterPropsIAPWS object.
Definition
WaterSSTP.h:168
Cantera::WaterSSTP::critTemperature
double critTemperature() const override
Critical temperature (K).
Definition
WaterSSTP.cpp:297
Cantera::WaterSSTP::getGibbs_RT
void getGibbs_RT(span< double > grt) const override
Get the nondimensional Gibbs functions for the species in their standard states at the current T and ...
Definition
WaterSSTP.cpp:98
Cantera::WaterSSTP::getCp_R_ref
void getCp_R_ref(span< double > cprt) const override
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
Definition
WaterSSTP.cpp:201
Cantera::WaterSSTP::WaterSSTP
WaterSSTP(const string &inputFile="", const string &id="")
Full constructor for a water phase.
Definition
WaterSSTP.cpp:16
Cantera::WaterSSTP::type
string type() const override
String indicating the thermodynamic model implemented.
Definition
WaterSSTP.h:78
Cantera::WaterSSTP::initThermo
void initThermo() override
Initialize the ThermoPhase object after all species have been set up.
Definition
WaterSSTP.cpp:28
Cantera::WaterSSTP::setPressure
void setPressure(double p) override
Set the internally stored pressure (Pa) at constant temperature and composition.
Definition
WaterSSTP.cpp:246
Cantera::WaterSSTP::vaporFraction
double vaporFraction() const override
Return the fraction of vapor at the current conditions.
Definition
WaterSSTP.cpp:337
Cantera::WaterSSTP::dthermalExpansionCoeffdT
double dthermalExpansionCoeffdT() const
Return the derivative of the volumetric thermal expansion coefficient.
Definition
WaterSSTP.cpp:280
Cantera::WaterSSTP::getEnthalpy_RT_ref
void getEnthalpy_RT_ref(span< double > hrt) const override
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
Definition
WaterSSTP.cpp:129
Cantera::WaterSSTP::cv_mole
double cv_mole() const override
Molar heat capacity at constant volume and composition [J/kmol/K].
Definition
WaterSSTP.cpp:124
Cantera::WaterSSTP::getEnthalpy_RT
void getEnthalpy_RT(span< double > hrt) const override
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
Definition
WaterSSTP.cpp:80
Cantera::WaterSSTP::getEntropy_R
void getEntropy_R(span< double > sr) const override
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
Definition
WaterSSTP.cpp:92
Cantera::WaterSSTP::EW_Offset
double EW_Offset
Offset constants used to obtain consistency with the NIST database.
Definition
WaterSSTP.h:210
Cantera::WaterSSTP::setTemperature
void setTemperature(const double temp) override
Set the temperature of the phase.
Definition
WaterSSTP.cpp:312
Cantera::WaterSSTP::isothermalCompressibility
double isothermalCompressibility() const override
Returns the isothermal compressibility. Units: 1/Pa.
Definition
WaterSSTP.cpp:270
Cantera::WaterSSTP::getStandardChemPotentials
void getStandardChemPotentials(span< double > gss) const override
Get the array of chemical potentials at unit activity for the species at their standard states at the...
Definition
WaterSSTP.cpp:108
Cantera::WaterSSTP::getGibbs_RT_ref
void getGibbs_RT_ref(span< double > grt) const override
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
Definition
WaterSSTP.cpp:149
Cantera::WaterSSTP::getWaterProps
WaterProps * getWaterProps()
Get a pointer to a changeable WaterPropsIAPWS object.
Definition
WaterSSTP.h:173
Cantera::WaterSSTP::_allowGasPhase
void _allowGasPhase(bool flag)
Switch that enables calculations in the gas phase.
Definition
WaterSSTP.h:184
Cantera::WaterSSTP::compatibleWithMultiPhase
bool compatibleWithMultiPhase() const override
Indicates whether this phase type can be used with class MultiPhase for equilibrium calculations.
Definition
WaterSSTP.h:135
Cantera::WaterSSTP::m_mw
double m_mw
Molecular weight of Water -> Cantera assumption.
Definition
WaterSSTP.h:203
Cantera::WaterSSTP::m_allowGasPhase
bool m_allowGasPhase
Since this phase represents a liquid (or supercritical) phase, it is an error to return a gas-phase a...
Definition
WaterSSTP.h:228
Cantera::WaterSSTP::_updateThermo
void _updateThermo() const
This routine must be overridden because it is not applicable.
Cantera::WaterSSTP::getStandardVolumes_ref
void getStandardVolumes_ref(span< double > vol) const override
Get the molar volumes of the species reference states at the current T and P_ref of the solution.
Definition
WaterSSTP.cpp:222
Cantera::WaterSSTP::phaseOfMatter
string phaseOfMatter() const override
String indicating the mechanical phase of the matter in this Phase.
Definition
WaterSSTP.cpp:21
Cantera::WaterSSTP::satPressure
double satPressure(double t) override
Return the saturation pressure given the temperature.
Definition
WaterSSTP.cpp:329
Cantera
Namespace for the Cantera kernel.
Definition
AnyMap.cpp:595
include
cantera
thermo
WaterSSTP.h
Generated by
1.17.0