GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/material/fluidmatrixinteractions/thermalconductivityaverage.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 8 8 100.0%
Functions: 19 19 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_THERMALCONDUCTIVITY_AVERAGED_HH
8 #define DUMUX_MATERIAL_THERMALCONDUCTIVITY_AVERAGED_HH
9
10 #include <algorithm>
11
12 namespace Dumux {
13
14 /*!
15 * \addtogroup EffectiveHeatConductivity
16 * \copydetails Dumux::ThermalConductivityAverage
17 */
18
19 /*!
20 * \ingroup EffectiveHeatConductivity
21 * \brief Effective thermal conductivity based on weighted arithmetic average
22 *
23 * ### Average (multiple fluid phases, one solid phase)
24 *
25 * The effective thermal conductivity of `ThermalConductivityAverage`
26 * is calculated as a weighted arithmetic average of the thermal
27 * conductivities of the solid and the fluid phases. The weights are determined by the volume
28 * fraction the phase occupies. Denoting the volume fractions by \f$ n_\alpha \f$, we have
29 * \f[
30 * \lambda_\text{eff} = \sum_\alpha \lambda_\alpha n_\alpha / \sum_\alpha n_\alpha,
31 * \f]
32 * summing over both fluid and solid phases. With the porosity \f$ \phi \f$ as
33 * the sum of all fluid volume fractions, we can equivalently write
34 * \f[
35 * \lambda_\text{eff} = \lambda_\text{s} (1-\phi) + \lambda_\text{f} \phi,
36 * \f]
37 * where \f$ \lambda_\text{s} \f$ is the thermal conductivity of the solid phase,
38 * and the effective thermal conductivity of the liquid phases is computed as
39 * an arithmetic average weighted with the fluid saturations.
40 */
41 template<class Scalar>
42 class ThermalConductivityAverage
43 {
44 public:
45 /*!
46 * \brief Effective thermal conductivity in \f$\mathrm{W/(m K)}\f$
47 * \param volVars volume variables
48 * \return Effective thermal conductivity in \f$\mathrm{W/(m K)}\f$
49 */
50 template<class VolumeVariables>
51 16129796 static Scalar effectiveThermalConductivity(const VolumeVariables& volVars)
52 {
53 16129796 constexpr int numFluidPhases = VolumeVariables::numFluidPhases();
54
55 // Get the thermal conductivities and the porosity from the volume variables
56 16129796 Scalar lambdaFluid = 0.0;
57
2/2
✓ Branch 0 taken 12020580 times.
✓ Branch 1 taken 12020580 times.
33260392 for (int phaseIdx = 0; phaseIdx < numFluidPhases; ++phaseIdx)
58 17130596 lambdaFluid += volVars.fluidThermalConductivity(phaseIdx)*volVars.saturation(phaseIdx);
59
60 33235560 const Scalar lambdaSolid = volVars.solidThermalConductivity();
61 33235560 const Scalar porosity = volVars.porosity();
62
63 16630196 return lambdaSolid*(1-porosity) + lambdaFluid*porosity;
64 }
65 };
66
67 } // end namespace Dumux
68
69 #endif
70