GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/material/fluidmatrixinteractions/3p/thermalconductivitysomerton3p.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 17 17 100.0%
Functions: 10 10 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 #ifndef DUMUX_MATERIAL_FLUIDMATRIX_THERMALCONDUCTIVITY_SOMERTON_THREE_P_HH
8 #define DUMUX_MATERIAL_FLUIDMATRIX_THERMALCONDUCTIVITY_SOMERTON_THREE_P_HH
9
10 #include <algorithm>
11 #include <cmath>
12
13 namespace Dumux {
14
15 /*!
16 * \addtogroup EffectiveHeatConductivity
17 * \copydetails Dumux::ThermalConductivitySomertonThreeP
18 */
19
20 /*!
21 * \ingroup EffectiveHeatConductivity
22 * \brief Effective thermal conductivity after Somerton
23 *
24 * ### Somerton (three fluid phases)
25 *
26 * The Somerton method \cite somerton1974 computes the thermal conductivity of dry and the wet soil material.
27 * It is extended here to a three phase system of water (w), NAPL (n) and gas (g).
28 * It uses a root function of the water and NAPL saturation to compute the
29 * effective thermal conductivity for a three-phase fluidsystem. The individual thermal
30 * conductivities are calculated as geometric mean of the thermal conductivity of the porous
31 * material and of the respective fluid phase.
32 *
33 * The effective thermal conductivity of `ThermalConductivitySomertonThreeP` is given by
34 * \f[
35 * \lambda_\text{eff} = \lambda_\text{g,eff} + \sqrt{S_\text{w}} \left(\lambda_\text{w,eff} - \lambda_\text{g,eff}\right) +
36 * \sqrt{S_\text{n}} \left(\lambda_\text{n,eff} - \lambda_\text{g,eff}\right)
37 * \f]
38 *
39 * with \f$ S_\text{w} \f$ the water saturation,
40 * \f$ S_\text{n} \f$ the NAPL saturation, the effective phase saturations given by
41 * \f$ \lambda_{\alpha,\text{eff}} = (\lambda_\text{s})^{\left(1-\phi\right)} (\lambda_\alpha)^\phi, \alpha \in \{\text{w,n,g}\}\f$
42 * (geometric mean) and \f$ \lambda_\text{s} \f$ is the thermal conductivity of the solid phase.
43 */
44 template<class Scalar>
45 class ThermalConductivitySomertonThreeP
46 {
47 public:
48 /*!
49 * \brief Effective thermal conductivity in \f$\mathrm{W/(m K)}\f$ for three phases
50 * \param volVars volume variables
51 * \return Effective thermal conductivity in \f$\mathrm{W/(m K)}\f$ for three phases
52 */
53 template<class VolumeVariables>
54 9041184 static Scalar effectiveThermalConductivity(const VolumeVariables& volVars)
55 {
56 using FluidSystem = typename VolumeVariables::FluidSystem;
57
58 9041184 const Scalar sw = volVars.saturation(FluidSystem::wPhaseIdx);
59 9041184 const Scalar sn = volVars.saturation(FluidSystem::nPhaseIdx);
60 9041184 const Scalar lambdaW = volVars.fluidThermalConductivity(FluidSystem::wPhaseIdx);
61 9041184 const Scalar lambdaN = volVars.fluidThermalConductivity(FluidSystem::nPhaseIdx);
62 9041184 const Scalar lambdaG = volVars.fluidThermalConductivity(FluidSystem::gPhaseIdx);
63 9041184 const Scalar lambdaSolid = volVars.solidThermalConductivity();
64 9041184 const Scalar porosity = volVars.porosity();
65
66 9041184 return effectiveThermalConductivity(sw, sn, lambdaW, lambdaN, lambdaG, lambdaSolid, porosity);
67 }
68
69 /*!
70 * \brief Effective thermal conductivity in \f$\mathrm{W/(m K)}\f$ for three phases
71 *
72 * \param sw The saturation of the wetting phase
73 * \param sn The saturation of the nonwetting phase
74 * \param lambdaW The thermal conductivity of the water phase in \f$\mathrm{W/(m K)}\f$
75 * \param lambdaN The thermal conductivity of the NAPL phase in \f$\mathrm{W/(m K)}\f$
76 * \param lambdaG The thermal conductivity of the gas phase in \f$\mathrm{W/(m K)}\f$
77 * \param lambdaSolid The thermal conductivity of the solid phase in \f$\mathrm{W/(m K)}\f$
78 * \param porosity The porosity
79 *
80 * \return Effective thermal conductivity in \f$\mathrm{W/(m K)}\f$ for three phases
81 */
82 9041184 static Scalar effectiveThermalConductivity(const Scalar sw,
83 const Scalar sn,
84 const Scalar lambdaW,
85 const Scalar lambdaN,
86 const Scalar lambdaG,
87 const Scalar lambdaSolid,
88 const Scalar porosity)
89 {
90 using std::max;
91 using std::pow;
92 using std::sqrt;
93
1/2
✓ Branch 0 taken 9041184 times.
✗ Branch 1 not taken.
9041184 const Scalar satW = max<Scalar>(0.0, sw);
94
2/2
✓ Branch 0 taken 8055382 times.
✓ Branch 1 taken 985802 times.
9041184 const Scalar satN = max<Scalar>(0.0, sn);
95
96 // porosity weighted geometric mean
97 9041184 const Scalar lSw = pow(lambdaSolid, (1.0 - porosity)) * pow(lambdaW, porosity);
98 9041184 const Scalar lSn = pow(lambdaSolid, (1.0 - porosity)) * pow(lambdaN, porosity);
99 9041184 const Scalar lSg = pow(lambdaSolid, (1.0 - porosity)) * pow(lambdaG, porosity);
100 9041184 const Scalar lambdaEff = lSg + sqrt(satW) * (lSw - lSg) + sqrt(satN) * (lSn -lSg);
101
102 9041184 return lambdaEff;
103
104 }
105 };
106
107 #ifndef DOXYGEN
108 #ifndef DUMUX_MATERIAL_FLUIDMATRIX_THERMALCONDUCTIVITY_SOMERTON_TWO_P_HH
109 template<class Scalar>
110 using ThermalConductivitySomerton [[deprecated("Use ThermalConductivitySomertonThreeP. Will be removed after 3.9.")]] = ThermalConductivitySomertonThreeP<Scalar>;
111 #endif
112 #endif
113
114 } // end namespace Dumux
115
116 #endif
117