3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_POROUS_MEDIUM_FLOW_FV_SPATIAL_PARAMS_HH
25#define DUMUX_POROUS_MEDIUM_FLOW_FV_SPATIAL_PARAMS_HH
26
27#include <dune/common/exceptions.hh>
28#include <dune/common/fmatrix.hh>
29
31#include <dumux/common/math.hh>
34
35namespace Dumux {
36
37#ifndef DOXYGEN
38namespace Detail {
39// helper struct detecting if the user-defined spatial params class has a permeabilityAtPos function
40template<class GlobalPosition>
41struct hasPermeabilityAtPos
42{
43 template<class SpatialParams>
44 auto operator()(const SpatialParams& a)
45 -> decltype(a.permeabilityAtPos(std::declval<GlobalPosition>()))
46 {}
47};
48} // end namespace Detail
49#endif
50
55template<class GridGeometry, class Scalar, class Implementation>
57: public FVPorousMediumSpatialParams<GridGeometry, Scalar, Implementation>
58{
60 using GridView = typename GridGeometry::GridView;
61 using FVElementGeometry = typename GridGeometry::LocalView;
62 using SubControlVolume = typename GridGeometry::SubControlVolume;
63 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
64 using Element = typename GridView::template Codim<0>::Entity;
65
66 enum { dim = GridView::dimension };
67 enum { dimWorld = GridView::dimensionworld };
68 using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
69
70 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
71
72public:
73 FVPorousMediumFlowSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
75 {
76 /* \brief default forchheimer coefficient
77 * Source: Ward, J.C. 1964 Turbulent flow in porous media. ASCE J. Hydraul. Div 90 \cite ward1964 .
78 * Actually the Forchheimer coefficient is also a function of the dimensions of the
79 * porous medium. Taking it as a constant is only a first approximation
80 * (Nield, Bejan, Convection in porous media, 2006, p. 10 \cite nield2006 )
81 */
82 forchCoeffDefault_ = getParam<Scalar>("SpatialParams.ForchCoeff", 0.55);
83 }
84
94 template<class ElementSolution>
95 decltype(auto) permeability(const Element& element,
96 const SubControlVolume& scv,
97 const ElementSolution& elemSol) const
98 {
99 static_assert(decltype(isValid(Detail::hasPermeabilityAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
100 " Your spatial params class has to either implement\n\n"
101 " const PermeabilityType& permeabilityAtPos(const GlobalPosition& globalPos) const\n\n"
102 " or overload this function\n\n"
103 " template<class ElementSolution>\n"
104 " const PermeabilityType& permeability(const Element& element,\n"
105 " const SubControlVolume& scv,\n"
106 " const ElementSolution& elemSol) const\n\n");
107
108 return this->asImp_().permeabilityAtPos(scv.center());
109 }
110
116 static constexpr bool evaluatePermeabilityAtScvfIP()
117 { return false; }
118
126 Scalar beaversJosephCoeffAtPos(const GlobalPosition& globalPos) const
127 {
128 DUNE_THROW(Dune::InvalidStateException,
129 "The spatial parameters do not provide a beaversJosephCoeffAtPos() method.");
130 }
131
138 Scalar forchCoeff(const SubControlVolumeFace &scvf) const
139 {
140 return forchCoeffDefault_;
141 }
142
143private:
144 Scalar forchCoeffDefault_;
145};
146
147} // namespace Dumux
148
149#endif
A helper function for class member function introspection.
The base class for spatial parameters in porous medium problems.
Define some often used mathematical functions.
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
constexpr auto isValid(const Expression &t)
A function that creates a test functor to do class member introspection at compile time.
Definition: isvalid.hh:93
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
The base class for spatial parameters of porous-medium problems.
Definition: fvporousmediumspatialparams.hh:63
The base class for spatial parameters used with finite-volume schemes.
Definition: common/fvspatialparams.hh:46
Implementation & asImp_()
Returns the implementation of the spatial parameters (static polymorphism)
Definition: common/fvspatialparams.hh:147
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvspatialparams.hh:142
The base class for spatial parameters of porous-medium-flow problems.
Definition: porousmediumflow/fvspatialparams.hh:58
decltype(auto) permeability(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Function for defining the (intrinsic) permeability .
Definition: porousmediumflow/fvspatialparams.hh:95
static constexpr bool evaluatePermeabilityAtScvfIP()
If the permeability should be evaluated directly at the scvf integration point (for convergence tests...
Definition: porousmediumflow/fvspatialparams.hh:116
FVPorousMediumFlowSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: porousmediumflow/fvspatialparams.hh:73
Scalar beaversJosephCoeffAtPos(const GlobalPosition &globalPos) const
Function for defining the Beavers-Joseph coefficient for multidomain problems .
Definition: porousmediumflow/fvspatialparams.hh:126
Scalar forchCoeff(const SubControlVolumeFace &scvf) const
Apply the Forchheimer coefficient for inertial forces calculation.
Definition: porousmediumflow/fvspatialparams.hh:138