3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
discretization/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 *****************************************************************************/
24#ifndef DUMUX_DISCRETIZATION_BOX_SUBCONTROLVOLUMEFACE_HH
25#define DUMUX_DISCRETIZATION_BOX_SUBCONTROLVOLUMEFACE_HH
26
27#include <utility>
28
29#include <dune/geometry/type.hh>
30#include <dune/geometry/multilineargeometry.hh>
31
38
39namespace Dumux {
40
47template<class GridView>
49{
50 using Grid = typename GridView::Grid;
51 static constexpr int dim = Grid::dimension;
52 static constexpr int dimWorld = Grid::dimensionworld;
55 using Scalar = typename Grid::ctype;
57 using Geometry = Dune::MultiLinearGeometry<Scalar, dim-1, dimWorld, GeometryTraits>;
58 using CornerStorage = typename GeometryTraits::template CornerStorage<dim-1, dimWorld>::Type;
59 using GlobalPosition = typename CornerStorage::value_type;
61};
62
70template<class GV,
73: public SubControlVolumeFaceBase<BoxSubControlVolumeFace<GV, T>, T>
74{
77 using GridIndexType = typename T::GridIndexType;
78 using LocalIndexType = typename T::LocalIndexType;
79 using Scalar = typename T::Scalar;
80 using CornerStorage = typename T::CornerStorage;
81 using Geometry = typename T::Geometry;
82 using BoundaryFlag = typename T::BoundaryFlag;
83 static constexpr int dim = Geometry::mydimension;
84
85public:
87 using GlobalPosition = typename T::GlobalPosition;
89 using Traits = T;
90
93
95 template<class GeometryHelper, class Element>
96 BoxSubControlVolumeFace(const GeometryHelper& geometryHelper,
97 const Element& element,
98 const typename Element::Geometry& elemGeometry,
99 GridIndexType scvfIndex,
100 std::vector<LocalIndexType>&& scvIndices,
101 bool boundary = false)
102 : corners_(geometryHelper.getScvfCorners(scvfIndex))
103 , center_(Dumux::center(corners_))
104 , unitOuterNormal_(geometryHelper.normal(corners_, scvIndices))
105 , scvfIndex_(scvfIndex)
106 , scvIndices_(std::move(scvIndices))
107 , boundary_(boundary)
108 , boundaryFlag_{}
109 {
110 area_ = Dumux::convexPolytopeVolume<dim>(
111 Dune::GeometryTypes::cube(dim),
112 [&](unsigned int i){ return corners_[i]; }
113 );
114 }
115
117 template<class GeometryHelper, class Intersection>
118 BoxSubControlVolumeFace(const GeometryHelper& geometryHelper,
119 const Intersection& intersection,
120 const typename Intersection::Geometry& isGeometry,
121 LocalIndexType indexInIntersection,
122 GridIndexType scvfIndex,
123 std::vector<LocalIndexType>&& scvIndices,
124 bool boundary = false)
125 : corners_(geometryHelper.getBoundaryScvfCorners(intersection.indexInInside(), indexInIntersection))
126 , center_(Dumux::center(corners_))
127 , unitOuterNormal_(intersection.centerUnitOuterNormal())
128 , scvfIndex_(scvfIndex)
129 , scvIndices_(std:: move(scvIndices))
130 , boundary_(boundary)
131 , boundaryFlag_{intersection}
132 {
133 area_ = Dumux::convexPolytopeVolume<dim>(
134 Dune::GeometryTypes::cube(dim),
135 [&](unsigned int i){ return corners_[i]; }
136 );
137 }
138
140 const GlobalPosition& center() const
141 {
142 return center_;
143 }
144
147 {
148 return center_;
149 }
150
152 Scalar area() const
153 {
154 return area_;
155 }
156
158 bool boundary() const
159 {
160 return boundary_;
161 }
162
164 {
165 return unitOuterNormal_;
166 }
167
169 LocalIndexType insideScvIdx() const
170 {
171 return scvIndices_[0];
172 }
173
175 // Results in undefined behaviour if i >= numOutsideScvs()
176 LocalIndexType outsideScvIdx(int i = 0) const
177 {
178 assert(!boundary());
179 return scvIndices_[1];
180 }
181
183 std::size_t numOutsideScvs() const
184 {
185 return static_cast<std::size_t>(!boundary());
186 }
187
189 GridIndexType index() const
190 {
191 return scvfIndex_;
192 }
193
194 [[deprecated("This will be removed after 3.6. Use fvGeometry.geometry(scvf).corner(i).")]]
195 const GlobalPosition& corner(unsigned int localIdx) const
196 {
197 assert(localIdx < corners_.size() && "provided index exceeds the number of corners");
198 return corners_[localIdx];
199 }
200
202 [[deprecated("This will be removed after 3.6. Use fvGeometry.geometry(scvf).")]]
203 Geometry geometry() const
204 {
205 return Geometry(Dune::GeometryTypes::cube(dim), corners_);
206 }
207
210 {
211 return boundaryFlag_.get();
212 }
213
214private:
215 CornerStorage corners_;
216 GlobalPosition center_;
217 GlobalPosition unitOuterNormal_;
218 Scalar area_;
219 GridIndexType scvfIndex_;
220 std::vector<LocalIndexType> scvIndices_;
221 bool boundary_;
222 BoundaryFlag boundaryFlag_;
223};
224
225} // end namespace Dumux
226
227#endif
Boundary flag to store e.g. in sub control volume faces.
Defines the index types used for grid and local indices.
Helper class constructing the dual grid finite volume geometries for the box discretizazion method.
Base class for a sub control volume face.
Compute the center point of a convex polytope geometry or a random-access container of corner points.
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
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
std::size_t value_type
Definition: boundaryflag.hh:51
Boundary flag to store e.g. in sub control volume faces.
Definition: boundaryflag.hh:67
typename GridView::IndexSet::IndexType GridIndex
Definition: indextraits.hh:39
unsigned int LocalIndex
Definition: indextraits.hh:40
Traits for an efficient corner storage for box method sub control volumes.
Definition: boxgeometryhelper.hh:44
Default traits class to be used for the sub-control volume faces for the box scheme.
Definition: discretization/box/subcontrolvolumeface.hh:49
typename Grid::ctype Scalar
Definition: discretization/box/subcontrolvolumeface.hh:55
typename CornerStorage::value_type GlobalPosition
Definition: discretization/box/subcontrolvolumeface.hh:59
typename GridView::Grid Grid
Definition: discretization/box/subcontrolvolumeface.hh:50
typename GeometryTraits::template CornerStorage< dim-1, dimWorld >::Type CornerStorage
Definition: discretization/box/subcontrolvolumeface.hh:58
static constexpr int dimWorld
Definition: discretization/box/subcontrolvolumeface.hh:52
typename IndexTraits< GridView >::LocalIndex LocalIndexType
Definition: discretization/box/subcontrolvolumeface.hh:54
static constexpr int dim
Definition: discretization/box/subcontrolvolumeface.hh:51
typename IndexTraits< GridView >::GridIndex GridIndexType
Definition: discretization/box/subcontrolvolumeface.hh:53
Dune::MultiLinearGeometry< Scalar, dim-1, dimWorld, GeometryTraits > Geometry
Definition: discretization/box/subcontrolvolumeface.hh:57
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
LocalIndexType outsideScvIdx(int i=0) const
Index of the i-th outside sub control volume or boundary scv index.
Definition: discretization/box/subcontrolvolumeface.hh:176
const GlobalPosition & unitOuterNormal() const
Definition: discretization/box/subcontrolvolumeface.hh:163
T Traits
state the traits public and thus export all types
Definition: discretization/box/subcontrolvolumeface.hh:89
GridIndexType index() const
The local index of this sub control volume face.
Definition: discretization/box/subcontrolvolumeface.hh:189
BoxSubControlVolumeFace(const GeometryHelper &geometryHelper, const Intersection &intersection, const typename Intersection::Geometry &isGeometry, LocalIndexType indexInIntersection, GridIndexType scvfIndex, std::vector< LocalIndexType > &&scvIndices, bool boundary=false)
Constructor for boundary scvfs.
Definition: discretization/box/subcontrolvolumeface.hh:118
BoxSubControlVolumeFace()=default
The default constructor.
const GlobalPosition & center() const
The center of the sub control volume face.
Definition: discretization/box/subcontrolvolumeface.hh:140
bool boundary() const
returns true if the sub control volume face is on the boundary
Definition: discretization/box/subcontrolvolumeface.hh:158
LocalIndexType insideScvIdx() const
index of the inside sub control volume
Definition: discretization/box/subcontrolvolumeface.hh:169
BoundaryFlag::value_type boundaryFlag() const
Return the boundary flag.
Definition: discretization/box/subcontrolvolumeface.hh:209
const GlobalPosition & corner(unsigned int localIdx) const
Definition: discretization/box/subcontrolvolumeface.hh:195
std::size_t numOutsideScvs() const
The number of scvs on the outside of this face.
Definition: discretization/box/subcontrolvolumeface.hh:183
BoxSubControlVolumeFace(const GeometryHelper &geometryHelper, const Element &element, const typename Element::Geometry &elemGeometry, GridIndexType scvfIndex, std::vector< LocalIndexType > &&scvIndices, bool boundary=false)
Constructor for inner scvfs.
Definition: discretization/box/subcontrolvolumeface.hh:96
const GlobalPosition & ipGlobal() const
The integration point for flux evaluations in global coordinates.
Definition: discretization/box/subcontrolvolumeface.hh:146
typename T::GlobalPosition GlobalPosition
export the type used for global coordinates
Definition: discretization/box/subcontrolvolumeface.hh:87
Geometry geometry() const
The geometry of the sub control volume face.
Definition: discretization/box/subcontrolvolumeface.hh:203
Scalar area() const
The area of the sub control volume face.
Definition: discretization/box/subcontrolvolumeface.hh:152
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