GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/porousmediumflow/fvspatialparamsmp.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 6 8 75.0%
Functions: 86 218 39.4%
Branches: 42 53 79.2%

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 SpatialParameters
10 * \brief The base class for spatial parameters in multi-phase porous-medium-flow problems.
11 */
12 #ifndef DUMUX_POROUS_MEDIUM_FLOW_FV_SPATIAL_PARAMS_MP_HH
13 #define DUMUX_POROUS_MEDIUM_FLOW_FV_SPATIAL_PARAMS_MP_HH
14
15 #include <dune/common/exceptions.hh>
16 #include <dune/common/fmatrix.hh>
17
18 #include <dumux/common/parameters.hh>
19 #include <dumux/common/math.hh>
20 #include <dumux/common/fvspatialparams.hh>
21 #include <dumux/common/typetraits/isvalid.hh>
22
23 #include "fvspatialparams.hh"
24
25 namespace Dumux {
26
27 #ifndef DOXYGEN
28 namespace Detail {
29 // helper struct detecting if the user-defined spatial params class
30 // has a fluidMatrixInteractionAtPos function
31 template<class GlobalPosition>
32 struct hasFluidMatrixInteractionAtPos
33 {
34 template<class SpatialParams>
35 auto operator()(const SpatialParams& a)
36 -> decltype(a.fluidMatrixInteractionAtPos(std::declval<GlobalPosition>()))
37 {}
38 };
39 } // end namespace Detail
40 #endif
41
42 /*!
43 * \ingroup SpatialParameters
44 * \brief The base class for spatial parameters of multi-phase problems
45 */
46 template<class GridGeometry, class Scalar, class Implementation>
47
1/8
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 107 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
107 class FVPorousMediumFlowSpatialParamsMP
48 : public FVPorousMediumFlowSpatialParams<GridGeometry, Scalar, Implementation>
49 {
50 using ParentType = FVPorousMediumFlowSpatialParams<GridGeometry, Scalar, Implementation>;
51 using GridView = typename GridGeometry::GridView;
52 using FVElementGeometry = typename GridGeometry::LocalView;
53 using SubControlVolume = typename GridGeometry::SubControlVolume;
54 using Element = typename GridView::template Codim<0>::Entity;
55
56 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
57
58 public:
59 152 FVPorousMediumFlowSpatialParamsMP(std::shared_ptr<const GridGeometry> gridGeometry)
60
2/6
✓ Branch 2 taken 150 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 150 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
152 : ParentType(gridGeometry)
61 152 {}
62
63 /*!
64 * \brief Function for defining the parameters needed by constitutive relationships (kr-sw, pc-sw, etc.).
65 *
66 * \param element The current element
67 * \param scv The sub-control volume inside the element.
68 * \param elemSol The solution at the dofs connected to the element.
69 */
70 template<class ElementSolution>
71 decltype(auto) fluidMatrixInteraction(const Element& element,
72 const SubControlVolume& scv,
73 const ElementSolution& elemSol) const
74 {
75 static_assert(decltype(isValid(Detail::hasFluidMatrixInteractionAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
76 " Your spatial params class has to either implement\n\n"
77 " auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const\n\n"
78 " or overload this function\n\n"
79 " template<class ElementSolution>\n"
80 " auto fluidMatrixInteraction(const Element& element,\n"
81 " const SubControlVolume& scv,\n"
82 " const ElementSolution& elemSol) const\n\n");
83
84
27/27
✓ Branch 0 taken 13439172 times.
✓ Branch 1 taken 99912807 times.
✓ Branch 2 taken 17820349 times.
✓ Branch 3 taken 99858765 times.
✓ Branch 4 taken 12647595 times.
✓ Branch 5 taken 98789697 times.
✓ Branch 6 taken 1409170 times.
✓ Branch 7 taken 8918795 times.
✓ Branch 8 taken 1409170 times.
✓ Branch 9 taken 22654039 times.
✓ Branch 10 taken 1606710 times.
✓ Branch 11 taken 21983340 times.
✓ Branch 12 taken 1483589 times.
✓ Branch 13 taken 14800917 times.
✓ Branch 14 taken 1483589 times.
✓ Branch 15 taken 14817484 times.
✓ Branch 16 taken 2115622 times.
✓ Branch 17 taken 14817484 times.
✓ Branch 18 taken 2115622 times.
✓ Branch 19 taken 14817484 times.
✓ Branch 20 taken 2115622 times.
✓ Branch 24 taken 3014525 times.
✓ Branch 25 taken 30537881 times.
✓ Branch 26 taken 3014525 times.
✓ Branch 27 taken 30537881 times.
✓ Branch 28 taken 3014525 times.
✓ Branch 29 taken 30537881 times.
1242134175 return this->asImp_().fluidMatrixInteractionAtPos(scv.center());
85 }
86
87 /*!
88 * \brief Function for defining which phase is to be considered as the wetting phase.
89 *
90 * \param element The current element
91 * \param scv The sub-control volume inside the element.
92 * \param elemSol The solution at the dofs connected to the element.
93 * \return the wetting phase index
94 */
95 template<class FluidSystem, class ElementSolution>
96 int wettingPhase(const Element& element,
97 const SubControlVolume& scv,
98 const ElementSolution& elemSol) const
99 {
100
12/12
✓ Branch 0 taken 12274386 times.
✓ Branch 1 taken 100826340 times.
✓ Branch 2 taken 12183592 times.
✓ Branch 3 taken 87525787 times.
✓ Branch 4 taken 11026701 times.
✓ Branch 5 taken 62628353 times.
✓ Branch 6 taken 825160 times.
✓ Branch 7 taken 401327 times.
✓ Branch 8 taken 233592 times.
✓ Branch 9 taken 135664 times.
✓ Branch 10 taken 233592 times.
✓ Branch 11 taken 135664 times.
432074446 return this->asImp_().template wettingPhaseAtPos<FluidSystem>(scv.center());
101 }
102
103 /*!
104 * \brief Function for defining which phase is to be considered as the wetting phase.
105 *
106 * \return the wetting phase index
107 * \param globalPos The global position
108 */
109 template<class FluidSystem>
110 int wettingPhaseAtPos(const GlobalPosition& globalPos) const
111 {
112 DUNE_THROW(Dune::InvalidStateException,
113 "The spatial parameters do not provide "
114 "a wettingPhaseAtPos() method.");
115 }
116 };
117
118 } // namespace Dumux
119
120 #endif
121