GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/dumux/material/fluidmatrixinteractions/2p/thermalconductivity/somerton.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 14 14 100.0%
Functions: 28 28 100.0%
Branches: 2 2 100.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-FileCopyrightText: 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 EffectiveHeatConductivity
10 * \brief Effective thermal conductivity after Somerton
11 */
12
13 #ifndef DUMUX_MATERIAL_FLUIDMATRIX_THERMALCONDUCTIVITY_SOMERTON_TWO_P_HH
14 #define DUMUX_MATERIAL_FLUIDMATRIX_THERMALCONDUCTIVITY_SOMERTON_TWO_P_HH
15
16 #include <algorithm>
17 #include <cmath>
18
19 namespace Dumux {
20
21 /*!
22 * \addtogroup EffectiveHeatConductivity
23 * \copydetails Dumux::ThermalConductivitySomertonTwoP
24 */
25
26 /*!
27 * \ingroup EffectiveHeatConductivity
28 * \brief Effective thermal conductivity after Somerton
29 *
30 * ### Somerton (two fluid phases)
31 *
32 * The Somerton method \cite somerton1974 computes the thermal conductivity of dry and the wet soil material.
33 * It uses a root function of the water saturation to compute the
34 * effective thermal conductivity for a two-phase fluidsystem. The individual thermal
35 * conductivities are calculated as geometric mean of the thermal conductivity of the porous
36 * material and of the respective fluid phase.
37 *
38 * The effective thermal conductivity of `ThermalConductivitySomertonTwoP` is given by
39 * \f[
40 * \lambda_\text{eff} = \lambda_\text{g,eff} + \sqrt{S_\text{w}} \left(\lambda_\text{w,eff} - \lambda_\text{g,eff}\right)
41 * \f]
42 *
43 * with \f$ S_\text{w} \f$ the water saturation,
44 * \f$ S_\text{n} \f$ the NAPL saturation, the effective phase saturations given by
45 * \f$ \lambda_{\alpha,\text{eff}} = (\lambda_\text{s})^{\left(1-\phi\right)} (\lambda_\alpha)^\phi, \alpha \in \lbrace\text{w,n,g}\rbrace \f$
46 * (geometric mean) and \f$ \lambda_\text{s} \f$ is the thermal conductivity of the solid phase.
47 * The effective conductivity \f$ \lambda_\text{g,eff} \f$ corresponds to dry conditions, whereas the
48 * effective conductivity \f$ \lambda_\text{g,eff} \f$ corresponds to wet conditions.
49 */
50 template<class Scalar>
51 class ThermalConductivitySomertonTwoP
52 {
53 public:
54 /*!
55 * \brief Effective thermal conductivity in \f$\mathrm{W/(m K)}\f$ for two phases
56 * \param volVars volume variables
57 * \return Effective thermal conductivity in \f$\mathrm{W/(m K)}\f$ for two phases
58 */
59 template<class VolumeVariables>
60 63583206 static Scalar effectiveThermalConductivity(const VolumeVariables& volVars)
61 {
62 using FluidSystem = typename VolumeVariables::FluidSystem;
63 static_assert(FluidSystem::numPhases == 2, "ThermalConductivitySomertonTwoP only works for two-phase fluid systems!");
64 static_assert((FluidSystem::isGas(0) && !FluidSystem::isGas(1)) || (!FluidSystem::isGas(0) && FluidSystem::isGas(1)),
65 "ThermalConductivitySomertonTwoP only works if one phase is gaseous and one is liquid!");
66
67 63583206 constexpr int liquidPhaseIdx = FluidSystem::isGas(0) ? 1 : 0;
68 63583206 constexpr int gasPhaseIdx = FluidSystem::isGas(0) ? 0 : 1;
69
70 63583206 const Scalar satLiquid = volVars.saturation(liquidPhaseIdx);
71 63583206 const Scalar lambdaLiquid = volVars.fluidThermalConductivity(liquidPhaseIdx);
72 63583189 const Scalar lambdaGas = volVars.fluidThermalConductivity(gasPhaseIdx);
73 63583189 const Scalar lambdaSolid = volVars.solidThermalConductivity();
74 63583189 const Scalar porosity = volVars.porosity();
75
76 63583189 return effectiveThermalConductivity_(satLiquid, lambdaLiquid, lambdaGas, lambdaSolid, porosity);
77 }
78
79 private:
80 /*!
81 * \brief Effective thermal conductivity in \f$\mathrm{W/(m K)}\f$ for two phases
82 *
83 * \param satLiquid The saturation of the liquid phase
84 * \param lambdaLiquid The thermal conductivity of the liquid phase in \f$\mathrm{W/(m K)}\f$
85 * \param lambdaGas The thermal conductivity of the gas phase in \f$\mathrm{W/(m K)}\f$
86 * \param lambdaSolid The thermal conductivity of the solid phase in \f$\mathrm{W/(m K)}\f$
87 * \param porosity The porosity
88 *
89 * \brief Effective thermal conductivity in \f$\mathrm{W/(m K)}\f$ for two phases
90 */
91 63559279 static Scalar effectiveThermalConductivity_(const Scalar satLiquid,
92 const Scalar lambdaLiquid,
93 const Scalar lambdaGas,
94 const Scalar lambdaSolid,
95 const Scalar porosity)
96 {
97 using std::max;
98 using std::pow;
99 using std::sqrt;
100
2/2
✓ Branch 0 taken 63545696 times.
✓ Branch 1 taken 13583 times.
63559279 const Scalar satLiquidPhysical = max<Scalar>(0.0, satLiquid);
101 // geometric mean, using ls^(1-p)*l^p = ls*(l/ls)^p
102 63559279 const Scalar lambdaSaturated = lambdaSolid * pow(lambdaLiquid / lambdaSolid, porosity);
103 63559279 const Scalar lambdaDry = lambdaSolid * pow(lambdaGas / lambdaSolid, porosity);
104
105 63559279 return lambdaDry + sqrt(satLiquidPhysical) * (lambdaSaturated - lambdaDry);
106 }
107 };
108
109
110 } // end namespace Dumux
111
112 #endif
113