GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/1p/periodicbc/spatialparams.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 8 16 50.0%
Functions: 2 8 25.0%
Branches: 9 58 15.5%

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 parameters for the incompressible test.
11 */
12 #ifndef DUMUX_INCOMPRESSIBLE_ONEP_TEST_SPATIAL_PARAMS_HH
13 #define DUMUX_INCOMPRESSIBLE_ONEP_TEST_SPATIAL_PARAMS_HH
14
15 #include <dumux/porousmediumflow/properties.hh>
16 #include <dumux/porousmediumflow/fvspatialparams1p.hh>
17
18 namespace Dumux {
19
20 /*!
21 * \ingroup OnePTests
22 * \brief The spatial parameters class for the test problem using the
23 * incompressible 1p model.
24 */
25 template<class TypeTag>
26
1/6
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
5 class OnePTestSpatialParams
27 : public FVPorousMediumFlowSpatialParamsOneP<GetPropType<TypeTag, Properties::GridGeometry>,
28 GetPropType<TypeTag, Properties::Scalar>,
29 OnePTestSpatialParams<TypeTag>>
30 {
31 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
32 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
33 using GridView = typename GridGeometry::GridView;
34 using Element = typename GridView::template Codim<0>::Entity;
35 using FVElementGeometry = typename GridGeometry::LocalView;
36 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
37
38 using ThisType = OnePTestSpatialParams<TypeTag>;
39 using ParentType = FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar, ThisType>;
40
41 static constexpr int dimWorld = GridView::dimensionworld;
42 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
43
44 public:
45 using PermeabilityType = Scalar;
46 5 OnePTestSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
47
4/12
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 5 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
15 : ParentType(gridGeometry)
48 {
49
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 permeability_ = getParam<Scalar>("SpatialParams.Permeability");
50
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 permeabilityLens_ = getParam<Scalar>("SpatialParams.PermeabilityLens");
51
52
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 lensLowerLeft_ = getParam<GlobalPosition>("SpatialParams.LensLowerLeft");
53
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 lensUpperRight_ = getParam<GlobalPosition>("SpatialParams.LensUpperRight");
54 5 }
55
56 /*!
57 * \brief Function for defining the (intrinsic) permeability \f$[m^2]\f$.
58 *
59 * \param element The element
60 * \param scv The sub-control volume
61 * \param elemSol The element solution vector
62 * \return the intrinsic permeability
63 */
64 template<class ElementSolution>
65 PermeabilityType permeability(const Element& element,
66 const SubControlVolume& scv,
67 const ElementSolution& elemSol) const
68 {
69 if (isInLens_(scv.dofPosition()))
70 return permeabilityLens_;
71 else
72 return permeability_;
73 }
74
75 /*!
76 * \brief Defines the porosity \f$\mathrm{[-]}\f$.
77 *
78 * \param globalPos The global position
79 */
80 Scalar porosityAtPos(const GlobalPosition& globalPos) const
81 { return 0.4; }
82
83 private:
84 bool isInLens_(const GlobalPosition &globalPos) const
85 {
86 for (int i = 0; i < dimWorld; ++i) {
87 if (globalPos[i] < lensLowerLeft_[i] + eps_ || globalPos[i] > lensUpperRight_[i] - eps_)
88 return false;
89 }
90 return true;
91 }
92
93 GlobalPosition lensLowerLeft_;
94 GlobalPosition lensUpperRight_;
95
96 Scalar permeability_, permeabilityLens_;
97
98 static constexpr Scalar eps_ = 1.5e-7;
99 };
100
101 } // end namespace Dumux
102
103 #endif
104