GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/test/porousmediumflow/1p/incompressible/spatialparams.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 21 21 100.0%
Functions: 12 12 100.0%
Branches: 20 30 66.7%

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-FileCopyrightText: 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/2
✓ Branch 0 taken 18 times.
✗ Branch 1 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
3/6
✓ 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.
36 : 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/2
✓ Branch 1 taken 18 times.
✗ Branch 2 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 47408 PermeabilityType permeability(const Element& element,
67 const SubControlVolume& scv,
68 const ElementSolution& elemSol) const
69 {
70
4/4
✓ Branch 0 taken 14782 times.
✓ Branch 1 taken 32626 times.
✓ Branch 2 taken 9640 times.
✓ Branch 3 taken 5142 times.
47408 if (isInLens_(scv.dofPosition()) && !checkIsConstantVelocity_)
71 9640 return permeabilityLens_;
72 else
73 37768 return permeability_;
74 }
75
76 /*!
77 * \brief Defines the porosity \f$\mathrm{[-]}\f$.
78 *
79 * \param globalPos The global position
80 */
81 1640 Scalar porosityAtPos(const GlobalPosition& globalPos) const
82 { return 0.4; }
83
84 /*!
85 * \brief Define the temperature in the domain in Kelvin.
86 * \param globalPos The global position
87 */
88 5 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 47408 Scalar extrusionFactorAtPos(const GlobalPosition& globalPos) const
95 47408 { return extrusionFactor_; }
96
97 private:
98 47408 bool isInLens_(const GlobalPosition &globalPos) const
99 {
100
2/2
✓ Branch 0 taken 74398 times.
✓ Branch 1 taken 14782 times.
89180 for (int i = 0; i < dimWorld; ++i) {
101
4/4
✓ Branch 0 taken 58112 times.
✓ Branch 1 taken 16286 times.
✓ Branch 2 taken 41772 times.
✓ Branch 3 taken 16340 times.
74398 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