GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/porenetwork/common/spatialparams.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 11 19 57.9%
Functions: 10 90 11.1%
Branches: 33 66 50.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 PoreNetworkModels
10 * \ingroup SpatialParameters
11 * \brief The base class for spatial parameters for pore-network models.
12 */
13 #ifndef DUMUX_PNM_SPATIAL_PARAMS_HH
14 #define DUMUX_PNM_SPATIAL_PARAMS_HH
15
16 #include <type_traits>
17 #include <memory>
18
19 #include <dune/common/fvector.hh>
20 #include <dumux/common/parameters.hh>
21 #include <dumux/porousmediumflow/fvspatialparams.hh>
22
23 namespace Dumux::PoreNetwork {
24
25 /*!
26 * \ingroup SpatialParameters
27 * \ingroup PoreNetworkModels
28 * \brief The base class for spatial parameters for pore-network models.
29 */
30 template<class GridGeometry, class Scalar, class Implementation>
31
1/6
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 12 times.
✗ Branch 5 not taken.
12 class SpatialParams
32 : public FVPorousMediumFlowSpatialParams<GridGeometry, Scalar, Implementation>
33 {
34 using ParentType = FVPorousMediumFlowSpatialParams<GridGeometry, Scalar, Implementation>;
35 using GridView = typename GridGeometry::GridView;
36 using SubControlVolume = typename GridGeometry::SubControlVolume;
37 using Element = typename GridView::template Codim<0>::Entity;
38
39 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
40 static constexpr auto dimWorld = GridView::dimensionworld;
41
42 public:
43 using PermeabilityType = Scalar;
44
45 22 SpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
46
2/6
✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
22 : ParentType(gridGeometry)
47 22 {}
48
49 /*!
50 * \brief Length of the throat \f$[m]\f$.
51 * Can be solution-dependent.
52 *
53 * \param element The finite volume element
54 * \param elemVolVars The element volume variables.
55 */
56 template<class ElementVolumeVariables>
57 Scalar throatLength(const Element& element,
58 const ElementVolumeVariables& elemVolVars) const
59 {
60 121392864 const auto eIdx = this->gridGeometry().elementMapper().index(element);
61 121392864 return this->gridGeometry().throatLength(eIdx);
62 }
63
64 /*!
65 * \brief Inscribed radius of the throat \f$[m]\f$.
66 * Can be solution-dependent.
67 *
68 * \param element The finite volume element
69 * \param elemVolVars The element volume variables.
70 */
71 template<class ElementVolumeVariables>
72 Scalar throatInscribedRadius(const Element& element,
73 const ElementVolumeVariables& elemVolVars) const
74 {
75 126192924 const auto eIdx = this->gridGeometry().elementMapper().index(element);
76 127094067 return this->gridGeometry().throatInscribedRadius(eIdx);
77 }
78
79 /*!
80 * \brief Cross-sectional area of the throat \f$[m]\f$.
81 * Can be solution-dependent.
82 *
83 * \param element The finite volume element
84 * \param elemVolVars The element volume variables.
85 */
86 template<class ElementVolumeVariables>
87 Scalar throatCrossSectionalArea(const Element& element,
88 const ElementVolumeVariables& elemVolVars) const
89 {
90 121392864 const auto eIdx = this->gridGeometry().elementMapper().index(element);
91
6/6
✓ Branch 0 taken 92457 times.
✓ Branch 1 taken 867363 times.
✓ Branch 2 taken 92457 times.
✓ Branch 3 taken 867363 times.
✓ Branch 4 taken 92457 times.
✓ Branch 5 taken 867363 times.
121392864 return this->gridGeometry().throatCrossSectionalArea(eIdx);
92 }
93
94 /*!
95 * \brief Inscribed radius of the pore body \f$[m]\f$.
96 * Can be solution-dependent.
97 *
98 * \param element The finite volume element
99 * \param scv The sub-control volume
100 * \param elemSol The element solution
101 */
102 template<class ElementSolutionVector>
103 Scalar poreInscribedRadius(const Element& element,
104 const SubControlVolume& scv,
105 const ElementSolutionVector& elemSol) const
106
24/48
✓ Branch 0 taken 2522976 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2522976 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2522976 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2522976 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2522976 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 2522976 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2522976 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 2522976 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 2522976 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 2522976 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 2522976 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 2522976 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 1092264 times.
✗ Branch 25 not taken.
✓ Branch 26 taken 1092264 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 1092264 times.
✗ Branch 29 not taken.
✓ Branch 30 taken 1092264 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 1092264 times.
✗ Branch 33 not taken.
✓ Branch 34 taken 1092264 times.
✗ Branch 35 not taken.
✓ Branch 36 taken 1092264 times.
✗ Branch 37 not taken.
✓ Branch 38 taken 1092264 times.
✗ Branch 39 not taken.
✓ Branch 40 taken 1092264 times.
✗ Branch 41 not taken.
✓ Branch 42 taken 1092264 times.
✗ Branch 43 not taken.
✓ Branch 44 taken 1092264 times.
✗ Branch 45 not taken.
✓ Branch 46 taken 1092264 times.
✗ Branch 47 not taken.
73911933 { return this->gridGeometry().poreInscribedRadius(scv.dofIndex()); }
107
108 /*!
109 * \brief Returns a reference to the gridview
110 */
111 const GridView& gridView() const
112 { return this->gridGeometry().gridView(); }
113
114 //! Required for compatibility reasons with porous medium-flow models.
115 Scalar permeabilityAtPos(const GlobalPosition& globalPos) const
116 { return 1.0; }
117
118 //! Required for compatibility reasons with porous medium-flow models.
119 Scalar porosityAtPos(const GlobalPosition& globalPos) const
120 { return 1.0; }
121
122 };
123
124 } // namespace Dumux::PoreNetwork
125
126 #endif
127