24#ifndef DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_SUBCONTROLVOLUMEFACE_HH
25#define DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_SUBCONTROLVOLUMEFACE_HH
30#include <dune/common/fvector.hh>
31#include <dune/geometry/type.hh>
32#include <dune/geometry/axisalignedcubegeometry.hh>
46template<
class Gr
idView>
51 using Scalar =
typename GridView::ctype;
52 using Element =
typename GridView::template Codim<0>::Entity;
55 static constexpr int dim = GridView::Grid::dimension;
56 static constexpr int dimWorld = GridView::Grid::dimensionworld;
65template<
class Gr
idView,
class T = FaceCenteredDefaultScvfGeometryTraits<Gr
idView>>
68 using Geometry =
typename T::Geometry;
69 using GridIndexType =
typename T::GridIndexType;
70 using Scalar =
typename T::Scalar;
71 using Element =
typename T::Element;
72 using CornerStorage =
typename T::CornerStorage;
76 using ElementGeometry =
typename Element::Geometry;
77 using IntersectionGeometry =
typename GridView::Intersection::Geometry;
84 enum class FaceType : SmallLocalIndexType {frontal, lateral};
91 const IntersectionGeometry& intersectionGeometry,
92 const std::array<GridIndexType, 2> globalScvIndices,
93 const SmallLocalIndexType localScvfIdx,
94 const GridIndexType globalScvfIdx,
98 : globalScvIndices_(globalScvIndices)
99 , localScvfIdx_(localScvfIdx)
100 , globalScvfIdx_(globalScvfIdx)
101 , area_(intersectionGeometry.
volume())
105 , boundaryType_(boundaryType)
108 center_ =
boundary() ? intersectionGeometry.center() : elementGeometry.center();
112 outerNormalSign_ *= -1.0;
116 : intersectionGeometry.center() - elementGeometry.center();
118 for (
int i = 0; i < corners_.size(); ++i)
119 corners_[i] = intersectionGeometry.corner(i) + frontalOffSet;
123 template<
class LateralFacetGeometry>
125 const IntersectionGeometry& intersectionGeometry,
126 const LateralFacetGeometry& lateralFacetGeometry,
127 const std::array<GridIndexType, 2> globalScvIndices,
128 const SmallLocalIndexType localScvfIdx,
129 const GridIndexType globalScvfIdx,
133 : globalScvIndices_(globalScvIndices)
134 , localScvfIdx_(localScvfIdx)
135 , globalScvfIdx_(globalScvfIdx)
136 , area_(0.5*lateralFacetGeometry.
volume())
140 , boundaryType_(boundaryType)
143 const auto shift = intersectionGeometry.center() - elementGeometry.center();
144 ipGlobal_ = lateralFacetGeometry.center() + shift;
145 center_ = 0.5*(lateralFacetGeometry.center() + ipGlobal_);
148 const auto eps = shift.two_norm() * 1e-8;
150 for (
int i = 0; i < corners_.size(); ++i)
153 auto&
corner = corners_[i];
154 corner = lateralFacetGeometry.corner(i);
159 if (abs(
corner[dofAxis] - intersectionGeometry.center()[dofAxis]) > eps)
160 corner[dofAxis] = elementGeometry.center()[dofAxis];
170 {
return ipGlobal_; }
182 {
return globalScvIndices_[0]; }
186 {
return globalScvIndices_[1]; }
189 {
return globalScvfIdx_; }
192 {
return localScvfIdx_; }
195 {
return faceType_; }
213 {
return normalAxis_; }
216 {
return outerNormalSign_; }
220 assert(localIdx < corners_.size() &&
"provided index exceeds the number of corners");
221 return corners_[localIdx];
227 auto inPlaneAxes = std::move(std::bitset<T::dimWorld>{}.set());
228 inPlaneAxes.set(normalAxis_,
false);
229 return { corners_.front(), corners_.back(), inPlaneAxes };
235 CornerStorage corners_;
236 std::array<GridIndexType, 2> globalScvIndices_;
237 SmallLocalIndexType localScvfIdx_;
238 GridIndexType globalScvfIdx_;
240 SmallLocalIndexType normalAxis_;
241 std::int_least8_t outerNormalSign_;
Defines the index types used for grid and local indices.
Base class for a sub control volume face.
auto volume(const Geometry &geo, unsigned int integrationOrder=4)
The volume of a given geometry.
Definition: volume.hh:171
static std::size_t normalAxis(const Vector &v)
Returns the normal axis index of a unit vector (0 = x, 1 = y, 2 = z)
Definition: normalaxis.hh:38
constexpr int sign(const ValueType &value) noexcept
Sign or signum function.
Definition: math.hh:641
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
typename GridView::IndexSet::IndexType GridIndex
Definition: indextraits.hh:39
std::uint_least8_t SmallLocalIndex
Definition: indextraits.hh:41
unsigned int LocalIndex
Definition: indextraits.hh:40
Default traits class to be used for the sub-control volume face for the face-centered staggered finit...
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:48
typename IndexTraits< GridView >::GridIndex GridIndexType
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:49
std::array< GlobalPosition,(1<<(dim-1))> CornerStorage
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:57
static constexpr int dim
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:55
Dune::AxisAlignedCubeGeometry< Scalar, dim-1, dimWorld > Geometry
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:58
typename GridView::template Codim< 0 >::Entity Element
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:52
static constexpr int dimWorld
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:56
typename GridView::ctype Scalar
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:51
typename IndexTraits< GridView >::LocalIndex LocalIndexType
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:50
typename Element::Geometry::GlobalCoordinate GlobalPosition
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:53
Face centered staggered sub control volume face.
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:67
BoundaryType
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:85
SmallLocalIndexType normalAxis() const
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:212
const GlobalPosition unitOuterNormal() const
The unit outer normal.
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:173
FaceCenteredStaggeredSubControlVolumeFace(const ElementGeometry &elementGeometry, const IntersectionGeometry &intersectionGeometry, const LateralFacetGeometry &lateralFacetGeometry, const std::array< GridIndexType, 2 > globalScvIndices, const SmallLocalIndexType localScvfIdx, const GridIndexType globalScvfIdx, const GlobalPosition &unitOuterNormal, const FaceType faceType, const BoundaryType boundaryType)
The constructor for lateral faces.
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:124
FaceType
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:84
SmallLocalIndexType localIndex() const
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:191
const GlobalPosition & center() const
The center of the sub control volume face.
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:165
Scalar area() const
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:209
FaceCenteredStaggeredSubControlVolumeFace(const ElementGeometry &elementGeometry, const IntersectionGeometry &intersectionGeometry, const std::array< GridIndexType, 2 > globalScvIndices, const SmallLocalIndexType localScvfIdx, const GridIndexType globalScvfIdx, const GlobalPosition &unitOuterNormal, const FaceType faceType, const BoundaryType boundaryType)
The constructor for frontal faces.
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:90
Geometry geometry() const
The geometry of the sub control volume face.
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:225
std::int_least8_t directionSign() const
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:215
GridIndexType outsideScvIdx() const
index of the outside sub control volume for spatial param evaluation
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:185
bool processorBoundary() const
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:200
const GlobalPosition & ipGlobal() const
The integration point of the sub control volume face.
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:169
GridIndexType index() const
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:188
T Traits
state the traits public and thus export all types
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:81
const GlobalPosition & corner(unsigned int localIdx) const
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:218
bool isFrontal() const
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:203
GridIndexType insideScvIdx() const
Index of the inside sub control volume for spatial param evaluation.
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:181
FaceCenteredStaggeredSubControlVolumeFace()=default
typename T::GlobalPosition GlobalPosition
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:83
bool isLateral() const
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:206
FaceType faceType() const
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:194
bool boundary() const
Definition: discretization/facecentered/staggered/subcontrolvolumeface.hh:197