GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/porenetwork/1p/fluxvariablescache.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 12 26 46.2%
Functions: 10 49 20.4%
Branches: 8 8 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 /*!
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 43045764 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 86091528 const auto eIdx = fvGeometry.gridGeometry().elementMapper().index(element);
40
2/2
✓ Branch 0 taken 4002588 times.
✓ Branch 1 taken 35427936 times.
43045764 throatCrossSectionShape_ = fvGeometry.gridGeometry().throatCrossSectionShape(eIdx);
41
2/2
✓ Branch 0 taken 4002588 times.
✓ Branch 1 taken 35427936 times.
43045764 throatShapeFactor_ = fvGeometry.gridGeometry().throatShapeFactor(eIdx);
42 86091528 throatCrossSectionalArea_ = problem.spatialParams().throatCrossSectionalArea(element, elemVolVars);
43 86091528 throatLength_ = problem.spatialParams().throatLength(element, elemVolVars);
44 86091528 throatInscribedRadius_ = problem.spatialParams().throatInscribedRadius(element, elemVolVars);
45 43045764 poreToPoreDistance_ = element.geometry().volume();
46
47 43045764 cache_.fill(problem, element, fvGeometry, scvf, elemVolVars, *this, /*phaseIdx*/0);
48 43374290 transmissibility_ = AdvectionType::calculateTransmissibility(problem, element, fvGeometry, scvf, elemVolVars, *this, /*phaseIdx*/0);
49 43045764 }
50
51 /*!
52 * \brief Returns the throats's cross-sectional shape.
53 */
54 Throat::Shape throatCrossSectionShape() const
55 { return throatCrossSectionShape_; }
56
57 /*!
58 * \brief Returns the throats's shape factor.
59 */
60 Scalar throatShapeFactor() const
61 { return throatShapeFactor_; }
62
63 /*!
64 * \brief Returns the throats's transmissibility.
65 */
66 Scalar transmissibility(const int phaseIdx = 0) const
67 { return transmissibility_; }
68
69 /*!
70 * \brief Returns the throats's cross-sectional area.
71 */
72 Scalar throatCrossSectionalArea(const int phaseIdx = 0) const
73 { return throatCrossSectionalArea_; }
74
75 /*!
76 * \brief Returns the throats's length.
77 */
78 Scalar throatLength() const
79 { return throatLength_; }
80
81 /*!
82 * \brief Returns the throats's inscribed radius.
83 */
84 Scalar throatInscribedRadius() const
85 { return throatInscribedRadius_; }
86
87 /*!
88 * \brief Returns the throats's pore-to-pore-center distance.
89 */
90 Scalar poreToPoreDistance() const
91 { return poreToPoreDistance_; }
92
93 /*!
94 * \brief Returns the throats's cached flow variables for single-phase flow.
95 */
96 const auto& singlePhaseFlowVariables() const
97
4/4
✓ Branch 0 taken 955632 times.
✓ Branch 1 taken 1598991 times.
✓ Branch 2 taken 955632 times.
✓ Branch 3 taken 1598991 times.
5109246 { 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