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 FaceCenteredStaggeredDiscretization | ||
10 | * \copydoc Dumux::FaceCenteredStaggeredSubControlVolumeFace | ||
11 | */ | ||
12 | #ifndef DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_SUBCONTROLVOLUMEFACE_HH | ||
13 | #define DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_SUBCONTROLVOLUMEFACE_HH | ||
14 | |||
15 | #include <array> | ||
16 | |||
17 | #include <dune/common/fvector.hh> | ||
18 | #include <dune/geometry/type.hh> | ||
19 | #include <dune/geometry/axisalignedcubegeometry.hh> | ||
20 | |||
21 | #include <dumux/common/indextraits.hh> | ||
22 | #include <dumux/discretization/subcontrolvolumefacebase.hh> | ||
23 | #include <dumux/discretization/facecentered/staggered/normalaxis.hh> | ||
24 | |||
25 | namespace Dumux { | ||
26 | |||
27 | /*! | ||
28 | * \ingroup FaceCenteredStaggeredDiscretization | ||
29 | * \brief Default traits class to be used for the sub-control volume face | ||
30 | * for the face-centered staggered finite volume scheme | ||
31 | * \tparam GridView the type of the grid view | ||
32 | */ | ||
33 | template<class GridView> | ||
34 | struct FaceCenteredDefaultScvfGeometryTraits | ||
35 | { | ||
36 | using GridIndexType = typename IndexTraits<GridView>::GridIndex; | ||
37 | using LocalIndexType = typename IndexTraits<GridView>::LocalIndex; | ||
38 | using Scalar = typename GridView::ctype; | ||
39 | using Element = typename GridView::template Codim<0>::Entity; | ||
40 | using GlobalPosition = typename Element::Geometry::GlobalCoordinate; | ||
41 | |||
42 | static constexpr int dim = GridView::Grid::dimension; | ||
43 | static constexpr int dimWorld = GridView::Grid::dimensionworld; | ||
44 | using CornerStorage = std::array<GlobalPosition, (1<<(dim-1))>; | ||
45 | using Geometry = Dune::AxisAlignedCubeGeometry<Scalar, dim-1, dimWorld>; | ||
46 | }; | ||
47 | |||
48 | /*! | ||
49 | * \ingroup FaceCenteredStaggeredDiscretization | ||
50 | * \brief Face centered staggered sub control volume face | ||
51 | */ | ||
52 | template<class GridView, class T = FaceCenteredDefaultScvfGeometryTraits<GridView>> | ||
53 | class FaceCenteredStaggeredSubControlVolumeFace | ||
54 | { | ||
55 | using Geometry = typename T::Geometry; | ||
56 | using GridIndexType = typename T::GridIndexType; | ||
57 | using Scalar = typename T::Scalar; | ||
58 | using Element = typename T::Element; | ||
59 | using CornerStorage = typename T::CornerStorage; | ||
60 | |||
61 | using SmallLocalIndexType = typename IndexTraits<GridView>::SmallLocalIndex; | ||
62 | |||
63 | using ElementGeometry = typename Element::Geometry; | ||
64 | using IntersectionGeometry = typename GridView::Intersection::Geometry; | ||
65 | |||
66 | public: | ||
67 | //! state the traits public and thus export all types | ||
68 | using Traits = T; | ||
69 | |||
70 | using GlobalPosition = typename T::GlobalPosition; | ||
71 | enum class FaceType : SmallLocalIndexType {frontal, lateral}; | ||
72 | enum class BoundaryType : SmallLocalIndexType {interior, physicalBoundary, processorBoundary}; | ||
73 | |||
74 | 71221344 | FaceCenteredStaggeredSubControlVolumeFace() = default; | |
75 | |||
76 | //! The constructor for frontal faces | ||
77 | 9497762 | FaceCenteredStaggeredSubControlVolumeFace(const ElementGeometry& elementGeometry, | |
78 | const IntersectionGeometry& intersectionGeometry, | ||
79 | const std::array<GridIndexType, 2> globalScvIndices, | ||
80 | const SmallLocalIndexType localScvfIdx, | ||
81 | const GridIndexType globalScvfIdx, | ||
82 | const GlobalPosition& unitOuterNormal, | ||
83 | const FaceType faceType, | ||
84 | const BoundaryType boundaryType) | ||
85 | : globalScvIndices_(globalScvIndices) | ||
86 | , localScvfIdx_(localScvfIdx) | ||
87 | , globalScvfIdx_(globalScvfIdx) | ||
88 | , area_(intersectionGeometry.volume()) | ||
89 | 9497762 | , normalAxis_(Dumux::normalAxis(unitOuterNormal)) | |
90 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9497762 times.
|
9497762 | , outerNormalSign_(sign(unitOuterNormal[normalAxis_])) |
91 | , faceType_(faceType) | ||
92 |
2/4✗ Branch 1 not taken.
✓ Branch 2 taken 8624600 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 873162 times.
|
37117952 | , boundaryType_(boundaryType) |
93 | { | ||
94 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9497762 times.
|
9497762 | assert(faceType == FaceType::frontal); |
95 |
2/2✓ Branch 0 taken 225674 times.
✓ Branch 1 taken 9272088 times.
|
18122362 | center_ = boundary() ? intersectionGeometry.center() : elementGeometry.center(); |
96 | 9497762 | ipGlobal_ = center_; | |
97 | |||
98 |
2/2✓ Branch 0 taken 9272088 times.
✓ Branch 1 taken 225674 times.
|
9497762 | if (!boundary()) |
99 | 9272088 | outerNormalSign_ *= -1.0; | |
100 | 9497762 | } | |
101 | |||
102 | //! The constructor for lateral faces | ||
103 | template<class LateralFacetGeometry> | ||
104 | 18555232 | FaceCenteredStaggeredSubControlVolumeFace(const ElementGeometry& elementGeometry, | |
105 | const IntersectionGeometry& intersectionGeometry, | ||
106 | const LateralFacetGeometry& lateralFacetGeometry, | ||
107 | const std::array<GridIndexType, 2> globalScvIndices, | ||
108 | const SmallLocalIndexType localScvfIdx, | ||
109 | const GridIndexType globalScvfIdx, | ||
110 | const GlobalPosition& unitOuterNormal, | ||
111 | const FaceType faceType, | ||
112 | const BoundaryType boundaryType) | ||
113 | : globalScvIndices_(globalScvIndices) | ||
114 | , localScvfIdx_(localScvfIdx) | ||
115 | , globalScvfIdx_(globalScvfIdx) | ||
116 | 37110464 | , area_(0.5*lateralFacetGeometry.volume()) | |
117 | 18555232 | , normalAxis_(Dumux::normalAxis(unitOuterNormal)) | |
118 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18555232 times.
|
18555232 | , outerNormalSign_(sign(unitOuterNormal[normalAxis_])) |
119 | , faceType_(faceType) | ||
120 |
2/4✗ Branch 1 not taken.
✓ Branch 2 taken 16861560 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1693672 times.
|
72527256 | , boundaryType_(boundaryType) |
121 | { | ||
122 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18555232 times.
|
18555232 | assert(faceType == FaceType::lateral); |
123 | 52278352 | const auto shift = intersectionGeometry.center() - elementGeometry.center(); | |
124 | 35416792 | ipGlobal_ = lateralFacetGeometry.center() + shift; | |
125 | 53972024 | center_ = 0.5*(lateralFacetGeometry.center() + ipGlobal_); | |
126 | 18555232 | } | |
127 | |||
128 | //! The center of the sub control volume face | ||
129 | const GlobalPosition& center() const | ||
130 |
4/5✓ Branch 0 taken 970 times.
✓ Branch 1 taken 182938 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 22860 times.
✓ Branch 4 taken 11925 times.
|
12748843 | { return center_; } |
131 | |||
132 | //! The integration point of the sub control volume face | ||
133 | const GlobalPosition& ipGlobal() const | ||
134 |
12/14✓ Branch 1 taken 26 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 114288 times.
✓ Branch 4 taken 2782 times.
✓ Branch 5 taken 1770 times.
✓ Branch 6 taken 28 times.
✓ Branch 7 taken 41892 times.
✓ Branch 8 taken 9564 times.
✓ Branch 9 taken 173970 times.
✓ Branch 10 taken 270 times.
✓ Branch 11 taken 173910 times.
✓ Branch 12 taken 1804 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 66968 times.
|
6425752 | { return ipGlobal_; } |
135 | |||
136 | //! The unit outer normal | ||
137 | const GlobalPosition unitOuterNormal() const | ||
138 | { | ||
139 | 372639015 | GlobalPosition result(0.0); | |
140 |
2/4✓ Branch 1 taken 26 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
|
375030807 | result[normalAxis_] = 1.0 * directionSign(); |
141 |
2/4✓ Branch 1 taken 26 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
|
370247223 | return result; |
142 | } | ||
143 | |||
144 | //! Index of the inside sub control volume for spatial param evaluation | ||
145 | ✗ | GridIndexType insideScvIdx() const | |
146 |
150/190✗ Branch 0 not taken.
✓ Branch 1 taken 165634832 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 165634832 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 93832916 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 151714570 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 57924620 times.
✓ Branch 10 taken 745 times.
✓ Branch 11 taken 17972419 times.
✓ Branch 12 taken 745 times.
✓ Branch 13 taken 18376373 times.
✓ Branch 14 taken 708 times.
✓ Branch 15 taken 143372337 times.
✓ Branch 16 taken 708 times.
✓ Branch 17 taken 148303601 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 39202352 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 176327808 times.
✓ Branch 22 taken 26 times.
✓ Branch 23 taken 142950658 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 34271135 times.
✗ Branch 26 not taken.
✓ Branch 27 taken 33824142 times.
✓ Branch 28 taken 1 times.
✓ Branch 29 taken 446920 times.
✗ Branch 30 not taken.
✓ Branch 31 taken 107621014 times.
✗ Branch 32 not taken.
✓ Branch 33 taken 107174092 times.
✓ Branch 34 taken 2 times.
✓ Branch 35 taken 19460040 times.
✗ Branch 36 not taken.
✓ Branch 37 taken 123920250 times.
✓ Branch 38 taken 16560 times.
✓ Branch 39 taken 142424695 times.
✓ Branch 40 taken 16562 times.
✓ Branch 41 taken 38264117 times.
✗ Branch 42 not taken.
✓ Branch 43 taken 16099896 times.
✗ Branch 44 not taken.
✓ Branch 45 taken 15816826 times.
✗ Branch 46 not taken.
✓ Branch 47 taken 52694088 times.
✓ Branch 48 taken 15760 times.
✓ Branch 49 taken 52677528 times.
✓ Branch 50 taken 15760 times.
✓ Branch 51 taken 89390270 times.
✗ Branch 52 not taken.
✓ Branch 53 taken 89390270 times.
✓ Branch 54 taken 726344 times.
✓ Branch 55 taken 90383840 times.
✓ Branch 56 taken 726344 times.
✓ Branch 57 taken 90392684 times.
✗ Branch 58 not taken.
✓ Branch 59 taken 17124 times.
✗ Branch 60 not taken.
✓ Branch 61 taken 567978 times.
✗ Branch 62 not taken.
✓ Branch 63 taken 1525928 times.
✓ Branch 64 taken 178390 times.
✓ Branch 65 taken 1320260 times.
✓ Branch 66 taken 179125 times.
✓ Branch 67 taken 440388 times.
✓ Branch 68 taken 794463 times.
✓ Branch 69 taken 268726 times.
✓ Branch 70 taken 793728 times.
✓ Branch 71 taken 487840 times.
✗ Branch 72 not taken.
✓ Branch 73 taken 21027464 times.
✓ Branch 74 taken 73128 times.
✓ Branch 75 taken 20789826 times.
✓ Branch 76 taken 73128 times.
✓ Branch 77 taken 1347886 times.
✗ Branch 78 not taken.
✓ Branch 79 taken 9606758 times.
✓ Branch 80 taken 1011120 times.
✓ Branch 81 taken 14166414 times.
✓ Branch 82 taken 188487938 times.
✓ Branch 83 taken 91118014 times.
✓ Branch 84 taken 187476818 times.
✓ Branch 85 taken 122816370 times.
✓ Branch 86 taken 728180 times.
✓ Branch 87 taken 43295100 times.
✓ Branch 88 taken 10970502 times.
✓ Branch 89 taken 11761502 times.
✓ Branch 90 taken 10256466 times.
✓ Branch 91 taken 77324682 times.
✓ Branch 92 taken 10815744 times.
✓ Branch 93 taken 74927440 times.
✓ Branch 94 taken 11658916 times.
✓ Branch 95 taken 19780106 times.
✓ Branch 96 taken 843172 times.
✓ Branch 97 taken 36119346 times.
✗ Branch 98 not taken.
✓ Branch 99 taken 30522088 times.
✓ Branch 100 taken 194592944 times.
✓ Branch 101 taken 53806644 times.
✓ Branch 102 taken 194592944 times.
✓ Branch 103 taken 44389280 times.
✗ Branch 104 not taken.
✓ Branch 105 taken 140485396 times.
✗ Branch 106 not taken.
✓ Branch 107 taken 147296702 times.
✓ Branch 108 taken 31302416 times.
✓ Branch 109 taken 22464710 times.
✓ Branch 110 taken 82224680 times.
✓ Branch 111 taken 70794734 times.
✓ Branch 112 taken 50964468 times.
✓ Branch 113 taken 56330238 times.
✓ Branch 114 taken 14908927 times.
✓ Branch 115 taken 4334882 times.
✓ Branch 116 taken 48631811 times.
✓ Branch 117 taken 12905800 times.
✓ Branch 118 taken 35552644 times.
✓ Branch 119 taken 10030282 times.
✓ Branch 120 taken 1773412 times.
✓ Branch 121 taken 2153030 times.
✗ Branch 122 not taken.
✓ Branch 123 taken 862492 times.
✗ Branch 124 not taken.
✓ Branch 125 taken 31959092 times.
✗ Branch 126 not taken.
✓ Branch 127 taken 31912946 times.
✓ Branch 128 taken 55571472 times.
✓ Branch 129 taken 14925442 times.
✓ Branch 130 taken 55571472 times.
✓ Branch 131 taken 15026708 times.
✓ Branch 132 taken 11478006 times.
✓ Branch 133 taken 36544542 times.
✓ Branch 134 taken 11478006 times.
✓ Branch 135 taken 36385132 times.
✓ Branch 136 taken 52807532 times.
✓ Branch 137 taken 28462482 times.
✓ Branch 138 taken 52807532 times.
✓ Branch 139 taken 77292114 times.
✗ Branch 140 not taken.
✓ Branch 141 taken 49850534 times.
✗ Branch 142 not taken.
✓ Branch 143 taken 1015302 times.
✓ Branch 144 taken 68358972 times.
✓ Branch 145 taken 13755650 times.
✓ Branch 146 taken 68358972 times.
✓ Branch 147 taken 13755650 times.
✗ Branch 148 not taken.
✓ Branch 149 taken 145974 times.
✗ Branch 150 not taken.
✓ Branch 151 taken 145998 times.
✗ Branch 152 not taken.
✓ Branch 153 taken 1116 times.
✓ Branch 154 taken 68929871 times.
✓ Branch 155 taken 31439485 times.
✓ Branch 156 taken 68929871 times.
✓ Branch 157 taken 31438393 times.
✗ Branch 158 not taken.
✓ Branch 159 taken 227496 times.
✓ Branch 160 taken 230681 times.
✓ Branch 161 taken 357337 times.
✓ Branch 162 taken 73209473 times.
✓ Branch 163 taken 16110439 times.
✓ Branch 164 taken 73467360 times.
✓ Branch 165 taken 16077143 times.
✓ Branch 166 taken 488568 times.
✓ Branch 167 taken 97665 times.
✗ Branch 168 not taken.
✓ Branch 169 taken 2062 times.
✗ Branch 170 not taken.
✓ Branch 171 taken 946 times.
✗ Branch 172 not taken.
✓ Branch 173 taken 2496 times.
✓ Branch 174 taken 365206 times.
✓ Branch 175 taken 185024 times.
✓ Branch 176 taken 365206 times.
✓ Branch 177 taken 185024 times.
✗ Branch 178 not taken.
✓ Branch 179 taken 2984 times.
✗ Branch 180 not taken.
✓ Branch 181 taken 492 times.
✓ Branch 182 taken 463716 times.
✓ Branch 183 taken 99056 times.
✓ Branch 184 taken 463716 times.
✓ Branch 185 taken 99056 times.
✗ Branch 186 not taken.
✓ Branch 187 taken 40 times.
✗ Branch 188 not taken.
✓ Branch 189 taken 40 times.
|
8172102546 | { return globalScvIndices_[0]; } |
147 | |||
148 | //! index of the outside sub control volume for spatial param evaluation | ||
149 | GridIndexType outsideScvIdx() const | ||
150 |
39/76✗ Branch 0 not taken.
✓ Branch 1 taken 163258540 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 163258540 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 150772814 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 150772814 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 11909284 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 11909258 times.
✓ Branch 12 taken 26 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 16560 times.
✓ Branch 15 taken 1 times.
✓ Branch 16 taken 16560 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✓ Branch 21 taken 2 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 89095264 times.
✓ Branch 24 taken 2 times.
✓ Branch 25 taken 111027772 times.
✗ Branch 26 not taken.
✓ Branch 27 taken 21932510 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✓ Branch 30 taken 626 times.
✓ Branch 31 taken 4352 times.
✓ Branch 32 taken 624 times.
✓ Branch 33 taken 4352 times.
✓ Branch 34 taken 624 times.
✓ Branch 35 taken 3104 times.
✓ Branch 36 taken 624 times.
✓ Branch 37 taken 23999052 times.
✗ Branch 38 not taken.
✓ Branch 39 taken 24003020 times.
✗ Branch 40 not taken.
✓ Branch 41 taken 7072 times.
✓ Branch 42 taken 7072 times.
✗ Branch 43 not taken.
✓ Branch 44 taken 7072 times.
✓ Branch 45 taken 13632 times.
✗ Branch 46 not taken.
✓ Branch 47 taken 13632 times.
✓ Branch 48 taken 13632 times.
✗ Branch 49 not taken.
✓ Branch 50 taken 13632 times.
✓ Branch 51 taken 13632 times.
✗ Branch 52 not taken.
✓ Branch 53 taken 26112 times.
✓ Branch 54 taken 13632 times.
✓ Branch 55 taken 12480 times.
✓ Branch 56 taken 13632 times.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✓ Branch 59 taken 30680 times.
✗ Branch 60 not taken.
✓ Branch 61 taken 30680 times.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 75 not taken.
|
3205099814 | { return globalScvIndices_[1]; } |
151 | |||
152 | ✗ | GridIndexType index() const | |
153 | ✗ | { return globalScvfIdx_; } | |
154 | |||
155 | ✗ | SmallLocalIndexType localIndex() const | |
156 | ✗ | { return localScvfIdx_; } | |
157 | |||
158 | FaceType faceType() const | ||
159 | { return faceType_; } | ||
160 | |||
161 | ✗ | bool boundary() const | |
162 | ✗ | { return boundaryType_ == BoundaryType::physicalBoundary; } | |
163 | |||
164 | ✗ | bool processorBoundary() const | |
165 | ✗ | { return boundaryType_ == BoundaryType::processorBoundary; } | |
166 | |||
167 | ✗ | bool isFrontal() const | |
168 | ✗ | { return faceType_ == FaceType::frontal; } | |
169 | |||
170 | ✗ | bool isLateral() const | |
171 | ✗ | { return faceType_ == FaceType::lateral; } | |
172 | |||
173 | ✗ | Scalar area() const | |
174 | ✗ | { return area_; } | |
175 | |||
176 | ✗ | SmallLocalIndexType normalAxis() const | |
177 | ✗ | { return normalAxis_; } | |
178 | |||
179 | ✗ | std::int_least8_t directionSign() const | |
180 | ✗ | { return outerNormalSign_; } | |
181 | |||
182 | private: | ||
183 | GlobalPosition center_; | ||
184 | GlobalPosition ipGlobal_; | ||
185 | std::array<GridIndexType, 2> globalScvIndices_; | ||
186 | SmallLocalIndexType localScvfIdx_; | ||
187 | GridIndexType globalScvfIdx_; | ||
188 | Scalar area_; | ||
189 | SmallLocalIndexType normalAxis_; | ||
190 | std::int_least8_t outerNormalSign_; | ||
191 | FaceType faceType_; | ||
192 | BoundaryType boundaryType_; | ||
193 | }; | ||
194 | |||
195 | } // end namespace Dumux | ||
196 | |||
197 | #endif | ||
198 |