GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/dumux/porenetwork/1p/fluxvariablescache.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 26 26 100.0%
Functions: 13 13 100.0%
Branches: 27 36 75.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 PNMOnePModel
10 * \copydoc Dumux::PoreNetwork::OnePFluxVariablesCache
11 */
12 #ifndef DUMUX_PNM_1P_FLUXVARIABLESCACHE_HH
13 #define DUMUX_PNM_1P_FLUXVARIABLESCACHE_HH
14
15 #include <dumux/porenetwork/common/throatproperties.hh>
16
17 namespace Dumux::PoreNetwork {
18
19 /*!
20 * \ingroup PNMOnePModel
21 * \brief Flux variables cache for the single-phase-flow PNM
22 * Store data required for flux calculation.
23 */
24 template<class AdvectionType>
25 class OnePFluxVariablesCache
26 {
27 using Scalar = typename AdvectionType::Scalar;
28 public:
29 //! whether the cache needs an update when the solution changes
30 static bool constexpr isSolDependent = true;
31
32 template<class Problem, class Element, class FVElementGeometry, class ElementVolumeVariables>
33 43069663 void update(const Problem& problem,
34 const Element& element,
35 const FVElementGeometry& fvGeometry,
36 const ElementVolumeVariables& elemVolVars,
37 const typename FVElementGeometry::SubControlVolumeFace& scvf)
38 {
39
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 35427936 times.
43069663 const auto eIdx = fvGeometry.gridGeometry().elementMapper().index(element);
40
2/2
✓ Branch 0 taken 4026487 times.
✓ Branch 1 taken 35427936 times.
43069663 throatCrossSectionShape_ = fvGeometry.gridGeometry().throatCrossSectionShape(eIdx);
41
2/2
✓ Branch 0 taken 4026487 times.
✓ Branch 1 taken 35427936 times.
43069663 throatShapeFactor_ = fvGeometry.gridGeometry().throatShapeFactor(eIdx);
42 43069663 throatCrossSectionalArea_ = problem.spatialParams().throatCrossSectionalArea(element, elemVolVars);
43 43069663 throatLength_ = problem.spatialParams().throatLength(element, elemVolVars);
44 43069663 throatInscribedRadius_ = problem.spatialParams().throatInscribedRadius(element, elemVolVars);
45 43069663 poreToPoreDistance_ = element.geometry().volume();
46
47 43069663 cache_.fill(problem, element, fvGeometry, scvf, elemVolVars, *this, /*phaseIdx*/0);
48 43069663 transmissibility_ = AdvectionType::calculateTransmissibility(problem, element, fvGeometry, scvf, elemVolVars, *this, /*phaseIdx*/0);
49 43069663 }
50
51 /*!
52 * \brief Returns the throats's cross-sectional shape.
53 */
54 39126502 Throat::Shape throatCrossSectionShape() const
55
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 38009559 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1092264 times.
39126502 { return throatCrossSectionShape_; }
56
57 /*!
58 * \brief Returns the throats's shape factor.
59 */
60 39101823 Scalar throatShapeFactor() const
61
3/4
✓ Branch 0 taken 20516725 times.
✓ Branch 1 taken 17492834 times.
✓ Branch 2 taken 1092264 times.
✗ Branch 3 not taken.
39101823 { return throatShapeFactor_; }
62
63 /*!
64 * \brief Returns the throats's transmissibility.
65 */
66 36218761 Scalar transmissibility(const int phaseIdx = 0) const
67
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 35065755 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1092264 times.
36158019 { return transmissibility_; }
68
69 /*!
70 * \brief Returns the throats's cross-sectional area.
71 */
72 79357551 Scalar throatCrossSectionalArea(const int phaseIdx = 0) const
73
8/10
✓ Branch 0 taken 20364 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 152276 times.
✓ Branch 3 taken 23160 times.
✓ Branch 4 taken 20458078 times.
✓ Branch 5 taken 17524481 times.
✓ Branch 6 taken 1092265 times.
✓ Branch 7 taken 31948673 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 2522976 times.
79357551 { return throatCrossSectionalArea_; }
74
75 /*!
76 * \brief Returns the throats's length.
77 */
78 39997123 Scalar throatLength() const
79
3/4
✓ Branch 0 taken 20516725 times.
✓ Branch 1 taken 17492834 times.
✓ Branch 2 taken 1092264 times.
✗ Branch 3 not taken.
39607855 { return throatLength_; }
80
81 /*!
82 * \brief Returns the throats's inscribed radius.
83 */
84 32362621 Scalar throatInscribedRadius() const
85
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 31948673 times.
32360515 { return throatInscribedRadius_; }
86
87 /*!
88 * \brief Returns the throats's pore-to-pore-center distance.
89 */
90 1872 Scalar poreToPoreDistance() const
91 1872 { return poreToPoreDistance_; }
92
93 /*!
94 * \brief Returns the throats's cached flow variables for single-phase flow.
95 */
96 const auto& singlePhaseFlowVariables() const
97
2/2
✓ Branch 0 taken 955632 times.
✓ Branch 1 taken 1598991 times.
2554623 { return cache_; }
98
99 private:
100 Throat::Shape throatCrossSectionShape_;
101 Scalar throatShapeFactor_;
102 Scalar transmissibility_;
103 Scalar throatCrossSectionalArea_;
104 Scalar throatLength_;
105 Scalar throatInscribedRadius_;
106 Scalar poreToPoreDistance_;
107
108 typename AdvectionType::Transmissibility::SinglePhaseCache cache_;
109 };
110
111 } // end namespace Dumux::PoreNetwork
112
113 #endif
114