25#ifndef DUMUX_POROUSMEDIUMFLOW_BOXDFM_SUBCONTROLVOLUMEFACE_HH
26#define DUMUX_POROUSMEDIUMFLOW_BOXDFM_SUBCONTROLVOLUMEFACE_HH
30#include <dune/geometry/type.hh>
31#include <dune/geometry/multilineargeometry.hh>
50template<
class Gr
idView>
53 using Grid =
typename GridView::Grid;
54 static constexpr int dim = Grid::dimension;
55 static constexpr int dimWorld = Grid::dimensionworld;
80 using GridIndexType =
typename T::GridIndexType;
81 using LocalIndexType =
typename T::LocalIndexType;
82 using Scalar =
typename T::Scalar;
83 using GlobalPosition =
typename T::GlobalPosition;
84 using CornerStorage =
typename T::CornerStorage;
85 using Geometry =
typename T::Geometry;
86 using BoundaryFlag =
typename T::BoundaryFlag;
88 static_assert(T::dim == 2 || T::dim == 3,
"Box-Dfm sub-control volume face only implemented in 2d or 3d");
98 template<
class GeometryHelper,
class Element>
100 const Element& element,
101 const typename Element::Geometry& elemGeometry,
102 GridIndexType scvfIndex,
103 std::vector<LocalIndexType>&& scvIndices)
104 : corners_(geometryHelper.getScvfCorners(scvfIndex))
106 , unitOuterNormal_(geometryHelper.
normal(corners_, scvIndices))
108 Dune::GeometryTypes::cube(T::dim-1),
109 [&](unsigned int i){
return corners_[i]; })
111 , scvfIndex_(scvfIndex)
112 , scvIndices_(std::move(scvIndices))
114 , isFractureScvf_(
false)
118 for (
const auto&
corner : corners_)
120 center_ /= corners_.size();
124 template<
class GeometryHelper,
class Intersection>
126 const Intersection& intersection,
127 const typename Intersection::Geometry& isGeometry,
128 LocalIndexType indexInIntersection,
129 GridIndexType scvfIndex,
130 std::vector<LocalIndexType>&& scvIndices)
131 : corners_(geometryHelper.getBoundaryScvfCorners(intersection.indexInInside(), indexInIntersection))
133 , unitOuterNormal_(intersection.centerUnitOuterNormal())
135 Dune::GeometryTypes::cube(T::dim-1),
136 [&](unsigned int i){
return corners_[i]; })
138 , scvfIndex_(scvfIndex)
139 , scvIndices_(std::move(scvIndices))
141 , isFractureScvf_(
false)
142 , boundaryFlag_{intersection}
145 for (
const auto&
corner : corners_)
147 center_ /= corners_.size();
151 template<
class GeometryHelper,
class Intersection>
153 const Intersection& intersection,
154 const typename Intersection::Geometry& isGeometry,
155 LocalIndexType indexInIntersection,
156 GridIndexType scvfIndex,
157 std::vector<LocalIndexType>&& scvIndices,
159 : corners_(geometryHelper.getFractureScvfCorners(intersection.indexInInside(), indexInIntersection))
161 , scvfIndex_(scvfIndex)
162 , scvIndices_(std::move(scvIndices))
164 , isFractureScvf_(true)
165 , boundaryFlag_{intersection}
166 , facetIdx_(intersection.indexInInside())
172 area_ = (corners_[1]-corners_[0]).two_norm();
173 else if (T::dim == 2)
177 unitOuterNormal_ = geometryHelper.fractureNormal(corners_, intersection, indexInIntersection);
180 for (
const auto&
corner : corners_)
182 center_ /= corners_.size();
199 {
return boundary_; }
203 {
return unitOuterNormal_; }
207 {
return scvfIndex_; }
211 {
return isFractureScvf_; }
215 { assert(isFractureScvf_);
return facetIdx_; }
219 {
return boundaryFlag_.get(); }
223 {
return scvIndices_[0]; }
230 return scvIndices_[1];
236 return static_cast<std::size_t
>(!
boundary());
240 const GlobalPosition&
corner(
unsigned int localIdx)
const
242 assert(localIdx < corners_.size() &&
"provided index exceeds the number of corners");
243 return corners_[localIdx];
250 DUNE_THROW(Dune::InvalidStateException,
"The geometry object cannot be defined for fracture scvs "
251 "because the number of known corners is insufficient. "
252 "You can do this manually by extract the corners from this scv "
253 "and extrude them by the corresponding aperture. ");
255 return Geometry(Dune::GeometryTypes::cube(Geometry::mydimension), corners_);
259 CornerStorage corners_;
260 GlobalPosition center_;
261 GlobalPosition unitOuterNormal_;
263 GridIndexType scvfIndex_;
264 std::vector<LocalIndexType> scvIndices_;
266 bool isFractureScvf_;
268 LocalIndexType facetIdx_;
Boundary flag to store e.g. in sub control volume faces.
Base class for a sub control volume face.
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
auto convexPolytopeVolume(Dune::GeometryType type, const CornerF &c)
Compute the volume of several common geometry types.
Definition: volume.hh:53
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
Definition: deprecated.hh:149
std::size_t value_type
Definition: boundaryflag.hh:51
Boundary flag to store e.g. in sub control volume faces.
Definition: boundaryflag.hh:67
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
Definition: porousmediumflow/boxdfm/geometryhelper.hh:38
Default traits class to be used for the sub-control volume faces for the box discrete fracture scheme...
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:52
static constexpr int dim
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:54
Dune::MultiLinearGeometry< Scalar, dim-1, dimWorld, GeometryTraits > Geometry
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:60
typename Grid::LeafGridView::IndexSet::IndexType GridIndexType
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:56
typename GeometryTraits::template CornerStorage< dim-1, dimWorld >::Type CornerStorage
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:61
static constexpr int dimWorld
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:55
typename CornerStorage::value_type GlobalPosition
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:62
typename Grid::ctype Scalar
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:58
typename GridView::Grid Grid
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:53
unsigned int LocalIndexType
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:57
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:77
const GlobalPosition & corner(unsigned int localIdx) const
Returns a corner of the sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:240
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:152
std::size_t numOutsideScvs() const
The number of scvs on the outside of this face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:234
const GlobalPosition & unitOuterNormal() const
returns the unit normal vector pointing outwards
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:202
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:125
BoundaryFlag::value_type boundaryFlag() const
Returns the boundary flag.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:218
LocalIndexType insideScvIdx() const
index of the inside sub control volume
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:222
const GlobalPosition & ipGlobal() const
The integration point for flux evaluations in global coordinates.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:190
const GlobalPosition & center() const
The center of the sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:186
LocalIndexType facetIndexInElement() const
The element-local facet index for which a fracture scv was created.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:214
BoxDfmSubControlVolumeFace()=default
The default constructor.
bool isOnFracture() const
Return if this is a fracture scvf.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:210
bool boundary() const
returns true if the sub control volume face is on the boundary
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:198
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:99
T Traits
State the traits public and thus export all types.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:92
LocalIndexType outsideScvIdx(int i=0) const
Index of the i-th outside sub control volume or boundary scv index.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:227
Geometry geometry() const
The geometry of the sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:247
GridIndexType index() const
The global index of this sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:206
Scalar area() const
The area of the sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:194
Helper class constructing the dual grid finite volume geometries for the box discrete fracture model.