Line | Branch | Exec | Source |
---|---|---|---|
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 | // | ||
7 | /*! | ||
8 | * \file | ||
9 | * \ingroup PoreNetworkDiscretization | ||
10 | * \brief the sub control volume for pore networks | ||
11 | */ | ||
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> | ||
17 | #include <dumux/common/indextraits.hh> | ||
18 | #include <dumux/discretization/subcontrolvolumebase.hh> | ||
19 | |||
20 | namespace Dumux::PoreNetwork { | ||
21 | |||
22 | /*! | ||
23 | * \ingroup PoreNetworkDiscretization | ||
24 | * \brief Default traits class | ||
25 | * \tparam GV the type of the grid view | ||
26 | */ | ||
27 | template<class GridView> | ||
28 | struct PNMDefaultScvGeometryTraits | ||
29 | { | ||
30 | using Grid = typename GridView::Grid; | ||
31 | |||
32 | static const int dim = Grid::dimension; | ||
33 | static const int dimWorld = Grid::dimensionworld; | ||
34 | |||
35 | using GridIndexType = typename IndexTraits<GridView>::GridIndex; | ||
36 | using LocalIndexType = typename IndexTraits<GridView>::LocalIndex; | ||
37 | using Scalar = typename Grid::ctype; | ||
38 | using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>; | ||
39 | using Geometry = Dune::AffineGeometry<Scalar, 1, dimWorld>; | ||
40 | }; | ||
41 | |||
42 | /*! | ||
43 | * \ingroup PoreNetworkDiscretization | ||
44 | * \brief the sub control volume for porenetworks | ||
45 | * \tparam GV the type of the grid view | ||
46 | * \tparam T the scv geometry traits | ||
47 | */ | ||
48 | template<class GV, | ||
49 | class T = PNMDefaultScvGeometryTraits<GV> > | ||
50 | class PNMSubControlVolume | ||
51 | : public Dumux::SubControlVolumeBase<PNMSubControlVolume<GV, T>, T> | ||
52 | { | ||
53 | using ThisType = PNMSubControlVolume<GV, T>; | ||
54 | using ParentType = Dumux::SubControlVolumeBase<ThisType, T>; | ||
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 | |||
60 | public: | ||
61 | //! export the type used for global coordinates | ||
62 | using GlobalPosition = typename T::GlobalPosition; | ||
63 | //! state the traits public and thus export all types | ||
64 | using Traits = T; | ||
65 | |||
66 | //! The default constructor | ||
67 | 16835010 | PNMSubControlVolume() = default; | |
68 | |||
69 | // the constructor in the box case | ||
70 | template<class Corners> | ||
71 | 7906658 | PNMSubControlVolume(GridIndexType dofIndex, | |
72 | LocalIndexType scvIdx, | ||
73 | GridIndexType elementIndex, | ||
74 | Corners&& corners, | ||
75 | const Scalar volume) | ||
76 | 31626632 | : center_(0.5*(corners[0]+corners[1])) | |
77 | 15813316 | , dofPosition_(corners[0]) | |
78 | , volume_(volume) | ||
79 | , elementIndex_(elementIndex) | ||
80 | , localDofIdx_(scvIdx) | ||
81 | 7906658 | , dofIndex_(dofIndex) | |
82 | 7906658 | {} | |
83 | |||
84 | //! The center of the sub control volume (return pore center). | ||
85 | //! Be aware that this is not the pore-body center! Use dofPosition() for the latter! | ||
86 | const GlobalPosition& center() const | ||
87 |
8/16✓ Branch 0 taken 2401 times.
✓ Branch 1 taken 1528997 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5015184 times.
✓ Branch 4 taken 41660 times.
✓ Branch 5 taken 941464 times.
✓ Branch 6 taken 2153760 times.
✓ Branch 7 taken 19221 times.
✓ Branch 8 taken 13 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
14021732 | { return center_; } |
88 | |||
89 | //! The volume of the sub control volume (part of a pore) | ||
90 | ✗ | Scalar volume() const | |
91 | ✗ | { return volume_; } | |
92 | |||
93 | //! The element-local index of the dof this scv is embedded in | ||
94 | ✗ | LocalIndexType localDofIndex() const | |
95 | ✗ | { return localDofIdx_; } | |
96 | |||
97 | //! The element-local index of this scv. | ||
98 | ✗ | LocalIndexType indexInElement() const | |
99 | ✗ | { return localDofIdx_; } | |
100 | |||
101 | //! The index of the dof this scv is embedded in | ||
102 | ✗ | GridIndexType dofIndex() const | |
103 | ✗ | { return dofIndex_; } | |
104 | |||
105 | // The position of the dof this scv is embedded in | ||
106 | const GlobalPosition& dofPosition() const | ||
107 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 1514 times.
✓ Branch 2 taken 16923 times.
✓ Branch 3 taken 14720 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
36962649 | { return dofPosition_; } |
108 | |||
109 | //! The global index of the element this scv is embedded in | ||
110 | ✗ | GridIndexType elementIndex() const | |
111 | ✗ | { return elementIndex_; } | |
112 | |||
113 | private: | ||
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 | ||
125 |