GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/dumux/material/fluidmatrixinteractions/diffusivityconstanttortuosity.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 4 4 100.0%
Functions: 14 14 100.0%
Branches: 4 6 66.7%

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 EffectiveDiffusivity
10 * \brief Relation for the effective diffusion coefficient with constant tortuosity
11 */
12
13 #ifndef DUMUX_MATERIAL_DIFFUSIVITY_CONSTANT_TORTUOSITY_HH
14 #define DUMUX_MATERIAL_DIFFUSIVITY_CONSTANT_TORTUOSITY_HH
15
16 #include <dumux/common/parameters.hh>
17
18 namespace Dumux {
19
20 /*!
21 * \addtogroup EffectiveDiffusivity
22 * \copydetails Dumux::DiffusivityConstantTortuosity
23 */
24
25 /*!
26 * \ingroup EffectiveDiffusivity
27 * \brief Relation for the effective diffusion coefficient with constant tortuosity
28 *
29 * ### Constant Tortuosity
30 *
31 * For `DiffusivityConstantTortuosity`, \f$ \tau = \text{const.} \f$,
32 * with default value 0.5, empirically obtained by Carman \cite carman1937.
33 * The value can be changed at runtime by setting parameter
34 * `"SpatialParams.Tortuosity"`. This will change the value of \f$ \tau \f$,
35 * and therefore the effective diffusion coefficient wherever
36 * the function `effectiveDiffusionCoefficient` is used.
37 */
38 template<class Scalar>
39 class DiffusivityConstantTortuosity
40 {
41 public:
42 /*!
43 * \brief Returns the effective diffusion coefficient (\f$\mathrm{m^2/s}\f$)
44 *
45 * Returns the effective diffusion coefficient (\f$\mathrm{m^2/s}\f$)
46 * of component \f$ \kappa \f$ (index `compIdxI`) in phase \f$ \alpha \f$ based
47 * on a constant tortuosity coefficient: \f$ D^\kappa_{\text{eff},\alpha} = \phi S_\alpha \tau D^\kappa_\alpha \f$.
48 *
49 * \param volVars The volume variables
50 * \param phaseIdx the index of phase \f$ \alpha \f$
51 * \param compIdxI the component index i (the component diffusing in phase \f$ \alpha \f$)
52 * \param compIdxJ the component index j (the main component of phase \f$ \alpha \f$)
53 */
54 template<class VolumeVariables>
55 76590786 static Scalar effectiveDiffusionCoefficient(const VolumeVariables& volVars,
56 const int phaseIdx,
57 const int compIdxI,
58 const int compIdxJ)
59 {
60
4/6
✓ Branch 0 taken 19 times.
✓ Branch 1 taken 44492327 times.
✓ Branch 3 taken 19 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 19 times.
✗ Branch 7 not taken.
76590786 static const Scalar tau = getParam<Scalar>("SpatialParams.Tortuosity", 0.5);
61 76590786 const Scalar diffCoeff = volVars.diffusionCoefficient(phaseIdx, compIdxI, compIdxJ);
62 76590786 return volVars.porosity() * volVars.saturation(phaseIdx) * tau * diffCoeff;
63 }
64
65 };
66 } // end namespace Dumux
67
68 #endif
69