GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/test/porousmediumflow/mpnc/obstacle/spatialparams.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 21 21 100.0%
Functions: 2 2 100.0%
Branches: 16 22 72.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 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/2
✓ Branch 0 taken 2 times.
✗ Branch 1 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
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 , pcKrSwCurve_("SpatialParams") // initialize the material law
54 2 , coarseK_(1e-12) // intrinsic permeability
55 2 , fineK_(1e-15) // intrinsic permeability
56 2 , porosity_(0.3)
57
3/6
✓ 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.
6 , temperature_(getParam<Scalar>("SpatialParams.Temperature"))
58 2 {}
59
60 template<class ElementSolution>
61
2/2
✓ Branch 0 taken 496476 times.
✓ Branch 1 taken 88572 times.
585048 PermeabilityType permeability(const Element& element,
62 const SubControlVolume& scv,
63 const ElementSolution& elemSol) const
64 {
65 1170096 if (isFineMaterial_(scv.dofPosition()))
66 103300 return fineK_;
67 else
68 481748 return coarseK_;
69 }
70
71 /*!
72 * \brief Defines the porosity \f$[-]\f$ of the soil
73 *
74 * \param globalPos The global position
75 */
76 585048 Scalar porosityAtPos(const GlobalPosition& globalPos) const
77 585048 { return porosity_; }
78
79 /*!
80 * \brief Defines the temperature \f$[K]\f$ at the given position
81 * \param globalPos The global position
82 */
83 586991 Scalar temperatureAtPos(const GlobalPosition& globalPos) const
84 586991 { return temperature_; }
85
86 /*!
87 * \brief Returns the fluid-matrix interaction law at a given location
88 */
89 1172039 auto fluidMatrixInteractionAtPos(const GlobalPosition &globalPos) const
90 {
91 1172039 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
2/2
✓ Branch 0 taken 496476 times.
✓ Branch 1 taken 88572 times.
585048 static bool isFineMaterial_(const GlobalPosition &pos)
112 {
113 return
114
2/2
✓ Branch 0 taken 381636 times.
✓ Branch 1 taken 114840 times.
496476 10 - eps_ <= pos[0] && pos[0] <= 20 + eps_ &&
115
5/6
✓ Branch 0 taken 496476 times.
✓ Branch 1 taken 88572 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 114840 times.
✓ Branch 4 taken 11540 times.
✓ Branch 5 taken 103300 times.
699888 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