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 CornerStorage =
typename T::CornerStorage;
73 using Geometry =
typename T::Geometry;
74 using BoundaryFlag =
typename T::BoundaryFlag;
76 static_assert(T::dim == 2 || T::dim == 3,
"Box-Dfm sub-control volume face only implemented in 2d or 3d");
86 template<
class GeometryHelper,
class Element>
88 const Element& element,
89 const typename Element::Geometry& elemGeometry,
90 GridIndexType scvfIndex,
91 std::vector<LocalIndexType>&& scvIndices)
92 : corners_(geometryHelper.getScvfCorners(scvfIndex))
94 , unitOuterNormal_(geometryHelper.
normal(corners_, scvIndices))
96 Dune::GeometryTypes::cube(T::dim-1),
97 [&](unsigned int i){
return corners_[i]; })
99 , scvfIndex_(scvfIndex)
100 , scvIndices_(std::move(scvIndices))
102 , isFractureScvf_(
false)
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,
116 LocalIndexType indexInIntersection,
117 GridIndexType scvfIndex,
118 std::vector<LocalIndexType>&& scvIndices)
119 : corners_(geometryHelper.getBoundaryScvfCorners(intersection.indexInInside(), indexInIntersection))
121 , unitOuterNormal_(intersection.centerUnitOuterNormal())
123 Dune::GeometryTypes::cube(T::dim-1),
124 [&](unsigned int i){
return corners_[i]; })
126 , scvfIndex_(scvfIndex)
127 , scvIndices_(std::move(scvIndices))
129 , isFractureScvf_(
false)
130 , boundaryFlag_{intersection}
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,
143 LocalIndexType indexInIntersection,
144 GridIndexType scvfIndex,
145 std::vector<LocalIndexType>&& scvIndices,
147 : corners_(geometryHelper.getFractureScvfCorners(intersection.indexInInside(), indexInIntersection))
149 , scvfIndex_(scvfIndex)
150 , scvIndices_(std::move(scvIndices))
152 , isFractureScvf_(true)
153 , boundaryFlag_{intersection}
154 , facetIdx_(intersection.indexInInside())
160 area_ = (corners_[1]-corners_[0]).two_norm();
161 else if (T::dim == 2)
165 unitOuterNormal_ = geometryHelper.fractureNormal(corners_, intersection, indexInIntersection);
168 for (
const auto& corner : corners_)
170 center_ /= corners_.size();
187 {
return boundary_; }
191 {
return unitOuterNormal_; }
195 {
return scvfIndex_; }
199 {
return isFractureScvf_; }
203 { assert(isFractureScvf_);
return facetIdx_; }
207 {
return boundaryFlag_.get(); }
211 {
return scvIndices_[0]; }
218 return scvIndices_[1];
224 return static_cast<std::size_t
>(!
boundary());
228 [[deprecated(
"Will be removed after 3.7. Use fvGeometry.geometry(scvf).")]]
232 DUNE_THROW(Dune::InvalidStateException,
"The geometry object cannot be defined for fracture scvs "
233 "because the number of known corners is insufficient. "
234 "You can do this manually by extract the corners from this scv "
235 "and extrude them by the corresponding aperture. ");
237 return Geometry(Dune::GeometryTypes::cube(Geometry::mydimension), corners_);
241 CornerStorage corners_;
242 GlobalPosition center_;
243 GlobalPosition unitOuterNormal_;
245 GridIndexType scvfIndex_;
246 std::vector<LocalIndexType> scvIndices_;
248 bool isFractureScvf_;
250 LocalIndexType facetIdx_;
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:222
const GlobalPosition & unitOuterNormal() const
returns the unit normal vector pointing outwards
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:190
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:206
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:178
const GlobalPosition & center() const
The center of the sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:174
LocalIndexType facetIndexInElement() const
The element-local facet index for which a fracture scv was created.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:202
BoxDfmSubControlVolumeFace()=default
The default constructor.
bool isOnFracture() const
Return if this is a fracture scvf.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:198
bool boundary() const
returns true if the sub control volume face is on the boundary
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:186
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:87
T Traits
State the traits public and thus export all types.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:80
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
Geometry geometry() const
The geometry of the sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:229
GridIndexType index() const
The global index of this sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:194
Scalar area() const
The area of the sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:182
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
Vector normal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: normal.hh:26
auto convexPolytopeVolume(Dune::GeometryType type, const CornerF &c)
Compute the volume of several common geometry types.
Definition: volume.hh:41
Definition: common/pdesolver.hh:24
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.