GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/mpnc/obstacle/spatialparams.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 9 18 50.0%
Functions: 2 12 16.7%
Branches: 25 64 39.1%

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 MPNCTests
10 * \brief The spatial parameters for the ObstacleProblem.
11 */
12
13 #ifndef DUMUX_OBSTACLE_SPATIAL_PARAMS_HH
14 #define DUMUX_OBSTACLE_SPATIAL_PARAMS_HH
15
16 #include <dumux/porousmediumflow/properties.hh>
17 #include <dumux/porousmediumflow/fvspatialparamsmp.hh>
18 #include <dumux/material/fluidmatrixinteractions/fluidmatrixinteraction.hh>
19 #include <dumux/material/fluidmatrixinteractions/2p/smoothedlinearlaw.hh>
20 #include <dumux/material/fluidmatrixinteractions/mp/mpadapter.hh>
21
22 namespace Dumux {
23
24 /**
25 * \ingroup MPNCTests
26 * \brief Definition of the spatial params properties for the obstacle problem.
27 *
28 */
29 template<class GridGeometry, class Scalar>
30
1/6
✗ 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.
2 class ObstacleSpatialParams
31 : public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar,
32 ObstacleSpatialParams<GridGeometry, Scalar>>
33 {
34 using GridView = typename GridGeometry::GridView;
35 using FVElementGeometry = typename GridGeometry::LocalView;
36 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
37 using Element = typename GridView::template Codim<0>::Entity;
38 using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar,
39 ObstacleSpatialParams<GridGeometry, Scalar>>;
40
41 enum {dimWorld=GridView::dimensionworld};
42 using GlobalPosition = typename SubControlVolume::GlobalPosition;
43
44 using PcKrSwCurve = FluidMatrix::SmoothedLinearLaw<Scalar>;
45
46 public:
47 //! Export the type used for the permeability
48 using PermeabilityType = Scalar;
49
50
51 2 ObstacleSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
52 : ParentType(gridGeometry)
53 , pcKrSwCurve_("SpatialParams") // initialize the material law
54 , coarseK_(1e-12) // intrinsic permeability
55 , fineK_(1e-15) // intrinsic permeability
56 , porosity_(0.3)
57
8/22
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 2 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 2 times.
✓ Branch 18 taken 2 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 2 times.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
6 , temperature_(getParam<Scalar>("SpatialParams.Temperature"))
58 2 {}
59
60 template<class ElementSolution>
61 PermeabilityType permeability(const Element& element,
62 const SubControlVolume& scv,
63 const ElementSolution& elemSol) const
64 {
65
2/4
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 496476 times.
✓ Branch 3 taken 88572 times.
585048 if (isFineMaterial_(scv.dofPosition()))
66 103300 return fineK_;
67 else
68 return coarseK_;
69 }
70
71 /*!
72 * \brief Defines the porosity \f$[-]\f$ of the soil
73 *
74 * \param globalPos The global position
75 */
76 Scalar porosityAtPos(const GlobalPosition& globalPos) const
77 { return porosity_; }
78
79 /*!
80 * \brief Defines the temperature \f$[K]\f$ at the given position
81 * \param globalPos The global position
82 */
83 Scalar temperatureAtPos(const GlobalPosition& globalPos) const
84 { return temperature_; }
85
86 /*!
87 * \brief Returns the fluid-matrix interaction law at a given location
88 */
89 auto fluidMatrixInteractionAtPos(const GlobalPosition &globalPos) const
90 {
91 3516117 return makeFluidMatrixInteraction(FluidMatrix::MPAdapter(pcKrSwCurve_));
92 }
93
94 /*!
95 * \brief Function for defining which phase is to be considered as the wetting phase.
96 *
97 * \param globalPos The global position
98 * \return The wetting phase index
99 */
100 template<class FluidSystem>
101 int wettingPhaseAtPos(const GlobalPosition& globalPos) const
102 {
103 return FluidSystem::phase0Idx;
104 }
105
106 private:
107 /*!
108 * \brief Returns whether a given global position is in the
109 * fine-permeability region or not.
110 */
111 static bool isFineMaterial_(const GlobalPosition &pos)
112 {
113 return
114
6/12
✗ 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 taken 496476 times.
✓ Branch 7 taken 88572 times.
✓ Branch 8 taken 114840 times.
✓ Branch 9 taken 381636 times.
✓ Branch 10 taken 114840 times.
✓ Branch 11 taken 381636 times.
585048 10 - eps_ <= pos[0] && pos[0] <= 20 + eps_ &&
115
8/20
✗ 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 taken 496476 times.
✓ Branch 11 taken 88572 times.
✓ Branch 12 taken 114840 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 114840 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 103300 times.
✓ Branch 17 taken 11540 times.
✓ Branch 18 taken 103300 times.
✓ Branch 19 taken 11540 times.
814728 0 - eps_ <= pos[1] && pos[1] <= 35 + eps_;
116 }
117
118 const PcKrSwCurve pcKrSwCurve_;
119 const Scalar coarseK_;
120 const Scalar fineK_;
121 const Scalar porosity_;
122 const Scalar temperature_;
123 static constexpr Scalar eps_ = 1e-6;
124 };
125
126 } // end namespace Dumux
127
128 #endif
129