GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/material/binarycoefficients/h2o_xylene.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 xylene.
11 */
12 #ifndef DUMUX_BINARY_COEFF_H2O_XYLENE_HH
13 #define DUMUX_BINARY_COEFF_H2O_XYLENE_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/xylene.hh>
21
22 namespace Dumux::BinaryCoeff {
23
24 /*!
25 * \ingroup Binarycoefficients
26 * \brief Binary coefficients for water and xylene.
27 */
28 class H2O_Xylene
29 {
30 public:
31 /*!
32 * \brief Henry coefficient \f$\mathrm{[Pa]}\f$ for xylene in liquid water.
33 * \param temperature the temperature \f$\mathrm{[K]}\f$
34 *
35 * See:
36 *
37 * Sander (1999) \cite sander1999
38 */
39 template <class Scalar>
40 static Scalar henry(Scalar temperature)
41 {
42 // after Sander
43 6593315 constexpr Scalar sanderH = 1.5e-1; //[M/atm]
44 //conversion to our Henry definition
45 6593315 Scalar dumuxH = sanderH / 101.325; // has now [(mol/m^3)/Pa]
46 6593315 dumuxH *= 18.02e-6; //multiplied by molar volume of reference phase = water
47 return 1.0/dumuxH; // [Pa]
48 }
49
50 /*!
51 * \brief Binary diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for molecular water and xylene.
52 * \param temperature the temperature \f$\mathrm{[K]}\f$
53 * \param pressure the pressure \f$\mathrm{[Pa]}\f$
54 *
55 */
56 template <class Scalar>
57 6593318 static Scalar gasDiffCoeff(Scalar temperature, Scalar pressure)
58 {
59 using H2O = Dumux::Components::H2O<Scalar>;
60 using Xylene = Dumux::Components::Xylene<Scalar>;
61
62 using std::clamp;
63
1/2
✓ Branch 0 taken 6593318 times.
✗ Branch 1 not taken.
6593318 temperature = clamp(temperature, 1e-9, 500.0); // regularization
64
1/2
✓ Branch 0 taken 6593318 times.
✗ Branch 1 not taken.
6593318 pressure = clamp(pressure, 0.0, 1e8); // regularization
65
66 using std::sqrt;
67 using std::exp;
68 using std::pow;
69 using Dune::power;
70 6593318 constexpr Scalar M_x = 1e3*Xylene::molarMass(); // [g/mol] molecular weight of xylene
71 6593318 constexpr Scalar M_w = 1e3*H2O::molarMass(); // [g/mol] molecular weight of water
72 6593318 constexpr Scalar Tb_x = 412.9; // [K] boiling temperature of xylene
73 6593318 constexpr Scalar Tb_w = 373.15; // [K] boiling temperature of water (at p_atm)
74 6593318 constexpr Scalar V_B_w = 18.0; // [cm^3/mol] LeBas molal volume of water
75 6593318 const Scalar sigma_w = 1.18*pow(V_B_w, 0.333); // charact. length of air
76 6593318 constexpr Scalar T_scal_w = 1.15*Tb_w; // [K] (molec. energy of attraction/Boltzmann constant)
77 6593318 constexpr Scalar V_B_x = 140.4; // [cm^3/mol] LeBas molal volume of xylene
78 6593318 const Scalar sigma_x = 1.18*pow(V_B_x, 0.333); // charact. length of xylene
79 6593318 const Scalar sigma_wx = 0.5*(sigma_w + sigma_x);
80 6593318 constexpr Scalar T_scal_x = 1.15*Tb_x;
81 6593318 const Scalar T_scal_wx = sqrt(T_scal_w*T_scal_x);
82
83 using std::max;
84 6593318 Scalar T_star = temperature/T_scal_wx;
85
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6593318 times.
6593318 T_star = max(T_star, 1e-5); // regularization
86
87 13186636 const Scalar Omega = 1.06036/pow(T_star, 0.1561) + 0.193/exp(T_star*0.47635)
88 6593318 + 1.03587/exp(T_star*1.52996) + 1.76474/exp(T_star*3.89411);
89 6593318 const Scalar B_ = 0.00217 - 0.0005*sqrt(1.0/M_w + 1.0/M_x);
90 6593318 const Scalar Mr = (M_w + M_x)/(M_w*M_x);
91 13186636 const Scalar D_wx = (B_*pow(temperature,1.6)*sqrt(Mr))
92 6593318 /(1e-5*pressure*power(sigma_wx, 2)*Omega); // [cm^2/s]
93
94 6593318 return D_wx*1e-4; // [m^2/s]
95 }
96
97 /*!
98 * \brief Diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for xylene in liquid water.
99 * \param temperature the temperature \f$\mathrm{[K]}\f$
100 * \param pressure the pressure \f$\mathrm{[Pa]}\f$
101 *
102 * \note Returns just an order of magnitude.
103 */
104 template <class Scalar>
105 static Scalar liquidDiffCoeff(Scalar temperature, Scalar pressure)
106 {
107 return 1.e-9;
108 }
109 };
110
111 } // end namespace Dumux::BinaryCoeff
112
113 #endif
114