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 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*/
28#ifndef OPM_HENRY_IAPWS_HPP
29#define OPM_HENRY_IAPWS_HPP
30
32
33namespace Opm
34{
44template <class Scalar, class Evaluation>
45inline Evaluation henryIAPWS(Scalar E,
46 Scalar F,
47 Scalar G,
48 Scalar H,
49 const Evaluation& temperature)
50{
51 typedef 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]*pow(tau, d[i]);
69 }
70
71 const Evaluation& exponent =
72 q*F +
73 E/temperature*f +
74 (F +
75 G*pow(tau, 2.0/3) +
76 H*tau)*
77 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 exp(exponent)*H2O::vaporPressure(temperature);
82}
83} // namespace Opm
84
85#endif // OPM_HENRY_IAPWS_HPP
Material properties of pure water .
Definition: H2O.hpp:62
static const Scalar criticalTemperature()
Returns the critical temperature of water.
Definition: H2O.hpp:92
static Evaluation vaporPressure(Evaluation temperature)
The vapor pressure in of pure water at a given temperature.
Definition: H2O.hpp:138
static const Scalar tripleTemperature()
Returns the temperature at water's triple point.
Definition: H2O.hpp:116
Definition: Air_Mesitylene.hpp:34
Evaluation exp(const Evaluation &value)
Definition: MathToolbox.hpp:403
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:45
ReturnEval_< Evaluation1, Evaluation2 >::type pow(const Evaluation1 &base, const Evaluation2 &exp)
Definition: MathToolbox.hpp:416