GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/material/binarycoefficients/henryiapws.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 15 16 93.8%
Functions: 1 1 100.0%
Branches: 3 4 75.0%

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 20711165 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 20711165 times.
20711165 if (temperature > H2O::criticalTemperature())
51 temperature = H2O::criticalTemperature();
52
53 20711165 Scalar Tr = temperature/H2O::criticalTemperature();
54 20711165 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 20711165 Scalar f = 0;
67 using std::pow;
68
2/2
✓ Branch 0 taken 124266990 times.
✓ Branch 1 taken 20711165 times.
144978155 for (int i = 0; i < 6; ++i) {
69 124266990 f += c[i]*pow(tau, d[i]);
70 }
71
72 20711165 Scalar exponent =
73 41422330 q*F +
74 20711165 E/temperature*f +
75 20711165 (F +
76 41422330 G*pow(tau, 2.0/3) +
77 41422330 H*tau)*
78 20711165 exp((H2O::tripleTemperature() - temperature)/100);
79
80 using std::exp;
81 20711165 return exp(exponent)*H2O::vaporPressure(temperature);
82 }
83 }
84
85 #endif
86