version 3.8
discretization/cellcentered/tpfa/subcontrolvolumeface.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-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_DISCRETIZATION_CC_TPFA_SUBCONTROLVOLUMEFACE_HH
13#define DUMUX_DISCRETIZATION_CC_TPFA_SUBCONTROLVOLUMEFACE_HH
14
15#include <utility>
16#include <vector>
17
18#include <dune/common/reservedvector.hh>
19#include <dune/geometry/type.hh>
20#include <dune/geometry/multilineargeometry.hh>
21
25
26namespace Dumux {
27
34template<class GridView>
36{
37 using Grid = typename GridView::Grid;
38
39 static constexpr int dim = Grid::dimension;
40 static constexpr int dimWorld = Grid::dimensionworld;
41
42 using Scalar = typename Grid::ctype;
45 using GridIndexStorage = typename std::conditional_t< (dim<dimWorld),
46 std::vector<GridIndexType>,
47 Dune::ReservedVector<GridIndexType, 2> >;
48
49 // we use geometry traits that use static corner vectors to and a fixed geometry type
50 template <class ct>
51 struct ScvfMLGTraits : public Dune::MultiLinearGeometryTraits<ct>
52 {
53 // we use static vectors to store the corners as we know
54 // the number of corners in advance (2^(dim-1) corners (1<<(dim-1))
55 template< int mydim, int cdim >
57 {
58 using Type = Dune::ReservedVector< Dune::FieldVector< ct, cdim >, (1<<(dim-1)) >;
59 };
60 };
61
62 using Geometry = Dune::MultiLinearGeometry<Scalar, dim-1, dimWorld, ScvfMLGTraits<Scalar> >;
64 using GlobalPosition = typename CornerStorage::value_type;
66};
67
74template<class GV,
77: public SubControlVolumeFaceBase<CCTpfaSubControlVolumeFace<GV, T>, T>
78{
81 using GridIndexType = typename T::GridIndexType;
82 using Scalar = typename T::Scalar;
83 using CornerStorage = typename T::CornerStorage;
84 using GridIndexStorage = typename T::GridIndexStorage;
85 using BoundaryFlag = typename T::BoundaryFlag;
86
87public:
89 using GlobalPosition = typename T::GlobalPosition;
91 using Traits = T;
92
93 // the default constructor
95
105 template <class Intersection>
106 CCTpfaSubControlVolumeFace(const Intersection& is,
107 const typename Intersection::Geometry& isGeometry,
108 GridIndexType scvfIndex,
109 const GridIndexStorage& scvIndices,
110 bool isBoundary)
111 : ParentType()
112 , area_(isGeometry.volume())
113 , center_(isGeometry.center())
114 , unitOuterNormal_(is.centerUnitOuterNormal())
115 , scvfIndex_(scvfIndex)
116 , scvIndices_(scvIndices)
117 , boundary_(isBoundary)
118 , boundaryFlag_{is}
119 {}
120
122 const GlobalPosition& center() const
123 {
124 return center_;
125 }
126
129 {
130 // Return center for now
131 return center_;
132 }
133
135 Scalar area() const
136 {
137 return area_;
138 }
139
141 bool boundary() const
142 {
143 return boundary_;
144 }
145
148 {
149 return unitOuterNormal_;
150 }
151
153 GridIndexType insideScvIdx() const
154 {
155 return scvIndices_[0];
156 }
157
159 // Results in undefined behaviour if i >= numOutsideScvs()
160 GridIndexType outsideScvIdx(int i = 0) const
161 {
162 return scvIndices_[i+1];
163 }
164
166 std::size_t numOutsideScvs() const
167 {
168 return scvIndices_.size()-1;
169 }
170
172 GridIndexType index() const
173 {
174 return scvfIndex_;
175 }
176
179 {
180 return boundaryFlag_.get();
181 }
182
183private:
184 Scalar area_;
185 GlobalPosition center_;
186 GlobalPosition unitOuterNormal_;
187 GridIndexType scvfIndex_;
188 GridIndexStorage scvIndices_;
189 bool boundary_;
190 BoundaryFlag boundaryFlag_;
191};
192
193} // end namespace Dumux
194
195#endif
Boundary flag to store e.g. in sub control volume faces.
Boundary flag to store e.g. in sub control volume faces.
Definition: boundaryflag.hh:55
std::size_t value_type
Definition: boundaryflag.hh:39
The sub control volume face.
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:78
bool boundary() const
returns true if the sub control volume face is on the boundary
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:141
typename T::GlobalPosition GlobalPosition
export the type used for global coordinates
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:89
const GlobalPosition & unitOuterNormal() const
The unit outer normal of the sub control volume face.
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:147
GridIndexType outsideScvIdx(int i=0) const
Index of the i-th outside sub control volume or boundary scv index.
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:160
BoundaryFlag::value_type boundaryFlag() const
Return the boundary flag.
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:178
std::size_t numOutsideScvs() const
The number of scvs on the outside of this face.
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:166
const GlobalPosition & center() const
The center of the sub control volume face.
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:122
GridIndexType insideScvIdx() const
index of the inside sub control volume
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:153
T Traits
state the traits public and thus export all types
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:91
const GlobalPosition & ipGlobal() const
The integration point for flux evaluations in global coordinates.
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:128
GridIndexType index() const
The global index of this sub control volume face.
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:172
CCTpfaSubControlVolumeFace(const Intersection &is, const typename Intersection::Geometry &isGeometry, GridIndexType scvfIndex, const GridIndexStorage &scvIndices, bool isBoundary)
Constructor with intersection.
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:106
Scalar area() const
The area of the sub control volume face.
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:135
Base class for a sub control volume face, i.e a part of the boundary of a sub control volume we compu...
Definition: subcontrolvolumefacebase.hh:29
auto volume(const Geometry &geo, unsigned int integrationOrder=4)
The volume of a given geometry.
Definition: volume.hh:159
Defines the index types used for grid and local indices.
Definition: adapt.hh:17
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:57
Dune::ReservedVector< Dune::FieldVector< ct, cdim >,(1<<(dim-1)) > Type
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:58
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:52
Default traits class to be used for the sub-control volume faces for the cell-centered finite volume ...
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:36
typename ScvfMLGTraits< Scalar >::template CornerStorage< dim-1, dimWorld >::Type CornerStorage
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:63
Dune::MultiLinearGeometry< Scalar, dim-1, dimWorld, ScvfMLGTraits< Scalar > > Geometry
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:62
typename GridView::Grid Grid
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:37
static constexpr int dim
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:39
typename CornerStorage::value_type GlobalPosition
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:64
typename IndexTraits< GridView >::LocalIndex LocalIndexType
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:44
typename Grid::ctype Scalar
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:42
typename IndexTraits< GridView >::GridIndex GridIndexType
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:43
static constexpr int dimWorld
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:40
typename std::conditional_t<(dim< dimWorld), std::vector< GridIndexType >, Dune::ReservedVector< GridIndexType, 2 > > GridIndexStorage
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:47
typename GridView::IndexSet::IndexType GridIndex
Definition: indextraits.hh:27
unsigned int LocalIndex
Definition: indextraits.hh:28
Base class for a sub control volume face.