version 3.11-dev
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-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_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
24
25namespace Dumux {
26
33template<class GridView>
35{
36 using Grid = typename GridView::Grid;
37
38 static constexpr int dim = Grid::dimension;
39 static constexpr int dimWorld = Grid::dimensionworld;
40
41 using Scalar = typename Grid::ctype;
44 using GridIndexStorage = typename std::conditional_t< (dim<dimWorld),
45 std::vector<GridIndexType>,
46 Dune::ReservedVector<GridIndexType, 2> >;
47
48 // we use geometry traits that use static corner vectors to and a fixed geometry type
49 template <class ct>
50 struct ScvfMLGTraits : public Dune::MultiLinearGeometryTraits<ct>
51 {
52 // we use static vectors to store the corners as we know
53 // the number of corners in advance (2^(dim-1) corners (1<<(dim-1))
54 template< int mydim, int cdim >
56 {
57 using Type = Dune::ReservedVector< Dune::FieldVector< ct, cdim >, (1<<(dim-1)) >;
58 };
59 };
60
61 using Geometry = Dune::MultiLinearGeometry<Scalar, dim-1, dimWorld, ScvfMLGTraits<Scalar> >;
63 using GlobalPosition = typename CornerStorage::value_type;
65};
66
73template<class GV,
76{
78 using GridIndexType = typename T::GridIndexType;
79 using Scalar = typename T::Scalar;
80 using CornerStorage = typename T::CornerStorage;
81 using GridIndexStorage = typename T::GridIndexStorage;
82 using BoundaryFlag = typename T::BoundaryFlag;
83
84public:
86 using GlobalPosition = typename T::GlobalPosition;
88 using Traits = T;
89
90 // the default constructor
92
102 template <class Intersection>
103 CCTpfaSubControlVolumeFace(const Intersection& is,
104 const typename Intersection::Geometry& isGeometry,
105 GridIndexType scvfIndex,
106 const GridIndexStorage& scvIndices,
107 bool isBoundary)
108 : area_(isGeometry.volume())
109 , center_(isGeometry.center())
110 , unitOuterNormal_(is.centerUnitOuterNormal())
111 , scvfIndex_(scvfIndex)
112 , scvIndices_(scvIndices)
113 , boundary_(isBoundary)
114 , boundaryFlag_{is}
115 {}
116
118 const GlobalPosition& center() const
119 {
120 return center_;
121 }
122
125 {
126 // Return center for now
127 return center_;
128 }
129
131 Scalar area() const
132 {
133 return area_;
134 }
135
137 bool boundary() const
138 {
139 return boundary_;
140 }
141
144 {
145 return unitOuterNormal_;
146 }
147
149 GridIndexType insideScvIdx() const
150 {
151 return scvIndices_[0];
152 }
153
155 // Results in undefined behaviour if i >= numOutsideScvs()
156 GridIndexType outsideScvIdx(int i = 0) const
157 {
158 return scvIndices_[i+1];
159 }
160
162 std::size_t numOutsideScvs() const
163 {
164 return scvIndices_.size()-1;
165 }
166
168 GridIndexType index() const
169 {
170 return scvfIndex_;
171 }
172
175 {
176 return boundaryFlag_.get();
177 }
178
179private:
180 Scalar area_;
181 GlobalPosition center_;
182 GlobalPosition unitOuterNormal_;
183 GridIndexType scvfIndex_;
184 GridIndexStorage scvIndices_;
185 bool boundary_;
186 BoundaryFlag boundaryFlag_;
187};
188
189} // end namespace Dumux
190
191#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:58
std::size_t value_type
Definition: boundaryflag.hh:28
The sub control volume face.
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:76
bool boundary() const
returns true if the sub control volume face is on the boundary
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:137
typename T::GlobalPosition GlobalPosition
export the type used for global coordinates
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:86
const GlobalPosition & unitOuterNormal() const
The unit outer normal of the sub control volume face.
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:143
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:156
BoundaryFlag::value_type boundaryFlag() const
Return the boundary flag.
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:174
std::size_t numOutsideScvs() const
The number of scvs on the outside of this face.
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:162
const GlobalPosition & center() const
The center of the sub control volume face.
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:118
GridIndexType insideScvIdx() const
index of the inside sub control volume
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:149
T Traits
state the traits public and thus export all types
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:88
const GlobalPosition & ipGlobal() const
The integration point for flux evaluations in global coordinates.
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:124
GridIndexType index() const
The global index of this sub control volume face.
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:168
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:103
Scalar area() const
The area of the sub control volume face.
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:131
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:56
Dune::ReservedVector< Dune::FieldVector< ct, cdim >,(1<<(dim-1)) > Type
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:57
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:51
Default traits class to be used for the sub-control volume faces for the cell-centered finite volume ...
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:35
typename ScvfMLGTraits< Scalar >::template CornerStorage< dim-1, dimWorld >::Type CornerStorage
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:62
Dune::MultiLinearGeometry< Scalar, dim-1, dimWorld, ScvfMLGTraits< Scalar > > Geometry
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:61
typename GridView::Grid Grid
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:36
static constexpr int dim
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:38
typename CornerStorage::value_type GlobalPosition
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:63
typename IndexTraits< GridView >::LocalIndex LocalIndexType
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:43
typename Grid::ctype Scalar
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:41
typename IndexTraits< GridView >::GridIndex GridIndexType
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:42
static constexpr int dimWorld
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:39
typename std::conditional_t<(dim< dimWorld), std::vector< GridIndexType >, Dune::ReservedVector< GridIndexType, 2 > > GridIndexStorage
Definition: discretization/cellcentered/tpfa/subcontrolvolumeface.hh:46
typename GridView::IndexSet::IndexType GridIndex
Definition: indextraits.hh:27
unsigned int LocalIndex
Definition: indextraits.hh:28