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 PQ1BubbleDiscretization | ||
10 | * \brief Base class for a sub control volume face | ||
11 | */ | ||
12 | #ifndef DUMUX_DISCRETIZATION_PQ1BUBBLE_SUBCONTROLVOLUMEFACE_HH | ||
13 | #define DUMUX_DISCRETIZATION_PQ1BUBBLE_SUBCONTROLVOLUMEFACE_HH | ||
14 | |||
15 | #include <utility> | ||
16 | |||
17 | #include <dune/geometry/type.hh> | ||
18 | #include <dune/geometry/multilineargeometry.hh> | ||
19 | |||
20 | #include <dumux/common/boundaryflag.hh> | ||
21 | #include <dumux/common/indextraits.hh> | ||
22 | #include <dumux/discretization/subcontrolvolumefacebase.hh> | ||
23 | #include <dumux/discretization/pq1bubble/geometryhelper.hh> | ||
24 | |||
25 | namespace Dumux { | ||
26 | |||
27 | /*! | ||
28 | * \ingroup PQ1BubbleDiscretization | ||
29 | * \brief Default traits class to be used for the sub-control volume faces | ||
30 | * for the cvfe scheme | ||
31 | * \tparam GV the type of the grid view | ||
32 | */ | ||
33 | template<class GridView> | ||
34 | struct PQ1BubbleDefaultScvfGeometryTraits | ||
35 | { | ||
36 | using Grid = typename GridView::Grid; | ||
37 | static constexpr int dim = Grid::dimension; | ||
38 | static constexpr int dimWorld = Grid::dimensionworld; | ||
39 | using GridIndexType = typename IndexTraits<GridView>::GridIndex; | ||
40 | using LocalIndexType = typename IndexTraits<GridView>::LocalIndex; | ||
41 | using Scalar = typename Grid::ctype; | ||
42 | using GeometryTraits = PQ1BubbleMLGeometryTraits<Scalar>; | ||
43 | using Geometry = Dune::MultiLinearGeometry<Scalar, dim-1, dimWorld, GeometryTraits>; | ||
44 | using CornerStorage = typename GeometryTraits::template CornerStorage<dim-1, dimWorld>::Type; | ||
45 | using GlobalPosition = typename CornerStorage::value_type; | ||
46 | using BoundaryFlag = Dumux::BoundaryFlag<Grid>; | ||
47 | }; | ||
48 | |||
49 | /*! | ||
50 | * \ingroup PQ1BubbleDiscretization | ||
51 | * \brief Class for a sub control volume face in the cvfe method, i.e a part of the boundary | ||
52 | * of a sub control volume we compute fluxes on. We simply use the base class here. | ||
53 | * \tparam GV the type of the grid view | ||
54 | * \tparam T the scvf geometry traits | ||
55 | */ | ||
56 | template<class GV, | ||
57 | class T = PQ1BubbleDefaultScvfGeometryTraits<GV> > | ||
58 | class PQ1BubbleSubControlVolumeFace | ||
59 | : public SubControlVolumeFaceBase<PQ1BubbleSubControlVolumeFace<GV, T>, T> | ||
60 | { | ||
61 | using ThisType = PQ1BubbleSubControlVolumeFace<GV, T>; | ||
62 | using ParentType = SubControlVolumeFaceBase<ThisType, T>; | ||
63 | using GridIndexType = typename T::GridIndexType; | ||
64 | using LocalIndexType = typename T::LocalIndexType; | ||
65 | using Scalar = typename T::Scalar; | ||
66 | using CornerStorage = typename T::CornerStorage; | ||
67 | using Geometry = typename T::Geometry; | ||
68 | using BoundaryFlag = typename T::BoundaryFlag; | ||
69 | |||
70 | public: | ||
71 | //! export the type used for global coordinates | ||
72 | using GlobalPosition = typename T::GlobalPosition; | ||
73 | //! state the traits public and thus export all types | ||
74 | using Traits = T; | ||
75 | |||
76 | //! The default constructor | ||
77 | 857932 | PQ1BubbleSubControlVolumeFace() = default; | |
78 | |||
79 | //! Constructor for inner scvfs | ||
80 | 857932 | PQ1BubbleSubControlVolumeFace(const GlobalPosition& center, | |
81 | const Scalar area, | ||
82 | const GlobalPosition& normal, | ||
83 | const std::array<LocalIndexType, 2>& scvIndices, | ||
84 | const LocalIndexType localScvfIdx, | ||
85 | bool overlapping = false) | ||
86 | 857932 | : center_(center) | |
87 | 857932 | , unitOuterNormal_(normal) | |
88 | , area_(area) | ||
89 | , localScvfIdx_(localScvfIdx) | ||
90 | 857932 | , scvIndices_(scvIndices) | |
91 | , boundary_(false) | ||
92 | 857932 | , overlapping_(overlapping) | |
93 | 857932 | , boundaryFlag_{} | |
94 | { } | ||
95 | |||
96 | //! Constructor for boundary scvfs | ||
97 | PQ1BubbleSubControlVolumeFace(const GlobalPosition& center, | ||
98 | const Scalar area, | ||
99 | const GlobalPosition& normal, | ||
100 | const std::array<LocalIndexType, 2>& scvIndices, | ||
101 | const LocalIndexType localScvfIdx, | ||
102 | const BoundaryFlag& bFlag, | ||
103 | bool overlapping = false) | ||
104 | 17430 | : center_(center) | |
105 | 17430 | , unitOuterNormal_(normal) | |
106 | 17430 | , area_(area) | |
107 | 17430 | , localScvfIdx_(localScvfIdx) | |
108 | 17430 | , scvIndices_(scvIndices) | |
109 | 17430 | , boundary_(true) | |
110 | 17430 | , overlapping_(overlapping) | |
111 | 17430 | , boundaryFlag_(bFlag) | |
112 | {} | ||
113 | |||
114 | //! The center of the sub control volume face | ||
115 | const GlobalPosition& center() const | ||
116 | 3744592 | { return center_; } | |
117 | |||
118 | //! The integration point for flux evaluations in global coordinates | ||
119 | 34736316 | const GlobalPosition& ipGlobal() const | |
120 |
7/8✓ Branch 3 taken 37994 times.
✓ Branch 4 taken 2340 times.
✓ Branch 6 taken 44360 times.
✗ Branch 7 not taken.
✓ Branch 1 taken 4323591 times.
✓ Branch 2 taken 30734 times.
✓ Branch 0 taken 14973 times.
✓ Branch 5 taken 2092 times.
|
43443300 | { return center_; } |
121 | |||
122 | //! The area of the sub control volume face | ||
123 | 98376000 | Scalar area() const | |
124 |
1/2✓ Branch 1 taken 44 times.
✗ Branch 2 not taken.
|
98376000 | { return area_; } |
125 | |||
126 | //! returns true if the sub control volume face is overlapping with another scv | ||
127 | 36684052 | bool isOverlapping() const | |
128 |
2/2✓ Branch 0 taken 18452340 times.
✓ Branch 1 taken 18231712 times.
|
36684052 | { return overlapping_; } |
129 | |||
130 | 74703234 | bool boundary() const | |
131 |
10/10✓ Branch 0 taken 36684032 times.
✓ Branch 1 taken 581034 times.
✓ Branch 2 taken 36684028 times.
✓ Branch 3 taken 581038 times.
✓ Branch 4 taken 14404 times.
✓ Branch 5 taken 43110 times.
✓ Branch 6 taken 10274 times.
✓ Branch 7 taken 53652 times.
✓ Branch 8 taken 44120 times.
✓ Branch 9 taken 7542 times.
|
74703210 | { return boundary_; } |
132 | |||
133 | //! The unit outer normal | ||
134 | 98341026 | const GlobalPosition unitOuterNormal() const | |
135 |
1/2✓ Branch 1 taken 7586 times.
✗ Branch 2 not taken.
|
98355782 | { return unitOuterNormal_; } |
136 | |||
137 | //! Index of the inside sub control volume | ||
138 | 136443484 | GridIndexType insideScvIdx() const | |
139 |
5/11✓ Branch 0 taken 11436885 times.
✓ Branch 1 taken 13533799 times.
✓ Branch 3 taken 64230 times.
✓ Branch 4 taken 223914 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 14800 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 2 not taken.
|
136443484 | { return scvIndices_[0]; } |
140 | |||
141 | //! index of the outside sub control volume | ||
142 | 61669468 | GridIndexType outsideScvIdx() const | |
143 |
5/8✓ Branch 0 taken 11436885 times.
✓ Branch 1 taken 13533775 times.
✓ Branch 2 taken 7400 times.
✓ Branch 3 taken 7400 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 14800 times.
✗ Branch 7 not taken.
|
61669468 | { return scvIndices_[1]; } |
144 | |||
145 | //! The number of scvs on the outside of this face | ||
146 | std::size_t numOutsideScvs() const | ||
147 |
1/2✓ Branch 1 taken 44 times.
✗ Branch 2 not taken.
|
44 | { return static_cast<std::size_t>(!boundary()); } |
148 | |||
149 | //! The local index of this sub control volume face | ||
150 | 62703536 | LocalIndexType index() const | |
151 |
3/5✓ Branch 4 taken 44 times.
✗ Branch 5 not taken.
✓ Branch 1 taken 76360 times.
✗ Branch 2 not taken.
✓ Branch 0 taken 14800 times.
|
62703536 | { return localScvfIdx_; } |
152 | |||
153 | //! Return the boundary flag | ||
154 | 53348 | typename BoundaryFlag::value_type boundaryFlag() const | |
155 | 53348 | { return boundaryFlag_.get(); } | |
156 | |||
157 | private: | ||
158 | GlobalPosition center_; | ||
159 | GlobalPosition unitOuterNormal_; | ||
160 | Scalar area_; | ||
161 | LocalIndexType localScvfIdx_; | ||
162 | std::array<LocalIndexType, 2> scvIndices_; | ||
163 | bool boundary_; | ||
164 | bool overlapping_; | ||
165 | BoundaryFlag boundaryFlag_; | ||
166 | }; | ||
167 | |||
168 | } // end namespace Dumux | ||
169 | |||
170 | #endif | ||
171 |