GCC Code Coverage Report


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