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 porous-medium-flow problems. | ||
11 | */ | ||
12 | #ifndef DUMUX_POROUS_MEDIUM_FLOW_FV_SPATIAL_PARAMS_HH | ||
13 | #define DUMUX_POROUS_MEDIUM_FLOW_FV_SPATIAL_PARAMS_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/fvporousmediumspatialparams.hh> | ||
21 | #include <dumux/common/typetraits/isvalid.hh> | ||
22 | |||
23 | namespace Dumux { | ||
24 | |||
25 | #ifndef DOXYGEN | ||
26 | namespace Detail { | ||
27 | // helper struct detecting if the user-defined spatial params class has a permeabilityAtPos function | ||
28 | template<class GlobalPosition> | ||
29 | struct hasPermeabilityAtPos | ||
30 | { | ||
31 | template<class SpatialParams> | ||
32 | auto operator()(const SpatialParams& a) | ||
33 | -> decltype(a.permeabilityAtPos(std::declval<GlobalPosition>())) | ||
34 | {} | ||
35 | }; | ||
36 | } // end namespace Detail | ||
37 | #endif | ||
38 | |||
39 | /*! | ||
40 | * \ingroup SpatialParameters | ||
41 | * \brief The base class for spatial parameters of porous-medium-flow problems. | ||
42 | */ | ||
43 | template<class GridGeometry, class Scalar, class Implementation> | ||
44 |
6/24✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 292 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 75 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 75 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 2 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 2 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
|
448 | class FVPorousMediumFlowSpatialParams |
45 | : public FVPorousMediumSpatialParams<GridGeometry, Scalar, Implementation> | ||
46 | { | ||
47 | using ParentType = FVPorousMediumSpatialParams<GridGeometry, Scalar, Implementation>; | ||
48 | using GridView = typename GridGeometry::GridView; | ||
49 | using FVElementGeometry = typename GridGeometry::LocalView; | ||
50 | using SubControlVolume = typename GridGeometry::SubControlVolume; | ||
51 | using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace; | ||
52 | using Element = typename GridView::template Codim<0>::Entity; | ||
53 | |||
54 | enum { dim = GridView::dimension }; | ||
55 | enum { dimWorld = GridView::dimensionworld }; | ||
56 | using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>; | ||
57 | |||
58 | using GlobalPosition = typename Element::Geometry::GlobalCoordinate; | ||
59 | |||
60 | public: | ||
61 | 707 | FVPorousMediumFlowSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry) | |
62 |
3/9✓ Branch 2 taken 526 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 526 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
708 | : ParentType(gridGeometry) |
63 | { | ||
64 | /* \brief default forchheimer coefficient | ||
65 | * Source: Ward, J.C. 1964 Turbulent flow in porous media. ASCE J. Hydraul. Div 90 \cite ward1964 . | ||
66 | * Actually the Forchheimer coefficient is also a function of the dimensions of the | ||
67 | * porous medium. Taking it as a constant is only a first approximation | ||
68 | * (Nield, Bejan, Convection in porous media, 2006, p. 10 \cite nield2006 ) | ||
69 | */ | ||
70 |
1/4✓ Branch 1 taken 526 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
707 | forchCoeffDefault_ = getParam<Scalar>("SpatialParams.ForchCoeff", 0.55); |
71 | 707 | } | |
72 | |||
73 | /*! | ||
74 | * \brief Function for defining the (intrinsic) permeability \f$[m^2]\f$ | ||
75 | * \note It is possibly solution dependent. | ||
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 permeability | ||
81 | */ | ||
82 | template<class ElementSolution> | ||
83 | ✗ | decltype(auto) permeability(const Element& element, | |
84 | const SubControlVolume& scv, | ||
85 | const ElementSolution& elemSol) const | ||
86 | { | ||
87 | static_assert(decltype(isValid(Detail::hasPermeabilityAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n" | ||
88 | " Your spatial params class has to either implement\n\n" | ||
89 | " const PermeabilityType& permeabilityAtPos(const GlobalPosition& globalPos) const\n\n" | ||
90 | " or overload this function\n\n" | ||
91 | " template<class ElementSolution>\n" | ||
92 | " const PermeabilityType& permeability(const Element& element,\n" | ||
93 | " const SubControlVolume& scv,\n" | ||
94 | " const ElementSolution& elemSol) const\n\n"); | ||
95 | |||
96 |
27/40✓ Branch 0 taken 6101619 times.
✓ Branch 1 taken 7465628 times.
✓ Branch 2 taken 6101632 times.
✓ Branch 3 taken 7443831 times.
✓ Branch 4 taken 24737 times.
✓ Branch 5 taken 1698 times.
✓ Branch 6 taken 2964 times.
✓ Branch 7 taken 152 times.
✓ Branch 8 taken 2879 times.
✓ Branch 9 taken 5670 times.
✓ Branch 10 taken 1778 times.
✓ Branch 11 taken 6126 times.
✓ Branch 12 taken 528 times.
✓ Branch 13 taken 6166 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 6166 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 5557 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 12 times.
✓ Branch 20 taken 5029 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 12 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 477999 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 477999 times.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✓ Branch 31 taken 1170 times.
✗ Branch 32 not taken.
✓ Branch 33 taken 1194 times.
✗ Branch 34 not taken.
✓ Branch 35 taken 3408 times.
✗ Branch 36 not taken.
✓ Branch 37 taken 528 times.
✓ Branch 38 taken 3384 times.
✗ Branch 39 not taken.
✓ Branch 40 taken 528 times.
✗ Branch 41 not taken.
|
226835381 | return this->asImp_().permeabilityAtPos(scv.center()); |
97 | } | ||
98 | |||
99 | /*! | ||
100 | * \brief If the permeability should be evaluated directly at the scvf integration point | ||
101 | * (for convergence tests with analytical and continuous perm functions) or is evaluated | ||
102 | * at the scvs (for permeability fields with discontinuities) -> default | ||
103 | */ | ||
104 | static constexpr bool evaluatePermeabilityAtScvfIP() | ||
105 | { return false; } | ||
106 | |||
107 | /*! | ||
108 | * \brief Function for defining the Beavers-Joseph coefficient for multidomain | ||
109 | * problems\f$\mathrm{[-]}\f$. | ||
110 | * | ||
111 | * \return Beavers-Joseph coefficient \f$\mathrm{[-]}\f$ | ||
112 | * \param globalPos The global position | ||
113 | */ | ||
114 | Scalar beaversJosephCoeffAtPos(const GlobalPosition& globalPos) const | ||
115 | { | ||
116 | DUNE_THROW(Dune::InvalidStateException, | ||
117 | "The spatial parameters do not provide a beaversJosephCoeffAtPos() method."); | ||
118 | } | ||
119 | |||
120 | /*! | ||
121 | * \brief Apply the Forchheimer coefficient for inertial forces | ||
122 | * calculation. | ||
123 | * \param scvf The sub-control volume face where the | ||
124 | * intrinsic velocity ought to be calculated. | ||
125 | */ | ||
126 | ✗ | Scalar forchCoeff(const SubControlVolumeFace &scvf) const | |
127 | { | ||
128 | ✗ | return forchCoeffDefault_; | |
129 | } | ||
130 | |||
131 | private: | ||
132 | Scalar forchCoeffDefault_; | ||
133 | }; | ||
134 | |||
135 | } // namespace Dumux | ||
136 | |||
137 | #endif | ||
138 |