My Project
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 namespace Opm {
38 
53 template <class Scalar>
54 class SimpleH2O : public Component<Scalar, SimpleH2O<Scalar> >
55 {
56  typedef ::Opm::IdealGas<Scalar> IdealGas;
57 
58  static const Scalar R; // specific gas constant of water
59 
60 public:
64  static const char* name()
65  { return "H2O"; }
66 
70  static bool gasIsCompressible()
71  { return true; }
72 
76  static bool liquidIsCompressible()
77  { return false; }
78 
82  static bool gasIsIdeal()
83  { return true; }
84 
88  static Scalar molarMass()
89  { return 18e-3; }
90 
94  static Scalar criticalTemperature()
95  { return 647.096; /* [K] */ }
96 
100  static Scalar criticalPressure()
101  { return 22.064e6; /* [N/m^2] */ }
102 
106  static Scalar tripleTemperature()
107  { return 273.16; /* [K] */ }
108 
112  static Scalar triplePressure()
113  { return 611.657; /* [N/m^2] */ }
114 
127  template <class Evaluation>
128  static Evaluation vaporPressure(const Evaluation& T)
129  {
130  if (T > criticalTemperature())
131  return criticalPressure();
132  if (T < tripleTemperature())
133  return 0; // water is solid: We don't take sublimation into account
134 
135  static const Scalar n[10] = {
136  0.11670521452767e4, -0.72421316703206e6, -0.17073846940092e2,
137  0.12020824702470e5, -0.32325550322333e7, 0.14915108613530e2,
138  -0.48232657361591e4, 0.40511340542057e6, -0.23855557567849,
139  0.65017534844798e3
140  };
141 
142  Evaluation sigma = T + n[8]/(T - n[9]);
143 
144  Evaluation A = (sigma + n[0])*sigma + n[1];
145  Evaluation B = (n[2]*sigma + n[3])*sigma + n[4];
146  Evaluation C = (n[5]*sigma + n[6])*sigma + n[7];
147 
148  Evaluation tmp = 2.0*C/(sqrt(B*B - 4.0*A*C) - B);
149  tmp *= tmp;
150  tmp *= tmp;
151 
152  return 1e6*tmp;
153  }
154 
161  template <class Evaluation>
162  static Evaluation gasEnthalpy(const Evaluation& temperature,
163  const Evaluation& /*pressure*/)
164  { return 1.976e3*temperature + 40.65e3/molarMass(); }
165 
166 
170  template <class Evaluation>
171  static Evaluation gasHeatCapacity(const Evaluation&,
172  const Evaluation&)
173  { return 1.976e3; }
174 
181  template <class Evaluation>
182  static Evaluation liquidEnthalpy(const Evaluation& temperature,
183  const Evaluation& /*pressure*/)
184  { return 4180*temperature; }
185 
189  template <class Evaluation>
190  static Evaluation liquidHeatCapacity(const Evaluation&,
191  const Evaluation&)
192  { return 4.184e3; }
193 
207  template <class Evaluation>
208  static Evaluation gasInternalEnergy(const Evaluation& temperature,
209  const Evaluation& pressure)
210  {
211  return
212  gasEnthalpy(temperature, pressure) -
213  1/molarMass()* // conversion from [J/(mol K)] to [J/(kg K)]
214  IdealGas::R*temperature; // = pressure *spec. volume for an ideal gas
215  }
216 
223  template <class Evaluation>
224  static Evaluation liquidInternalEnergy(const Evaluation& temperature,
225  const Evaluation& pressure)
226  {
227  return
228  liquidEnthalpy(temperature, pressure) -
229  pressure/liquidDensity(temperature, pressure);
230  }
231 
238  template <class Evaluation>
239  static Evaluation liquidThermalConductivity(const Evaluation& /*temperature*/,
240  const Evaluation& /*pressure*/)
241  {
242  return 0.578078; // conductivity of liquid water [W / (m K ) ] IAPWS evaluated at p=.1 MPa, T=8°C
243  }
244 
251  template <class Evaluation>
252  static Evaluation gasThermalConductivity(const Evaluation& /*temperature*/,
253  const Evaluation& /*pressure*/)
254  {
255  return 0.028224; // conductivity of steam [W / (m K ) ] IAPWS evaluated at p=.1 MPa, T=8°C
256  }
257 
264  template <class Evaluation>
265  static Evaluation gasDensity(const Evaluation& temperature, const Evaluation& pressure)
266  {
267  // Assume an ideal gas
268  return molarMass()*IdealGas::molarDensity(temperature, pressure);
269  }
270 
277  template <class Evaluation>
278  static Evaluation gasPressure(const Evaluation& temperature, const Evaluation& density)
279  {
280  // Assume an ideal gas
281  return IdealGas::pressure(temperature, density/molarMass());
282  }
283 
290  template <class Evaluation>
291  static Evaluation liquidDensity(const Evaluation& /*temperature*/, const Evaluation& /*pressure*/)
292  {
293  return 1000;
294  }
295 
302  template <class Evaluation>
303  static Evaluation liquidPressure(const Evaluation& /*temperature*/, const Evaluation& /*density*/)
304  {
305  throw std::logic_error("The liquid pressure is undefined for incompressible fluids");
306  }
307 
315  template <class Evaluation>
316  static Evaluation gasViscosity(const Evaluation& /*temperature*/,
317  const Evaluation& /*pressure*/)
318  {
319  return 1e-05;
320  }
321 
328  template <class Evaluation>
329  static Evaluation liquidViscosity(const Evaluation& /*temperature*/, const Evaluation& /*pressure*/)
330  {
331  return 1e-03;
332  }
333 };
334 
335 template <class Scalar>
336 const Scalar SimpleH2O<Scalar>::R = Constants<Scalar>::R / 18e-3;
337 
338 } // namespace Opm
339 
340 #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:42
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:55
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of steam .
Definition: SimpleH2O.hpp:208
static Evaluation gasHeatCapacity(const Evaluation &, const Evaluation &)
Specific isobaric heat capacity of the component [J/kg] as a gas.
Definition: SimpleH2O.hpp:171
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition: SimpleH2O.hpp:76
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: SimpleH2O.hpp:82
static Evaluation gasThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of steam .
Definition: SimpleH2O.hpp:252
static Scalar tripleTemperature()
Returns the temperature at water's triple point.
Definition: SimpleH2O.hpp:106
static Evaluation liquidPressure(const Evaluation &, const Evaluation &)
The pressure of water in at a given density and temperature.
Definition: SimpleH2O.hpp:303
static Evaluation liquidHeatCapacity(const Evaluation &, const Evaluation &)
Specific isobaric heat capacity of the component [J/kg] as a liquid.
Definition: SimpleH2O.hpp:190
static Evaluation vaporPressure(const Evaluation &T)
The vapor pressure in of pure water at a given temperature.
Definition: SimpleH2O.hpp:128
static Evaluation liquidDensity(const Evaluation &, const Evaluation &)
The density of pure water at a given pressure and temperature .
Definition: SimpleH2O.hpp:291
static Scalar molarMass()
The molar mass in of water.
Definition: SimpleH2O.hpp:88
static Scalar criticalTemperature()
Returns the critical temperature of water.
Definition: SimpleH2O.hpp:94
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of liquid water .
Definition: SimpleH2O.hpp:182
static Evaluation gasViscosity(const Evaluation &, const Evaluation &)
The dynamic viscosity of steam.
Definition: SimpleH2O.hpp:316
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition: SimpleH2O.hpp:70
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of water steam .
Definition: SimpleH2O.hpp:162
static Evaluation gasPressure(const Evaluation &temperature, const Evaluation &density)
The pressure of steam in at a given density and temperature.
Definition: SimpleH2O.hpp:278
static Evaluation liquidInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of liquid water .
Definition: SimpleH2O.hpp:224
static Evaluation liquidThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of liquid water .
Definition: SimpleH2O.hpp:239
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of steam at a given pressure and temperature.
Definition: SimpleH2O.hpp:265
static Scalar criticalPressure()
Returns the critical pressure of water.
Definition: SimpleH2O.hpp:100
static Scalar triplePressure()
Returns the pressure at water's triple point.
Definition: SimpleH2O.hpp:112
static const char * name()
A human readable name for the water.
Definition: SimpleH2O.hpp:64
static Evaluation liquidViscosity(const Evaluation &, const Evaluation &)
The dynamic viscosity of pure water.
Definition: SimpleH2O.hpp:329