24#ifndef DUMUX_DISCRETIZATION_BOX_SUBCONTROLVOLUME_HH
25#define DUMUX_DISCRETIZATION_BOX_SUBCONTROLVOLUME_HH
27#include <dune/geometry/type.hh>
28#include <dune/geometry/multilineargeometry.hh>
43template<
class Gr
idView>
46 using Grid =
typename GridView::Grid;
48 static const int dim = Grid::dimension;
49 static const int dimWorld = Grid::dimensionworld;
56 template<
int mydim,
int cdim >
59 using Type = std::array< Dune::FieldVector< ct, cdim >, (1<<(
dim)) >;
66 static const bool v =
true;
67 static const unsigned int topologyId = Dune::GeometryTypes::cube(mydim).id();
74 using Geometry = Dune::MultiLinearGeometry<Scalar, dim, dimWorld, ScvMLGTraits<Scalar>>;
92 using Geometry =
typename T::Geometry;
93 using GridIndexType =
typename T::GridIndexType;
94 using LocalIndexType =
typename T::LocalIndexType;
95 using Scalar =
typename T::Scalar;
96 using CornerStorage =
typename T::CornerStorage;
97 enum { dim = Geometry::mydimension };
109 template<
class GeometryHelper>
111 LocalIndexType scvIdx,
114 : corners_(geometryHelper.getScvCorners(scvIdx)),
116 volume_(geometryHelper.scvVolume(corners_)),
118 localDofIdx_(scvIdx),
122 for (
const auto&
corner : corners_)
124 center_ /= corners_.size();
143 return Geometry(Dune::GeometryTypes::cube(dim), corners_);
175 return elementIndex_;
181 assert(localIdx < corners_.size() &&
"provided index exceeds the number of corners");
182 return corners_[localIdx];
186 CornerStorage corners_;
189 GridIndexType elementIndex_;
190 LocalIndexType localDofIdx_;
191 GridIndexType dofIndex_;
Defines the index types used for grid and local indices.
Define some often used mathematical functions.
Helper class constructing the dual grid finite volume geometries for the box discretizazion method.
Base class for a sub control volume.
typename GridView::IndexSet::IndexType GridIndex
Definition: indextraits.hh:39
unsigned int LocalIndex
Definition: indextraits.hh:40
Default traits class to be used for the sub-control volumes for the box scheme.
Definition: discretization/box/subcontrolvolume.hh:45
typename GridView::Grid Grid
Definition: discretization/box/subcontrolvolume.hh:46
Dune::MultiLinearGeometry< Scalar, dim, dimWorld, ScvMLGTraits< Scalar > > Geometry
Definition: discretization/box/subcontrolvolume.hh:74
typename IndexTraits< GridView >::GridIndex GridIndexType
Definition: discretization/box/subcontrolvolume.hh:71
typename ScvMLGTraits< Scalar >::template CornerStorage< dim, dimWorld >::Type CornerStorage
Definition: discretization/box/subcontrolvolume.hh:75
typename IndexTraits< GridView >::LocalIndex LocalIndexType
Definition: discretization/box/subcontrolvolume.hh:72
static const int dim
Definition: discretization/box/subcontrolvolume.hh:48
static const int dimWorld
Definition: discretization/box/subcontrolvolume.hh:49
typename Grid::ctype Scalar
Definition: discretization/box/subcontrolvolume.hh:73
typename CornerStorage::value_type GlobalPosition
Definition: discretization/box/subcontrolvolume.hh:76
Definition: discretization/box/subcontrolvolume.hh:53
Definition: discretization/box/subcontrolvolume.hh:58
std::array< Dune::FieldVector< ct, cdim >,(1<<(dim)) > Type
Definition: discretization/box/subcontrolvolume.hh:59
Definition: discretization/box/subcontrolvolume.hh:65
static const bool v
Definition: discretization/box/subcontrolvolume.hh:66
static const unsigned int topologyId
Definition: discretization/box/subcontrolvolume.hh:67
the sub control volume for the box scheme
Definition: discretization/box/subcontrolvolume.hh:89
Geometry geometry() const
The geometry of the sub control volume.
Definition: discretization/box/subcontrolvolume.hh:141
const GlobalPosition & corner(LocalIndexType localIdx) const
Return the corner for the given local index.
Definition: discretization/box/subcontrolvolume.hh:179
T Traits
state the traits public and thus export all types
Definition: discretization/box/subcontrolvolume.hh:103
LocalIndexType localDofIndex() const
The element-local index of the dof this scv is embedded in.
Definition: discretization/box/subcontrolvolume.hh:147
const GlobalPosition & center() const
The center of the sub control volume.
Definition: discretization/box/subcontrolvolume.hh:128
BoxSubControlVolume()=default
The default constructor.
typename T::GlobalPosition GlobalPosition
export the type used for global coordinates
Definition: discretization/box/subcontrolvolume.hh:101
LocalIndexType indexInElement() const
Definition: discretization/box/subcontrolvolume.hh:154
GridIndexType elementIndex() const
The global index of the element this scv is embedded in.
Definition: discretization/box/subcontrolvolume.hh:173
GridIndexType dofIndex() const
The index of the dof this scv is embedded in.
Definition: discretization/box/subcontrolvolume.hh:160
Scalar volume() const
The volume of the sub control volume.
Definition: discretization/box/subcontrolvolume.hh:134
const GlobalPosition & dofPosition() const
Definition: discretization/box/subcontrolvolume.hh:166
BoxSubControlVolume(const GeometryHelper &geometryHelper, LocalIndexType scvIdx, GridIndexType elementIndex, GridIndexType dofIndex)
Definition: discretization/box/subcontrolvolume.hh:110
Base class for a sub control volume, i.e a part of the control volume we are making the balance for....
Definition: subcontrolvolumebase.hh:38