25#ifndef DUMUX_POROUSMEDIUMFLOW_BOXDFM_GEOMETRY_HELPER_HH
26#define DUMUX_POROUSMEDIUMFLOW_BOXDFM_GEOMETRY_HELPER_HH
28#include <dune/common/fvector.hh>
29#include <dune/common/reservedvector.hh>
30#include <dune/geometry/multilineargeometry.hh>
42 template<
int mydim,
int cdim >
45 using Type = Dune::ReservedVector< Dune::FieldVector< ct, cdim >, (1<<(mydim)) >;
52 static const bool v =
true;
53 static const unsigned int topologyId = Dune::GeometryTypes::cube(mydim).id();
58template<
class Gr
idView,
int dim,
class ScvType,
class ScvfType>
62template <
class Gr
idView,
class ScvType,
class ScvfType>
67 using Intersection =
typename GridView::Intersection;
68 using ScvfCornerStorage =
typename ScvfType::Traits::CornerStorage;
70 static constexpr auto dim = GridView::dimension;
71 using Scalar =
typename GridView::ctype;
76 using ParentType::ParentType;
82 const auto& geo = this->elementGeometry();
83 const auto ref = referenceElement(geo);
84 return ScvfCornerStorage({ geo.global(ref.position(localFacetIndex, 1)) });
88 [[deprecated(
"Will be removed after release 3.6. Use other signature.")]]
90 const typename Intersection::Geometry& isGeom,
91 unsigned int idxOnIntersection = 0)
const
93 return getFractureScvfCorners(is.indexInInside(), idxOnIntersection);
98 typename ScvfType::Traits::GlobalPosition
100 const Intersection& is,
101 unsigned int edgeIndexInIntersection)
const
103 const auto& geo = this->elementGeometry();
104 const auto ref = referenceElement(geo);
105 const auto v0 = ref.subEntity(is.indexInInside(), 1, 0, dim);
106 const auto v1 = ref.subEntity(is.indexInInside(), 1, 1, dim);
107 auto normal = geo.corner(v1) - geo.corner(v0);
114template <
class Gr
idView,
class ScvType,
class ScvfType>
119 using Intersection =
typename GridView::Intersection;
120 using ScvfCornerStorage =
typename ScvfType::Traits::CornerStorage;
122 static constexpr auto dim = GridView::dimension;
123 static constexpr auto dimWorld = GridView::dimensionworld;
124 using Scalar =
typename GridView::ctype;
129 using ParentType::ParentType;
133 unsigned int indexInFacet)
const
135 constexpr int facetCodim = 1;
140 using Dune::referenceElement;
141 const auto& geo = this->elementGeometry();
142 const auto type = referenceElement(geo).type(localFacetIndex, facetCodim);
143 if (type == Dune::GeometryTypes::triangle)
146 return Detail::Box::subEntityKeyToCornerStorage<ScvfCornerStorage>(geo, localFacetIndex, facetCodim, Corners::keys[indexInFacet]);
148 else if (type == Dune::GeometryTypes::quadrilateral)
151 return Detail::Box::subEntityKeyToCornerStorage<ScvfCornerStorage>(geo, localFacetIndex, facetCodim, Corners::keys[indexInFacet]);
154 DUNE_THROW(Dune::NotImplemented,
"Box fracture scvf geometries for dim=" << dim
155 <<
" dimWorld=" << dimWorld
156 <<
" type=" << type);
160 [[deprecated(
"Will be removed after release 3.6. Use other signature.")]]
162 const typename Intersection::Geometry& isGeom,
163 unsigned int edgeIndexInIntersection)
const
165 return getFractureScvfCorners(is.indexInInside(), edgeIndexInIntersection);
169 typename ScvfType::Traits::GlobalPosition
171 const Intersection& is,
172 unsigned int edgeIndexInIntersection)
const
174 const auto& geo = this->elementGeometry();
175 const auto refElement = referenceElement(geo);
178 typename ScvfType::Traits::GlobalPosition c[4];
180 const auto corners = refElement.size(is.indexInInside(), 1, dim);
181 for (
int i = 0; i < corners; ++i)
183 const auto vIdxLocal = refElement.subEntity(is.indexInInside(), 1, i, dim);
184 c[i] = geo.corner(vIdxLocal);
188 const auto gridEdge = [&] ()
193 if (edgeIndexInIntersection == 0)
return c[1]-c[0];
194 else if (edgeIndexInIntersection == 1)
return c[2]-c[0];
195 else if (edgeIndexInIntersection == 2)
return c[2]-c[1];
196 else DUNE_THROW(Dune::InvalidStateException,
"Invalid edge index");
198 else if (corners == 4)
200 if (edgeIndexInIntersection == 0)
return c[2]-c[0];
201 else if (edgeIndexInIntersection == 1)
return c[3]-c[1];
202 else if (edgeIndexInIntersection == 2)
return c[1]-c[0];
203 else if (edgeIndexInIntersection == 3)
return c[3]-c[2];
204 else DUNE_THROW(Dune::InvalidStateException,
"Invalid edge index");
207 DUNE_THROW(Dune::InvalidStateException,
"Invalid face geometry");
211 assert(scvfCorners.size() == 2);
212 const auto scvfEdge = scvfCorners[1]-scvfCorners[0];
Helper class constructing the dual grid finite volume geometries for the box discretizazion method.
Vector normal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: normal.hh:38
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:654
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
Definition: boxgeometryhelper.hh:156
Definition: boxgeometryhelper.hh:167
Create sub control volumes and sub control volume face geometries.
Definition: boxgeometryhelper.hh:269
A class to create sub control volume and sub control volume face geometries per element.
Definition: boxgeometryhelper.hh:374
A class to create sub control volume and sub control volume face geometries per element.
Definition: boxgeometryhelper.hh:547
Definition: porousmediumflow/boxdfm/geometryhelper.hh:38
Definition: porousmediumflow/boxdfm/geometryhelper.hh:44
Dune::ReservedVector< Dune::FieldVector< ct, cdim >,(1<<(mydim)) > Type
Definition: porousmediumflow/boxdfm/geometryhelper.hh:45
Definition: porousmediumflow/boxdfm/geometryhelper.hh:51
static const bool v
Definition: porousmediumflow/boxdfm/geometryhelper.hh:52
static const unsigned int topologyId
Definition: porousmediumflow/boxdfm/geometryhelper.hh:53
Create sub control volumes and sub control volume face geometries.
Definition: porousmediumflow/boxdfm/geometryhelper.hh:59
ScvfCornerStorage getFractureScvfCorners(unsigned int localFacetIndex, unsigned int) const
Get the corners of the (d-1)-dimensional fracture scvf.
Definition: porousmediumflow/boxdfm/geometryhelper.hh:79
ScvfCornerStorage getFractureScvfCorners(const Intersection &is, const typename Intersection::Geometry &isGeom, unsigned int idxOnIntersection=0) const
Get the corners of the (d-1)-dimensional fracture scvf.
Definition: porousmediumflow/boxdfm/geometryhelper.hh:89
ScvfType::Traits::GlobalPosition fractureNormal(const ScvfCornerStorage &p, const Intersection &is, unsigned int edgeIndexInIntersection) const
Definition: porousmediumflow/boxdfm/geometryhelper.hh:99
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:132
ScvfType::Traits::GlobalPosition fractureNormal(const ScvfCornerStorage &scvfCorners, const Intersection &is, unsigned int edgeIndexInIntersection) const
get fracture scvf normal vector
Definition: porousmediumflow/boxdfm/geometryhelper.hh:170
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: porousmediumflow/boxdfm/geometryhelper.hh:161