version 3.11-dev
Loading...
Searching...
No Matches
multidomain/facet/box/subcontrolvolumeface.hh
Go to the documentation of this file.
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//
14#ifndef DUMUX_FACETCOUPLING_BOX_SUBCONTROLVOLUMEFACE_HH
15#define DUMUX_FACETCOUPLING_BOX_SUBCONTROLVOLUMEFACE_HH
16
17#include <utility>
18
19#include <dune/geometry/type.hh>
20#include <dune/geometry/multilineargeometry.hh>
21
26
27namespace Dumux {
28
37template<class GV, class T = BoxDefaultScvfGeometryTraits<GV> >
39{
40 using GridIndexType = typename T::GridIndexType;
41 using LocalIndexType = typename T::LocalIndexType;
42 using Scalar = typename T::Scalar;
43 using CornerStorage = typename T::CornerStorage;
44 using Geometry = typename T::Geometry;
45 using BoundaryFlag = typename T::BoundaryFlag;
46
47public:
49 using GlobalPosition = typename T::GlobalPosition;
51 using Traits = T;
52
55
57 template<class GeometryHelper, class Element>
58 BoxFacetCouplingSubControlVolumeFace(const GeometryHelper& geometryHelper,
59 const Element& element,
60 unsigned int scvfIndex,
61 std::array<LocalIndexType, 2>&& scvIndices)
62 : center_(0.0)
63 , scvfIndex_(scvfIndex)
64 , scvIndices_(std::move(scvIndices))
65 , facetIndex_(/*undefined*/)
66 , indexInFacet_(/*undefined*/)
67 , boundary_(false)
68 , interiorBoundary_(false)
69 , boundaryFlag_{}
70 {
71 const auto corners = geometryHelper.getScvfCorners(scvfIndex);
72 unitOuterNormal_ = geometryHelper.normal(corners, scvIndices_);
73 area_ = Dumux::convexPolytopeVolume<T::dim-1>(
74 Dune::GeometryTypes::cube(T::dim-1),
75 [&](unsigned int i){ return corners[i]; });
76 for (const auto& corner : corners)
77 center_ += corner;
78 center_ /= corners.size();
79 }
80
82 template<class GeometryHelper, class Intersection>
83 BoxFacetCouplingSubControlVolumeFace(const GeometryHelper& geometryHelper,
84 const Intersection& intersection,
85 LocalIndexType indexInIntersection,
86 GridIndexType scvfIndex,
87 std::array<LocalIndexType, 2>&& scvIndices,
88 bool boundary,
90 : center_(0.0)
91 , unitOuterNormal_(intersection.centerUnitOuterNormal())
92 , scvfIndex_(scvfIndex)
93 , scvIndices_(std::move(scvIndices))
94 , facetIndex_(intersection.indexInInside())
95 , indexInFacet_(indexInIntersection)
96 , boundary_(boundary)
97 , interiorBoundary_(interiorBoundary)
98 , boundaryFlag_{intersection}
99 {
100 auto corners = geometryHelper.getBoundaryScvfCorners(intersection.indexInInside(), indexInIntersection);
102 Dune::GeometryTypes::cube(T::dim-1),
103 [&](unsigned int i){ return corners[i]; });
104 for (const auto& corner : corners)
105 center_ += corner;
106 center_ /= corners.size();
107 }
108
110 const GlobalPosition& center() const
111 { return center_; }
112
115 { return center_; }
116
118 Scalar area() const
119 { return area_; }
120
122 bool boundary() const
123 { return boundary_; }
124
126 bool interiorBoundary() const
127 { return interiorBoundary_; }
128
132 { return unitOuterNormal_; }
133
135 LocalIndexType insideScvIdx() const
136 { return scvIndices_[0]; }
137
139 GridIndexType index() const
140 { return scvfIndex_; }
141
143 // Results in undefined behaviour if i >= numOutsideScvs()
144 LocalIndexType outsideScvIdx(int i = 0) const
145 {
146 assert(!boundary() && !interiorBoundary());
147 return scvIndices_[1];
148 }
149
151 std::size_t numOutsideScvs() const
152 {
153 return static_cast<std::size_t>(!(boundary() || interiorBoundary()));
154 }
155
158 LocalIndexType facetIndexInElement() const
159 {
160 assert(interiorBoundary_ || boundary_);
161 return facetIndex_;
162 }
163
166 LocalIndexType indexInElementFacet() const
167 {
168 assert(interiorBoundary_ || boundary_);
169 return indexInFacet_;
170 }
171
174 { return boundaryFlag_.get(); }
175
176private:
177 // geometrical information
178 GlobalPosition center_;
179 GlobalPosition unitOuterNormal_;
180 Scalar area_;
181
182 // indices
183 GridIndexType scvfIndex_;
184 std::array<LocalIndexType, 2> scvIndices_;
185
186 // indices valid for domain/interior boundary scvfs
187 LocalIndexType facetIndex_;
188 LocalIndexType indexInFacet_;
189
190 // boundary information
191 bool boundary_;
192 bool interiorBoundary_;
193 BoundaryFlag boundaryFlag_;
194};
195
196} // end namespace Dumux
197
198#endif
Boundary flag to store e.g. in sub control volume faces.
Helper class constructing the dual grid finite volume geometries for the box discretizazion method.
Boundary flag to store e.g. in sub control volume faces.
Definition boundaryflag.hh:58
std::size_t value_type
Definition boundaryflag.hh:28
bool boundary() const
Definition multidomain/facet/box/subcontrolvolumeface.hh:122
LocalIndexType facetIndexInElement() const
Definition multidomain/facet/box/subcontrolvolumeface.hh:158
LocalIndexType insideScvIdx() const
index of the inside sub control volume
Definition multidomain/facet/box/subcontrolvolumeface.hh:135
GridIndexType index() const
The element-local index of this sub control volume face.
Definition multidomain/facet/box/subcontrolvolumeface.hh:139
BoxDefaultScvfGeometryTraits< GridView > Traits
Definition multidomain/facet/box/subcontrolvolumeface.hh:51
BoxFacetCouplingSubControlVolumeFace(const GeometryHelper &geometryHelper, const Intersection &intersection, LocalIndexType indexInIntersection, GridIndexType scvfIndex, std::array< LocalIndexType, 2 > &&scvIndices, bool boundary, bool interiorBoundary)
Constructor for domain or interior boundary scvfs.
Definition multidomain/facet/box/subcontrolvolumeface.hh:83
Scalar area() const
The area of the sub control volume face.
Definition multidomain/facet/box/subcontrolvolumeface.hh:118
typename BoxDefaultScvfGeometryTraits< GridView >::GlobalPosition GlobalPosition
Definition multidomain/facet/box/subcontrolvolumeface.hh:49
BoxFacetCouplingSubControlVolumeFace()=default
The default constructor.
const GlobalPosition & center() const
The center of the sub control volume face.
Definition multidomain/facet/box/subcontrolvolumeface.hh:110
const GlobalPosition & ipGlobal() const
The integration point for flux evaluations in global coordinates.
Definition multidomain/facet/box/subcontrolvolumeface.hh:114
bool interiorBoundary() const
Definition multidomain/facet/box/subcontrolvolumeface.hh:126
std::size_t numOutsideScvs() const
The number of scvs on the outside of this face.
Definition multidomain/facet/box/subcontrolvolumeface.hh:151
LocalIndexType indexInElementFacet() const
Definition multidomain/facet/box/subcontrolvolumeface.hh:166
BoxFacetCouplingSubControlVolumeFace(const GeometryHelper &geometryHelper, const Element &element, unsigned int scvfIndex, std::array< LocalIndexType, 2 > &&scvIndices)
Constructor for inner scvfs.
Definition multidomain/facet/box/subcontrolvolumeface.hh:58
const GlobalPosition & unitOuterNormal() const
Definition multidomain/facet/box/subcontrolvolumeface.hh:131
BoundaryFlag::value_type boundaryFlag() const
Return the boundary flag.
Definition multidomain/facet/box/subcontrolvolumeface.hh:173
LocalIndexType outsideScvIdx(int i=0) const
Index of the i-th outside sub control volume or boundary scv index.
Definition multidomain/facet/box/subcontrolvolumeface.hh:144
Base class for a sub control volume face.
auto convexPolytopeVolume(Dune::GeometryType type, const CornerF &c)
Compute the volume of several common geometry types.
Definition volume.hh:41
Definition adapt.hh:17
Compute the volume of several common geometry types.