version 3.11-dev
discretization/pq2/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_PQ2_SUBCONTROLVOLUMEFACE_HH
13#define DUMUX_DISCRETIZATION_PQ2_SUBCONTROLVOLUMEFACE_HH
14
15#include <utility>
16
17#include <dune/geometry/type.hh>
18#include <dune/geometry/multilineargeometry.hh>
19
23
24namespace Dumux {
25
32template<class GridView>
34{
35 using Grid = typename GridView::Grid;
36 static constexpr int dim = Grid::dimension;
37 static constexpr int dimWorld = Grid::dimensionworld;
40 using Scalar = typename Grid::ctype;
42 using Geometry = Dune::MultiLinearGeometry<Scalar, dim-1, dimWorld, GeometryTraits>;
43 using CornerStorage = typename GeometryTraits::template CornerStorage<dim-1, dimWorld>::Type;
44 using GlobalPosition = typename CornerStorage::value_type;
46};
47
55template<class GV,
58{
59 using GridIndexType = typename T::GridIndexType;
60 using LocalIndexType = typename T::LocalIndexType;
61 using Scalar = typename T::Scalar;
62 using CornerStorage = typename T::CornerStorage;
63 using Geometry = typename T::Geometry;
64 using BoundaryFlag = typename T::BoundaryFlag;
65
66public:
68 using GlobalPosition = typename T::GlobalPosition;
70 using Traits = T;
71
74
77 const Scalar area,
79 const std::array<LocalIndexType, 2>& scvIndices,
80 const LocalIndexType localScvfIdx,
81 bool overlapping = false)
82 : center_(center)
83 , unitOuterNormal_(normal)
84 , area_(area)
85 , localScvfIdx_(localScvfIdx)
86 , scvIndices_(scvIndices)
87 , boundary_(false)
88 , overlapping_(overlapping)
89 , boundaryFlag_{}
90 { }
91
94 const Scalar area,
96 const std::array<LocalIndexType, 2>& scvIndices,
97 const LocalIndexType localScvfIdx,
98 const BoundaryFlag& bFlag,
99 bool overlapping = false)
100 : center_(center)
101 , unitOuterNormal_(normal)
102 , area_(area)
103 , localScvfIdx_(localScvfIdx)
104 , scvIndices_(scvIndices)
105 , boundary_(true)
106 , overlapping_(overlapping)
107 , boundaryFlag_(bFlag)
108 {}
109
111 const GlobalPosition& center() const
112 { return center_; }
113
116 { return center_; }
117
119 Scalar area() const
120 { return area_; }
121
123 bool isOverlapping() const
124 { return overlapping_; }
125
126 bool boundary() const
127 { return boundary_; }
128
131 { return unitOuterNormal_; }
132
134 GridIndexType insideScvIdx() const
135 { return scvIndices_[0]; }
136
138 GridIndexType outsideScvIdx() const
139 { return scvIndices_[1]; }
140
142 std::size_t numOutsideScvs() const
143 { return static_cast<std::size_t>(!boundary()); }
144
146 LocalIndexType index() const
147 { return localScvfIdx_; }
148
151 { return boundaryFlag_.get(); }
152
153private:
154 GlobalPosition center_;
155 GlobalPosition unitOuterNormal_;
156 Scalar area_;
157 LocalIndexType localScvfIdx_;
158 std::array<LocalIndexType, 2> scvIndices_;
159 bool boundary_;
160 bool overlapping_;
161 BoundaryFlag boundaryFlag_;
162};
163
164} // end namespace Dumux
165
166#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
Class for a sub control volume face in the cvfe method, i.e a part of the boundary of a sub control v...
Definition: discretization/pq2/subcontrolvolumeface.hh:58
Scalar area() const
The area of the sub control volume face.
Definition: discretization/pq2/subcontrolvolumeface.hh:119
GridIndexType outsideScvIdx() const
index of the outside sub control volume
Definition: discretization/pq2/subcontrolvolumeface.hh:138
bool boundary() const
Definition: discretization/pq2/subcontrolvolumeface.hh:126
const GlobalPosition & ipGlobal() const
The integration point for flux evaluations in global coordinates.
Definition: discretization/pq2/subcontrolvolumeface.hh:115
PQ2SubControlVolumeFace(const GlobalPosition &center, const Scalar area, const GlobalPosition &normal, const std::array< LocalIndexType, 2 > &scvIndices, const LocalIndexType localScvfIdx, bool overlapping=false)
Constructor for inner scvfs.
Definition: discretization/pq2/subcontrolvolumeface.hh:76
bool isOverlapping() const
returns true if the sub control volume face is overlapping with another scv
Definition: discretization/pq2/subcontrolvolumeface.hh:123
typename T::GlobalPosition GlobalPosition
export the type used for global coordinates
Definition: discretization/pq2/subcontrolvolumeface.hh:68
PQ2SubControlVolumeFace()=default
The default constructor.
std::size_t numOutsideScvs() const
The number of scvs on the outside of this face.
Definition: discretization/pq2/subcontrolvolumeface.hh:142
T Traits
state the traits public and thus export all types
Definition: discretization/pq2/subcontrolvolumeface.hh:70
GridIndexType insideScvIdx() const
Index of the inside sub control volume.
Definition: discretization/pq2/subcontrolvolumeface.hh:134
BoundaryFlag::value_type boundaryFlag() const
Return the boundary flag.
Definition: discretization/pq2/subcontrolvolumeface.hh:150
PQ2SubControlVolumeFace(const GlobalPosition &center, const Scalar area, const GlobalPosition &normal, const std::array< LocalIndexType, 2 > &scvIndices, const LocalIndexType localScvfIdx, const BoundaryFlag &bFlag, bool overlapping=false)
Constructor for boundary scvfs.
Definition: discretization/pq2/subcontrolvolumeface.hh:93
const GlobalPosition unitOuterNormal() const
The unit outer normal.
Definition: discretization/pq2/subcontrolvolumeface.hh:130
LocalIndexType index() const
The local index of this sub control volume face.
Definition: discretization/pq2/subcontrolvolumeface.hh:146
const GlobalPosition & center() const
The center of the sub control volume face.
Definition: discretization/pq2/subcontrolvolumeface.hh:111
Helper class constructing the dual grid finite volume geometries for the cvfe discretizazion method.
Vector normal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: normal.hh:26
Defines the index types used for grid and local indices.
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 volume faces for the cvfe scheme.
Definition: discretization/pq2/subcontrolvolumeface.hh:34
typename IndexTraits< GridView >::LocalIndex LocalIndexType
Definition: discretization/pq2/subcontrolvolumeface.hh:39
static constexpr int dimWorld
Definition: discretization/pq2/subcontrolvolumeface.hh:37
Dune::MultiLinearGeometry< Scalar, dim-1, dimWorld, GeometryTraits > Geometry
Definition: discretization/pq2/subcontrolvolumeface.hh:42
typename GeometryTraits::template CornerStorage< dim-1, dimWorld >::Type CornerStorage
Definition: discretization/pq2/subcontrolvolumeface.hh:43
typename CornerStorage::value_type GlobalPosition
Definition: discretization/pq2/subcontrolvolumeface.hh:44
static constexpr int dim
Definition: discretization/pq2/subcontrolvolumeface.hh:36
typename GridView::Grid Grid
Definition: discretization/pq2/subcontrolvolumeface.hh:35
typename Grid::ctype Scalar
Definition: discretization/pq2/subcontrolvolumeface.hh:40
typename IndexTraits< GridView >::GridIndex GridIndexType
Definition: discretization/pq2/subcontrolvolumeface.hh:38
Traits for an efficient corner storage for the PQ2 method.
Definition: discretization/pq2/geometryhelper.hh:34