GCC Code Coverage Report


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