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>
38template<
class Gr
idView>
41 using Grid =
typename GridView::Grid;
42 static constexpr int dim = Grid::dimension;
43 static constexpr int dimWorld = Grid::dimensionworld;
68 using GridIndexType =
typename T::GridIndexType;
69 using LocalIndexType =
typename T::LocalIndexType;
70 using Scalar =
typename T::Scalar;
71 using GlobalPosition =
typename T::GlobalPosition;
72 using Geometry =
typename T::Geometry;
73 using BoundaryFlag =
typename T::BoundaryFlag;
75 static_assert(T::dim == 2 || T::dim == 3,
"Box-Dfm sub-control volume face only implemented in 2d or 3d");
85 template<
class GeometryHelper,
class Element>
87 const Element& element,
88 const typename Element::Geometry& elemGeometry,
89 GridIndexType scvfIndex,
90 std::vector<LocalIndexType>&& scvIndices)
92 , scvfIndex_(scvfIndex)
93 , scvIndices_(std::move(scvIndices))
95 , isFractureScvf_(false)
98 , indexInIntersection_(0)
100 const auto corners = geometryHelper.getScvfCorners(scvfIndex);
101 unitOuterNormal_ = geometryHelper.normal(corners, scvIndices_);
103 Dune::GeometryTypes::cube(T::dim-1),
104 [&](
unsigned int i){
return corners[i]; });
106 for (
const auto& corner : corners)
108 center_ /= corners.size();
112 template<
class GeometryHelper,
class Intersection>
114 const Intersection& intersection,
115 const typename Intersection::Geometry& isGeometry,
117 GridIndexType scvfIndex,
118 std::vector<LocalIndexType>&& scvIndices)
120 , unitOuterNormal_(intersection.centerUnitOuterNormal())
121 , scvfIndex_(scvfIndex)
122 , scvIndices_(std::move(scvIndices))
124 , isFractureScvf_(false)
125 , boundaryFlag_{intersection}
127 , indexInIntersection_(0)
129 const auto corners = geometryHelper.getBoundaryScvfCorners(intersection.indexInInside(),
indexInIntersection);
131 Dune::GeometryTypes::cube(T::dim-1),
132 [&](
unsigned int i){
return corners[i]; });
133 for (
const auto& corner : corners)
135 center_ /= corners.size();
139 template<
class GeometryHelper,
class Intersection>
141 const Intersection& intersection,
142 const typename Intersection::Geometry& isGeometry,
144 GridIndexType scvfIndex,
145 std::vector<LocalIndexType>&& scvIndices,
148 , scvfIndex_(scvfIndex)
149 , scvIndices_(std::move(scvIndices))
151 , isFractureScvf_(true)
152 , boundaryFlag_{intersection}
153 , facetIdx_(intersection.indexInInside())
156 const auto corners = geometryHelper.getFractureScvfCorners(intersection.indexInInside(),
indexInIntersection);
161 area_ = (corners[1]-corners[0]).two_norm();
162 else if (T::dim == 2)
166 unitOuterNormal_ = geometryHelper.fractureNormal(corners, intersection,
indexInIntersection);
169 for (
const auto& corner : corners)
171 center_ /= corners.size();
188 {
return boundary_; }
192 {
return unitOuterNormal_; }
196 {
return scvfIndex_; }
200 {
return isFractureScvf_; }
204 { assert(isFractureScvf_);
return facetIdx_; }
208 { assert(isFractureScvf_);
return indexInIntersection_; }
212 {
return boundaryFlag_.get(); }
216 {
return scvIndices_[0]; }
223 return scvIndices_[1];
229 return static_cast<std::size_t
>(!
boundary());
233 GlobalPosition center_;
234 GlobalPosition unitOuterNormal_;
236 GridIndexType scvfIndex_;
237 std::vector<LocalIndexType> scvIndices_;
239 bool isFractureScvf_;
241 LocalIndexType facetIdx_;
242 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:55
std::size_t value_type
Definition: boundaryflag.hh:39
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:65
BoxDfmSubControlVolumeFace(const GeometryHelper &geometryHelper, const Intersection &intersection, const typename Intersection::Geometry &isGeometry, LocalIndexType indexInIntersection, GridIndexType scvfIndex, std::vector< LocalIndexType > &&scvIndices, bool boundary)
Constructor for inner fracture scvfs.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:140
std::size_t numOutsideScvs() const
The number of scvs on the outside of this face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:227
const GlobalPosition & unitOuterNormal() const
returns the unit normal vector pointing outwards
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:191
BoxDfmSubControlVolumeFace(const GeometryHelper &geometryHelper, const Intersection &intersection, const typename Intersection::Geometry &isGeometry, LocalIndexType indexInIntersection, GridIndexType scvfIndex, std::vector< LocalIndexType > &&scvIndices)
Constructor for boundary scvfs.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:113
BoundaryFlag::value_type boundaryFlag() const
Returns the boundary flag.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:211
LocalIndexType indexInIntersection() const
The local edge index inside the intersection.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:207
LocalIndexType insideScvIdx() const
index of the inside sub control volume
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:215
const GlobalPosition & ipGlobal() const
The integration point for flux evaluations in global coordinates.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:179
const GlobalPosition & center() const
The center of the sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:175
LocalIndexType facetIndexInElement() const
The element-local facet index for which a fracture scv was created.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:203
BoxDfmSubControlVolumeFace()=default
The default constructor.
bool isOnFracture() const
Return if this is a fracture scvf.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:199
bool boundary() const
returns true if the sub control volume face is on the boundary
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:187
BoxDfmSubControlVolumeFace(const GeometryHelper &geometryHelper, const Element &element, const typename Element::Geometry &elemGeometry, GridIndexType scvfIndex, std::vector< LocalIndexType > &&scvIndices)
Constructor for inner scvfs.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:86
T Traits
State the traits public and thus export all types.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:79
LocalIndexType outsideScvIdx(int i=0) const
Index of the i-th outside sub control volume or boundary scv index.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:220
GridIndexType index() const
The global index of this sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:195
Scalar area() const
The area of the sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:183
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:29
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:40
static constexpr int dim
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:42
Dune::MultiLinearGeometry< Scalar, dim-1, dimWorld, GeometryTraits > Geometry
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:48
typename Grid::LeafGridView::IndexSet::IndexType GridIndexType
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:44
typename GeometryTraits::template CornerStorage< dim-1, dimWorld >::Type CornerStorage
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:49
static constexpr int dimWorld
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:43
typename CornerStorage::value_type GlobalPosition
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:50
typename Grid::ctype Scalar
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:46
typename GridView::Grid Grid
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:41
unsigned int LocalIndexType
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:45
Definition: porousmediumflow/boxdfm/geometryhelper.hh:26
Base class for a sub control volume face.
Compute the volume of several common geometry types.