version 3.8
geomechanics/poroelastic/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_GEOMECHANICS_POROELASTIC_FV_SPATIAL_PARAMS_HH
13#define DUMUX_GEOMECHANICS_POROELASTIC_FV_SPATIAL_PARAMS_HH
14
15#include <memory>
16
19#include <dumux/geomechanics/spatialparamstraits_.hh>
20
21namespace Dumux {
22
23#ifndef DOXYGEN
24namespace Detail {
25
26// helper struct detecting if the user-defined problem class has an effectiveFluidDensityAtPos function
27template<class GlobalPosition>
28struct hasEffFluidDensityAtPos
29{
30 template<class Problem>
31 auto operator()(const Problem& a)
32 -> decltype(a.effectiveFluidDensityAtPos(std::declval<GlobalPosition>()))
33 {}
34};
35
36// helper struct detecting if the user-defined problem class has an effectivePorePressureAtPos function
37template<class GlobalPosition>
38struct hasEffPorePressureAtPos
39{
40 template<class Problem>
41 auto operator()(const Problem& a)
42 -> decltype(a.effectivePorePressureAtPos(std::declval<GlobalPosition>()))
43 {}
44};
45
46// helper struct detecting if the user-defined spatial params class has a reactiveVolumeFractionAtPos function
47template<class GlobalPosition, class SolidSystem>
48struct hasReactiveVolumeFractionAtPos
49{
50 template<class SpatialParams>
51 auto operator()(const SpatialParams& a)
52 -> decltype(a.template reactiveVolumeFractionAtPos<SolidSystem>(std::declval<GlobalPosition>(), 0))
53 {}
54};
55
56// helper struct detecting if the user-defined spatial params class has a biotCoefficientAtPos function
57template<class GlobalPosition>
58struct hasBiotCoeffAtPos
59{
60 template<class SpatialParams>
61 auto operator()(const SpatialParams& a)
62 -> decltype(a.biotCoefficientAtPos(std::declval<GlobalPosition>()))
63 {}
64};
65
66} // end namespace Detail
67#endif
68
73template<class GridGeometry, class Scalar, class Implementation>
75: public FVPorousMediumSpatialParams<GridGeometry, Scalar, Implementation>
76{
78 using FVElementGeometry = typename GridGeometry::LocalView;
79 using SubControlVolume = typename GridGeometry::SubControlVolume;
80 using GridView = typename GridGeometry::GridView;
81 using Element = typename GridView::template Codim<0>::Entity;
82 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
83
84public:
86 FVPoroElasticSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
88 {}
89
97 Scalar effectiveFluidDensity(const Element& element,
98 const SubControlVolume& scv) const
99 {
100 static_assert(decltype(isValid(Detail::hasEffFluidDensityAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
101 " Your problem class has to either implement\n\n"
102 " Scalar effectiveFluidDensityAtPos(const GlobalPosition& globalPos) const\n\n"
103 " or overload this function\n\n"
104 " template<class ElementSolution>\n"
105 " Scalar effectiveFluidDensity(const Element& element,\n\
106 const SubControlVolume& scv) const\n\n");
107
108 return this->asImp_().effectiveFluidDensityAtPos(scv.center());
109 }
110
124 template<class ElemVolVars, class FluxVarsCache>
125 Scalar effectivePorePressure(const Element& element,
126 const FVElementGeometry& fvGeometry,
127 const ElemVolVars& elemVolVars,
128 const FluxVarsCache& fluxVarsCache) const
129 {
130 static_assert(decltype(isValid(Detail::hasEffPorePressureAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
131 " Your problem class has to either implement\n\n"
132 " Scalar effectivePorePressureAtPos(const GlobalPosition& globalPos) const\n\n"
133 " or overload this function\n\n"
134 " template<class ElementSolution>\n"
135 " Scalar effectivePorePressure(const Element& element,\n"
136 " const FVElementGeometry& fvGeometry,\n"
137 " const ElemVolVars& elemVolVars,\n"
138 " const FluxVarsCache& fluxVarsCache) const\n\n");
139
140 return this->asImp_().effectivePorePressureAtPos(element.geometry().center());
141 }
142
159 template<class SolidSystem, class ElementSolution,
160 std::enable_if_t< SolidSystem::isInert() &&
161 !decltype(isValid(Detail::hasReactiveVolumeFractionAtPos<GlobalPosition, SolidSystem>())
162 (std::declval<Implementation>()))::value, int > = 0 >
163 Scalar reactiveVolumeFraction(const Element& element,
164 const SubControlVolume& scv,
165 const ElementSolution& elemSol,
166 int compIdx) const
167 { return 0.0; }
168
170 template<class SolidSystem, class ElementSolution,
171 std::enable_if_t< !SolidSystem::isInert() ||
172 decltype(isValid(Detail::hasReactiveVolumeFractionAtPos<GlobalPosition, SolidSystem>())
173 (std::declval<Implementation>()))::value, int > = 0 >
174 Scalar reactiveVolumeFraction(const Element& element,
175 const SubControlVolume& scv,
176 const ElementSolution& elemSol,
177 int compIdx) const
178 {
179 static_assert(decltype(isValid(Detail::hasReactiveVolumeFractionAtPos<GlobalPosition, SolidSystem>())(this->asImp_()))::value," \n\n"
180 " Your spatial params class has to either implement\n\n"
181 " template<class SolidSystem>\n"
182 " Scalar inertVolumeFractionAtPos(const GlobalPosition& globalPos, int compIdx) const\n\n"
183 " or overload this function\n\n"
184 " template<class SolidSystem, class ElementSolution>\n"
185 " Scalar inertVolumeFraction(const Element& element,\n"
186 " const SubControlVolume& scv,\n"
187 " const ElementSolution& elemSol,\n"
188 " int compIdx) const\n\n");
189
190 return this->asImp_().template reactiveVolumeFractionAtPos<SolidSystem>(scv.center(), compIdx);
191 }
192
206 template<class ElemVolVars, class FluxVarsCache>
207 decltype(auto) lameParams(const Element& element,
208 const FVElementGeometry& fvGeometry,
209 const ElemVolVars& elemVolVars,
210 const FluxVarsCache& fluxVarsCache) const
211 {
212 static_assert(decltype(isValid(Detail::hasLameParamsAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
213 " Your spatial params class has to either implement\n\n"
214 " const LameParams& lameParamsAtPos(const GlobalPosition& globalPos) const\n\n"
215 " or overload this function\n\n"
216 " template<class ElementSolution>\n"
217 " const LameParams& lameParams(const Element& element,\n"
218 " const FVElementGeometry& fvGeometry,\n"
219 " const ElemVolVars& elemVolVars,\n"
220 " const FluxVarsCache& fluxVarsCache) const\n\n");
221
222 return this->asImp_().lameParamsAtPos(fluxVarsCache.ipGlobal());
223 }
224
238 template<class ElemVolVars, class FluxVarsCache>
239 Scalar biotCoefficient(const Element& element,
240 const FVElementGeometry& fvGeometry,
241 const ElemVolVars& elemVolVars,
242 const FluxVarsCache& fluxVarsCache) const
243 {
244 static_assert(decltype(isValid(Detail::hasBiotCoeffAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
245 " Your spatial params class has to either implement\n\n"
246 " const LameParams& biotCoefficientAtPos(const GlobalPosition& globalPos) const\n\n"
247 " or overload this function\n\n"
248 " template<class ElementSolution>\n"
249 " const LameParams& biotCoefficient(const Element& element,\n"
250 " const FVElementGeometry& fvGeometry,\n"
251 " const ElemVolVars& elemVolVars,\n"
252 " const FluxVarsCache& fluxVarsCache) const\n\n");
253
254 return this->asImp_().biotCoefficientAtPos(fluxVarsCache.ipGlobal());
255 }
256};
257
258} // end namespace Dumux
259
260#endif
The base class for spatial parameters of poro-elastic geomechanical problems.
Definition: geomechanics/poroelastic/fvspatialparams.hh:76
decltype(auto) lameParams(const Element &element, const FVElementGeometry &fvGeometry, const ElemVolVars &elemVolVars, const FluxVarsCache &fluxVarsCache) const
Define the Lame parameters.
Definition: geomechanics/poroelastic/fvspatialparams.hh:207
Scalar effectiveFluidDensity(const Element &element, const SubControlVolume &scv) const
Returns the effective fluid density within an scv.
Definition: geomechanics/poroelastic/fvspatialparams.hh:97
Scalar reactiveVolumeFraction(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol, int compIdx) const
Function for defining the solid volume fraction of a solid component that takes part in some sort of ...
Definition: geomechanics/poroelastic/fvspatialparams.hh:163
Scalar biotCoefficient(const Element &element, const FVElementGeometry &fvGeometry, const ElemVolVars &elemVolVars, const FluxVarsCache &fluxVarsCache) const
Returns the Biot coefficient in an element.
Definition: geomechanics/poroelastic/fvspatialparams.hh:239
FVPoroElasticSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry)
The constructor.
Definition: geomechanics/poroelastic/fvspatialparams.hh:86
Scalar effectivePorePressure(const Element &element, const FVElementGeometry &fvGeometry, const ElemVolVars &elemVolVars, const FluxVarsCache &fluxVarsCache) const
Returns the effective pore pressure.
Definition: geomechanics/poroelastic/fvspatialparams.hh:125
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.
Definition: adapt.hh:17