13#ifndef DUMUX_POROUSMEDIUMFLOW_BOXDFM_GEOMETRY_HELPER_HH
14#define DUMUX_POROUSMEDIUMFLOW_BOXDFM_GEOMETRY_HELPER_HH
16#include <dune/common/fvector.hh>
17#include <dune/common/reservedvector.hh>
18#include <dune/geometry/multilineargeometry.hh>
30 template<
int mydim,
int cdim >
33 using Type = Dune::ReservedVector< Dune::FieldVector< ct, cdim >, (1<<(mydim)) >;
40 static const bool v =
true;
41 static const unsigned int topologyId = Dune::GeometryTypes::cube(mydim).id();
46template<
class Gr
idView,
int dim,
class ScvType,
class ScvfType>
50template <
class Gr
idView,
class ScvType,
class ScvfType>
55 using Intersection =
typename GridView::Intersection;
56 using ScvfCornerStorage =
typename ScvfType::Traits::CornerStorage;
58 static constexpr auto dim = GridView::dimension;
59 using Scalar =
typename GridView::ctype;
64 using ParentType::ParentType;
70 const auto& geo = this->elementGeometry();
71 const auto ref = referenceElement(geo);
72 return ScvfCornerStorage({ geo.global(ref.position(localFacetIndex, 1)) });
77 typename ScvfType::Traits::GlobalPosition
79 const Intersection& is,
80 unsigned int edgeIndexInIntersection)
const
82 const auto& geo = this->elementGeometry();
83 const auto ref = referenceElement(geo);
84 const auto v0 = ref.subEntity(is.indexInInside(), 1, 0, dim);
85 const auto v1 = ref.subEntity(is.indexInInside(), 1, 1, dim);
86 auto normal = geo.corner(v1) - geo.corner(v0);
93template <
class Gr
idView,
class ScvType,
class ScvfType>
98 using Intersection =
typename GridView::Intersection;
99 using ScvfCornerStorage =
typename ScvfType::Traits::CornerStorage;
101 static constexpr auto dim = GridView::dimension;
102 static constexpr auto dimWorld = GridView::dimensionworld;
103 using Scalar =
typename GridView::ctype;
108 using ParentType::ParentType;
112 unsigned int indexInFacet)
const
114 constexpr int facetCodim = 1;
119 using Dune::referenceElement;
120 const auto& geo = this->elementGeometry();
121 const auto type = referenceElement(geo).type(localFacetIndex, facetCodim);
122 if (type == Dune::GeometryTypes::triangle)
125 return Detail::Box::subEntityKeyToCornerStorage<ScvfCornerStorage>(geo, localFacetIndex, facetCodim, Corners::keys[indexInFacet]);
127 else if (type == Dune::GeometryTypes::quadrilateral)
130 return Detail::Box::subEntityKeyToCornerStorage<ScvfCornerStorage>(geo, localFacetIndex, facetCodim, Corners::keys[indexInFacet]);
133 DUNE_THROW(Dune::NotImplemented,
"Box fracture scvf geometries for dim=" << dim
134 <<
" dimWorld=" << dimWorld
135 <<
" type=" << type);
139 typename ScvfType::Traits::GlobalPosition
141 const Intersection& is,
142 unsigned int edgeIndexInIntersection)
const
144 const auto& geo = this->elementGeometry();
145 const auto refElement = referenceElement(geo);
148 typename ScvfType::Traits::GlobalPosition c[4];
150 const auto corners = refElement.size(is.indexInInside(), 1, dim);
151 for (
int i = 0; i < corners; ++i)
153 const auto vIdxLocal = refElement.subEntity(is.indexInInside(), 1, i, dim);
154 c[i] = geo.corner(vIdxLocal);
158 const auto gridEdge = [&] ()
163 if (edgeIndexInIntersection == 0)
return c[1]-c[0];
164 else if (edgeIndexInIntersection == 1)
return c[2]-c[0];
165 else if (edgeIndexInIntersection == 2)
return c[2]-c[1];
166 else DUNE_THROW(Dune::InvalidStateException,
"Invalid edge index");
168 else if (corners == 4)
170 if (edgeIndexInIntersection == 0)
return c[2]-c[0];
171 else if (edgeIndexInIntersection == 1)
return c[3]-c[1];
172 else if (edgeIndexInIntersection == 2)
return c[1]-c[0];
173 else if (edgeIndexInIntersection == 3)
return c[3]-c[2];
174 else DUNE_THROW(Dune::InvalidStateException,
"Invalid edge index");
177 DUNE_THROW(Dune::InvalidStateException,
"Invalid face geometry");
181 assert(scvfCorners.size() == 2);
182 const auto scvfEdge = scvfCorners[1]-scvfCorners[0];
Helper class constructing the dual grid finite volume geometries for the box discretizazion method.
ScvfCornerStorage getFractureScvfCorners(unsigned int localFacetIndex, unsigned int) const
Get the corners of the (d-1)-dimensional fracture scvf.
Definition: porousmediumflow/boxdfm/geometryhelper.hh:67
ScvfType::Traits::GlobalPosition fractureNormal(const ScvfCornerStorage &p, const Intersection &is, unsigned int edgeIndexInIntersection) const
Definition: porousmediumflow/boxdfm/geometryhelper.hh:78
ScvfCornerStorage getFractureScvfCorners(unsigned int localFacetIndex, unsigned int indexInFacet) const
Create the sub control volume face geometries on an intersection marked as fracture.
Definition: porousmediumflow/boxdfm/geometryhelper.hh:111
ScvfType::Traits::GlobalPosition fractureNormal(const ScvfCornerStorage &scvfCorners, const Intersection &is, unsigned int edgeIndexInIntersection) const
get fracture scvf normal vector
Definition: porousmediumflow/boxdfm/geometryhelper.hh:140
Create sub control volumes and sub control volume face geometries.
Definition: porousmediumflow/boxdfm/geometryhelper.hh:47
A class to create sub control volume and sub control volume face geometries per element.
Definition: boxgeometryhelper.hh:339
A class to create sub control volume and sub control volume face geometries per element.
Definition: boxgeometryhelper.hh:475
Create sub control volumes and sub control volume face geometries.
Definition: boxgeometryhelper.hh:257
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:642
Vector normal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: normal.hh:26
Definition: porousmediumflow/boxdfm/geometryhelper.hh:32
Dune::ReservedVector< Dune::FieldVector< ct, cdim >,(1<<(mydim)) > Type
Definition: porousmediumflow/boxdfm/geometryhelper.hh:33
Definition: porousmediumflow/boxdfm/geometryhelper.hh:39
static const bool v
Definition: porousmediumflow/boxdfm/geometryhelper.hh:40
static const unsigned int topologyId
Definition: porousmediumflow/boxdfm/geometryhelper.hh:41
Definition: porousmediumflow/boxdfm/geometryhelper.hh:26
Definition: boxgeometryhelper.hh:155
Definition: boxgeometryhelper.hh:144