GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/1p/incompressible/spatialparams.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 16 22 72.7%
Functions: 11 55 20.0%
Branches: 32 73 43.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 OnePTests
10 * \brief The spatial params the incompressible test
11 */
12
13 #ifndef DUMUX_INCOMPRESSIBLE_ONEP_TEST_SPATIAL_PARAMS_HH
14 #define DUMUX_INCOMPRESSIBLE_ONEP_TEST_SPATIAL_PARAMS_HH
15
16 #include <dumux/porousmediumflow/properties.hh>
17 #include <dumux/porousmediumflow/fvspatialparams1p.hh>
18
19 namespace Dumux {
20
21 /*!
22 * \ingroup OnePTests
23 * \brief The spatial parameters class for the test problem using the
24 * incompressible 1p model
25 */
26 template<class GridGeometry, class Scalar>
27
1/6
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 18 times.
✗ Branch 5 not taken.
18 class OnePTestSpatialParams
28 : public FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar,
29 OnePTestSpatialParams<GridGeometry, Scalar>>
30 {
31 using GridView = typename GridGeometry::GridView;
32 using Element = typename GridView::template Codim<0>::Entity;
33 using FVElementGeometry = typename GridGeometry::LocalView;
34 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
35
36 using ThisType = OnePTestSpatialParams<GridGeometry, Scalar>;
37 using ParentType = FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar, ThisType>;
38
39 static constexpr int dimWorld = GridView::dimensionworld;
40 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
41
42 public:
43 using PermeabilityType = Scalar;
44 18 OnePTestSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
45
7/17
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 18 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 18 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 18 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
57 : ParentType(gridGeometry)
46 {
47
1/2
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
18 extrusionFactor_ = getParam<Scalar>("Problem.ExtrusionFactor");
48
1/2
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
18 permeability_ = getParam<Scalar>("SpatialParams.Permeability");
49
1/2
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
18 permeabilityLens_ = getParam<Scalar>("SpatialParams.PermeabilityLens");
50
51
1/2
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
18 lensLowerLeft_ = getParam<GlobalPosition>("SpatialParams.LensLowerLeft");
52
1/2
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
18 lensUpperRight_ = getParam<GlobalPosition>("SpatialParams.LensUpperRight");
53
54
1/4
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
18 checkIsConstantVelocity_ = getParam<bool>("Problem.CheckIsConstantVelocity",false);
55 18 }
56
57 /*!
58 * \brief Function for defining the (intrinsic) permeability \f$[m^2]\f$.
59 *
60 * \param element The element
61 * \param scv The sub-control volume
62 * \param elemSol The element solution vector
63 * \return The intrinsic permeability
64 */
65 template<class ElementSolution>
66 PermeabilityType permeability(const Element& element,
67 const SubControlVolume& scv,
68 const ElementSolution& elemSol) const
69 {
70
4/8
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14170 times.
✓ Branch 5 taken 31598 times.
✓ Branch 6 taken 9028 times.
✓ Branch 7 taken 5142 times.
45768 if (isInLens_(scv.dofPosition()) && !checkIsConstantVelocity_)
71 9028 return permeabilityLens_;
72 else
73 36740 return permeability_;
74 }
75
76 /*!
77 * \brief Defines the porosity \f$\mathrm{[-]}\f$.
78 *
79 * \param globalPos The global position
80 */
81 Scalar porosityAtPos(const GlobalPosition& globalPos) const
82 1440 { return 0.4; }
83
84 /*!
85 * \brief Define the temperature in the domain in Kelvin.
86 * \param globalPos The global position
87 */
88 Scalar temperatureAtPos(const GlobalPosition& globalPos) const
89 { return 283.15; }
90
91 /*!
92 * \brief Define the extrusion of the domain at a given position.
93 */
94 Scalar extrusionFactorAtPos(const GlobalPosition& globalPos) const
95 { return extrusionFactor_; }
96
97 private:
98 bool isInLens_(const GlobalPosition &globalPos) const
99 {
100
2/4
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 71738 times.
✓ Branch 3 taken 14170 times.
85908 for (int i = 0; i < dimWorld; ++i) {
101
12/24
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 55966 times.
✓ Branch 13 taken 15772 times.
✓ Branch 14 taken 55966 times.
✓ Branch 15 taken 15772 times.
✓ Branch 16 taken 55966 times.
✓ Branch 17 taken 15772 times.
✓ Branch 18 taken 40140 times.
✓ Branch 19 taken 15826 times.
✓ Branch 20 taken 40140 times.
✓ Branch 21 taken 15826 times.
✓ Branch 22 taken 40140 times.
✓ Branch 23 taken 15826 times.
215214 if (globalPos[i] < lensLowerLeft_[i] + eps_ || globalPos[i] > lensUpperRight_[i] - eps_)
102 return false;
103 }
104 return true;
105 }
106
107 GlobalPosition lensLowerLeft_;
108 GlobalPosition lensUpperRight_;
109
110 Scalar extrusionFactor_, permeability_, permeabilityLens_;
111
112 static constexpr Scalar eps_ = 1.5e-7;
113
114 bool checkIsConstantVelocity_;
115 };
116
117 } // end namespace Dumux
118
119 #endif
120