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 
32 
33 #include "Component.hpp"
34 
35 #include <cmath>
36 
37 namespace Opm {
38 
53 template <class Scalar>
54 class SimpleH2O : public Component<Scalar, SimpleH2O<Scalar> >
55 {
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/(Opm::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 1976*(temperature - 293.15) + 2.45e6; }
165 
172  template <class Evaluation>
173  static Evaluation liquidEnthalpy(const Evaluation& temperature,
174  const Evaluation& /*pressure*/)
175  { return 4180*(temperature - 293.15); }
176 
190  template <class Evaluation>
191  static Evaluation gasInternalEnergy(const Evaluation& temperature,
192  const Evaluation& pressure)
193  {
194  return
195  gasEnthalpy(temperature, pressure) -
196  1/molarMass()* // conversion from [J/(mol K)] to [J/(kg K)]
197  IdealGas::R*temperature; // = pressure *spec. volume for an ideal gas
198  }
199 
206  template <class Evaluation>
207  static Evaluation liquidInternalEnergy(const Evaluation& temperature,
208  const Evaluation& pressure)
209  {
210  return
211  liquidEnthalpy(temperature, pressure) -
212  pressure/liquidDensity(temperature, pressure);
213  }
214 
221  template <class Evaluation>
222  static Evaluation liquidThermalConductivity(const Evaluation& /*temperature*/,
223  const Evaluation& /*pressure*/)
224  {
225  return 0.578078; // conductivity of liquid water [W / (m K ) ] IAPWS evaluated at p=.1 MPa, T=8°C
226  }
227 
234  template <class Evaluation>
235  static Evaluation gasThermalConductivity(const Evaluation& /*temperature*/,
236  const Evaluation& /*pressure*/)
237  {
238  return 0.028224; // conductivity of steam [W / (m K ) ] IAPWS evaluated at p=.1 MPa, T=8°C
239  }
240 
247  template <class Evaluation>
248  static Evaluation gasDensity(const Evaluation& temperature, const Evaluation& pressure)
249  {
250  // Assume an ideal gas
251  return molarMass()*IdealGas::molarDensity(temperature, pressure);
252  }
253 
260  template <class Evaluation>
261  static Evaluation gasPressure(const Evaluation& temperature, const Evaluation& density)
262  {
263  // Assume an ideal gas
264  return IdealGas::pressure(temperature, density/molarMass());
265  }
266 
273  template <class Evaluation>
274  static Evaluation liquidDensity(const Evaluation& /*temperature*/, const Evaluation& /*pressure*/)
275  {
276  return 1000;
277  }
278 
285  template <class Evaluation>
286  static Evaluation liquidPressure(const Evaluation& /*temperature*/, const Evaluation& /*density*/)
287  {
288  OPM_THROW(std::logic_error,
289  "The liquid pressure is undefined for incompressible fluids");
290  }
291 
299  template <class Evaluation>
300  static Evaluation gasViscosity(const Evaluation& /*temperature*/,
301  const Evaluation& /*pressure*/)
302  {
303  return 1e-05;
304  }
305 
312  template <class Evaluation>
313  static Evaluation liquidViscosity(const Evaluation& /*temperature*/, const Evaluation& /*pressure*/)
314  {
315  return 1e-03;
316  }
317 };
318 
319 template <class Scalar>
320 const Scalar SimpleH2O<Scalar>::R = Opm::Constants<Scalar>::R / 18e-3;
321 
322 } // namespace Opm
323 
324 #endif
static Scalar tripleTemperature()
Returns the temperature at water&#39;s triple point.
Definition: SimpleH2O.hpp:106
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...
A simple version of pure water.
Definition: SimpleH2O.hpp:54
Relations valid for an ideal gas.
Abstract base class of a pure chemical species.
Definition: Component.hpp:43
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of water steam .
Definition: SimpleH2O.hpp:162
static Scalar criticalPressure()
Returns the critical pressure of water.
Definition: SimpleH2O.hpp:100
static Scalar molarMass()
The molar mass in of water.
Definition: SimpleH2O.hpp:88
static Evaluation gasViscosity(const Evaluation &, const Evaluation &)
The dynamic viscosity of steam.
Definition: SimpleH2O.hpp:300
static Evaluation gasDensity(const Evaluation &temperature, const Evaluation &pressure)
The density of steam at a given pressure and temperature.
Definition: SimpleH2O.hpp:248
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of steam .
Definition: SimpleH2O.hpp:191
static Evaluation gasPressure(const Evaluation &temperature, const Evaluation &density)
The pressure of steam in at a given density and temperature.
Definition: SimpleH2O.hpp:261
Definition: Air_Mesitylene.hpp:33
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 liquidEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of liquid water .
Definition: SimpleH2O.hpp:173
static const Scalar R
The ideal gas constant .
Definition: IdealGas.hpp:41
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition: SimpleH2O.hpp:76
static const char * name()
A human readable name for the water.
Definition: SimpleH2O.hpp:64
A central place for various physical constants occuring in some equations.
Definition: Constants.hpp:40
Abstract base class of a pure chemical species.
static Evaluation liquidInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of liquid water .
Definition: SimpleH2O.hpp:207
static Evaluation vaporPressure(const Evaluation &T)
The vapor pressure in of pure water at a given temperature.
Definition: SimpleH2O.hpp:128
Relations valid for an ideal gas.
Definition: IdealGas.hpp:37
static Evaluation gasThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of steam .
Definition: SimpleH2O.hpp:235
static Evaluation liquidThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of liquid water .
Definition: SimpleH2O.hpp:222
static Evaluation liquidPressure(const Evaluation &, const Evaluation &)
The pressure of water in at a given density and temperature.
Definition: SimpleH2O.hpp:286
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition: SimpleH2O.hpp:70
static Evaluation molarDensity(const Evaluation &temperature, const Evaluation &pressure)
The molar density of the gas , depending on pressure and temperature.
Definition: IdealGas.hpp:67
static Evaluation liquidDensity(const Evaluation &, const Evaluation &)
The density of pure water at a given pressure and temperature .
Definition: SimpleH2O.hpp:274
static Scalar criticalTemperature()
Returns the critical temperature of water.
Definition: SimpleH2O.hpp:94
static Evaluation liquidViscosity(const Evaluation &, const Evaluation &)
The dynamic viscosity of pure water.
Definition: SimpleH2O.hpp:313
static Scalar triplePressure()
Returns the pressure at water&#39;s triple point.
Definition: SimpleH2O.hpp:112
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: SimpleH2O.hpp:82