version 3.11-dev
discretization/pq2/subcontrolvolume.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightText: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_DISCRETIZATION_PQ2_SUBCONTROLVOLUME_HH
13#define DUMUX_DISCRETIZATION_PQ2_SUBCONTROLVOLUME_HH
14
15#include <dune/geometry/type.hh>
16#include <dune/geometry/multilineargeometry.hh>
17
18#include <dumux/common/math.hh>
21
22namespace Dumux {
23
30template<class GridView>
32{
33 using Grid = typename GridView::Grid;
34
35 static const int dim = Grid::dimension;
36 static const int dimWorld = Grid::dimensionworld;
37
40 using Scalar = typename Grid::ctype;
42 using Geometry = Dune::MultiLinearGeometry<Scalar, dim, dimWorld, GeometryTraits>;
43 using CornerStorage = typename GeometryTraits::template CornerStorage<dim, dimWorld>::Type;
44 using GlobalPosition = typename CornerStorage::value_type;
45};
46
53template<class GridView, class T = PQ2DefaultScvGeometryTraits<GridView>>
55{
56 using Scalar = typename T::Scalar;
57 using GridIndexType = typename T::GridIndexType;
58 using LocalIndexType = typename T::LocalIndexType;
59
60public:
62 using GlobalPosition = typename T::GlobalPosition;
64 using Traits = T;
65
67
71 const LocalIndexType indexInElement,
72 const LocalIndexType localDofIndex,
73 const GridIndexType eIdx,
74 const GridIndexType dofIdx,
75 bool overlapping = false)
76
77 : center_(center)
78 , dofPosition_(dofPosition)
79 , volume_(volume)
80 , indexInElement_(indexInElement)
81 , localDofIndex_(localDofIndex)
82 , eIdx_(eIdx)
83 , dofIdx_(dofIdx)
84 , overlapping_(overlapping)
85 {}
86
88 const GlobalPosition& center() const
89 { return center_; }
90
93 { return dofPosition_; }
94
95 Scalar volume() const
96 { return volume_; }
97
99 bool isOverlapping() const
100 { return overlapping_; }
101
102 GridIndexType dofIndex() const
103 { return dofIdx_; }
104
105 LocalIndexType indexInElement() const
106 { return indexInElement_; }
107
108 GridIndexType elementIndex() const
109 { return eIdx_; }
110
111 LocalIndexType localDofIndex() const
112 { return localDofIndex_; }
113
114private:
115 GlobalPosition center_;
116 GlobalPosition dofPosition_;
117 Scalar volume_;
118 LocalIndexType indexInElement_;
119 LocalIndexType localDofIndex_;
120 GridIndexType eIdx_;
121 GridIndexType dofIdx_;
122 bool overlapping_;
123};
124
125} // end namespace Dumux
126
127#endif
the sub control volume for the pq2 scheme
Definition: discretization/pq2/subcontrolvolume.hh:55
const GlobalPosition & dofPosition() const
The position of the degree of freedom.
Definition: discretization/pq2/subcontrolvolume.hh:92
GridIndexType elementIndex() const
Definition: discretization/pq2/subcontrolvolume.hh:108
bool isOverlapping() const
returns true if the sub control volume is overlapping with another scv
Definition: discretization/pq2/subcontrolvolume.hh:99
GridIndexType dofIndex() const
Definition: discretization/pq2/subcontrolvolume.hh:102
PQ2SubControlVolume(const Scalar &volume, const GlobalPosition &dofPosition, const GlobalPosition &center, const LocalIndexType indexInElement, const LocalIndexType localDofIndex, const GridIndexType eIdx, const GridIndexType dofIdx, bool overlapping=false)
Definition: discretization/pq2/subcontrolvolume.hh:68
LocalIndexType indexInElement() const
Definition: discretization/pq2/subcontrolvolume.hh:105
typename T::GlobalPosition GlobalPosition
export the type used for global coordinates
Definition: discretization/pq2/subcontrolvolume.hh:62
Scalar volume() const
Definition: discretization/pq2/subcontrolvolume.hh:95
LocalIndexType localDofIndex() const
Definition: discretization/pq2/subcontrolvolume.hh:111
T Traits
state the traits public and thus export all types
Definition: discretization/pq2/subcontrolvolume.hh:64
const GlobalPosition & center() const
The center of the sub control volume.
Definition: discretization/pq2/subcontrolvolume.hh:88
Helper class constructing the dual grid finite volume geometries for the cvfe discretizazion method.
Defines the index types used for grid and local indices.
Define some often used mathematical functions.
Definition: adapt.hh:17
typename GridView::IndexSet::IndexType GridIndex
Definition: indextraits.hh:27
unsigned int LocalIndex
Definition: indextraits.hh:28
Default traits class to be used for the sub-control volumes for the pq2 scheme.
Definition: discretization/pq2/subcontrolvolume.hh:32
typename IndexTraits< GridView >::LocalIndex LocalIndexType
Definition: discretization/pq2/subcontrolvolume.hh:39
static const int dimWorld
Definition: discretization/pq2/subcontrolvolume.hh:36
static const int dim
Definition: discretization/pq2/subcontrolvolume.hh:35
typename CornerStorage::value_type GlobalPosition
Definition: discretization/pq2/subcontrolvolume.hh:44
typename GeometryTraits::template CornerStorage< dim, dimWorld >::Type CornerStorage
Definition: discretization/pq2/subcontrolvolume.hh:43
typename IndexTraits< GridView >::GridIndex GridIndexType
Definition: discretization/pq2/subcontrolvolume.hh:38
Dune::MultiLinearGeometry< Scalar, dim, dimWorld, GeometryTraits > Geometry
Definition: discretization/pq2/subcontrolvolume.hh:42
typename GridView::Grid Grid
Definition: discretization/pq2/subcontrolvolume.hh:33
typename Grid::ctype Scalar
Definition: discretization/pq2/subcontrolvolume.hh:40
Traits for an efficient corner storage for the PQ2 method.
Definition: discretization/pq2/geometryhelper.hh:34