GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/test/porousmediumflow/2p/boxdfm/spatialparams.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 22 22 100.0%
Functions: 15 15 100.0%
Branches: 34 42 81.0%

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 TwoPTests
10 * \brief The spatial params for the incompressible 2p test.
11 */
12
13 #ifndef DUMUX_INCOMPRESSIBLE_TWOPBOXDFM_TEST_SPATIAL_PARAMS_HH
14 #define DUMUX_INCOMPRESSIBLE_TWOPBOXDFM_TEST_SPATIAL_PARAMS_HH
15
16 #include <dumux/discretization/method.hh>
17
18 #include <dumux/porousmediumflow/fvspatialparamsmp.hh>
19 #include <dumux/material/fluidmatrixinteractions/2p/brookscorey.hh>
20
21 #include <dumux/porousmediumflow/2p/boxmaterialinterfaces.hh>
22
23 namespace Dumux {
24
25 /*!
26 * \ingroup TwoPTests
27 * \brief The spatial params for the incompressible 2p test.
28 */
29 template<class GridGeometry, class Scalar>
30 class TwoPTestSpatialParams
31 : public FVPorousMediumFlowSpatialParamsMP< GridGeometry, Scalar, TwoPTestSpatialParams<GridGeometry, Scalar> >
32 {
33 using ThisType = TwoPTestSpatialParams<GridGeometry, Scalar>;
34 using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, ThisType>;
35
36 using GridView = typename GridGeometry::GridView;
37 using Element = typename GridView::template Codim<0>::Entity;
38 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
39
40 using FVElementGeometry = typename GridGeometry::LocalView;
41 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
42
43 static constexpr int dimWorld = GridView::dimensionworld;
44
45 using PcKrSw = FluidMatrix::BrooksCoreyDefault<Scalar>;
46 using MaterialInterfaces = BoxMaterialInterfaces<GridGeometry, PcKrSw>;
47 public:
48 using PermeabilityType = Scalar;
49
50 6 TwoPTestSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
51 : ParentType(gridGeometry)
52
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 , pcKrSwMatrix_("SpatialParams.Matrix")
53
4/8
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 6 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 6 times.
✗ Branch 12 not taken.
24 , pcKrSwFracture_("SpatialParams.Fracture")
54 6 {}
55
56 /*!
57 * \brief Returns how much the domain is extruded at a given sub-control volume.
58 * Here, we extrude the fracture scvs by half the aperture
59 */
60 template<class ElementSolution>
61 29212096 Scalar extrusionFactor(const Element& element,
62 const SubControlVolume& scv,
63 const ElementSolution& elemSol) const
64 {
65 // In the box-scheme, we compute fluxes etc element-wise,
66 // thus per element we compute only half a fracture !!!
67
4/6
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 29212090 times.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 6 times.
✗ Branch 7 not taken.
29212096 static const Scalar aHalf = getParam<Scalar>("SpatialParams.FractureAperture")/2.0;
68
2/2
✓ Branch 0 taken 1871952 times.
✓ Branch 1 taken 27340144 times.
29212096 if (scv.isOnFracture())
69 1871952 return aHalf;
70 return 1.0;
71 }
72
73 /*!
74 * \brief Function for defining the (intrinsic) permeability \f$[m^2]\f$.
75 * In this test, we use element-wise distributed permeabilities.
76 *
77 * \param element The current element
78 * \param scv The sub-control volume inside the element.
79 * \param elemSol The solution at the dofs connected to the element.
80 * \return The permeability
81 */
82 template<class ElementSolution>
83 29212096 PermeabilityType permeability(const Element& element,
84 const SubControlVolume& scv,
85 const ElementSolution& elemSol) const
86 {
87
2/2
✓ Branch 0 taken 27340144 times.
✓ Branch 1 taken 1871952 times.
29212096 if (scv.isOnFracture())
88 return 5e-10;
89 else
90 27340144 return 1e-12;
91 }
92
93
94 /*!
95 * \brief Returns the porosity \f$[-]\f$
96 *
97 * \param element The current element
98 * \param scv The sub-control volume inside the element.
99 * \param elemSol The solution at the dofs connected to the element.
100 * \return The porosity
101 */
102 template<class ElementSolution>
103 29212096 Scalar porosity(const Element& element,
104 const SubControlVolume& scv,
105 const ElementSolution& elemSol) const
106 {
107
2/2
✓ Branch 0 taken 27340144 times.
✓ Branch 1 taken 1871952 times.
29212096 if (scv.isOnFracture())
108 return 0.6;
109 else
110 27340144 return 0.15;
111 }
112
113 /*!
114 * \brief Returns the fluid-matrix interaction law.
115 *
116 * In this test, we use element-wise distributed material parameters.
117 *
118 * \param element The current element
119 * \param scv The sub-control volume inside the element.
120 * \param elemSol The solution at the dofs connected to the element.
121 */
122 template<class ElementSolution>
123
8/8
✓ Branch 0 taken 1871952 times.
✓ Branch 1 taken 2956806 times.
✓ Branch 2 taken 1871952 times.
✓ Branch 3 taken 27340144 times.
✓ Branch 4 taken 1871952 times.
✓ Branch 5 taken 27340144 times.
✓ Branch 6 taken 2192 times.
✓ Branch 7 taken 31552 times.
63286694 auto fluidMatrixInteraction(const Element& element,
124 const SubControlVolume& scv,
125 const ElementSolution& elemSol) const
126 {
127
8/8
✓ Branch 0 taken 1871952 times.
✓ Branch 1 taken 2956806 times.
✓ Branch 2 taken 1871952 times.
✓ Branch 3 taken 27340144 times.
✓ Branch 4 taken 1871952 times.
✓ Branch 5 taken 27340144 times.
✓ Branch 6 taken 2192 times.
✓ Branch 7 taken 31552 times.
63286694 if (scv.isOnFracture())
128 5618048 return makeFluidMatrixInteraction(pcKrSwFracture_);
129 else
130 57668646 return makeFluidMatrixInteraction(pcKrSwMatrix_);
131 }
132
133 /*!
134 * \brief Function for defining which phase is to be considered as the wetting phase.
135 *
136 * \param globalPos The global position
137 * \return The wetting phase index
138 */
139 template<class FluidSystem>
140 int wettingPhaseAtPos(const GlobalPosition& globalPos) const
141 { return FluidSystem::phase0Idx; }
142
143 //! Updates the map of which material parameters are associated with a nodal dof.
144 template<class SolutionVector>
145 6 void updateMaterialInterfaces(const SolutionVector& x)
146
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
6 { materialInterfaces_ = std::make_unique<MaterialInterfaces>(this->gridGeometry(), *this, x); }
147
148 //! Returns the material parameters associated with a nodal dof
149 29212096 const MaterialInterfaces& materialInterfaces() const
150
2/2
✓ Branch 0 taken 4828758 times.
✓ Branch 1 taken 24383338 times.
29212096 { return *materialInterfaces_; }
151
152 private:
153 PcKrSw pcKrSwMatrix_;
154 PcKrSw pcKrSwFracture_;
155
156 std::unique_ptr<MaterialInterfaces> materialInterfaces_;
157
158 static constexpr Scalar eps_ = 1.5e-7;
159 };
160
161 } // end namespace Dumux
162
163 #endif
164