version 3.8
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-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_PNM_SUBCONTROLVOLUME_HH
13#define DUMUX_DISCRETIZATION_PNM_SUBCONTROLVOLUME_HH
14
15#include <dune/geometry/affinegeometry.hh>
16#include <dumux/common/math.hh>
19
20namespace Dumux::PoreNetwork {
21
27template<class GridView>
29{
30 using Grid = typename GridView::Grid;
31
32 static const int dim = Grid::dimension;
33 static const int dimWorld = Grid::dimensionworld;
34
37 using Scalar = typename Grid::ctype;
38 using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
39 using Geometry = Dune::AffineGeometry<Scalar, 1, dimWorld>;
40};
41
48template<class GV,
51: public Dumux::SubControlVolumeBase<PNMSubControlVolume<GV, T>, T>
52{
55 using GridIndexType = typename T::GridIndexType;
56 using LocalIndexType = typename T::LocalIndexType;
57 using Scalar = typename T::Scalar;
58 using Geometry = typename T::Geometry;
59
60public:
62 using GlobalPosition = typename T::GlobalPosition;
64 using Traits = T;
65
68
69 // the constructor in the box case
70 template<class Corners>
72 LocalIndexType scvIdx,
73 GridIndexType elementIndex,
74 Corners&& corners,
75 const Scalar volume)
76 : center_(0.5*(corners[0]+corners[1]))
77 , dofPosition_(corners[0])
78 , volume_(volume)
79 , elementIndex_(elementIndex)
80 , localDofIdx_(scvIdx)
81 , dofIndex_(dofIndex)
82 {}
83
86 const GlobalPosition& center() const
87 { return center_; }
88
90 Scalar volume() const
91 { return volume_; }
92
94 LocalIndexType localDofIndex() const
95 { return localDofIdx_; }
96
98 LocalIndexType indexInElement() const
99 { return localDofIdx_; }
100
102 GridIndexType dofIndex() const
103 { return dofIndex_; }
104
105 // The position of the dof this scv is embedded in
107 { return dofPosition_; }
108
110 GridIndexType elementIndex() const
111 { return elementIndex_; }
112
113private:
114 GlobalPosition center_;
115 GlobalPosition dofPosition_;
116 Scalar volume_;
117 GridIndexType elementIndex_;
118 LocalIndexType localDofIdx_;
119 GridIndexType dofIndex_;
120};
121
122} // end namespace Dumux::PoreNetwork
123
124#endif
the sub control volume for porenetworks
Definition: discretization/porenetwork/subcontrolvolume.hh:52
T Traits
state the traits public and thus export all types
Definition: discretization/porenetwork/subcontrolvolume.hh:64
LocalIndexType localDofIndex() const
The element-local index of the dof this scv is embedded in.
Definition: discretization/porenetwork/subcontrolvolume.hh:94
GridIndexType dofIndex() const
The index of the dof this scv is embedded in.
Definition: discretization/porenetwork/subcontrolvolume.hh:102
GridIndexType elementIndex() const
The global index of the element this scv is embedded in.
Definition: discretization/porenetwork/subcontrolvolume.hh:110
const GlobalPosition & center() const
Definition: discretization/porenetwork/subcontrolvolume.hh:86
Scalar volume() const
The volume of the sub control volume (part of a pore)
Definition: discretization/porenetwork/subcontrolvolume.hh:90
PNMSubControlVolume(GridIndexType dofIndex, LocalIndexType scvIdx, GridIndexType elementIndex, Corners &&corners, const Scalar volume)
Definition: discretization/porenetwork/subcontrolvolume.hh:71
PNMSubControlVolume()=default
The default constructor.
typename T::GlobalPosition GlobalPosition
export the type used for global coordinates
Definition: discretization/porenetwork/subcontrolvolume.hh:62
LocalIndexType indexInElement() const
The element-local index of this scv.
Definition: discretization/porenetwork/subcontrolvolume.hh:98
const GlobalPosition & dofPosition() const
Definition: discretization/porenetwork/subcontrolvolume.hh:106
Base class for a sub control volume, i.e a part of the control volume we are making the balance for....
Definition: subcontrolvolumebase.hh:26
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:29
static const int dim
Definition: discretization/porenetwork/subcontrolvolume.hh:32
typename GridView::Grid Grid
Definition: discretization/porenetwork/subcontrolvolume.hh:30
typename Grid::ctype Scalar
Definition: discretization/porenetwork/subcontrolvolume.hh:37
Dune::AffineGeometry< Scalar, 1, dimWorld > Geometry
Definition: discretization/porenetwork/subcontrolvolume.hh:39
static const int dimWorld
Definition: discretization/porenetwork/subcontrolvolume.hh:33
Dune::FieldVector< Scalar, dimWorld > GlobalPosition
Definition: discretization/porenetwork/subcontrolvolume.hh:38
typename IndexTraits< GridView >::LocalIndex LocalIndexType
Definition: discretization/porenetwork/subcontrolvolume.hh:36
typename IndexTraits< GridView >::GridIndex GridIndexType
Definition: discretization/porenetwork/subcontrolvolume.hh:35
Base class for a sub control volume.