GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/discretization/staggered/freeflow/subcontrolvolumeface.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 42 55 76.4%
Functions: 7 51 13.7%
Branches: 251 828 30.3%

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 StaggeredDiscretization
10 * \copydoc Dumux::FreeFlowStaggeredSubControlVolumeFace
11 */
12 #ifndef DUMUX_DISCRETIZATION_STAGGERED_FREE_FLOW_SUBCONTROLVOLUMEFACE_HH
13 #define DUMUX_DISCRETIZATION_STAGGERED_FREE_FLOW_SUBCONTROLVOLUMEFACE_HH
14
15 #include <array>
16 #include <utility>
17 #include <dune/common/fvector.hh>
18 #include <dune/geometry/type.hh>
19 #include <dune/geometry/multilineargeometry.hh>
20
21 #include <dumux/common/indextraits.hh>
22 #include <dumux/discretization/subcontrolvolumefacebase.hh>
23 #include <dumux/discretization/staggered/subcontrolvolumeface.hh>
24 #include <dumux/discretization/staggered/freeflow/staggeredgeometryhelper.hh>
25
26 #include <typeinfo>
27
28 namespace Dumux {
29
30 /*!
31 * \ingroup StaggeredDiscretization
32 * \brief Default traits class to be used for the sub-control volume faces
33 * for the free-flow staggered finite volume scheme
34 * \tparam GridView the type of the grid view
35 * \tparam upwindSchemeOrder the order of the upwind scheme
36 */
37 template<class GridView, int upwindSchemeOrder>
38 struct FreeFlowStaggeredDefaultScvfGeometryTraits
39 {
40 using GridIndexType = typename IndexTraits<GridView>::GridIndex;
41 using LocalIndexType = typename IndexTraits<GridView>::LocalIndex;
42 using Scalar = typename GridView::ctype;
43 using GeometryHelper = FreeFlowStaggeredGeometryHelper<GridView, upwindSchemeOrder>;
44 using PairData = typename GeometryHelper::PairData;
45 using AxisData = typename GeometryHelper::AxisData;
46
47 using Grid = typename GridView::Grid;
48 static constexpr int dim = Grid::dimension;
49 static constexpr int dimWorld = Grid::dimensionworld;
50
51 using Element = typename GridView::template Codim<0>::Entity;
52 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
53 using Geometry = Dune::AxisAlignedCubeGeometry<Scalar, dim-1, dimWorld>;
54 };
55
56 /*!
57 * \ingroup StaggeredDiscretization
58 * \brief Helper function to turn a given cell scvface into a fake boundary face
59 * \note This function is considered internal to staggered freeflow and may change or be deleted at any time without deprecation warning
60 */
61 template<class SubControlVolumeFace>
62 SubControlVolumeFace makeStaggeredBoundaryFace(const SubControlVolumeFace& scvf,
63 const typename SubControlVolumeFace::GlobalPosition& newCenter)
64 {
65
0/9
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
17456952 auto bf = scvf;
66 34913904 bf.setCenter(newCenter);
67 34913904 bf.setBoundary(true);
68 34913904 bf.setIsGhostFace(true);
69 return bf;
70 }
71
72 /*!
73 * \ingroup StaggeredDiscretization
74 * \brief Class for a sub control volume face in the staggered method, i.e a part of the boundary
75 * of a sub control volume we compute fluxes on. This is a specialization for free flow models.
76 */
77 template<class GV,
78 int upwindSchemeOrder,
79 class T = FreeFlowStaggeredDefaultScvfGeometryTraits<GV, upwindSchemeOrder>>
80
11/51
✓ Branch 0 taken 8171696 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 8229376 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5348 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 66332 times.
✓ Branch 9 taken 475352 times.
✓ Branch 10 taken 508848 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 750 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✓ Branch 30 taken 48624 times.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✓ Branch 34 taken 24720 times.
✗ Branch 35 not taken.
✓ Branch 36 taken 6400 times.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✓ Branch 49 taken 277824 times.
✗ Branch 50 not taken.
35625192 class FreeFlowStaggeredSubControlVolumeFace
81 : public SubControlVolumeFaceBase<FreeFlowStaggeredSubControlVolumeFace<GV, upwindSchemeOrder, T>, T>
82 {
83 using ThisType = FreeFlowStaggeredSubControlVolumeFace<GV, upwindSchemeOrder, T>;
84 using ParentType = SubControlVolumeFaceBase<ThisType, T>;
85 using Geometry = typename T::Geometry;
86 using GridIndexType = typename IndexTraits<GV>::GridIndex;
87 using LocalIndexType = typename IndexTraits<GV>::LocalIndex;
88
89 using PairData = typename T::PairData;
90 using AxisData = typename T::AxisData;
91
92 using Scalar = typename T::Scalar;
93 static const int dim = GV::dimension;
94
95 static constexpr int numPairs = 2 * (dim - 1);
96
97 static constexpr bool useHigherOrder = upwindSchemeOrder > 1;
98
99 public:
100 using GlobalPosition = typename T::GlobalPosition;
101
102 static constexpr int numCornersPerFace = 2 * (dim - 1);
103
104 //! State the traits public and thus export all types
105 using Traits = T;
106
107 // The default constructor
108 FreeFlowStaggeredSubControlVolumeFace() = default;
109
110 //! Constructor with intersection
111 template <class Intersection>
112 358318 FreeFlowStaggeredSubControlVolumeFace(const Intersection& is,
113 const typename Intersection::Geometry& isGeometry,
114 GridIndexType scvfIndex,
115 const std::vector<GridIndexType>& scvIndices,
116 const typename T::GeometryHelper& geometryHelper)
117 : ParentType(),
118 area_(isGeometry.volume()),
119 center_(isGeometry.center()),
120 unitOuterNormal_(is.centerUnitOuterNormal()),
121 scvfIndex_(scvfIndex),
122 scvIndices_(scvIndices),
123 boundary_(is.boundary()),
124 axisData_(geometryHelper.axisData()),
125 1074954 pairData_(std::move(geometryHelper.pairData())),
126 localFaceIdx_(geometryHelper.localFaceIndex()),
127 dirIdx_(geometryHelper.directionIndex()),
128 358318 outerNormalSign_(sign(unitOuterNormal_[directionIndex()])),
129
4/5
✓ Branch 0 taken 2250 times.
✓ Branch 1 taken 330318 times.
✓ Branch 2 taken 28000 times.
✓ Branch 3 taken 750 times.
✗ Branch 4 not taken.
2501226 isGhostFace_(false)
130 {
131 718136 dimensions[0] = (isGeometry.corner(1) - isGeometry.corner(0)).two_norm();
132 if constexpr (dim == 3)
133 2250 dimensions[1] = (isGeometry.corner(2) - isGeometry.corner(0)).two_norm();
134 358318 }
135
136 //! The center of the sub control volume face
137 const GlobalPosition& center() const
138 {
139
4/91
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 9960 times.
✓ Branch 11 taken 29170 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 1407912 times.
✓ Branch 16 taken 241964 times.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 106 not taken.
✗ Branch 107 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
437792099 return center_;
140 }
141
142 //! The position of the dof living on the face
143 const GlobalPosition& dofPosition() const
144 {
145
2/2
✓ Branch 0 taken 864004 times.
✓ Branch 1 taken 1318948 times.
2377122 return center_;
146 }
147
148 //! The integration point for flux evaluations in global coordinates
149 const GlobalPosition& ipGlobal() const
150 {
151 // Return center for now
152
5/14
✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 11928 times.
✓ Branch 5 taken 2940 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 5976 times.
✓ Branch 11 taken 1488 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
594931476 return center_;
153 }
154
155 //! The area of the sub control volume face
156 Scalar area() const
157 {
158 return area_;
159 }
160
161 //! Returns boolean if the sub control volume face is on the boundary
162 bool boundary() const
163 {
164 return boundary_;
165 }
166
167 //! The unit outer normal vector
168 const GlobalPosition& unitOuterNormal() const
169 {
170 3056 return unitOuterNormal_;
171 }
172
173 //! Index of the inside sub control volume for spatial param evaluation
174 GridIndexType insideScvIdx() const
175 {
176
43/60
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 53878 times.
✓ Branch 10 taken 236993270 times.
✓ Branch 11 taken 42339956 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 3895197 times.
✓ Branch 14 taken 16260347 times.
✓ Branch 15 taken 136410954 times.
✓ Branch 16 taken 30090346 times.
✓ Branch 17 taken 50151602 times.
✓ Branch 18 taken 26593966 times.
✓ Branch 19 taken 1396464 times.
✓ Branch 20 taken 613554 times.
✓ Branch 21 taken 17333007 times.
✓ Branch 22 taken 25113700 times.
✓ Branch 23 taken 50300854 times.
✓ Branch 24 taken 59122888 times.
✓ Branch 25 taken 33517104 times.
✓ Branch 26 taken 57161402 times.
✓ Branch 27 taken 6627496 times.
✓ Branch 28 taken 25415096 times.
✓ Branch 29 taken 14279742 times.
✓ Branch 30 taken 6813298 times.
✓ Branch 31 taken 3300 times.
✓ Branch 32 taken 3000 times.
✓ Branch 33 taken 936652 times.
✓ Branch 34 taken 14231788 times.
✓ Branch 35 taken 6800 times.
✓ Branch 36 taken 4608 times.
✓ Branch 37 taken 244460 times.
✓ Branch 38 taken 3600 times.
✓ Branch 39 taken 507716 times.
✓ Branch 40 taken 6173968 times.
✓ Branch 41 taken 524008 times.
✓ Branch 42 taken 449712 times.
✓ Branch 43 taken 141504 times.
✓ Branch 44 taken 168424 times.
✓ Branch 45 taken 186768 times.
✓ Branch 46 taken 52940 times.
✓ Branch 47 taken 68500 times.
✓ Branch 48 taken 139120 times.
✗ Branch 49 not taken.
✓ Branch 50 taken 8400 times.
✓ Branch 51 taken 99120 times.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✓ Branch 57 taken 5340 times.
✓ Branch 58 taken 55860 times.
✗ Branch 59 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
4840303031 return scvIndices_[0];
177 }
178
179 //! index of the outside sub control volume for spatial param evaluation
180 GridIndexType outsideScvIdx() const
181 {
182
10/50
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 53878 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 59452 times.
✓ Branch 14 taken 17840 times.
✓ Branch 15 taken 85588 times.
✓ Branch 16 taken 21120 times.
✓ Branch 17 taken 210756 times.
✓ Branch 18 taken 52656 times.
✓ Branch 19 taken 182196 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 11940 times.
✓ Branch 22 taken 59820 times.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
2625582867 return scvIndices_[1];
183 }
184
185 //! The global index of this sub control volume face
186 GridIndexType index() const
187 {
188 return scvfIndex_;
189 }
190
191 //! The local index of this sub control volume face
192 LocalIndexType localFaceIdx() const
193 {
194
3/6
✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 41080652 times.
✓ Branch 5 taken 372400 times.
✗ Branch 6 not taken.
95016582 return localFaceIdx_;
195 }
196
197 //! Returns the direction index of the facet (0 = x, 1 = y, 2 = z)
198 unsigned int directionIndex() const
199 {
200 return dirIdx_;
201 }
202
203 //! Returns whether the unitNormal of the face points in positive coordinate direction
204 bool normalInPosCoordDir() const
205 {
206
2/2
✓ Branch 0 taken 141440847 times.
✓ Branch 1 taken 141787571 times.
283228418 return directionSign() > 0;
207 }
208
209 //! Returns the sign of the unit outer normal's vector
210 int directionSign() const
211 {
212 return outerNormalSign_;
213 }
214
215 //! Returns the data for one sub face
216 const PairData& pairData(const int idx) const
217 {
218
30/63
✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 48 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 48 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 48 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 96 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 96 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 96 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 96 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 53878 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 400406 times.
✓ Branch 29 taken 278986698 times.
✓ Branch 30 taken 346528 times.
✓ Branch 31 taken 278986698 times.
✗ Branch 34 not taken.
✓ Branch 35 taken 3895192 times.
✓ Branch 36 taken 48 times.
✓ Branch 37 taken 288104029 times.
✓ Branch 38 taken 48 times.
✓ Branch 39 taken 284208837 times.
✓ Branch 42 taken 2 times.
✓ Branch 43 taken 3895190 times.
✓ Branch 44 taken 10782298 times.
✓ Branch 45 taken 205980742 times.
✓ Branch 46 taken 10782296 times.
✓ Branch 47 taken 202085552 times.
✓ Branch 48 taken 3703040 times.
✓ Branch 49 taken 68962968 times.
✓ Branch 50 taken 3769372 times.
✓ Branch 51 taken 72791828 times.
✓ Branch 52 taken 66332 times.
✓ Branch 53 taken 3828860 times.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
3765775940 return pairData_[idx];
219 }
220
221 //! Return an array of all pair data
222 const std::array<PairData, numPairs>& pairData() const
223 {
224
6/54
✓ Branch 0 taken 2787790 times.
✓ Branch 1 taken 141926794 times.
✓ Branch 2 taken 153929632 times.
✓ Branch 3 taken 76964816 times.
✓ Branch 4 taken 136300 times.
✓ Branch 5 taken 1809044 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
379243684 return pairData_;
225 }
226
227 //! Return an array of all pair data
228 const AxisData& axisData() const
229 {
230 return axisData_;
231 }
232
233 //! Returns true if the face is a ghost face
234 bool isGhostFace() const
235 {
236 return isGhostFace_;
237 }
238
239 //! Returns the length of the face in a certain direction (adaptation of area() for 3d)
240 Scalar faceLength(const int localSubFaceIdx) const
241 {
242 48 if (dim == 3 && localSubFaceIdx > 1)
243 48 return dimensions[1];
244 else
245 579361120 return dimensions[0];
246 }
247
248 /*!
249 * \brief Check if the face has a parallel neighbor
250 *
251 * \param localSubFaceIdx The local index of the subface
252 * \param parallelDegreeIdx The index describing how many faces away from the self face
253 */
254 bool hasParallelNeighbor(const int localSubFaceIdx, const int parallelDegreeIdx) const
255 {
256
45/144
✓ Branch 0 taken 12481458 times.
✓ Branch 1 taken 252081734 times.
✓ Branch 2 taken 12481458 times.
✓ Branch 3 taken 252081734 times.
✓ Branch 4 taken 12481458 times.
✓ Branch 5 taken 252081734 times.
✓ Branch 6 taken 8191653 times.
✓ Branch 7 taken 144124411 times.
✓ Branch 8 taken 8191653 times.
✓ Branch 9 taken 144124411 times.
✓ Branch 10 taken 8191653 times.
✓ Branch 11 taken 144124411 times.
✓ Branch 12 taken 3828860 times.
✓ Branch 13 taken 21097 times.
✓ Branch 14 taken 3828860 times.
✓ Branch 15 taken 21097 times.
✓ Branch 16 taken 3828860 times.
✓ Branch 17 taken 21097 times.
✓ Branch 18 taken 21097 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 21097 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 21097 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 1616104 times.
✓ Branch 25 taken 37777 times.
✓ Branch 26 taken 1616104 times.
✓ Branch 27 taken 37777 times.
✓ Branch 28 taken 1616104 times.
✓ Branch 29 taken 37777 times.
✓ Branch 30 taken 2115753 times.
✓ Branch 31 taken 53878 times.
✓ Branch 32 taken 2115753 times.
✓ Branch 33 taken 53878 times.
✓ Branch 34 taken 2115753 times.
✓ Branch 35 taken 53878 times.
✓ Branch 36 taken 45235 times.
✓ Branch 37 taken 2171525 times.
✓ Branch 38 taken 45235 times.
✓ Branch 39 taken 2171525 times.
✓ Branch 40 taken 45235 times.
✓ Branch 41 taken 2171525 times.
✓ Branch 42 taken 6393336 times.
✓ Branch 43 taken 190664 times.
✓ Branch 44 taken 6393336 times.
✓ Branch 45 taken 190664 times.
✓ Branch 46 taken 6393336 times.
✓ Branch 47 taken 190664 times.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ 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.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 96 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✗ Branch 107 not taken.
✗ Branch 108 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 111 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 115 not taken.
✗ Branch 116 not taken.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 120 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 123 not taken.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 126 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 129 not taken.
✗ Branch 130 not taken.
✗ Branch 131 not taken.
✗ Branch 132 not taken.
✗ Branch 133 not taken.
✗ Branch 134 not taken.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 138 not taken.
✗ Branch 139 not taken.
✗ Branch 140 not taken.
✗ Branch 141 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
1300123746 return pairData(localSubFaceIdx).hasParallelNeighbor[parallelDegreeIdx];
257 }
258
259 /*!
260 * \brief Check if the face has a half parallel neighbor
261 *
262 * \param localSubFaceIdx The local index of the subface
263 *
264 * ------------
265 * | |
266 * | |
267 * | |
268 * -----------------------
269 * | yyyyyyyy s |
270 * | yyyyyyyy s |
271 * | yyyyyyyy s |
272 * -----------------------
273 * In this corner geometry, hasParallelNeighbor will return true for subcontrolvolumeface s belonging to the
274 * element filled by 'y's, but hasParallelNeighbor will return false for the subcontrolvolumeface that has the
275 * same dofIndex. We name this situation hasHalfParallelNeighbor.
276 */
277 bool hasHalfParallelNeighbor(const int localSubFaceIdx) const
278 {
279
14/20
✓ Branch 0 taken 10696 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10696 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 10696 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 10696 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 264563192 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 264563192 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 3823512 times.
✓ Branch 13 taken 5348 times.
✓ Branch 14 taken 3823512 times.
✓ Branch 15 taken 5348 times.
✓ Branch 16 taken 21097 times.
✓ Branch 17 taken 5348 times.
✓ Branch 18 taken 21097 times.
✓ Branch 19 taken 5348 times.
536869082 return pairData(localSubFaceIdx).hasHalfParallelNeighbor;
280 }
281
282 /*!
283 * \brief Check if the face has a corner parallel neighbor
284 *
285 * \param localSubFaceIdx The local index of the subface
286 *
287 * ------------
288 * | yyyyyyyy s
289 * | yyyyyyyy s
290 * | yyyyyyyy s
291 * -----------------------
292 * | | |
293 * | | |
294 * | | |
295 * -----------------------
296 * In this corner geometry, hasParallelNeighbor will return true for subcontrolvolumeface s belonging to the
297 * element filled by 'y's. However, as there also might be a boundary velocity value known at the corner, which
298 * can be used instead of the standard parallel velocity in some cases, we want to identify this situation. We
299 * name it cornerParallelNeighbor.
300 */
301 bool hasCornerParallelNeighbor(const int localSubFaceIdx) const
302 {
303
6/20
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 264563192 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 264563192 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 3823512 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 3823512 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 21097 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 21097 times.
536815602 return pairData(localSubFaceIdx).hasCornerParallelNeighbor;
304 }
305
306 /*!
307 * \brief Check if the face has an outer normal neighbor
308 *
309 * \param localSubFaceIdx The local index of the subface
310 */
311 bool hasOuterLateral(const int localSubFaceIdx) const
312 {
313
4/96
✓ Branch 0 taken 146783280 times.
✓ Branch 1 taken 7146352 times.
✓ Branch 2 taken 146783280 times.
✓ Branch 3 taken 7146352 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ 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.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
307859264 return pairData(localSubFaceIdx).hasOuterLateral;
314 }
315
316 /*!
317 * \brief Check if the face has a backward neighbor
318 *
319 * \param backwardIdx The index describing how many faces backward this dof is from the opposite face
320 */
321 template<bool enable = useHigherOrder, std::enable_if_t<enable, int> = 0>
322 bool hasBackwardNeighbor(const int backwardIdx) const
323 {
324
4/8
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 33266 times.
✓ Branch 5 taken 1612734 times.
✓ Branch 6 taken 33266 times.
✓ Branch 7 taken 1612734 times.
5006040 return axisData().hasBackwardNeighbor[backwardIdx];
325 }
326
327 /*!
328 * \brief Check if the face has a forward neighbor
329 *
330 * \param forwardIdx The index describing how many faces forward this dof is of the self face
331 */
332 template<bool enable = useHigherOrder, std::enable_if_t<enable, int> = 0>
333 bool hasForwardNeighbor(const int forwardIdx) const
334 {
335
4/8
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 27666 times.
✓ Branch 5 taken 1618334 times.
✓ Branch 6 taken 27666 times.
✓ Branch 7 taken 1618334 times.
5473152 return axisData().hasForwardNeighbor[forwardIdx];
336 }
337
338 //! Returns the dof of the face
339 GridIndexType dofIndex() const
340 {
341
27/79
✓ Branch 0 taken 4864 times.
✓ Branch 1 taken 32392 times.
✓ Branch 2 taken 3823540 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 3925776 times.
✓ Branch 6 taken 1496000 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 155648 times.
✓ Branch 9 taken 1569344 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1024 times.
✓ Branch 13 taken 8630688 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 283200 times.
✓ Branch 16 taken 8631712 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 58765 times.
✓ Branch 19 taken 336835 times.
✓ Branch 20 taken 10150 times.
✓ Branch 21 taken 11362 times.
✓ Branch 22 taken 267288 times.
✓ Branch 23 taken 1452544 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 2419200 times.
✓ Branch 26 taken 1452544 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 2419200 times.
✓ Branch 29 taken 196 times.
✗ Branch 30 not taken.
✓ Branch 31 taken 560 times.
✓ Branch 32 taken 196 times.
✗ Branch 33 not taken.
✓ Branch 34 taken 22680 times.
✓ Branch 35 taken 18328 times.
✓ Branch 36 taken 22120 times.
✓ Branch 37 taken 18328 times.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ 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.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
121287952 return axisData().selfDof;
342 }
343
344 //! Returns the dof of the opposing face
345 GridIndexType dofIndexOpposingFace() const
346 {
347
1/2
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
76964828 return axisData().oppositeDof;
348 }
349
350 //! Returns the dof the first forward face
351 GridIndexType dofIndexForwardFace() const
352 {
353 return axisData().inAxisForwardDofs[0];
354 }
355
356 //! Returns the dof of the first backward face
357 GridIndexType dofIndexBackwardFace() const
358 {
359 return axisData().inAxisBackwardDofs[0];
360 }
361
362 //! Returns the distance between the face and the opposite one
363 Scalar selfToOppositeDistance() const
364 {
365
2/3
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 144714486 times.
✗ Branch 2 not taken.
146639680 return axisData().selfToOppositeDistance;
366 }
367
368 /*!
369 * \brief Returns the distance between the parallel dofs
370 *
371 * \param localSubFaceIdx The local index of the subface
372 * \param parallelDegreeIdx The index describing how many faces away from the self
373 */
374 96 Scalar parallelDofsDistance(const int localSubFaceIdx, const int parallelDegreeIdx) const
375 {
376
2/2
✓ Branch 0 taken 48 times.
✓ Branch 1 taken 48 times.
96 if (parallelDegreeIdx == 0)
377
16/16
✓ Branch 0 taken 21121 times.
✓ Branch 1 taken 1657359 times.
✓ Branch 2 taken 21097 times.
✓ Branch 3 taken 1657335 times.
✓ Branch 4 taken 21097 times.
✓ Branch 5 taken 1657335 times.
✓ Branch 6 taken 21097 times.
✓ Branch 7 taken 1657335 times.
✓ Branch 8 taken 21097 times.
✓ Branch 9 taken 1657335 times.
✓ Branch 10 taken 21097 times.
✓ Branch 11 taken 1657335 times.
✓ Branch 12 taken 21097 times.
✓ Branch 13 taken 1657335 times.
✓ Branch 14 taken 21097 times.
✓ Branch 15 taken 1657335 times.
1143141568 return (faceLength(localSubFaceIdx) + pairData(localSubFaceIdx).parallelCellWidths[0]) * 0.5;
378 // pairData(localSubFaceIdx).parallelCellWidths[0]) will return 0.0 if the subface perpendicular the scvf lies on a boundary
379 else
380 {
381
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
48 assert((parallelDegreeIdx == 1) && "Only the width of the first two parallel cells (indices 0 and 1) is stored for each scvf.");
382 10857865 return (pairData(localSubFaceIdx).parallelCellWidths[0] + pairData(localSubFaceIdx).parallelCellWidths[1]) * 0.5;
383 }
384 }
385
386 //! set the center to a different position
387 void setCenter(const GlobalPosition& center)
388 17456952 { center_ = center; }
389
390 //! set the boundary flag
391 void setBoundary(bool boundaryFlag)
392 17456952 { boundary_ = boundaryFlag; }
393
394 //! set the ghost face flag
395 void setIsGhostFace(bool isGhostFaceFlag)
396
5/21
✗ Branch 0 not taken.
✓ Branch 1 taken 120800 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 11928 times.
✓ Branch 5 taken 2940 times.
✓ Branch 6 taken 508848 times.
✓ Branch 7 taken 289112 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
17456952 { isGhostFace_ = isGhostFaceFlag; }
397
398 private:
399 std::array<Scalar, dim-1> dimensions;
400 Scalar area_;
401 GlobalPosition center_;
402 GlobalPosition unitOuterNormal_;
403 GridIndexType scvfIndex_;
404 std::vector<GridIndexType> scvIndices_;
405 bool boundary_;
406
407 Scalar selfToOppositeDistance_;
408 AxisData axisData_;
409 std::array<PairData, numPairs> pairData_;
410
411 int localFaceIdx_;
412 unsigned int dirIdx_;
413 int outerNormalSign_;
414 bool isGhostFace_;
415 };
416
417 } // end namespace Dumux
418
419 #endif
420