24#ifndef DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_SUBCONTROLVOLUME_HH
25#define DUMUX_DISCRETIZATION_FACECENTERED_STAGGERED_SUBCONTROLVOLUME_HH
30#include <dune/geometry/type.hh>
31#include <dune/geometry/axisalignedcubegeometry.hh>
43template<
class Gr
idView>
48 using Scalar =
typename GridView::ctype;
49 using Element =
typename GridView::template Codim<0>::Entity;
52 static constexpr int dim = GridView::Grid::dimension;
53 static constexpr int dimWorld = GridView::Grid::dimensionworld;
55 using Geometry = Dune::AxisAlignedCubeGeometry<Scalar, dim, dimWorld>;
62template<
class Gr
idView,
class T = FaceCenteredDefaultScvGeometryTraits<Gr
idView>>
65 using Geometry =
typename T::Geometry;
66 using CornerStorage =
typename T::CornerStorage;
67 using Element =
typename T::Element;
68 using GlobalPosition =
typename T::GlobalPosition;
69 using Scalar =
typename T::Scalar;
70 using GridIndexType =
typename T::GridIndexType;
73 using ElementGeometry =
typename Element::Geometry;
74 using IntersectionGeometry =
typename GridView::Intersection::Geometry;
84 const IntersectionGeometry& intersectionGeometry,
85 const GridIndexType globalIndex,
87 const GridIndexType dofIdx,
88 const SmallLocalIndexType
dofAxis,
89 const GridIndexType eIdx,
91 : center_(0.5*(intersectionGeometry.
center() + elementGeometry.
center()))
92 , dofPosition_(intersectionGeometry.
center())
93 , volume_(elementGeometry.
volume()*0.5)
94 , globalIndex_(globalIndex)
101 for (
int i = 0; i < corners_.size(); ++i)
103 auto&
corner = corners_[i];
106 corner = elementGeometry.corner(i);
111 const auto eps = 1e-8;
125 {
return dofPosition_; }
134 {
return globalIndex_; }
140 {
return indexInElement_; }
143 {
return indexInElement_; }
149 {
return directionSign_; }
152 {
return boundary_; }
154 const GlobalPosition&
corner(
unsigned int localIdx)
const
156 assert(localIdx < corners_.size() &&
"provided index exceeds the number of corners");
157 return corners_[localIdx];
163 return Geometry(corners_.front(), corners_.back());
167 GlobalPosition center_;
168 GlobalPosition dofPosition_;
169 CornerStorage corners_;
171 GridIndexType globalIndex_;
172 SmallLocalIndexType indexInElement_;
173 GridIndexType dofIdx_;
174 SmallLocalIndexType dofAxis_;
175 std::int_least8_t directionSign_;
Defines the index types used for grid and local indices.
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 volumes for the face-centered staggered scheme.
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:45
static constexpr int dimWorld
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:53
typename GridView::template Codim< 0 >::Entity Element
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:49
std::array< GlobalPosition,(1<<(dim))> CornerStorage
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:54
typename GridView::ctype Scalar
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:48
static constexpr int dim
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:52
typename IndexTraits< GridView >::GridIndex GridIndexType
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:46
Dune::AxisAlignedCubeGeometry< Scalar, dim, dimWorld > Geometry
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:55
typename Element::Geometry::GlobalCoordinate GlobalPosition
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:50
typename IndexTraits< GridView >::LocalIndex LocalIndexType
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:47
Face centered staggered sub control volume.
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:64
const GlobalPosition & center() const
The center of the sub control volume.
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:120
const GlobalPosition & dofPosition() const
The position of the degree of freedom.
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:124
GridIndexType elementIndex() const
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:136
T Traits
state the traits public and thus export all types
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:79
SmallLocalIndexType localDofIndex() const
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:142
Scalar volume() const
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:127
FaceCenteredStaggeredSubControlVolume()=default
SmallLocalIndexType dofAxis() const
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:145
GridIndexType index() const
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:133
SmallLocalIndexType indexInElement() const
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:139
FaceCenteredStaggeredSubControlVolume(const ElementGeometry &elementGeometry, const IntersectionGeometry &intersectionGeometry, const GridIndexType globalIndex, const SmallLocalIndexType indexInElement, const GridIndexType dofIdx, const SmallLocalIndexType dofAxis, const GridIndexType eIdx, const bool boundary)
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:83
const GlobalPosition & corner(unsigned int localIdx) const
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:154
std::int_least8_t directionSign() const
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:148
GridIndexType dofIndex() const
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:130
Geometry geometry() const
The geometry of the sub control volume face.
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:161
bool boundary() const
Definition: discretization/facecentered/staggered/subcontrolvolume.hh:151