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  Copyright (C) 2009-2013 by Andreas Lauser
5 
6  This file is part of the Open Porous Media project (OPM).
7 
8  OPM is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 2 of the License, or
11  (at your option) any later version.
12 
13  OPM is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with OPM. If not, see <http://www.gnu.org/licenses/>.
20 */
25 #ifndef OPM_SIMPLE_H2O_HPP
26 #define OPM_SIMPLE_H2O_HPP
27 
30 
31 #include "Component.hpp"
32 
33 #include <cmath>
34 
35 namespace Opm {
36 
51 template <class Scalar>
52 class SimpleH2O : public Component<Scalar, SimpleH2O<Scalar> >
53 {
55 
56  static const Scalar R; // specific gas constant of water
57 
58 public:
62  static const char *name()
63  { return "H2O"; }
64 
68  static bool gasIsCompressible()
69  { return true; }
70 
74  static bool liquidIsCompressible()
75  { return false; }
76 
80  static bool gasIsIdeal()
81  { return true; }
82 
86  static Scalar molarMass()
87  { return 18e-3; }
88 
93  { return 647.096; /* [K] */ }
94 
99  { return 22.064e6; /* [N/m^2] */ }
100 
105  { return 273.16; /* [K] */ }
106 
111  { return 611.657; /* [N/m^2] */ }
112 
125  template <class Evaluation>
126  static Evaluation vaporPressure(const Evaluation& T)
127  {
128  typedef Opm::MathToolbox<Evaluation> Toolbox;
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/(Toolbox::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
Abstract base class of a pure chemical species.
Definition: Component.hpp:42
static Evaluation gasInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of steam .
Definition: SimpleH2O.hpp:191
static Scalar criticalTemperature()
Returns the critical temperature of water.
Definition: SimpleH2O.hpp:92
static Evaluation gasPressure(const Evaluation &temperature, const Evaluation &density)
The pressure of steam in at a given density and temperature.
Definition: SimpleH2O.hpp:261
static Evaluation liquidPressure(const Evaluation &, const Evaluation &)
The pressure of water in at a given density and temperature.
Definition: SimpleH2O.hpp:286
static bool liquidIsCompressible()
Returns true iff the liquid phase is assumed to be compressible.
Definition: SimpleH2O.hpp:74
Definition: MathToolbox.hpp:39
Definition: Air_Mesitylene.hpp:31
static Evaluation liquidThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of liquid water .
Definition: SimpleH2O.hpp:222
static Scalar criticalPressure()
Returns the critical pressure of water.
Definition: SimpleH2O.hpp:98
Scalar Scalar
Definition: Component.hpp:45
static Evaluation gasEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of water steam .
Definition: SimpleH2O.hpp:162
static Evaluation liquidInternalEnergy(const Evaluation &temperature, const Evaluation &pressure)
Specific internal energy of liquid water .
Definition: SimpleH2O.hpp:207
static Scalar molarMass()
The molar mass in of water.
Definition: SimpleH2O.hpp:86
static Evaluation liquidDensity(const Evaluation &, const Evaluation &)
The density of pure water at a given pressure and temperature .
Definition: SimpleH2O.hpp:274
Evaluation< Scalar, VarSetTag, numVars > sqrt(const Evaluation< Scalar, VarSetTag, numVars > &x)
Definition: Math.hpp:278
static bool gasIsCompressible()
Returns true iff the gas phase is assumed to be compressible.
Definition: SimpleH2O.hpp:68
static Scalar triplePressure()
Returns the pressure at water's triple point.
Definition: SimpleH2O.hpp:110
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:56
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 molarDensity(const Evaluation &temperature, const Evaluation &pressure)
The molar density of the gas , depending on pressure and temperature.
Definition: IdealGas.hpp:65
static const char * name()
A human readable name for the water.
Definition: SimpleH2O.hpp:62
static const Scalar R
The ideal gas constant .
Definition: IdealGas.hpp:39
static Evaluation gasThermalConductivity(const Evaluation &, const Evaluation &)
Specific heat conductivity of steam .
Definition: SimpleH2O.hpp:235
static Evaluation liquidEnthalpy(const Evaluation &temperature, const Evaluation &)
Specific enthalpy of liquid water .
Definition: SimpleH2O.hpp:173
static Scalar tripleTemperature()
Returns the temperature at water's triple point.
Definition: SimpleH2O.hpp:104
Relations valid for an ideal gas.
static Evaluation vaporPressure(const Evaluation &T)
The vapor pressure in of pure water at a given temperature.
Definition: SimpleH2O.hpp:126
static bool gasIsIdeal()
Returns true iff the gas phase is assumed to be ideal.
Definition: SimpleH2O.hpp:80
Relations valid for an ideal gas.
Definition: IdealGas.hpp:35
A simple version of pure water.
Definition: SimpleH2O.hpp:52
static Evaluation gasViscosity(const Evaluation &, const Evaluation &)
The dynamic viscosity of steam.
Definition: SimpleH2O.hpp:300
Abstract base class of a pure chemical species.
static Evaluation liquidViscosity(const Evaluation &, const Evaluation &)
The dynamic viscosity of pure water.
Definition: SimpleH2O.hpp:313
A central place for various physical constants occuring in some equations.
Definition: Constants.hpp:39
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...