My Project
Loading...
Searching...
No Matches
SimpleH2O.hpp
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18
19 Consult the COPYING file in the top-level source directory of this
20 module for the precise wording of the license and the list of
21 copyright holders.
22*/
27#ifndef OPM_SIMPLE_H2O_HPP
28#define OPM_SIMPLE_H2O_HPP
29
30#include "Component.hpp"
31
34
35#include <cmath>
36
37#include <string_view>
38
39namespace Opm {
40
55template <class Scalar>
56class SimpleH2O : public Component<Scalar, SimpleH2O<Scalar> >
57{
58 typedef ::Opm::IdealGas<Scalar> IdealGas;
59
60 static const Scalar R; // specific gas constant of water
61
62public:
66 static std::string_view name()
67 { return "H2O"; }
68
72 static bool gasIsCompressible()
73 { return true; }
74
79 { return false; }
80
84 static bool gasIsIdeal()
85 { return true; }
86
90 static Scalar molarMass()
91 { return 18e-3; }
92
96 static Scalar criticalTemperature()
97 { return 647.096; /* [K] */ }
98
102 static Scalar criticalPressure()
103 { return 22.064e6; /* [N/m^2] */ }
104
108 static Scalar tripleTemperature()
109 { return 273.16; /* [K] */ }
110
114 static Scalar triplePressure()
115 { return 611.657; /* [N/m^2] */ }
116
129 template <class Evaluation>
130 static Evaluation vaporPressure(const Evaluation& T)
131 {
132 if (T > criticalTemperature())
133 return criticalPressure();
134 if (T < tripleTemperature())
135 return 0; // water is solid: We don't take sublimation into account
136
137 static const Scalar n[10] = {
138 0.11670521452767e4, -0.72421316703206e6, -0.17073846940092e2,
139 0.12020824702470e5, -0.32325550322333e7, 0.14915108613530e2,
140 -0.48232657361591e4, 0.40511340542057e6, -0.23855557567849,
141 0.65017534844798e3
142 };
143
144 Evaluation sigma = T + n[8]/(T - n[9]);
145
146 Evaluation A = (sigma + n[0])*sigma + n[1];
147 Evaluation B = (n[2]*sigma + n[3])*sigma + n[4];
148 Evaluation C = (n[5]*sigma + n[6])*sigma + n[7];
149
150 Evaluation tmp = 2.0*C/(sqrt(B*B - 4.0*A*C) - B);
151 tmp *= tmp;
152 tmp *= tmp;
153
154 return 1e6*tmp;
155 }
156
163 template <class Evaluation>
164 static Evaluation gasEnthalpy(const Evaluation& temperature,
165 const Evaluation& /*pressure*/)
166 { return 1.976e3*temperature + 40.65e3/molarMass(); }
167
168
172 template <class Evaluation>
173 static Evaluation gasHeatCapacity(const Evaluation&,
174 const Evaluation&)
175 { return 1.976e3; }
176
183 template <class Evaluation>
184 static Evaluation liquidEnthalpy(const Evaluation& temperature,
185 const Evaluation& /*pressure*/)
186 { return 4180*temperature; }
187
191 template <class Evaluation>
192 static Evaluation liquidHeatCapacity(const Evaluation&,
193 const Evaluation&)
194 { return 4.184e3; }
195
209 template <class Evaluation>
210 static Evaluation gasInternalEnergy(const Evaluation& temperature,
211 const Evaluation& pressure)
212 {
213 return
214 gasEnthalpy(temperature, pressure) -
215 1/molarMass()* // conversion from [J/(mol K)] to [J/(kg K)]
216 IdealGas::R*temperature; // = pressure *spec. volume for an ideal gas
217 }
218
225 template <class Evaluation>
226 static Evaluation liquidInternalEnergy(const Evaluation& temperature,
227 const Evaluation& pressure)
228 {
229 return
230 liquidEnthalpy(temperature, pressure) -
231 pressure/liquidDensity(temperature, pressure);
232 }
233
240 template <class Evaluation>
241 static Evaluation liquidThermalConductivity(const Evaluation& /*temperature*/,
242 const Evaluation& /*pressure*/)
243 {
244 return 0.578078; // conductivity of liquid water [W / (m K ) ] IAPWS evaluated at p=.1 MPa, T=8°C
245 }
246
253 template <class Evaluation>
254 static Evaluation gasThermalConductivity(const Evaluation& /*temperature*/,
255 const Evaluation& /*pressure*/)
256 {
257 return 0.028224; // conductivity of steam [W / (m K ) ] IAPWS evaluated at p=.1 MPa, T=8°C
258 }
259
266 template <class Evaluation>
267 static Evaluation gasDensity(const Evaluation& temperature, const Evaluation& pressure)
268 {
269 // Assume an ideal gas
270 return molarMass()*IdealGas::molarDensity(temperature, pressure);
271 }
272
279 template <class Evaluation>
280 static Evaluation gasPressure(const Evaluation& temperature, const Evaluation& density)
281 {
282 // Assume an ideal gas
283 return IdealGas::pressure(temperature, density/molarMass());
284 }
285
292 template <class Evaluation>
293 static Evaluation liquidDensity(const Evaluation& /*temperature*/, const Evaluation& /*pressure*/)
294 {
295 return 1000;
296 }
297
304 template <class Evaluation>
305 static Evaluation liquidPressure(const Evaluation& /*temperature*/, const Evaluation& /*density*/)
306 {
307 throw std::logic_error("The liquid pressure is undefined for incompressible fluids");
308 }
309
317 template <class Evaluation>
318 static Evaluation gasViscosity(const Evaluation& /*temperature*/,
319 const Evaluation& /*pressure*/)
320 {
321 return 1e-05;
322 }
323
330 template <class Evaluation>
331 static Evaluation liquidViscosity(const Evaluation& /*temperature*/, const Evaluation& /*pressure*/)
332 {
333 return 1e-03;
334 }
335};
336
337template <class Scalar>
338const Scalar SimpleH2O<Scalar>::R = Constants<Scalar>::R / 18e-3;
339
340} // namespace Opm
341
342#endif
Abstract base class of a pure chemical species.
Relations valid for an ideal gas.
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...
Abstract base class of a pure chemical species.
Definition Component.hpp:44
static const Scalar R
The ideal gas constant [J/(mol K)].
Definition Constants.hpp:45
Relations valid for an ideal gas.
Definition IdealGas.hpp:38
static const Scalar R
The ideal gas constant .
Definition IdealGas.hpp:41
static Evaluation pressure(const Evaluation &temperature, const Evaluation &rhoMolar)
The pressure of the gas in , depending on the molar density and temperature.
Definition IdealGas.hpp:58
static Evaluation molarDensity(const Evaluation &temperature, const Evaluation &pressure)
The molar density of the gas , depending on pressure and temperature.
Definition IdealGas.hpp:67
A simple version of pure water.
Definition SimpleH2O.hpp:57
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of steam .
Definition SimpleH2O.hpp:210
static Evaluation gasHeatCapacity(const Evaluation &, const Evaluation &)
Specific isobaric heat capacity of the component [J/kg] as a gas.
Definition SimpleH2O.hpp:173
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition SimpleH2O.hpp:78
static std::string_view name()
A human readable name for the water.
Definition SimpleH2O.hpp:66
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition SimpleH2O.hpp:84
static Evaluation gasThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of steam .
Definition SimpleH2O.hpp:254
static Scalar tripleTemperature()
Returns the temperature at water's triple point.
Definition SimpleH2O.hpp:108
static Evaluation liquidPressure(const Evaluation &, const Evaluation &)
The pressure of water in at a given density and temperature.
Definition SimpleH2O.hpp:305
static Evaluation liquidHeatCapacity(const Evaluation &, const Evaluation &)
Specific isobaric heat capacity of the component [J/kg] as a liquid.
Definition SimpleH2O.hpp:192
static Evaluation vaporPressure(const Evaluation &T)
The vapor pressure in of pure water at a given temperature.
Definition SimpleH2O.hpp:130
static Evaluation liquidDensity(const Evaluation &, const Evaluation &)
The density of pure water at a given pressure and temperature .
Definition SimpleH2O.hpp:293
static Scalar molarMass()
The molar mass in of water.
Definition SimpleH2O.hpp:90
static Scalar criticalTemperature()
Returns the critical temperature of water.
Definition SimpleH2O.hpp:96
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of liquid water .
Definition SimpleH2O.hpp:184
static Evaluation gasViscosity(const Evaluation &, const Evaluation &)
The dynamic viscosity of steam.
Definition SimpleH2O.hpp:318
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition SimpleH2O.hpp:72
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of water steam .
Definition SimpleH2O.hpp:164
static Evaluation gasPressure(const Evaluation &temperature, const Evaluation &density)
The pressure of steam in at a given density and temperature.
Definition SimpleH2O.hpp:280
static Evaluation liquidInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of liquid water .
Definition SimpleH2O.hpp:226
static Evaluation liquidThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of liquid water .
Definition SimpleH2O.hpp:241
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of steam at a given pressure and temperature.
Definition SimpleH2O.hpp:267
static Scalar criticalPressure()
Returns the critical pressure of water.
Definition SimpleH2O.hpp:102
static Scalar triplePressure()
Returns the pressure at water's triple point.
Definition SimpleH2O.hpp:114
static Evaluation liquidViscosity(const Evaluation &, const Evaluation &)
The dynamic viscosity of pure water.
Definition SimpleH2O.hpp:331
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30