GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/test/porousmediumflow/richardsnc/spatialparams.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 23 23 100.0%
Functions: 2 2 100.0%
Branches: 53 74 71.6%

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 RichardsNCTests
10 * \brief The spatial parameters for the RichardsWellTracerProblem.
11 */
12
13 #ifndef DUMUX_RICHARDS_LENS_SPATIAL_PARAMETERS_HH
14 #define DUMUX_RICHARDS_LENS_SPATIAL_PARAMETERS_HH
15
16 #include <dumux/material/fluidmatrixinteractions/2p/vangenuchten.hh>
17 #include <dumux/porousmediumflow/fvspatialparamsmp.hh>
18 #include <dumux/porousmediumflow/richards/model.hh>
19
20 namespace Dumux {
21
22 /*!
23 * \ingroup RichardsModel
24 * \ingroup ImplicitTestProblems
25 * \brief The spatial parameters for the RichardsWellTracerProblem.
26 */
27 template<class GridGeometry, class Scalar>
28
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 class RichardsWellTracerSpatialParams
29 : public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar,
30 RichardsWellTracerSpatialParams<GridGeometry, Scalar>>
31 {
32 using GridView = typename GridGeometry::GridView;
33 using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar,
34 RichardsWellTracerSpatialParams<GridGeometry, Scalar>>;
35
36 enum { dimWorld=GridView::dimensionworld };
37 using Element = typename GridView::template Codim<0>::Entity;
38 using FVElementGeometry = typename GridGeometry::LocalView;
39 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
40 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
41
42 using PcKrSwCurve = FluidMatrix::VanGenuchtenNoReg<Scalar>;
43
44 public:
45 // export permeability type
46 using PermeabilityType = Scalar;
47
48 2 RichardsWellTracerSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
49 : ParentType(gridGeometry)
50
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
2 , lensPcKrSwCurve_("SpatialParams.Lens")
51
4/8
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 2 times.
✗ Branch 12 not taken.
6 , outerPcKrSwCurve_("SpatialParams.OuterDomain")
52 {
53
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 lensLowerLeft_ = getParam<GlobalPosition>("Problem.LensLowerLeft");
54
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 lensUpperRight_ = getParam<GlobalPosition>("Problem.LensUpperRight");
55
56 2 lensK_ = 1e-14;
57 2 outerK_ = 5e-12;
58 2 }
59
60 /*!
61 * \brief Returns the intrinsic permeability tensor [m^2] at a given location
62 *
63 * \param globalPos The global position where we evaluate
64 */
65 9925200 PermeabilityType permeabilityAtPos(const GlobalPosition& globalPos) const
66 {
67
4/4
✓ Branch 0 taken 398052 times.
✓ Branch 1 taken 4564548 times.
✓ Branch 2 taken 398052 times.
✓ Branch 3 taken 4564548 times.
9925200 if (isInLens_(globalPos))
68 796104 return lensK_;
69 9129096 return outerK_;
70 }
71
72 /*!
73 * \brief Returns the temperature within the domain.
74 *
75 * \param element The finite volume element
76 * \param scv The sub-control volume
77 * \param elemSol The element solution
78 */
79 template<class ElementSolution>
80 Scalar temperature(const Element& element,
81 const SubControlVolume& scv,
82 const ElementSolution& elemSol) const
83 { return 273.15 + 10; }; // -> 10°C
84
85 /*!
86 * \brief Returns the porosity [] at a given location
87 *
88 * \param globalPos The global position where we evaluate
89 */
90 4962600 Scalar porosityAtPos(const GlobalPosition& globalPos) const
91 {
92
2/2
✓ Branch 0 taken 398052 times.
✓ Branch 1 taken 4564548 times.
4962600 if (isInLens_(globalPos))
93 398052 return 0.2;
94 return 0.4;
95 }
96
97 /*!
98 * \brief Returns the fluid-matrix interaction law at a given location
99 *
100 * \param globalPos The global coordinates for the given location
101 */
102 9925202 auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const
103 {
104
5/8
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 398052 times.
✓ Branch 5 taken 4564548 times.
✓ Branch 6 taken 398052 times.
✓ Branch 7 taken 4564548 times.
9925202 if (isInLens_(globalPos))
105 796104 return makeFluidMatrixInteraction(lensPcKrSwCurve_);
106 else
107 9129098 return makeFluidMatrixInteraction(outerPcKrSwCurve_);
108 }
109
110 private:
111 24813002 bool isInLens_(const GlobalPosition &globalPos) const
112 {
113
11/14
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5623164 times.
✓ Branch 5 taken 398052 times.
✓ Branch 6 taken 5623164 times.
✓ Branch 7 taken 398052 times.
✓ Branch 8 taken 5623164 times.
✓ Branch 9 taken 398052 times.
✓ Branch 10 taken 5623164 times.
✓ Branch 11 taken 398052 times.
✓ Branch 12 taken 5623164 times.
✓ Branch 13 taken 398052 times.
30106082 for (int i = 0; i < dimWorld; ++i)
114
22/28
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 4167432 times.
✓ Branch 9 taken 1455732 times.
✓ Branch 10 taken 1058616 times.
✓ Branch 11 taken 3108816 times.
✓ Branch 12 taken 4167432 times.
✓ Branch 13 taken 1455732 times.
✓ Branch 14 taken 1058616 times.
✓ Branch 15 taken 3108816 times.
✓ Branch 16 taken 4167432 times.
✓ Branch 17 taken 1455732 times.
✓ Branch 18 taken 1058616 times.
✓ Branch 19 taken 3108816 times.
✓ Branch 20 taken 4167432 times.
✓ Branch 21 taken 1455732 times.
✓ Branch 22 taken 1058616 times.
✓ Branch 23 taken 3108816 times.
✓ Branch 24 taken 4167432 times.
✓ Branch 25 taken 1455732 times.
✓ Branch 26 taken 1058616 times.
✓ Branch 27 taken 3108816 times.
28115822 if (globalPos[i] < lensLowerLeft_[i] - eps_ || globalPos[i] > lensUpperRight_[i] + eps_)
115 return false;
116
117 return true;
118 }
119
120 static constexpr Scalar eps_ = 1.5e-7;
121
122 GlobalPosition lensLowerLeft_;
123 GlobalPosition lensUpperRight_;
124
125 Scalar lensK_;
126 Scalar outerK_;
127
128 const PcKrSwCurve lensPcKrSwCurve_;
129 const PcKrSwCurve outerPcKrSwCurve_;
130 };
131
132 } // end namespace Dumux
133
134 #endif
135