version 3.11-dev
discretization/porenetwork/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_PNM_SUBCONTROLVOLUME_HH
13#define DUMUX_DISCRETIZATION_PNM_SUBCONTROLVOLUME_HH
14
15#include <dune/geometry/affinegeometry.hh>
16#include <dumux/common/math.hh>
18
19namespace Dumux::PoreNetwork {
20
26template<class GridView>
28{
29 using Grid = typename GridView::Grid;
30
31 static const int dim = Grid::dimension;
32 static const int dimWorld = Grid::dimensionworld;
33
36 using Scalar = typename Grid::ctype;
37 using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
38 using Geometry = Dune::AffineGeometry<Scalar, 1, dimWorld>;
39};
40
47template<class GV,
50{
52 using GridIndexType = typename T::GridIndexType;
53 using LocalIndexType = typename T::LocalIndexType;
54 using Scalar = typename T::Scalar;
55 using Geometry = typename T::Geometry;
56
57public:
59 using GlobalPosition = typename T::GlobalPosition;
61 using Traits = T;
62
65
66 // the constructor in the box case
67 template<class Corners>
69 LocalIndexType scvIdx,
70 GridIndexType elementIndex,
71 Corners&& corners,
72 const Scalar volume)
73 : center_(0.5*(corners[0]+corners[1]))
74 , dofPosition_(corners[0])
75 , volume_(volume)
76 , elementIndex_(elementIndex)
77 , localDofIdx_(scvIdx)
78 , dofIndex_(dofIndex)
79 {}
80
83 const GlobalPosition& center() const
84 { return center_; }
85
87 Scalar volume() const
88 { return volume_; }
89
91 LocalIndexType localDofIndex() const
92 { return localDofIdx_; }
93
95 LocalIndexType indexInElement() const
96 { return localDofIdx_; }
97
99 GridIndexType dofIndex() const
100 { return dofIndex_; }
101
102 // The position of the dof this scv is embedded in
104 { return dofPosition_; }
105
107 GridIndexType elementIndex() const
108 { return elementIndex_; }
109
110private:
111 GlobalPosition center_;
112 GlobalPosition dofPosition_;
113 Scalar volume_;
114 GridIndexType elementIndex_;
115 LocalIndexType localDofIdx_;
116 GridIndexType dofIndex_;
117};
118
119} // end namespace Dumux::PoreNetwork
120
121#endif
the sub control volume for porenetworks
Definition: discretization/porenetwork/subcontrolvolume.hh:50
T Traits
state the traits public and thus export all types
Definition: discretization/porenetwork/subcontrolvolume.hh:61
LocalIndexType localDofIndex() const
The element-local index of the dof this scv is embedded in.
Definition: discretization/porenetwork/subcontrolvolume.hh:91
GridIndexType dofIndex() const
The index of the dof this scv is embedded in.
Definition: discretization/porenetwork/subcontrolvolume.hh:99
GridIndexType elementIndex() const
The global index of the element this scv is embedded in.
Definition: discretization/porenetwork/subcontrolvolume.hh:107
const GlobalPosition & center() const
Definition: discretization/porenetwork/subcontrolvolume.hh:83
Scalar volume() const
The volume of the sub control volume (part of a pore)
Definition: discretization/porenetwork/subcontrolvolume.hh:87
PNMSubControlVolume(GridIndexType dofIndex, LocalIndexType scvIdx, GridIndexType elementIndex, Corners &&corners, const Scalar volume)
Definition: discretization/porenetwork/subcontrolvolume.hh:68
PNMSubControlVolume()=default
The default constructor.
typename T::GlobalPosition GlobalPosition
export the type used for global coordinates
Definition: discretization/porenetwork/subcontrolvolume.hh:59
LocalIndexType indexInElement() const
The element-local index of this scv.
Definition: discretization/porenetwork/subcontrolvolume.hh:95
const GlobalPosition & dofPosition() const
Definition: discretization/porenetwork/subcontrolvolume.hh:103
Defines the index types used for grid and local indices.
Define some often used mathematical functions.
Definition: discretization/porenetwork/fvelementgeometry.hh:24
typename GridView::IndexSet::IndexType GridIndex
Definition: indextraits.hh:27
unsigned int LocalIndex
Definition: indextraits.hh:28
Default traits class.
Definition: discretization/porenetwork/subcontrolvolume.hh:28
static const int dim
Definition: discretization/porenetwork/subcontrolvolume.hh:31
typename GridView::Grid Grid
Definition: discretization/porenetwork/subcontrolvolume.hh:29
typename Grid::ctype Scalar
Definition: discretization/porenetwork/subcontrolvolume.hh:36
Dune::AffineGeometry< Scalar, 1, dimWorld > Geometry
Definition: discretization/porenetwork/subcontrolvolume.hh:38
static const int dimWorld
Definition: discretization/porenetwork/subcontrolvolume.hh:32
Dune::FieldVector< Scalar, dimWorld > GlobalPosition
Definition: discretization/porenetwork/subcontrolvolume.hh:37
typename IndexTraits< GridView >::LocalIndex LocalIndexType
Definition: discretization/porenetwork/subcontrolvolume.hh:35
typename IndexTraits< GridView >::GridIndex GridIndexType
Definition: discretization/porenetwork/subcontrolvolume.hh:34