HenryIapws.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  Copyright (C) 2010 by Benjamin Faigle
6 
7  This file is part of the Open Porous Media project (OPM).
8 
9  OPM is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 2 of the License, or
12  (at your option) any later version.
13 
14  OPM is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OPM. If not, see <http://www.gnu.org/licenses/>.
21 */
27 #ifndef OPM_HENRY_IAPWS_HPP
28 #define OPM_HENRY_IAPWS_HPP
29 
31 
32 namespace Opm
33 {
43 template <class Scalar, class Evaluation>
44 inline Evaluation henryIAPWS(Scalar E,
45  Scalar F,
46  Scalar G,
47  Scalar H,
48  const Evaluation& temperature)
49 {
50  typedef Opm::MathToolbox<Evaluation> Toolbox;
51  typedef Opm::H2O<Evaluation> H2O;
52 
53  Evaluation Tr = temperature/H2O::criticalTemperature();
54  Evaluation tau = 1 - Tr;
55 
56  static const Scalar c[6] = {
57  1.99274064, 1.09965342, -0.510839303,
58  -1.75493479,-45.5170352, -6.7469445e5
59  };
60  static const Scalar d[6] = {
61  1/3.0, 2/3.0, 5/3.0,
62  16/3.0, 43/3.0, 110/3.0
63  };
64  static const Scalar q = -0.023767;
65 
66  Evaluation f = 0;
67  for (int i = 0; i < 6; ++i) {
68  f += c[i]*Toolbox::pow(tau, d[i]);
69  }
70 
71  const Evaluation& exponent =
72  q*F +
73  E/temperature*f +
74  (F +
75  G*Toolbox::pow(tau, 2.0/3) +
76  H*tau)*
77  Toolbox::exp((H2O::tripleTemperature() - temperature)/100);
78  // CAUTION: K_D is formulated in mole fractions. We have to
79  // multiply it with the vapor pressure of water in order to get
80  // derivative of the partial pressure.
81  return Toolbox::exp(exponent)*H2O::vaporPressure(temperature);
82 }
83 } // namespace Opm
84 
85 #endif // OPM_HENRY_IAPWS_HPP
Material properties of pure water .
Definition: H2O.hpp:60
Definition: MathToolbox.hpp:39
static Evaluation vaporPressure(Evaluation temperature)
The vapor pressure in of pure water at a given temperature.
Definition: H2O.hpp:131
Definition: Air_Mesitylene.hpp:31
static const Scalar tripleTemperature()
Returns the temperature at water's triple point.
Definition: H2O.hpp:109
Material properties of pure water .
Evaluation< Scalar, VarSetTag, numVars > exp(const Evaluation< Scalar, VarSetTag, numVars > &x)
Definition: Math.hpp:295
static const Scalar criticalTemperature()
Returns the critical temperature of water.
Definition: H2O.hpp:91
Evaluation< Scalar, VarSetTag, numVars > pow(const Evaluation< Scalar, VarSetTag, numVars > &base, Scalar exp)
Definition: Math.hpp:312
Evaluation henryIAPWS(Scalar E, Scalar F, Scalar G, Scalar H, const Evaluation &temperature)
The Henry constants in liquid water using the IAPWS 2004 formulation.
Definition: HenryIapws.hpp:44