GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/richards/lens/spatialparams.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 17 23 73.9%
Functions: 7 30 23.3%
Branches: 178 238 74.8%

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 RichardsTests
10 * \brief Spatial parameters for the RichardsLensProblem.
11 */
12
13 #ifndef DUMUX_RICHARDS_LENS_SPATIAL_PARAMETERS_HH
14 #define DUMUX_RICHARDS_LENS_SPATIAL_PARAMETERS_HH
15
16 #include <dumux/porousmediumflow/fvspatialparamsmp.hh>
17 #include <dumux/material/fluidmatrixinteractions/2p/vangenuchten.hh>
18
19 #include <dumux/porousmediumflow/richards/model.hh>
20
21 namespace Dumux {
22
23 /*!
24 * \ingroup RichardsTests
25 * \brief The spatial parameters for the RichardsLensProblem.
26 */
27 template<class GridGeometry, class Scalar>
28
1/6
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 23 times.
✗ Branch 5 not taken.
23 class RichardsLensSpatialParams
29 : public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, RichardsLensSpatialParams<GridGeometry, Scalar>>
30 {
31 using ThisType = RichardsLensSpatialParams<GridGeometry, Scalar>;
32 using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, ThisType>;
33 using GridView = typename GridGeometry::GridView;
34 using FVElementGeometry = typename GridGeometry::LocalView;
35 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
36 using Element = typename GridView::template Codim<0>::Entity;
37 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
38
39 enum { dimWorld = GridView::dimensionworld };
40
41 using PcKrSwCurve = FluidMatrix::VanGenuchtenDefault<Scalar>;
42
43 public:
44 // export permeability type
45 using PermeabilityType = Scalar;
46
47 23 RichardsLensSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
48 : ParentType(gridGeometry)
49 , pcKrSwCurveLens_("SpatialParams.Lens")
50
13/34
✓ Branch 2 taken 23 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 23 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 23 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 23 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 23 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 23 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 23 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 23 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 23 times.
✗ Branch 25 not taken.
✓ Branch 27 taken 23 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 23 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 23 times.
✗ Branch 34 not taken.
✓ Branch 35 taken 23 times.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
207 , pcKrSwCurveOuterDomain_("SpatialParams.OuterDomain")
51 {
52 23 lensLowerLeft_ = {1.0, 2.0};
53 23 lensUpperRight_ = {4.0, 3.0};
54 23 lensK_ = 1e-12;
55 23 outerK_ = 5e-12;
56 23 }
57
58 /*!
59 * \brief Returns the intrinsic permeability tensor [m^2] at a given location
60 *
61 * \param globalPos The global position where we evaluate
62 */
63 PermeabilityType permeabilityAtPos(const GlobalPosition& globalPos) const
64 {
65
2/4
✓ Branch 0 taken 300304 times.
✓ Branch 1 taken 1991260 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
2291564 if (isInLens_(globalPos))
66 300304 return lensK_;
67 1991260 return outerK_;
68 }
69
70 /*!
71 * \brief Returns the porosity [] at a given location
72 *
73 * \param globalPos The global position where we evaluate
74 */
75 Scalar porosityAtPos(const GlobalPosition& globalPos) const
76 { return 0.4; }
77
78 /*!
79 * \brief Returns the fluid-matrix interaction law for the sub-control volume
80 *
81 * This method is not actually required by the Richards model, but provided
82 * for the convenience of the RichardsLensProblem
83 *
84 * \param element The current finite element
85 * \param scv The sub-control volume
86 * \param elemSol The current element solution
87 */
88 template<class ElementSolution>
89 auto fluidMatrixInteraction(const Element& element,
90 const SubControlVolume& scv,
91 const ElementSolution& elemSol) const
92 {
93 const auto& globalPos = scv.dofPosition();
94
4/6
✗ Branch 1 not taken.
✓ Branch 2 taken 2291564 times.
✓ Branch 4 taken 69121 times.
✓ Branch 5 taken 1183 times.
✓ Branch 6 taken 53872 times.
✗ Branch 7 not taken.
5367944 return fluidMatrixInteractionAtPos(globalPos);
95 }
96
97 /*!
98 * \brief Returns the fluid-matrix interaction law at a given location
99 * \param globalPos The global coordinates for the given location
100 */
101 auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const
102 {
103
18/20
✓ Branch 0 taken 76038 times.
✓ Branch 1 taken 378282 times.
✓ Branch 2 taken 361168 times.
✓ Branch 3 taken 1930396 times.
✓ Branch 4 taken 361168 times.
✓ Branch 5 taken 1930396 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 12529 times.
✓ Branch 9 taken 93066 times.
✓ Branch 10 taken 18804 times.
✓ Branch 11 taken 104188 times.
✓ Branch 12 taken 18804 times.
✓ Branch 13 taken 104188 times.
✓ Branch 14 taken 1776 times.
✓ Branch 15 taken 12432 times.
✓ Branch 16 taken 65 times.
✓ Branch 17 taken 3240 times.
✓ Branch 18 taken 48 times.
✓ Branch 19 taken 1520 times.
5408108 if (isInLens_(globalPos))
104 850400 return makeFluidMatrixInteraction(pcKrSwCurveLens_);
105 4557708 return makeFluidMatrixInteraction(pcKrSwCurveOuterDomain_);
106 }
107
108 /*!
109 * \brief Returns the temperature [K] at a given location
110 * \param globalPos The global coordinates for the given location
111 */
112 Scalar temperatureAtPos(const GlobalPosition& globalPos) const
113 { return 273.15 + 10.0; }; // -> 10°C
114
115 private:
116 bool isInLens_(const GlobalPosition &globalPos) const
117 {
118
20/24
✓ Branch 0 taken 703408 times.
✓ Branch 1 taken 76038 times.
✓ Branch 2 taken 3522980 times.
✓ Branch 3 taken 361168 times.
✓ Branch 4 taken 3522980 times.
✓ Branch 5 taken 361168 times.
✓ Branch 6 taken 3470228 times.
✓ Branch 7 taken 300304 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 146014 times.
✓ Branch 13 taken 12529 times.
✓ Branch 14 taken 187960 times.
✓ Branch 15 taken 18804 times.
✓ Branch 16 taken 187960 times.
✓ Branch 17 taken 18804 times.
✓ Branch 18 taken 21312 times.
✓ Branch 19 taken 1776 times.
✓ Branch 20 taken 3526 times.
✓ Branch 21 taken 65 times.
✓ Branch 22 taken 1760 times.
✓ Branch 23 taken 48 times.
12918832 for (int i = 0; i < dimWorld; ++i)
119
120/144
✓ Branch 0 taken 519530 times.
✓ Branch 1 taken 183878 times.
✓ Branch 2 taken 519530 times.
✓ Branch 3 taken 183878 times.
✓ Branch 4 taken 519530 times.
✓ Branch 5 taken 183878 times.
✓ Branch 6 taken 325126 times.
✓ Branch 7 taken 194404 times.
✓ Branch 8 taken 325126 times.
✓ Branch 9 taken 194404 times.
✓ Branch 10 taken 325126 times.
✓ Branch 11 taken 194404 times.
✓ Branch 12 taken 2587032 times.
✓ Branch 13 taken 935948 times.
✓ Branch 14 taken 2587032 times.
✓ Branch 15 taken 935948 times.
✓ Branch 16 taken 2587032 times.
✓ Branch 17 taken 935948 times.
✓ Branch 18 taken 1592584 times.
✓ Branch 19 taken 994448 times.
✓ Branch 20 taken 1592584 times.
✓ Branch 21 taken 994448 times.
✓ Branch 22 taken 1592584 times.
✓ Branch 23 taken 994448 times.
✓ Branch 24 taken 2587032 times.
✓ Branch 25 taken 935948 times.
✓ Branch 26 taken 2587032 times.
✓ Branch 27 taken 935948 times.
✓ Branch 28 taken 2587032 times.
✓ Branch 29 taken 935948 times.
✓ Branch 30 taken 1592584 times.
✓ Branch 31 taken 994448 times.
✓ Branch 32 taken 1592584 times.
✓ Branch 33 taken 994448 times.
✓ Branch 34 taken 1592584 times.
✓ Branch 35 taken 994448 times.
✓ Branch 36 taken 2509362 times.
✓ Branch 37 taken 960866 times.
✓ Branch 38 taken 2509362 times.
✓ Branch 39 taken 960866 times.
✓ Branch 40 taken 2509362 times.
✓ Branch 41 taken 960866 times.
✓ Branch 42 taken 1478968 times.
✓ Branch 43 taken 1030394 times.
✓ Branch 44 taken 1478968 times.
✓ Branch 45 taken 1030394 times.
✓ Branch 46 taken 1478968 times.
✓ Branch 47 taken 1030394 times.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✓ Branch 72 taken 99325 times.
✓ Branch 73 taken 46689 times.
✓ Branch 74 taken 99325 times.
✓ Branch 75 taken 46689 times.
✓ Branch 76 taken 99325 times.
✓ Branch 77 taken 46689 times.
✓ Branch 78 taken 52948 times.
✓ Branch 79 taken 46377 times.
✓ Branch 80 taken 52948 times.
✓ Branch 81 taken 46377 times.
✓ Branch 82 taken 52948 times.
✓ Branch 83 taken 46377 times.
✓ Branch 84 taken 139287 times.
✓ Branch 85 taken 48673 times.
✓ Branch 86 taken 139287 times.
✓ Branch 87 taken 48673 times.
✓ Branch 88 taken 139287 times.
✓ Branch 89 taken 48673 times.
✓ Branch 90 taken 83772 times.
✓ Branch 91 taken 55515 times.
✓ Branch 92 taken 83772 times.
✓ Branch 93 taken 55515 times.
✓ Branch 94 taken 83772 times.
✓ Branch 95 taken 55515 times.
✓ Branch 96 taken 137982 times.
✓ Branch 97 taken 49978 times.
✓ Branch 98 taken 137982 times.
✓ Branch 99 taken 49978 times.
✓ Branch 100 taken 137982 times.
✓ Branch 101 taken 49978 times.
✓ Branch 102 taken 83772 times.
✓ Branch 103 taken 54210 times.
✓ Branch 104 taken 83772 times.
✓ Branch 105 taken 54210 times.
✓ Branch 106 taken 83772 times.
✓ Branch 107 taken 54210 times.
✓ Branch 108 taken 15392 times.
✓ Branch 109 taken 5920 times.
✓ Branch 110 taken 15392 times.
✓ Branch 111 taken 5920 times.
✓ Branch 112 taken 15392 times.
✓ Branch 113 taken 5920 times.
✓ Branch 114 taken 8880 times.
✓ Branch 115 taken 6512 times.
✓ Branch 116 taken 8880 times.
✓ Branch 117 taken 6512 times.
✓ Branch 118 taken 8880 times.
✓ Branch 119 taken 6512 times.
✓ Branch 120 taken 1914 times.
✓ Branch 121 taken 1612 times.
✓ Branch 122 taken 1914 times.
✓ Branch 123 taken 1612 times.
✓ Branch 124 taken 1914 times.
✓ Branch 125 taken 1612 times.
✓ Branch 126 taken 286 times.
✓ Branch 127 taken 1628 times.
✓ Branch 128 taken 286 times.
✓ Branch 129 taken 1628 times.
✓ Branch 130 taken 286 times.
✓ Branch 131 taken 1628 times.
✓ Branch 132 taken 1008 times.
✓ Branch 133 taken 752 times.
✓ Branch 134 taken 1008 times.
✓ Branch 135 taken 752 times.
✓ Branch 136 taken 1008 times.
✓ Branch 137 taken 752 times.
✓ Branch 138 taken 240 times.
✓ Branch 139 taken 768 times.
✓ Branch 140 taken 240 times.
✓ Branch 141 taken 768 times.
✓ Branch 142 taken 240 times.
✓ Branch 143 taken 768 times.
35304384 if (globalPos[i] < lensLowerLeft_[i] - eps_ || globalPos[i] > lensUpperRight_[i] + eps_)
120 return false;
121
122 return true;
123 }
124
125 static constexpr Scalar eps_ = 1e-6;
126
127 GlobalPosition lensLowerLeft_;
128 GlobalPosition lensUpperRight_;
129
130 Scalar lensK_;
131 Scalar outerK_;
132 const PcKrSwCurve pcKrSwCurveLens_;
133 const PcKrSwCurve pcKrSwCurveOuterDomain_;
134 };
135
136 } // end namespace Dumux
137
138 #endif
139