25#ifndef DUMUX_POROUSMEDIUMFLOW_BOXDFM_GEOMETRY_HELPER_HH
26#define DUMUX_POROUSMEDIUMFLOW_BOXDFM_GEOMETRY_HELPER_HH
34template<
class Gr
idView,
int dim,
class ScvType,
class ScvfType>
38template <
class Gr
idView,
class ScvType,
class ScvfType>
43 using Intersection =
typename GridView::Intersection;
44 using ScvfCornerStorage =
typename ScvfType::Traits::CornerStorage;
46 static constexpr auto dim = GridView::dimension;
47 using Scalar =
typename GridView::ctype;
52 using ParentType::ParentType;
57 const typename Intersection::Geometry& isGeom,
58 unsigned int idxOnIntersection = 0)
const
59 {
return ScvfCornerStorage({isGeom.center()}); }
64 typename ScvfType::Traits::GlobalPosition
66 const Intersection& is,
67 unsigned int edgeIndexInIntersection = 0)
const
69 const auto refElement = referenceElement(this->elementGeometry_);
70 const auto vIdxLocal0 = refElement.subEntity(is.indexInInside(), 1, 0, dim);
71 const auto vIdxLocal1 = refElement.subEntity(is.indexInInside(), 1, 1, dim);
72 auto n = this->elementGeometry_.corner(vIdxLocal1) - this->elementGeometry_.corner(vIdxLocal0);
79template <
class Gr
idView,
class ScvType,
class ScvfType>
84 using Intersection =
typename GridView::Intersection;
85 using ScvfCornerStorage =
typename ScvfType::Traits::CornerStorage;
87 static constexpr auto dim = GridView::dimension;
88 static constexpr auto dimWorld = GridView::dimensionworld;
89 using Scalar =
typename GridView::ctype;
94 using ParentType::ParentType;
98 const typename Intersection::Geometry& isGeom,
99 unsigned int edgeIndexInIntersection)
const
101 const auto refElement = referenceElement(this->elementGeometry_);
102 const auto faceRefElem = referenceElement(isGeom);
105 typename ScvfType::Traits::GlobalPosition pi[9];
108 pi[0] = isGeom.center();
111 const auto idxInInside = is.indexInInside();
112 for (
int i = 0; i < faceRefElem.size(1); ++i)
114 const auto edgeIdxLocal = refElement.subEntity(idxInInside, 1, i, dim-1);
115 pi[i+1] = this->p_[edgeIdxLocal+this->corners_+1];
119 const auto corners = isGeom.corners();
125 static const std::uint8_t fo = 1;
126 static const std::uint8_t map[3][2] =
133 return ScvfCornerStorage{ {pi[map[edgeIndexInIntersection][0]],
134 pi[map[edgeIndexInIntersection][1]]} };
139 static const std::uint8_t fo = 1;
140 static const std::uint8_t map[4][2] =
148 return ScvfCornerStorage{ {pi[map[edgeIndexInIntersection][0]],
149 pi[map[edgeIndexInIntersection][1]]} };
152 DUNE_THROW(Dune::NotImplemented,
"Box fracture scvf geometries for dim=" << dim
153 <<
" dimWorld=" << dimWorld
154 <<
" corners=" << corners);
159 typename ScvfType::Traits::GlobalPosition
161 const Intersection& is,
162 unsigned int edgeIndexInIntersection)
const
164 const auto refElement = referenceElement(this->elementGeometry_);
167 typename ScvfType::Traits::GlobalPosition c[4];
169 const auto corners = refElement.size(is.indexInInside(), 1, dim);
170 for (
int i = 0; i < corners; ++i)
172 const auto vIdxLocal = refElement.subEntity(is.indexInInside(), 1, i, dim);
173 c[i] = this->elementGeometry_.corner(vIdxLocal);
177 const auto gridEdge = [&] ()
182 if (edgeIndexInIntersection == 0)
return c[1]-c[0];
183 else if (edgeIndexInIntersection == 1)
return c[2]-c[0];
184 else if (edgeIndexInIntersection == 2)
return c[2]-c[1];
185 else DUNE_THROW(Dune::InvalidStateException,
"Invalid edge index");
187 else if (corners == 4)
189 if (edgeIndexInIntersection == 0)
return c[2]-c[0];
190 else if (edgeIndexInIntersection == 1)
return c[3]-c[1];
191 else if (edgeIndexInIntersection == 2)
return c[1]-c[0];
192 else if (edgeIndexInIntersection == 3)
return c[3]-c[2];
193 else DUNE_THROW(Dune::InvalidStateException,
"Invalid edge index");
196 DUNE_THROW(Dune::InvalidStateException,
"Invalid face geometry");
200 assert(p.size() == 2);
201 const auto scvfEdge = p[1]-p[0];
Helper class constructing the dual grid finite volume geometries for the box discretizazion method.
Dune::FieldVector< Scalar, 3 > crossProduct(const Dune::FieldVector< Scalar, 3 > &vec1, const Dune::FieldVector< Scalar, 3 > &vec2)
Cross product of two vectors in three-dimensional Euclidean space.
Definition: math.hh:640
Create sub control volumes and sub control volume face geometries.
Definition: boxgeometryhelper.hh:36
A class to create sub control volume and sub control volume face geometries per element.
Definition: boxgeometryhelper.hh:119
A class to create sub control volume and sub control volume face geometries per element.
Definition: boxgeometryhelper.hh:338
Create sub control volumes and sub control volume face geometries.
Definition: geometryhelper.hh:35
ScvfType::Traits::GlobalPosition fractureNormal(const ScvfCornerStorage &p, const Intersection &is, unsigned int edgeIndexInIntersection=0) const
Definition: geometryhelper.hh:65
ScvfCornerStorage getFractureScvfCorners(const Intersection &is, const typename Intersection::Geometry &isGeom, unsigned int idxOnIntersection=0) const
Definition: geometryhelper.hh:56
ScvfCornerStorage getFractureScvfCorners(const Intersection &is, const typename Intersection::Geometry &isGeom, unsigned int edgeIndexInIntersection) const
Create the sub control volume face geometries on an intersection marked as fracture.
Definition: geometryhelper.hh:97
ScvfType::Traits::GlobalPosition fractureNormal(const ScvfCornerStorage &p, const Intersection &is, unsigned int edgeIndexInIntersection) const
get fracture scvf normal vector
Definition: geometryhelper.hh:160