24#ifndef DUMUX_DISCRETIZATION_BOX_SUBCONTROLVOLUMEFACE_HH
25#define DUMUX_DISCRETIZATION_BOX_SUBCONTROLVOLUMEFACE_HH
29#include <dune/geometry/type.hh>
30#include <dune/geometry/multilineargeometry.hh>
45template<
class Gr
idView>
48 using Grid =
typename GridView::Grid;
49 static constexpr int dim = Grid::dimension;
50 static constexpr int dimWorld = Grid::dimensionworld;
58 template<
int mydim,
int cdim >
61 using Type = std::array< Dune::FieldVector< ct, cdim >, (1<<(
dim-1)) >;
68 static const bool v =
true;
69 static const unsigned int topologyId = Dune::GeometryTypes::cube(mydim).id();
96 using GridIndexType =
typename T::GridIndexType;
97 using LocalIndexType =
typename T::LocalIndexType;
98 using Scalar =
typename T::Scalar;
99 using CornerStorage =
typename T::CornerStorage;
100 using Geometry =
typename T::Geometry;
101 using BoundaryFlag =
typename T::BoundaryFlag;
113 template<
class GeometryHelper,
class Element>
115 const Element& element,
116 const typename Element::Geometry& elemGeometry,
117 GridIndexType scvfIndex,
118 std::vector<LocalIndexType>&& scvIndices,
120 : corners_(geometryHelper.getScvfCorners(scvfIndex)),
122 unitOuterNormal_(geometryHelper.
normal(corners_, scvIndices)),
123 area_(geometryHelper.scvfArea(corners_)),
124 scvfIndex_(scvfIndex),
125 scvIndices_(std::move(scvIndices)),
129 for (
const auto&
corner : corners_)
131 center_ /= corners_.size();
135 template<
class GeometryHelper,
class Intersection>
137 const Intersection& intersection,
138 const typename Intersection::Geometry& isGeometry,
139 LocalIndexType indexInIntersection,
140 GridIndexType scvfIndex,
141 std::vector<LocalIndexType>&& scvIndices,
143 : corners_(geometryHelper.getBoundaryScvfCorners(intersection, isGeometry, indexInIntersection)),
145 unitOuterNormal_(intersection.centerUnitOuterNormal()),
146 area_(geometryHelper.scvfArea(corners_)),
147 scvfIndex_(scvfIndex),
148 scvIndices_(std:: move(scvIndices)),
150 , boundaryFlag_{intersection}
152 for (
const auto&
corner : corners_)
154 center_ /= corners_.size();
183 return unitOuterNormal_;
189 return scvIndices_[0];
197 return scvIndices_[1];
203 return static_cast<std::size_t
>(!
boundary());
214 assert(localIdx < corners_.size() &&
"provided index exceeds the number of corners");
215 return corners_[localIdx];
221 return Geometry(Dune::GeometryTypes::cube(Geometry::mydimension), corners_);
227 return boundaryFlag_.get();
231 CornerStorage corners_;
235 GridIndexType scvfIndex_;
236 std::vector<LocalIndexType> scvIndices_;
Defines the index types used for grid and local indices.
Boundary flag to store e.g. in sub control volume faces.
Base class for a sub control volume face.
Helper class constructing the dual grid finite volume geometries for the box discretizazion method.
Vector normal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: normal.hh:36
std::size_t value_type
Definition: boundaryflag.hh:51
Definition: boundaryflag.hh:68
typename GridView::IndexSet::IndexType GridIndex
Definition: indextraits.hh:39
unsigned int LocalIndex
Definition: indextraits.hh:40
Default traits class to be used for the sub-control volume faces for the box scheme.
Definition: discretization/box/subcontrolvolumeface.hh:47
Dune::MultiLinearGeometry< Scalar, dim-1, dimWorld, ScvfMLGTraits< Scalar > > Geometry
Definition: discretization/box/subcontrolvolumeface.hh:76
typename Grid::ctype Scalar
Definition: discretization/box/subcontrolvolumeface.hh:75
typename CornerStorage::value_type GlobalPosition
Definition: discretization/box/subcontrolvolumeface.hh:78
typename GridView::Grid Grid
Definition: discretization/box/subcontrolvolumeface.hh:48
static constexpr int dimWorld
Definition: discretization/box/subcontrolvolumeface.hh:50
typename IndexTraits< GridView >::LocalIndex LocalIndexType
Definition: discretization/box/subcontrolvolumeface.hh:74
static constexpr int dim
Definition: discretization/box/subcontrolvolumeface.hh:49
typename IndexTraits< GridView >::GridIndex GridIndexType
Definition: discretization/box/subcontrolvolumeface.hh:73
typename ScvfMLGTraits< Scalar >::template CornerStorage< dim-1, dimWorld >::Type CornerStorage
Definition: discretization/box/subcontrolvolumeface.hh:77
Definition: discretization/box/subcontrolvolumeface.hh:55
Definition: discretization/box/subcontrolvolumeface.hh:60
std::array< Dune::FieldVector< ct, cdim >,(1<<(dim-1)) > Type
Definition: discretization/box/subcontrolvolumeface.hh:61
Definition: discretization/box/subcontrolvolumeface.hh:67
static const bool v
Definition: discretization/box/subcontrolvolumeface.hh:68
static const unsigned int topologyId
Definition: discretization/box/subcontrolvolumeface.hh:69
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
LocalIndexType outsideScvIdx(int i=0) const
Index of the i-th outside sub control volume or boundary scv index.
Definition: discretization/box/subcontrolvolumeface.hh:194
const GlobalPosition & unitOuterNormal() const
Definition: discretization/box/subcontrolvolumeface.hh:181
T Traits
state the traits public and thus export all types
Definition: discretization/box/subcontrolvolumeface.hh:107
GridIndexType index() const
The local index of this sub control volume face.
Definition: discretization/box/subcontrolvolumeface.hh:207
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:136
BoxSubControlVolumeFace()=default
The default constructor.
const GlobalPosition & center() const
The center of the sub control volume face.
Definition: discretization/box/subcontrolvolumeface.hh:158
bool boundary() const
returns true if the sub control volume face is on the boundary
Definition: discretization/box/subcontrolvolumeface.hh:176
LocalIndexType insideScvIdx() const
index of the inside sub control volume
Definition: discretization/box/subcontrolvolumeface.hh:187
BoundaryFlag::value_type boundaryFlag() const
Return the boundary flag.
Definition: discretization/box/subcontrolvolumeface.hh:225
const GlobalPosition & corner(unsigned int localIdx) const
Definition: discretization/box/subcontrolvolumeface.hh:212
std::size_t numOutsideScvs() const
The number of scvs on the outside of this face.
Definition: discretization/box/subcontrolvolumeface.hh:201
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:114
const GlobalPosition & ipGlobal() const
The integration point for flux evaluations in global coordinates.
Definition: discretization/box/subcontrolvolumeface.hh:164
typename T::GlobalPosition GlobalPosition
export the type used for global coordinates
Definition: discretization/box/subcontrolvolumeface.hh:105
Geometry geometry() const
The geometry of the sub control volume face.
Definition: discretization/box/subcontrolvolumeface.hh:219
Scalar area() const
The area of the sub control volume face.
Definition: discretization/box/subcontrolvolumeface.hh:170
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