Line | Branch | Exec | Source |
---|---|---|---|
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 | // SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder | ||
5 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
6 | // | ||
7 | /*! | ||
8 | * \file | ||
9 | * \ingroup Binarycoefficients | ||
10 | * \brief The IAPWS formulation of Henry coefficients in water. | ||
11 | */ | ||
12 | #ifndef DUMUX_HENRY_IAPWS_HH | ||
13 | #define DUMUX_HENRY_IAPWS_HH | ||
14 | |||
15 | #include <dumux/material/components/h2o.hh> | ||
16 | |||
17 | namespace Dumux { | ||
18 | /*! | ||
19 | * \ingroup Binarycoefficients | ||
20 | * \brief The Henry constants in liquid water using the IAPWS 2004 | ||
21 | * formulation. | ||
22 | * \param E Correlation parameter | ||
23 | * \param F Correlation parameter | ||
24 | * \param G Correlation parameter | ||
25 | * \param H Correlation parameter | ||
26 | * \param temperature the temperature \f$\mathrm{[K]}\f$ | ||
27 | * | ||
28 | * This function calculates \f$\mathrm{K_D}\f$, see: | ||
29 | * | ||
30 | * IAPWS: "Guideline on the Henry's Constant and Vapor-Liquid | ||
31 | * Distribution Constant for Gases in H2O and D2O at High | ||
32 | * Temperatures" | ||
33 | * Equation (5) \cite watanabe2004 <BR> | ||
34 | * | ||
35 | * Range of validity: T = {278.12 ; 636.46} | ||
36 | * approximations beyond this range are increasingly incorrect. | ||
37 | * However, close to the critical the values are more, again. | ||
38 | */ | ||
39 | template <class Scalar> | ||
40 | 20648437 | inline Scalar henryIAPWS(Scalar E, | |
41 | Scalar F, | ||
42 | Scalar G, | ||
43 | Scalar H, | ||
44 | Scalar temperature) | ||
45 | { | ||
46 | using H2O = Dumux::Components::H2O<Scalar>; | ||
47 | |||
48 | // regularizing temperature helps for stability. | ||
49 | // Results are unphysical! | ||
50 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20648437 times.
|
20648437 | if (temperature > H2O::criticalTemperature()) |
51 | ✗ | temperature = H2O::criticalTemperature(); | |
52 | |||
53 | 20648437 | Scalar Tr = temperature/H2O::criticalTemperature(); | |
54 | 20648437 | Scalar 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 | 20648437 | Scalar f = 0; | |
67 | using std::pow; | ||
68 |
2/2✓ Branch 0 taken 123890622 times.
✓ Branch 1 taken 20648437 times.
|
144539059 | for (int i = 0; i < 6; ++i) { |
69 | 123890622 | f += c[i]*pow(tau, d[i]); | |
70 | } | ||
71 | |||
72 | 20648437 | Scalar exponent = | |
73 | 41296874 | q*F + | |
74 | 20648437 | E/temperature*f + | |
75 | 20648437 | (F + | |
76 | 41296874 | G*pow(tau, 2.0/3) + | |
77 | 41296874 | H*tau)* | |
78 | 20648437 | exp((H2O::tripleTemperature() - temperature)/100); | |
79 | |||
80 | using std::exp; | ||
81 | 20648437 | return exp(exponent)*H2O::vaporPressure(temperature); | |
82 | } | ||
83 | } | ||
84 | |||
85 | #endif | ||
86 |