GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/2p/boxdfm/spatialparams.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 15 24 62.5%
Functions: 15 35 42.9%
Branches: 35 68 51.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 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 , pcKrSwMatrix_("SpatialParams.Matrix")
53
11/30
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 6 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 6 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 6 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 6 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 6 times.
✗ Branch 25 not taken.
✓ Branch 27 taken 6 times.
✗ Branch 28 not taken.
✓ Branch 29 taken 6 times.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
48 , 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 33788256 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 33788250 times.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 6 times.
✗ Branch 7 not taken.
33788256 static const Scalar aHalf = getParam<Scalar>("SpatialParams.FractureAperture")/2.0;
68
2/2
✓ Branch 0 taken 2167952 times.
✓ Branch 1 taken 31620304 times.
33788256 if (scv.isOnFracture())
69 2167952 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 PermeabilityType permeability(const Element& element,
84 const SubControlVolume& scv,
85 const ElementSolution& elemSol) const
86 {
87
2/4
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 31620304 times.
✓ Branch 3 taken 2167952 times.
33788256 if (scv.isOnFracture())
88 return 5e-10;
89 else
90 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 Scalar porosity(const Element& element,
104 const SubControlVolume& scv,
105 const ElementSolution& elemSol) const
106 {
107
2/8
✗ 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 31620304 times.
✓ Branch 7 taken 2167952 times.
33788256 if (scv.isOnFracture())
108 return 0.6;
109 else
110 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 auto fluidMatrixInteraction(const Element& element,
124 const SubControlVolume& scv,
125 const ElementSolution& elemSol) const
126 {
127
8/10
✓ Branch 0 taken 2167952 times.
✓ Branch 1 taken 3413386 times.
✓ Branch 2 taken 2167952 times.
✓ Branch 3 taken 31620304 times.
✓ Branch 4 taken 2167952 times.
✓ Branch 5 taken 31620304 times.
✓ Branch 6 taken 2192 times.
✓ Branch 7 taken 31552 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
73191594 if (scv.isOnFracture())
128 6506048 return makeFluidMatrixInteraction(pcKrSwFracture_);
129 else
130 66685546 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
2/4
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
12 { materialInterfaces_ = std::make_unique<MaterialInterfaces>(this->gridGeometry(), *this, x); }
147
148 //! Returns the material parameters associated with a nodal dof
149 const MaterialInterfaces& materialInterfaces() const
150
4/4
✓ Branch 0 taken 5581338 times.
✓ Branch 1 taken 28206918 times.
✓ Branch 2 taken 5581338 times.
✓ Branch 3 taken 28206918 times.
67576512 { 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