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 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/4✓ Branch 0 taken 112 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
112 | 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 | 158 | FVPorousMediumFlowSpatialParamsMP(std::shared_ptr<const GridGeometry> gridGeometry) | |
60 |
1/2✓ Branch 2 taken 156 times.
✗ Branch 3 not taken.
|
158 | : ParentType(gridGeometry) |
61 | 158 | {} | |
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 | 432201755 | 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 |
8/8✓ Branch 0 taken 13888388 times.
✓ Branch 1 taken 116840498 times.
✓ Branch 2 taken 2168762 times.
✓ Branch 3 taken 23044319 times.
✓ Branch 4 taken 3436791 times.
✓ Branch 5 taken 730859 times.
✓ Branch 6 taken 3014525 times.
✓ Branch 7 taken 30537881 times.
|
448092520 | 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 | 12491188 | int wettingPhase(const Element& element, | |
97 | const SubControlVolume& scv, | ||
98 | const ElementSolution& elemSol) const | ||
99 | { | ||
100 |
4/4✓ Branch 0 taken 13205396 times.
✓ Branch 1 taken 99310505 times.
✓ Branch 2 taken 679709 times.
✓ Branch 3 taken 57335435 times.
|
252212928 | 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 |