GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/material/binarycoefficients/h2o_mesitylene.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 27 31 87.1%
Functions: 1 3 33.3%
Branches: 3 6 50.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 Binary coefficients for water and mesitylene.
11 */
12 #ifndef DUMUX_BINARY_COEFF_H2O_MESITYLENE_HH
13 #define DUMUX_BINARY_COEFF_H2O_MESITYLENE_HH
14
15 #include <algorithm>
16
17 #include <dune/common/math.hh>
18
19 #include <dumux/material/components/h2o.hh>
20 #include <dumux/material/components/mesitylene.hh>
21
22 namespace Dumux::BinaryCoeff {
23
24 /*!
25 * \ingroup Binarycoefficients
26 * \brief Binary coefficients for water and mesitylene.
27 */
28 class H2O_Mesitylene
29 {
30 public:
31 /*!
32 * \brief Henry coefficient \f$\mathrm{[Pa]}\f$ for mesitylene in liquid water.
33 * \param temperature the temperature \f$\mathrm{[K]}\f$
34 * See:
35 * R. Sander (1999) \cite sander1999
36 */
37 template <class Scalar>
38 static Scalar henry(Scalar temperature)
39 {
40 // after Sanders
41 2764137 constexpr Scalar sanderH = 1.7e-1; // [M/atm]
42 //conversion to our Henry definition
43 2764137 Scalar dumuxH = sanderH / 101.325; // has now [(mol/m^3)/Pa]
44 2764137 dumuxH *= 18.02e-6; // multiplied by molar volume of reference phase = water
45 return 1.0/dumuxH; // [Pa]
46 }
47
48 /*!
49 * \brief Binary diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for molecular water and mesitylene.
50 * \param temperature the temperature \f$\mathrm{[K]}\f$
51 * \param pressure the pressure \f$\mathrm{[Pa]}\f$
52 */
53 template <class Scalar>
54 2764139 static Scalar gasDiffCoeff(Scalar temperature, Scalar pressure)
55 {
56 using H2O = Dumux::Components::H2O<Scalar>;
57 using Mesitylene = Dumux::Components::Mesitylene<Scalar>;
58
59 using std::clamp;
60
1/2
✓ Branch 0 taken 2764139 times.
✗ Branch 1 not taken.
2764139 temperature = clamp(temperature, 1e-9, 500.0); // regularization
61
1/2
✓ Branch 0 taken 2764139 times.
✗ Branch 1 not taken.
2764139 pressure = clamp(pressure, 0.0, 1e8); // regularization
62
63 using std::sqrt;
64 using std::pow;
65 using Dune::power;
66 using std::exp;
67 2764139 constexpr Scalar M_m = 1e3*Mesitylene::molarMass(); // [g/mol] molecular weight of mesitylene
68 2764139 constexpr Scalar M_w = 1e3*H2O::molarMass(); // [g/mol] molecular weight of water
69 2764139 constexpr Scalar Tb_m = 437.9; // [K] boiling temperature of mesitylen
70 2764139 constexpr Scalar Tb_w = 373.15; // [K] boiling temperature of water (at p_atm)
71 2764139 constexpr Scalar V_B_w = 18.0; // [cm^3/mol] LeBas molal volume of water
72
73 using std::cbrt;
74 2764139 const Scalar sigma_w = 1.18*cbrt(V_B_w); // charact. length of air
75 2764139 constexpr Scalar T_scal_w = 1.15*Tb_w; // [K] (molec. energy of attraction/Boltzmann constant)
76 2764139 constexpr Scalar V_B_m = 162.6; // [cm^3/mol] LeBas molal volume of mesitylen
77 2764139 const Scalar sigma_m = 1.18*cbrt(V_B_m); // charact. length of mesitylen
78 2764139 const Scalar sigma_wm = 0.5*(sigma_w + sigma_m);
79 2764139 constexpr Scalar T_scal_m = 1.15*Tb_m;
80 2764139 const Scalar T_scal_wm = sqrt(T_scal_w*T_scal_m);
81
82 using std::max;
83 2764139 Scalar T_star = temperature/T_scal_wm;
84
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2764139 times.
2764139 T_star = max(T_star, 1e-5); // regularization
85
86 5528278 const Scalar Omega = 1.06036/pow(T_star,0.1561) + 0.193/exp(T_star*0.47635)
87 2764139 + 1.03587/exp(T_star*1.52996) + 1.76474/exp(T_star*3.89411);
88 2764139 const Scalar B_ = 0.00217 - 0.0005*sqrt(1.0/M_w + 1.0/M_m);
89 2764139 const Scalar Mr = (M_w + M_m)/(M_w*M_m);
90 5528278 const Scalar D_wm = (B_*pow(temperature, 1.6)*sqrt(Mr))
91 2764139 /(1e-5*pressure*power(sigma_wm, 2)*Omega); // [cm^2/s]
92
93 2764139 return D_wm*1e-4; // [m^2/s]
94 }
95
96 /*!
97 * \brief Diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for mesitylene in liquid water.
98 * \param temperature the temperature \f$\mathrm{[K]}\f$
99 * \param pressure the pressure \f$\mathrm{[Pa]}\f$
100 *
101 * \note Returns just an order of magnitude.
102 */
103 template <class Scalar>
104 static Scalar liquidDiffCoeff(Scalar temperature, Scalar pressure)
105 {
106 return 1.e-9;
107 }
108 };
109
110 } // end namespace Dumux::BinaryCoeff
111
112 #endif
113