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>
32#include <dune/common/reservedvector.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;
64 template<
int mydim,
int cdim >
67 using Type = Dune::ReservedVector< Dune::FieldVector< ct, cdim >, (1<<(
dim-1)) >;
74 static const bool v =
true;
75 static const unsigned int topologyId = Dune::GeometryTypes::cube(mydim).id();
102 using GridIndexType =
typename T::GridIndexType;
103 using LocalIndexType =
typename T::LocalIndexType;
104 using Scalar =
typename T::Scalar;
105 using GlobalPosition =
typename T::GlobalPosition;
106 using CornerStorage =
typename T::CornerStorage;
107 using Geometry =
typename T::Geometry;
108 using BoundaryFlag =
typename T::BoundaryFlag;
110 static_assert(T::dim == 2 || T::dim == 3,
"Box-Dfm sub-control volume face only implemented in 2d or 3d");
120 template<
class GeometryHelper,
class Element>
122 const Element& element,
123 const typename Element::Geometry& elemGeometry,
124 GridIndexType scvfIndex,
125 std::vector<LocalIndexType>&& scvIndices)
126 : corners_(geometryHelper.getScvfCorners(scvfIndex))
128 , unitOuterNormal_(geometryHelper.
normal(corners_, scvIndices))
129 , area_(geometryHelper.scvfArea(corners_))
130 , scvfIndex_(scvfIndex)
131 , scvIndices_(std::move(scvIndices))
133 , isFractureScvf_(false)
137 for (
const auto&
corner : corners_)
139 center_ /= corners_.size();
143 template<
class GeometryHelper,
class Intersection>
145 const Intersection& intersection,
146 const typename Intersection::Geometry& isGeometry,
147 LocalIndexType indexInIntersection,
148 GridIndexType scvfIndex,
149 std::vector<LocalIndexType>&& scvIndices)
150 : corners_(geometryHelper.getBoundaryScvfCorners(intersection, isGeometry, indexInIntersection))
152 , unitOuterNormal_(intersection.centerUnitOuterNormal())
153 , area_(geometryHelper.scvfArea(corners_))
154 , scvfIndex_(scvfIndex)
155 , scvIndices_(std::move(scvIndices))
157 , isFractureScvf_(false)
158 , boundaryFlag_{intersection}
161 for (
const auto&
corner : corners_)
163 center_ /= corners_.size();
167 template<
class GeometryHelper,
class Intersection>
169 const Intersection& intersection,
170 const typename Intersection::Geometry& isGeometry,
171 LocalIndexType indexInIntersection,
172 GridIndexType scvfIndex,
173 std::vector<LocalIndexType>&& scvIndices,
175 : corners_(geometryHelper.getFractureScvfCorners(intersection, isGeometry, indexInIntersection))
177 , scvfIndex_(scvfIndex)
178 , scvIndices_(std::move(scvIndices))
180 , isFractureScvf_(true)
181 , boundaryFlag_{intersection}
182 , facetIdx_(intersection.indexInInside())
188 area_ = (corners_[1]-corners_[0]).two_norm();
189 else if (T::dim == 2)
193 unitOuterNormal_ = geometryHelper.fractureNormal(corners_, intersection, indexInIntersection);
196 for (
const auto&
corner : corners_)
198 center_ /= corners_.size();
215 {
return boundary_; }
219 {
return unitOuterNormal_; }
223 {
return scvfIndex_; }
227 {
return isFractureScvf_; }
231 { assert(isFractureScvf_);
return facetIdx_; }
235 {
return boundaryFlag_.get(); }
239 {
return scvIndices_[0]; }
246 return scvIndices_[1];
252 return static_cast<std::size_t
>(!
boundary());
256 const GlobalPosition&
corner(
unsigned int localIdx)
const
258 assert(localIdx < corners_.size() &&
"provided index exceeds the number of corners");
259 return corners_[localIdx];
266 DUNE_THROW(Dune::InvalidStateException,
"The geometry object cannot be defined for fracture scvs "
267 "because the number of known corners is insufficient. "
268 "You can do this manually by extract the corners from this scv "
269 "and extrude them by the corresponding aperture. ");
271 return Geometry(Dune::GeometryTypes::cube(Geometry::mydimension), corners_);
275 CornerStorage corners_;
276 GlobalPosition center_;
277 GlobalPosition unitOuterNormal_;
279 GridIndexType scvfIndex_;
280 std::vector<LocalIndexType> scvIndices_;
282 bool isFractureScvf_;
284 LocalIndexType facetIdx_;
Base class for a sub control volume face.
Helper class constructing the dual grid finite volume geometries for the box discretizazion method.
Boundary flag to store e.g. in sub control volume faces.
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
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
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, ScvfMLGTraits< Scalar > > Geometry
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:82
typename Grid::LeafGridView::IndexSet::IndexType GridIndexType
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:79
static constexpr int dimWorld
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:55
typename CornerStorage::value_type GlobalPosition
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:84
typename Grid::ctype Scalar
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:81
typename GridView::Grid Grid
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:53
unsigned int LocalIndexType
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:80
typename ScvfMLGTraits< Scalar >::template CornerStorage< dim-1, dimWorld >::Type CornerStorage
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:83
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:60
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:66
Dune::ReservedVector< Dune::FieldVector< ct, cdim >,(1<<(dim-1)) > Type
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:67
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:73
static const unsigned int topologyId
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:75
static const bool v
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:74
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:99
const GlobalPosition & corner(unsigned int localIdx) const
Returns a corner of the sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:256
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:168
std::size_t numOutsideScvs() const
The number of scvs on the outside of this face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:250
const GlobalPosition & unitOuterNormal() const
returns the unit normal vector pointing outwards
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:218
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:144
BoundaryFlag::value_type boundaryFlag() const
Returns the boundary flag.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:234
LocalIndexType insideScvIdx() const
index of the inside sub control volume
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:238
const GlobalPosition & ipGlobal() const
The integration point for flux evaluations in global coordinates.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:206
const GlobalPosition & center() const
The center of the sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:202
LocalIndexType facetIndexInElement() const
The element-local facet index for which a fracture scv was created.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:230
BoxDfmSubControlVolumeFace()=default
The default constructor.
bool isOnFracture() const
Return if this is a fracture scvf.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:226
bool boundary() const
returns true if the sub control volume face is on the boundary
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:214
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:121
T Traits
State the traits public and thus export all types.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:114
LocalIndexType outsideScvIdx(int i=0) const
Index of the i-th outside sub control volume or boundary scv index.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:243
Geometry geometry() const
The geometry of the sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:263
GridIndexType index() const
The global index of this sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:222
Scalar area() const
The area of the sub control volume face.
Definition: porousmediumflow/boxdfm/subcontrolvolumeface.hh:210