3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
26#ifndef DUMUX_FACETCOUPLING_BOX_SUBCONTROLVOLUMEFACE_HH
27#define DUMUX_FACETCOUPLING_BOX_SUBCONTROLVOLUMEFACE_HH
28
29#include <utility>
30
31#include <dune/geometry/type.hh>
32#include <dune/geometry/multilineargeometry.hh>
33
38
39namespace Dumux {
40
49template<class GV, class T = BoxDefaultScvfGeometryTraits<GV> >
51: public SubControlVolumeFaceBase<BoxFacetCouplingSubControlVolumeFace<GV, T>, T>
52{
55 using GridIndexType = typename T::GridIndexType;
56 using LocalIndexType = typename T::LocalIndexType;
57 using Scalar = typename T::Scalar;
58 using CornerStorage = typename T::CornerStorage;
59 using Geometry = typename T::Geometry;
60 using BoundaryFlag = typename T::BoundaryFlag;
61
62public:
64 using GlobalPosition = typename T::GlobalPosition;
66 using Traits = T;
67
70
72 template<class GeometryHelper, class Element>
73 BoxFacetCouplingSubControlVolumeFace(const GeometryHelper& geometryHelper,
74 const Element& element,
75 const typename Element::Geometry& elemGeometry,
76 unsigned int scvfIndex,
77 std::vector<LocalIndexType>&& scvIndices)
78 : corners_(geometryHelper.getScvfCorners(scvfIndex))
79 , center_(0.0)
80 , unitOuterNormal_(geometryHelper.normal(corners_, scvIndices))
81 , area_(geometryHelper.scvfArea(corners_))
82 , scvfIndex_(scvfIndex)
83 , scvIndices_(std::move(scvIndices))
84 , facetIndex_(/*undefined*/)
85 , indexInFacet_(/*undefined*/)
86 , boundary_(false)
87 , interiorBoundary_(false)
88 , boundaryFlag_{}
89 {
90 for (const auto& corner : corners_)
91 center_ += corner;
92 center_ /= corners_.size();
93 }
94
96 template<class GeometryHelper, class Intersection>
97 BoxFacetCouplingSubControlVolumeFace(const GeometryHelper& geometryHelper,
98 const Intersection& intersection,
99 const typename Intersection::Geometry& isGeometry,
100 LocalIndexType indexInIntersection,
101 GridIndexType scvfIndex,
102 std::vector<LocalIndexType>&& scvIndices,
103 bool boundary,
104 bool interiorBoundary)
105 : corners_(geometryHelper.getBoundaryScvfCorners(intersection, isGeometry, indexInIntersection))
106 , center_(0.0)
107 , unitOuterNormal_(intersection.centerUnitOuterNormal())
108 , area_(geometryHelper.scvfArea(corners_))
109 , scvfIndex_(scvfIndex)
110 , scvIndices_(std::move(scvIndices))
111 , facetIndex_(intersection.indexInInside())
112 , indexInFacet_(indexInIntersection)
113 , boundary_(boundary)
114 , interiorBoundary_(interiorBoundary)
115 , boundaryFlag_{intersection}
116 {
117 for (const auto& corner : corners_)
118 center_ += corner;
119 center_ /= corners_.size();
120 }
121
123 const GlobalPosition& center() const
124 { return center_; }
125
128 { return center_; }
129
131 Scalar area() const
132 { return area_; }
133
135 bool boundary() const
136 { return boundary_; }
137
139 bool interiorBoundary() const
140 { return interiorBoundary_; }
141
145 { return unitOuterNormal_; }
146
148 LocalIndexType insideScvIdx() const
149 { return scvIndices_[0]; }
150
152 GridIndexType index() const
153 { return scvfIndex_; }
154
157 LocalIndexType outsideScvIdx() const
158 {
159 assert(!boundary());
160 return scvIndices_[1];
161 }
162
165 LocalIndexType facetIndexInElement() const
166 {
167 assert(interiorBoundary_ || boundary_);
168 return facetIndex_;
169 }
170
173 LocalIndexType indexInElementFacet() const
174 {
175 assert(interiorBoundary_ || boundary_);
176 return indexInFacet_;
177 }
178
180 Geometry geometry() const
181 { return Geometry(Dune::GeometryTypes::cube(Geometry::mydimension), corners_); }
182
185 { return boundaryFlag_.get(); }
186
188 const GlobalPosition& corner(unsigned int localIdx) const
189 {
190 assert(localIdx < corners_.size() && "provided index exceeds the number of corners");
191 return corners_[localIdx];
192 }
193
194private:
195 // geometrical information
196 CornerStorage corners_;
197 GlobalPosition center_;
198 GlobalPosition unitOuterNormal_;
199 Scalar area_;
200
201 // indices
202 GridIndexType scvfIndex_;
203 std::vector<LocalIndexType> scvIndices_;
204
205 // indices valid for domain/interior boundary scvfs
206 LocalIndexType facetIndex_;
207 LocalIndexType indexInFacet_;
208
209 // boundary information
210 bool boundary_;
211 bool interiorBoundary_;
212 BoundaryFlag boundaryFlag_;
213};
214
215} // end namespace Dumux
216
217#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.
Base class for a sub control volume face.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
std::size_t value_type
Definition: boundaryflag.hh:51
Definition: boundaryflag.hh:68
Class for a sub control volume face in the box method, i.e a part of the boundary of a sub control vo...
Definition: discretization/box/subcontrolvolumeface.hh:93
Base class for a sub control volume face, i.e a part of the boundary of a sub control volume we compu...
Definition: subcontrolvolumefacebase.hh:41
Class for a sub control volume face in the box method, i.e a part of the boundary of a sub control vo...
Definition: multidomain/facet/box/subcontrolvolumeface.hh:52
bool boundary() const
returns bolean if the sub control volume face is on the boundary
Definition: multidomain/facet/box/subcontrolvolumeface.hh:135
LocalIndexType facetIndexInElement() const
Definition: multidomain/facet/box/subcontrolvolumeface.hh:165
Geometry geometry() const
The geometry of the sub control volume face.
Definition: multidomain/facet/box/subcontrolvolumeface.hh:180
LocalIndexType insideScvIdx() const
index of the inside sub control volume for spatial param evaluation
Definition: multidomain/facet/box/subcontrolvolumeface.hh:148
GridIndexType index() const
The element-local index of this sub control volume face.
Definition: multidomain/facet/box/subcontrolvolumeface.hh:152
T Traits
state the traits public and thus export all types
Definition: multidomain/facet/box/subcontrolvolumeface.hh:66
Scalar area() const
The area of the sub control volume face.
Definition: multidomain/facet/box/subcontrolvolumeface.hh:131
BoxFacetCouplingSubControlVolumeFace(const GeometryHelper &geometryHelper, const Element &element, const typename Element::Geometry &elemGeometry, unsigned int scvfIndex, std::vector< LocalIndexType > &&scvIndices)
Constructor for inner scvfs.
Definition: multidomain/facet/box/subcontrolvolumeface.hh:73
typename T::GlobalPosition GlobalPosition
export the type used for global coordinates
Definition: multidomain/facet/box/subcontrolvolumeface.hh:64
LocalIndexType outsideScvIdx() const
Definition: multidomain/facet/box/subcontrolvolumeface.hh:157
BoxFacetCouplingSubControlVolumeFace()=default
The default constructor.
const GlobalPosition & center() const
The center of the sub control volume face.
Definition: multidomain/facet/box/subcontrolvolumeface.hh:123
const GlobalPosition & ipGlobal() const
The integration point for flux evaluations in global coordinates.
Definition: multidomain/facet/box/subcontrolvolumeface.hh:127
const GlobalPosition & corner(unsigned int localIdx) const
returns the position of a corner of the face
Definition: multidomain/facet/box/subcontrolvolumeface.hh:188
BoxFacetCouplingSubControlVolumeFace(const GeometryHelper &geometryHelper, const Intersection &intersection, const typename Intersection::Geometry &isGeometry, LocalIndexType indexInIntersection, GridIndexType scvfIndex, std::vector< LocalIndexType > &&scvIndices, bool boundary, bool interiorBoundary)
Constructor for domain or interior boundary scvfs.
Definition: multidomain/facet/box/subcontrolvolumeface.hh:97
bool interiorBoundary() const
returns bolean if the sub control volume face is on an interior boundary
Definition: multidomain/facet/box/subcontrolvolumeface.hh:139
LocalIndexType indexInElementFacet() const
Definition: multidomain/facet/box/subcontrolvolumeface.hh:173
const GlobalPosition & unitOuterNormal() const
Definition: multidomain/facet/box/subcontrolvolumeface.hh:144
BoundaryFlag::value_type boundaryFlag() const
Return the boundary flag.
Definition: multidomain/facet/box/subcontrolvolumeface.hh:184
Base class for a sub control volume face.