3.6-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
39
40namespace Dumux {
41
50template<class GV, class T = BoxDefaultScvfGeometryTraits<GV> >
52: public SubControlVolumeFaceBase<BoxFacetCouplingSubControlVolumeFace<GV, T>, T>
53{
56 using GridIndexType = typename T::GridIndexType;
57 using LocalIndexType = typename T::LocalIndexType;
58 using Scalar = typename T::Scalar;
59 using CornerStorage = typename T::CornerStorage;
60 using Geometry = typename T::Geometry;
61 using BoundaryFlag = typename T::BoundaryFlag;
62
63public:
65 using GlobalPosition = typename T::GlobalPosition;
67 using Traits = T;
68
71
73 template<class GeometryHelper, class Element>
74 BoxFacetCouplingSubControlVolumeFace(const GeometryHelper& geometryHelper,
75 const Element& element,
76 const typename Element::Geometry& elemGeometry,
77 unsigned int scvfIndex,
78 std::vector<LocalIndexType>&& scvIndices)
79 : corners_(geometryHelper.getScvfCorners(scvfIndex))
80 , center_(0.0)
81 , unitOuterNormal_(geometryHelper.normal(corners_, scvIndices))
82 , area_(Dumux::convexPolytopeVolume<T::dim-1>(
83 Dune::GeometryTypes::cube(T::dim-1),
84 [&](unsigned int i){ return corners_[i]; })
85 )
86 , scvfIndex_(scvfIndex)
87 , scvIndices_(std::move(scvIndices))
88 , facetIndex_(/*undefined*/)
89 , indexInFacet_(/*undefined*/)
90 , boundary_(false)
91 , interiorBoundary_(false)
92 , boundaryFlag_{}
93 {
94 for (const auto& corner : corners_)
95 center_ += corner;
96 center_ /= corners_.size();
97 }
98
100 template<class GeometryHelper, class Intersection>
101 BoxFacetCouplingSubControlVolumeFace(const GeometryHelper& geometryHelper,
102 const Intersection& intersection,
103 const typename Intersection::Geometry& isGeometry,
104 LocalIndexType indexInIntersection,
105 GridIndexType scvfIndex,
106 std::vector<LocalIndexType>&& scvIndices,
107 bool boundary,
108 bool interiorBoundary)
109 : corners_(geometryHelper.getBoundaryScvfCorners(intersection.indexInInside(), indexInIntersection))
110 , center_(0.0)
111 , unitOuterNormal_(intersection.centerUnitOuterNormal())
112 , area_(Dumux::convexPolytopeVolume<T::dim-1>(
113 Dune::GeometryTypes::cube(T::dim-1),
114 [&](unsigned int i){ return corners_[i]; })
115 )
116 , scvfIndex_(scvfIndex)
117 , scvIndices_(std::move(scvIndices))
118 , facetIndex_(intersection.indexInInside())
119 , indexInFacet_(indexInIntersection)
120 , boundary_(boundary)
121 , interiorBoundary_(interiorBoundary)
122 , boundaryFlag_{intersection}
123 {
124 for (const auto& corner : corners_)
125 center_ += corner;
126 center_ /= corners_.size();
127 }
128
130 const GlobalPosition& center() const
131 { return center_; }
132
135 { return center_; }
136
138 Scalar area() const
139 { return area_; }
140
142 bool boundary() const
143 { return boundary_; }
144
146 bool interiorBoundary() const
147 { return interiorBoundary_; }
148
152 { return unitOuterNormal_; }
153
155 LocalIndexType insideScvIdx() const
156 { return scvIndices_[0]; }
157
159 GridIndexType index() const
160 { return scvfIndex_; }
161
163 // Results in undefined behaviour if i >= numOutsideScvs()
164 LocalIndexType outsideScvIdx(int i = 0) const
165 {
166 assert(!boundary() && !interiorBoundary());
167 return scvIndices_[1];
168 }
169
171 std::size_t numOutsideScvs() const
172 {
173 return static_cast<std::size_t>(!(boundary() || interiorBoundary()));
174 }
175
178 LocalIndexType facetIndexInElement() const
179 {
180 assert(interiorBoundary_ || boundary_);
181 return facetIndex_;
182 }
183
186 LocalIndexType indexInElementFacet() const
187 {
188 assert(interiorBoundary_ || boundary_);
189 return indexInFacet_;
190 }
191
193 Geometry geometry() const
194 { return Geometry(Dune::GeometryTypes::cube(Geometry::mydimension), corners_); }
195
198 { return boundaryFlag_.get(); }
199
201 const GlobalPosition& corner(unsigned int localIdx) const
202 {
203 assert(localIdx < corners_.size() && "provided index exceeds the number of corners");
204 return corners_[localIdx];
205 }
206
207private:
208 // geometrical information
209 CornerStorage corners_;
210 GlobalPosition center_;
211 GlobalPosition unitOuterNormal_;
212 Scalar area_;
213
214 // indices
215 GridIndexType scvfIndex_;
216 std::vector<LocalIndexType> scvIndices_;
217
218 // indices valid for domain/interior boundary scvfs
219 LocalIndexType facetIndex_;
220 LocalIndexType indexInFacet_;
221
222 // boundary information
223 bool boundary_;
224 bool interiorBoundary_;
225 BoundaryFlag boundaryFlag_;
226};
227
228} // end namespace Dumux
229
230#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.
Compute the volume of several common geometry types.
Vector normal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: normal.hh:38
auto convexPolytopeVolume(Dune::GeometryType type, const CornerF &c)
Compute the volume of several common geometry types.
Definition: volume.hh:53
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
Definition: deprecated.hh:149
std::size_t value_type
Definition: boundaryflag.hh:51
Boundary flag to store e.g. in sub control volume faces.
Definition: boundaryflag.hh:67
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:74
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:53
bool boundary() const
returns true if the sub control volume face is on the boundary
Definition: multidomain/facet/box/subcontrolvolumeface.hh:142
LocalIndexType facetIndexInElement() const
Definition: multidomain/facet/box/subcontrolvolumeface.hh:178
Geometry geometry() const
The geometry of the sub control volume face.
Definition: multidomain/facet/box/subcontrolvolumeface.hh:193
LocalIndexType insideScvIdx() const
index of the inside sub control volume
Definition: multidomain/facet/box/subcontrolvolumeface.hh:155
GridIndexType index() const
The element-local index of this sub control volume face.
Definition: multidomain/facet/box/subcontrolvolumeface.hh:159
T Traits
state the traits public and thus export all types
Definition: multidomain/facet/box/subcontrolvolumeface.hh:67
Scalar area() const
The area of the sub control volume face.
Definition: multidomain/facet/box/subcontrolvolumeface.hh:138
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:74
typename T::GlobalPosition GlobalPosition
export the type used for global coordinates
Definition: multidomain/facet/box/subcontrolvolumeface.hh:65
BoxFacetCouplingSubControlVolumeFace()=default
The default constructor.
const GlobalPosition & center() const
The center of the sub control volume face.
Definition: multidomain/facet/box/subcontrolvolumeface.hh:130
const GlobalPosition & ipGlobal() const
The integration point for flux evaluations in global coordinates.
Definition: multidomain/facet/box/subcontrolvolumeface.hh:134
const GlobalPosition & corner(unsigned int localIdx) const
returns the position of a corner of the face
Definition: multidomain/facet/box/subcontrolvolumeface.hh:201
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:101
bool interiorBoundary() const
returns true if the sub control volume face is on an interior boundary
Definition: multidomain/facet/box/subcontrolvolumeface.hh:146
std::size_t numOutsideScvs() const
The number of scvs on the outside of this face.
Definition: multidomain/facet/box/subcontrolvolumeface.hh:171
LocalIndexType indexInElementFacet() const
Definition: multidomain/facet/box/subcontrolvolumeface.hh:186
const GlobalPosition & unitOuterNormal() const
Definition: multidomain/facet/box/subcontrolvolumeface.hh:151
BoundaryFlag::value_type boundaryFlag() const
Return the boundary flag.
Definition: multidomain/facet/box/subcontrolvolumeface.hh:197
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:164
Base class for a sub control volume face.