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 PoreNetworkModels | ||
10 | * \ingroup SpatialParameters | ||
11 | * \brief The default class for spatial parameters for single-phase pore-network models. | ||
12 | */ | ||
13 | #ifndef DUMUX_PNM_ONEP_PERMEABILITY_UPSCALING_SPATIAL_PARAMS_1P_HH | ||
14 | #define DUMUX_PNM_ONEP_PERMEABILITY_UPSCALING_SPATIAL_PARAMS_1P_HH | ||
15 | |||
16 | #include <dumux/porenetwork/common/spatialparams.hh> | ||
17 | |||
18 | namespace Dumux::PoreNetwork { | ||
19 | |||
20 | /*! | ||
21 | * \ingroup PoreNetworkModels | ||
22 | * \ingroup SpatialParameters | ||
23 | * \brief Spatial parameters for the upscaling example | ||
24 | */ | ||
25 | template <class GridGeometry, class Scalar> | ||
26 | class UpscalingSpatialParams : public SpatialParams<GridGeometry, Scalar, | ||
27 | UpscalingSpatialParams<GridGeometry, Scalar>> | ||
28 | { | ||
29 | using ParentType = SpatialParams<GridGeometry, Scalar, | ||
30 | UpscalingSpatialParams<GridGeometry, Scalar>>; | ||
31 | using GridView = typename GridGeometry::GridView; | ||
32 | using FVElementGeometry = typename GridGeometry::LocalView; | ||
33 | using SubControlVolume = typename GridGeometry::SubControlVolume; | ||
34 | using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace; | ||
35 | using Element = typename GridView::template Codim<0>::Entity; | ||
36 | using GlobalPosition = typename Element::Geometry::GlobalCoordinate; | ||
37 | public: | ||
38 | |||
39 | 2 | UpscalingSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry) | |
40 |
3/10✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
4 | : ParentType(gridGeometry) |
41 | { | ||
42 |
5/14✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
10 | std::vector<Scalar> totalAreaSharedWithAdjacentThroats(gridGeometry->numDofs()); |
43 |
3/6✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
|
6 | poreShapeFactor_.resize(gridGeometry->numDofs()); |
44 | |||
45 |
4/4✓ Branch 3 taken 30768 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 30768 times.
✓ Branch 6 taken 2 times.
|
30774 | for (const auto& element : elements(gridGeometry->gridView())) |
46 | { | ||
47 | 61536 | const auto eIdx = gridGeometry->elementMapper().index(element); | |
48 |
2/2✓ Branch 1 taken 61536 times.
✓ Branch 2 taken 30768 times.
|
92304 | for (int i = 0; i < 2; ++i) |
49 | { | ||
50 |
4/8✗ Branch 0 not taken.
✓ Branch 1 taken 61536 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 61536 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 61536 times.
✓ Branch 7 taken 61536 times.
✗ Branch 8 not taken.
|
184608 | const auto vIdx = gridGeometry->gridView().indexSet().subIndex(element, i, GridView::dimension); |
51 |
3/6✓ Branch 0 taken 61536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 61536 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 61536 times.
✗ Branch 5 not taken.
|
184608 | totalAreaSharedWithAdjacentThroats[vIdx] += gridGeometry->throatCrossSectionalArea(eIdx); |
52 |
2/4✓ Branch 0 taken 61536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 61536 times.
✗ Branch 3 not taken.
|
369216 | poreShapeFactor_[vIdx] += gridGeometry->throatShapeFactor(eIdx) * gridGeometry->throatCrossSectionalArea(eIdx); |
53 | } | ||
54 | } | ||
55 | |||
56 |
4/4✓ Branch 0 taken 14778 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 14778 times.
✓ Branch 3 taken 2 times.
|
29558 | for (int i = 0; i < totalAreaSharedWithAdjacentThroats.size(); ++i) |
57 | 44334 | poreShapeFactor_[i] /= totalAreaSharedWithAdjacentThroats[i]; | |
58 | 2 | } | |
59 | |||
60 | ✗ | Scalar temperatureAtPos(const GlobalPosition& globalPos) const | |
61 | ✗ | { return 283.15; } | |
62 | |||
63 | template<class ElementSolutionVector> | ||
64 | ✗ | Scalar poreLength(const Element& element, | |
65 | const SubControlVolume& scv, | ||
66 | const ElementSolutionVector& elemSol) const | ||
67 | { | ||
68 | // we assume the pore length to be equal to the inscribed pore radius | ||
69 |
8/16✓ Branch 0 taken 2522976 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2522976 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2522976 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2522976 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1092264 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1092264 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1092264 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1092264 times.
✗ Branch 15 not taken.
|
14460960 | return this->asImp_().poreInscribedRadius(element, scv, elemSol); |
70 | } | ||
71 | |||
72 | template<class ElementSolutionVector> | ||
73 | ✗ | Scalar poreShapeFactor(const Element& element, | |
74 | const SubControlVolume& scv, | ||
75 | const ElementSolutionVector& elemSol) const | ||
76 | { | ||
77 | // we assume the pore length to be equal to the inscribed pore radius | ||
78 |
8/16✓ Branch 0 taken 2522976 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2522976 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2522976 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2522976 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1092264 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1092264 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1092264 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1092264 times.
✗ Branch 15 not taken.
|
14460960 | return poreShapeFactor_[scv.dofIndex()]; |
79 | } | ||
80 | |||
81 | template<class ElementSolutionVector> | ||
82 | ✗ | Scalar poreCrossSectionalArea(const Element& element, | |
83 | const SubControlVolume& scv, | ||
84 | const ElementSolutionVector& elemSol) const | ||
85 | { | ||
86 |
4/8✓ Branch 0 taken 2522976 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2522976 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1092264 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1092264 times.
✗ Branch 7 not taken.
|
12276432 | const Scalar r = this->asImp_().poreInscribedRadius(element, scv, elemSol); |
87 | |||
88 | // we assume the pore cross sectional area to be equal to the area of | ||
89 | // circle with the pore's inscribed radius | ||
90 |
4/8✓ Branch 0 taken 2522976 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2522976 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1092264 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1092264 times.
✗ Branch 7 not taken.
|
12276432 | return M_PI * r * r; |
91 | } | ||
92 | |||
93 | // dimensionless kinetic-energy coefficient which for non-creeping flow | ||
94 | template<class ElementSolutionVector> | ||
95 | ✗ | Scalar kineticEnergyCoefficient(const Element& element, | |
96 | const SubControlVolume& scv, | ||
97 | const ElementSolutionVector& elemSol) const | ||
98 | ✗ | { return 1.0; } | |
99 | |||
100 | // dimensionless momentum coefficient which for non-creeping flow | ||
101 | template<class ElementSolutionVector> | ||
102 | ✗ | Scalar momentumCoefficient(const Element& element, | |
103 | const SubControlVolume& scv, | ||
104 | const ElementSolutionVector& elemSol) const | ||
105 | ✗ | { return 1.0; } | |
106 | |||
107 | private: | ||
108 | std::vector<Scalar> poreShapeFactor_; | ||
109 | }; | ||
110 | |||
111 | } // namespace Dumux::PoreNetwork | ||
112 | |||
113 | #endif | ||
114 |