GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/material/binarycoefficients/air_xylene.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 22 24 91.7%
Functions: 1 2 50.0%
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 air and xylene.
11 */
12 #ifndef DUMUX_BINARY_COEFF_AIR_XYLENE_HH
13 #define DUMUX_BINARY_COEFF_AIR_XYLENE_HH
14
15 #include <algorithm>
16
17 #include <dune/common/math.hh>
18
19 #include <dumux/material/components/air.hh>
20 #include <dumux/material/components/xylene.hh>
21
22 namespace Dumux::BinaryCoeff {
23
24 /*!
25 * \ingroup Binarycoefficients
26 * \brief Binary coefficients for air and xylene.
27 */
28 class Air_Xylene
29 {
30 public:
31 /*!
32 * \brief Henry coefficient \f$\mathrm{[Pa]}\f$ for mesitylene in air.
33 * \param temperature the temperature \f$\mathrm{[K]}\f$
34 */
35 template <class Scalar>
36 static Scalar henry(Scalar temperature)
37 { DUNE_THROW(Dune::NotImplemented,
38 "Henry coefficient of air in xylene");
39 }
40
41 /*!
42 * \brief Binary diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for air and xylene.
43 * method according to Wilke and Lee
44 * see W.J. Lyman, W.F. Reehl, D.H. Rosenblatt (1990) \cite lyman1990 <BR>
45 * \param temperature temperature in \f$\mathrm{[K]}\f$
46 * \param pressure pressure in \f$\mathrm{[Pa]}\f$
47 *
48 */
49 template <class Scalar>
50 6593318 static Scalar gasDiffCoeff(Scalar temperature, Scalar pressure)
51 {
52 using Air = Dumux::Components::Air<Scalar>;
53 using Xylene = Dumux::Components::Xylene<Scalar>;
54
55 using std::clamp;
56
1/2
✓ Branch 0 taken 6593318 times.
✗ Branch 1 not taken.
6593318 temperature = clamp(temperature, 1e-9, 500.0); // regularization
57
1/2
✓ Branch 0 taken 6593318 times.
✗ Branch 1 not taken.
6593318 pressure = clamp(pressure, 0.0, 1e8); // regularization
58
59 using std::pow;
60 using Dune::power;
61 using std::sqrt;
62 using std::exp;
63 6593318 const Scalar M_x = 1e3*Xylene::molarMass(); // [g/mol] molecular weight of xylene
64 6593318 const Scalar M_a = 1e3*Air::molarMass(); // [g/mol] molecular weight of air
65 6593318 const Scalar Tb_x = 412.0; // [K] boiling temperature of xylene
66 6593318 const Scalar sigma_a = 3.711; // charact. length of air
67 6593318 const Scalar T_scal_a = 78.6; // [K] (molec. energy of attraction/Boltzmann constant)
68 6593318 const Scalar V_B_x = 140.4; // [cm^3/mol] LeBas molal volume of xylene
69 6593318 const Scalar sigma_x = 1.18*pow(V_B_x, 0.333); // charact. length of xylene
70 6593318 const Scalar sigma_ax = 0.5*(sigma_a + sigma_x);
71 6593318 const Scalar T_scal_x = 1.15*Tb_x;
72 6593318 const Scalar T_scal_ax = sqrt(T_scal_a*T_scal_x);
73
74 using std::max;
75 6593318 Scalar T_star = temperature/T_scal_ax;
76
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6593318 times.
6593318 T_star = max(T_star, 1e-5); // regularization
77
78 13186636 const Scalar Omega = 1.06036/pow(T_star, 0.1561) + 0.193/exp(T_star*0.47635)
79 6593318 + 1.03587/exp(T_star*1.52996) + 1.76474/exp(T_star*3.89411);
80 6593318 const Scalar B_ = 0.00217 - 0.0005*sqrt(1.0/M_a + 1.0/M_x);
81 6593318 const Scalar Mr = (M_a + M_x)/(M_a*M_x);
82 13186636 const Scalar D_ax = (B_*pow(temperature,1.5)*sqrt(Mr))
83 6593318 /(1e-5*pressure*power(sigma_ax, 2)*Omega); // [cm^2/s]
84
85 6593318 return D_ax*1e-4; // [m^2/s]
86 }
87
88 /*!
89 * \brief Diffusion coefficient \f$\mathrm{[m^2/s]}\f$ for air and xylene in liquid water.
90 * \param temperature temperature in \f$\mathrm{[K]}\f$
91 * \param pressure pressure in \f$\mathrm{[Pa]}\f$
92 *
93 * \note Returns just an order of magnitude.
94 */
95 template <class Scalar>
96 static Scalar liquidDiffCoeff(Scalar temperature, Scalar pressure)
97 {
98 return 1e-9;
99 }
100 };
101
102 } // end namespace Dumux::BinaryCoeff
103
104 #endif
105