GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/dumux/porenetwork/common/spatialparams.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 15 15 100.0%
Functions: 10 10 100.0%
Branches: 6 12 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-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 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/4
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
16 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 26 SpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
46
1/2
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
26 : ParentType(gridGeometry)
47 26 {}
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 40488187 Scalar throatLength(const Element& element,
58 const ElementVolumeVariables& elemVolVars) const
59 {
60 40488187 const auto eIdx = this->gridGeometry().elementMapper().index(element);
61 40488187 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 42408244 Scalar throatInscribedRadius(const Element& element,
73 const ElementVolumeVariables& elemVolVars) const
74 {
75 42408244 const auto eIdx = this->gridGeometry().elementMapper().index(element);
76 42388588 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 40488187 Scalar throatCrossSectionalArea(const Element& element,
88 const ElementVolumeVariables& elemVolVars) const
89 {
90 40488187 const auto eIdx = this->gridGeometry().elementMapper().index(element);
91
2/2
✓ Branch 0 taken 92457 times.
✓ Branch 1 taken 867363 times.
40488187 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 27310120 Scalar poreInscribedRadius(const Element& element,
104 const SubControlVolume& scv,
105 const ElementSolutionVector& elemSol) const
106
2/4
✓ Branch 0 taken 2522976 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1092264 times.
✗ Branch 3 not taken.
22202632 { 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