version 3.10-dev
freeflow/spatialparams.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_FREEFLOW_SPATIAL_PARAMS_HH
13#define DUMUX_FREEFLOW_SPATIAL_PARAMS_HH
14
16
17namespace Dumux {
18
19#ifndef DOXYGEN
20namespace Detail::BrinkmanSpatialParams {
21
22template<class GlobalPosition>
23struct hasInversePermeabilityAtPos
24{
25 template<class SpatialParams>
26 auto operator()(const SpatialParams& a)
27 -> decltype(a.inversePermeabilityAtPos(std::declval<GlobalPosition>()))
28 {}
29};
30
31template<class GlobalPosition>
32struct hasBrinkmanEpsilonAtPos
33{
34 template<class SpatialParams>
35 auto operator()(const SpatialParams& a)
36 -> decltype(a.brinkmanEpsilonAtPos(std::declval<GlobalPosition>()))
37 {}
38};
39
40} // end namespace Detail
41#endif
42
47template<class GridGeometry, class Scalar, class Implementation>
49: public FVSpatialParams<GridGeometry, Scalar, Implementation>
50{
52
53public:
54 FreeFlowSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
56 {}
57};
58
63template<class GridGeometry, class Scalar, class Implementation>
65: public FreeFlowSpatialParams<GridGeometry, Scalar, Implementation>
66{
68 using GridView = typename GridGeometry::GridView;
69 using Element = typename GridView::template Codim<0>::Entity;
70 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
71 using FVElementGeometry = typename GridGeometry::LocalView;
72 using SubControlVolume = typename GridGeometry::SubControlVolume;
73
74public:
75 BrinkmanSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
77 {}
78
79 decltype(auto) inversePermeability(const Element& element,
80 const FVElementGeometry& fvGeometry,
81 const SubControlVolume& scv) const
82 {
83 static_assert(decltype(isValid(Detail::BrinkmanSpatialParams::hasInversePermeabilityAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
84 " Your spatial params class has to either implement\n\n"
85 " const PermeabilityType& inversePermeabilityAtPos(const GlobalPosition& globalPos) const\n\n"
86 " or overload this function\n\n"
87 " const PermeabilityType& inversePermeability(const Element& element,\n"
88 " const FVElementGeometry& fvGeometry,\n"
89 " const SubControlVolume& scv) const\n"
90 " This can be done simply with the invert() function of the DimMatrix type (e.g. permeability.invert()). \n\n");
91 return this->asImp_().inversePermeabilityAtPos(scv.dofPosition());
92 }
93
94 Scalar brinkmanEpsilon(const Element& element,
95 const FVElementGeometry& fvGeometry,
96 const SubControlVolume& scv) const
97 {
98 static_assert(decltype(isValid(Detail::BrinkmanSpatialParams::hasBrinkmanEpsilonAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
99 " Your spatial params class has to either implement\n\n"
100 " const Scalar& brinkmanEpsilonAtPos(const GlobalPosition& globalPos) const\n\n"
101 " or overload this function\n\n"
102 " const Scalar& brinkmanEpsilon(const Element& element,\n"
103 " const FVElementGeometry& fvGeometry,\n"
104 " const SubControlVolume& scv) const\n\n");
105 return this->asImp_().brinkmanEpsilonAtPos(scv.dofPosition());
106 }
107
108};
109
114template<class GridGeometry, class Scalar>
116: public FreeFlowSpatialParams<GridGeometry, Scalar, FreeFlowDefaultSpatialParams<GridGeometry, Scalar>>
117{
119public:
121};
122
123} // end namespace Dumux
124
125#endif
Definition of the spatial parameters for the darcy-brinkman problems.
Definition: freeflow/spatialparams.hh:66
decltype(auto) inversePermeability(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolume &scv) const
Definition: freeflow/spatialparams.hh:79
Scalar brinkmanEpsilon(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolume &scv) const
Definition: freeflow/spatialparams.hh:94
BrinkmanSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: freeflow/spatialparams.hh:75
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
Definition of the spatial parameters for the freeflow problems.
Definition: freeflow/spatialparams.hh:117
Definition of the spatial parameters for the freeflow problems.
Definition: freeflow/spatialparams.hh:50
FreeFlowSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: freeflow/spatialparams.hh:54
Basic spatial parameters to be used with finite-volume schemes.
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
Definition: adapt.hh:17