13#ifndef DUMUX_POROUSMEDIUMFLOW_BOXDFM_SUBCONTROLVOLUMEFACE_HH
14#define DUMUX_POROUSMEDIUMFLOW_BOXDFM_SUBCONTROLVOLUMEFACE_HH
18#include <dune/geometry/type.hh>
19#include <dune/geometry/multilineargeometry.hh>
37template<
class Gr
idView>
40 using Grid =
typename GridView::Grid;
41 static constexpr int dim = Grid::dimension;
42 static constexpr int dimWorld = Grid::dimensionworld;
65 using GridIndexType =
typename T::GridIndexType;
66 using LocalIndexType =
typename T::LocalIndexType;
67 using Scalar =
typename T::Scalar;
68 using Geometry =
typename T::Geometry;
69 using BoundaryFlag =
typename T::BoundaryFlag;
71 static_assert(T::dim == 2 || T::dim == 3,
"Box-Dfm sub-control volume face only implemented in 2d or 3d");
83 template<
class GeometryHelper,
class Element>
85 const Element& element,
86 GridIndexType scvfIndex,
87 std::array<LocalIndexType, 2>&& scvIndices)
89 , scvfIndex_(scvfIndex)
90 , scvIndices_(std::move(scvIndices))
92 , isFractureScvf_(false)
95 , indexInIntersection_(0)
97 const auto corners = geometryHelper.getScvfCorners(scvfIndex);
98 unitOuterNormal_ = geometryHelper.normal(corners, scvIndices_);
100 Dune::GeometryTypes::cube(T::dim-1),
101 [&](
unsigned int i){
return corners[i]; });
103 for (
const auto& corner : corners)
105 center_ /= corners.size();
109 template<
class GeometryHelper,
class Intersection>
111 const Intersection& intersection,
113 GridIndexType scvfIndex,
114 std::array<LocalIndexType, 2>&& scvIndices)
116 , unitOuterNormal_(intersection.centerUnitOuterNormal())
117 , scvfIndex_(scvfIndex)
118 , scvIndices_(std::move(scvIndices))
120 , isFractureScvf_(false)
121 , boundaryFlag_{intersection}
123 , indexInIntersection_(0)
125 const auto corners = geometryHelper.getBoundaryScvfCorners(intersection.indexInInside(),
indexInIntersection);
127 Dune::GeometryTypes::cube(T::dim-1),
128 [&](
unsigned int i){
return corners[i]; });
129 for (
const auto& corner : corners)
131 center_ /= corners.size();
135 template<
class GeometryHelper,
class Intersection>
137 const Intersection& intersection,
139 GridIndexType scvfIndex,
140 std::array<LocalIndexType, 2>&& scvIndices,
143 , scvfIndex_(scvfIndex)
144 , scvIndices_(std::move(scvIndices))
146 , isFractureScvf_(true)
147 , boundaryFlag_{intersection}
148 , facetIdx_(intersection.indexInInside())
151 const auto corners = geometryHelper.getFractureScvfCorners(intersection.indexInInside(),
indexInIntersection);
156 area_ = (corners[1]-corners[0]).two_norm();
157 else if (T::dim == 2)
161 unitOuterNormal_ = geometryHelper.fractureNormal(corners, intersection,
indexInIntersection);
164 for (
const auto& corner : corners)
166 center_ /= corners.size();
183 {
return boundary_; }
187 {
return unitOuterNormal_; }
191 {
return scvfIndex_; }
195 {
return isFractureScvf_; }
199 { assert(isFractureScvf_);
return facetIdx_; }
203 { assert(isFractureScvf_);
return indexInIntersection_; }
207 {
return boundaryFlag_.get(); }
211 {
return scvIndices_[0]; }
218 return scvIndices_[1];
224 return static_cast<std::size_t
>(!
boundary());
231 GridIndexType scvfIndex_;
232 std::array<LocalIndexType, 2> scvIndices_;
234 bool isFractureScvf_;
236 LocalIndexType facetIdx_;
237 LocalIndexType indexInIntersection_;
Boundary flag to store e.g. in sub control volume faces.
Boundary flag to store e.g. in sub control volume faces.
Definition: boundaryflag.hh:58
std::size_t value_type
Definition: boundaryflag.hh:28
Class for a sub control volume face in the box discrete fracture method, i.e a part of the boundary o...
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:63
std::size_t numOutsideScvs() const
The number of scvs on the outside of this face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:222
const GlobalPosition & unitOuterNormal() const
returns the unit normal vector pointing outwards
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:186
BoundaryFlag::value_type boundaryFlag() const
Returns the boundary flag.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:206
LocalIndexType indexInIntersection() const
The local edge index inside the intersection.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:202
LocalIndexType insideScvIdx() const
index of the inside sub control volume
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:210
const GlobalPosition & ipGlobal() const
The integration point for flux evaluations in global coordinates.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:174
const GlobalPosition & center() const
The center of the sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:170
BoxDfmSubControlVolumeFace(const GeometryHelper &geometryHelper, const Element &element, GridIndexType scvfIndex, std::array< LocalIndexType, 2 > &&scvIndices)
Constructor for inner scvfs.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:84
LocalIndexType facetIndexInElement() const
The element-local facet index for which a fracture scv was created.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:198
BoxDfmSubControlVolumeFace()=default
The default constructor.
bool isOnFracture() const
Return if this is a fracture scvf.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:194
bool boundary() const
returns true if the sub control volume face is on the boundary
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:182
BoxDfmSubControlVolumeFace(const GeometryHelper &geometryHelper, const Intersection &intersection, LocalIndexType indexInIntersection, GridIndexType scvfIndex, std::array< LocalIndexType, 2 > &&scvIndices, bool boundary)
Constructor for inner fracture scvfs.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:136
T Traits
State the traits public and thus export all types.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:77
LocalIndexType outsideScvIdx(int i=0) const
Index of the i-th outside sub control volume or boundary scv index.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:215
typename T::GlobalPosition GlobalPosition
export the type used for global coordinates
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:75
GridIndexType index() const
The global index of this sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:190
BoxDfmSubControlVolumeFace(const GeometryHelper &geometryHelper, const Intersection &intersection, LocalIndexType indexInIntersection, GridIndexType scvfIndex, std::array< LocalIndexType, 2 > &&scvIndices)
Constructor for boundary scvfs.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:110
Scalar area() const
The area of the sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:178
auto convexPolytopeVolume(Dune::GeometryType type, const CornerF &c)
Compute the volume of several common geometry types.
Definition: volume.hh:41
Helper class constructing the dual grid finite volume geometries for the box discrete fracture model.
Default traits class to be used for the sub-control volume faces for the box discrete fracture scheme...
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:39
static constexpr int dim
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:41
Dune::MultiLinearGeometry< Scalar, dim-1, dimWorld, GeometryTraits > Geometry
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:47
typename Grid::LeafGridView::IndexSet::IndexType GridIndexType
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:43
typename GeometryTraits::template CornerStorage< dim-1, dimWorld >::Type CornerStorage
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:48
static constexpr int dimWorld
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:42
typename CornerStorage::value_type GlobalPosition
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:49
typename Grid::ctype Scalar
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:45
typename GridView::Grid Grid
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:40
unsigned int LocalIndexType
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:44
Definition: porousmediumflow/boxdfm/geometryhelper.hh:26
Compute the volume of several common geometry types.