version 3.8
porousmediumflow/fvspatialparams.hh
Go to the documentation of this file.
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//
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
19#include <dumux/common/math.hh>
22
23namespace Dumux {
24
25#ifndef DOXYGEN
26namespace Detail {
27// helper struct detecting if the user-defined spatial params class has a permeabilityAtPos function
28template<class GlobalPosition>
29struct 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
43template<class GridGeometry, class Scalar, class Implementation>
45: public FVPorousMediumSpatialParams<GridGeometry, Scalar, Implementation>
46{
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
60public:
61 FVPorousMediumFlowSpatialParams(std::shared_ptr<const GridGeometry> 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 forchCoeffDefault_ = getParam<Scalar>("SpatialParams.ForchCoeff", 0.55);
71 }
72
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 return this->asImp_().permeabilityAtPos(scv.center());
97 }
98
104 static constexpr bool evaluatePermeabilityAtScvfIP()
105 { return false; }
106
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
126 Scalar forchCoeff(const SubControlVolumeFace &scvf) const
127 {
128 return forchCoeffDefault_;
129 }
130
131private:
132 Scalar forchCoeffDefault_;
133};
134
135} // namespace Dumux
136
137#endif
The base class for spatial parameters of porous-medium-flow problems.
Definition: porousmediumflow/fvspatialparams.hh:46
decltype(auto) permeability(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Function for defining the (intrinsic) permeability .
Definition: porousmediumflow/fvspatialparams.hh:83
static constexpr bool evaluatePermeabilityAtScvfIP()
If the permeability should be evaluated directly at the scvf integration point (for convergence tests...
Definition: porousmediumflow/fvspatialparams.hh:104
FVPorousMediumFlowSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: porousmediumflow/fvspatialparams.hh:61
Scalar beaversJosephCoeffAtPos(const GlobalPosition &globalPos) const
Function for defining the Beavers-Joseph coefficient for multidomain problems .
Definition: porousmediumflow/fvspatialparams.hh:114
Scalar forchCoeff(const SubControlVolumeFace &scvf) const
Apply the Forchheimer coefficient for inertial forces calculation.
Definition: porousmediumflow/fvspatialparams.hh:126
The base class for spatial parameters of porous-medium problems.
Definition: fvporousmediumspatialparams.hh:51
The base class for spatial parameters used with finite-volume schemes.
Definition: common/fvspatialparams.hh:34
Implementation & asImp_()
Returns the implementation of the spatial parameters (static polymorphism)
Definition: common/fvspatialparams.hh:135
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvspatialparams.hh:130
The base class for spatial parameters in porous medium problems.
constexpr auto isValid(const Expression &t)
A function that creates a test functor to do class member introspection at compile time.
Definition: isvalid.hh:81
A helper function for class member function introspection.
Define some often used mathematical functions.
Definition: adapt.hh:17
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.