3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
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 * 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_GEOMECHANICS_POROELASTIC_FV_SPATIAL_PARAMS_HH
25#define DUMUX_GEOMECHANICS_POROELASTIC_FV_SPATIAL_PARAMS_HH
26
27#include <memory>
28
31#include <dumux/geomechanics/spatialparamstraits_.hh>
32
33namespace Dumux {
34
35#ifndef DOXYGEN
36namespace Detail {
37
38// helper struct detecting if the user-defined problem class has an effectiveFluidDensityAtPos function
39template<class GlobalPosition>
40struct hasEffFluidDensityAtPos
41{
42 template<class Problem>
43 auto operator()(const Problem& a)
44 -> decltype(a.effectiveFluidDensityAtPos(std::declval<GlobalPosition>()))
45 {}
46};
47
48// helper struct detecting if the user-defined problem class has an effectivePorePressureAtPos function
49template<class GlobalPosition>
50struct hasEffPorePressureAtPos
51{
52 template<class Problem>
53 auto operator()(const Problem& a)
54 -> decltype(a.effectivePorePressureAtPos(std::declval<GlobalPosition>()))
55 {}
56};
57
58// helper struct detecting if the user-defined spatial params class has a reactiveVolumeFractionAtPos function
59template<class GlobalPosition, class SolidSystem>
60struct hasReactiveVolumeFractionAtPos
61{
62 template<class SpatialParams>
63 auto operator()(const SpatialParams& a)
64 -> decltype(a.template reactiveVolumeFractionAtPos<SolidSystem>(std::declval<GlobalPosition>(), 0))
65 {}
66};
67
68// helper struct detecting if the user-defined spatial params class has a biotCoefficientAtPos function
69template<class GlobalPosition>
70struct hasBiotCoeffAtPos
71{
72 template<class SpatialParams>
73 auto operator()(const SpatialParams& a)
74 -> decltype(a.biotCoefficientAtPos(std::declval<GlobalPosition>()))
75 {}
76};
77
78} // end namespace Detail
79#endif
80
85template<class GridGeometry, class Scalar, class Implementation>
87: public FVPorousMediumSpatialParams<GridGeometry, Scalar, Implementation>
88{
90 using FVElementGeometry = typename GridGeometry::LocalView;
91 using SubControlVolume = typename GridGeometry::SubControlVolume;
92 using GridView = typename GridGeometry::GridView;
93 using Element = typename GridView::template Codim<0>::Entity;
94 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
95
96public:
98 FVPoroElasticSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
100 {}
101
109 Scalar effectiveFluidDensity(const Element& element,
110 const SubControlVolume& scv) const
111 {
112 static_assert(decltype(isValid(Detail::hasEffFluidDensityAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
113 " Your problem class has to either implement\n\n"
114 " Scalar effectiveFluidDensityAtPos(const GlobalPosition& globalPos) const\n\n"
115 " or overload this function\n\n"
116 " template<class ElementSolution>\n"
117 " Scalar effectiveFluidDensity(const Element& element,\n\
118 const SubControlVolume& scv) const\n\n");
119
120 return this->asImp_().effectiveFluidDensityAtPos(scv.center());
121 }
122
136 template<class ElemVolVars, class FluxVarsCache>
137 Scalar effectivePorePressure(const Element& element,
138 const FVElementGeometry& fvGeometry,
139 const ElemVolVars& elemVolVars,
140 const FluxVarsCache& fluxVarsCache) const
141 {
142 static_assert(decltype(isValid(Detail::hasEffPorePressureAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
143 " Your problem class has to either implement\n\n"
144 " Scalar effectivePorePressureAtPos(const GlobalPosition& globalPos) const\n\n"
145 " or overload this function\n\n"
146 " template<class ElementSolution>\n"
147 " Scalar effectivePorePressure(const Element& element,\n"
148 " const FVElementGeometry& fvGeometry,\n"
149 " const ElemVolVars& elemVolVars,\n"
150 " const FluxVarsCache& fluxVarsCache) const\n\n");
151
152 return this->asImp_().effectivePorePressureAtPos(element.geometry().center());
153 }
154
171 template<class SolidSystem, class ElementSolution,
172 std::enable_if_t< SolidSystem::isInert() &&
173 !decltype(isValid(Detail::hasReactiveVolumeFractionAtPos<GlobalPosition, SolidSystem>())
174 (std::declval<Implementation>()))::value, int > = 0 >
175 Scalar reactiveVolumeFraction(const Element& element,
176 const SubControlVolume& scv,
177 const ElementSolution& elemSol,
178 int compIdx) const
179 { return 0.0; }
180
182 template<class SolidSystem, class ElementSolution,
183 std::enable_if_t< !SolidSystem::isInert() ||
184 decltype(isValid(Detail::hasReactiveVolumeFractionAtPos<GlobalPosition, SolidSystem>())
185 (std::declval<Implementation>()))::value, int > = 0 >
186 Scalar reactiveVolumeFraction(const Element& element,
187 const SubControlVolume& scv,
188 const ElementSolution& elemSol,
189 int compIdx) const
190 {
191 static_assert(decltype(isValid(Detail::hasReactiveVolumeFractionAtPos<GlobalPosition, SolidSystem>())(this->asImp_()))::value," \n\n"
192 " Your spatial params class has to either implement\n\n"
193 " template<class SolidSystem>\n"
194 " Scalar inertVolumeFractionAtPos(const GlobalPosition& globalPos, int compIdx) const\n\n"
195 " or overload this function\n\n"
196 " template<class SolidSystem, class ElementSolution>\n"
197 " Scalar inertVolumeFraction(const Element& element,\n"
198 " const SubControlVolume& scv,\n"
199 " const ElementSolution& elemSol,\n"
200 " int compIdx) const\n\n");
201
202 return this->asImp_().template reactiveVolumeFractionAtPos<SolidSystem>(scv.center(), compIdx);
203 }
204
218 template<class ElemVolVars, class FluxVarsCache>
219 decltype(auto) lameParams(const Element& element,
220 const FVElementGeometry& fvGeometry,
221 const ElemVolVars& elemVolVars,
222 const FluxVarsCache& fluxVarsCache) const
223 {
224 static_assert(decltype(isValid(Detail::hasLameParamsAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
225 " Your spatial params class has to either implement\n\n"
226 " const LameParams& lameParamsAtPos(const GlobalPosition& globalPos) const\n\n"
227 " or overload this function\n\n"
228 " template<class ElementSolution>\n"
229 " const LameParams& lameParams(const Element& element,\n"
230 " const FVElementGeometry& fvGeometry,\n"
231 " const ElemVolVars& elemVolVars,\n"
232 " const FluxVarsCache& fluxVarsCache) const\n\n");
233
234 return this->asImp_().lameParamsAtPos(fluxVarsCache.ipGlobal());
235 }
236
250 template<class ElemVolVars, class FluxVarsCache>
251 Scalar biotCoefficient(const Element& element,
252 const FVElementGeometry& fvGeometry,
253 const ElemVolVars& elemVolVars,
254 const FluxVarsCache& fluxVarsCache) const
255 {
256 static_assert(decltype(isValid(Detail::hasBiotCoeffAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
257 " Your spatial params class has to either implement\n\n"
258 " const LameParams& biotCoefficientAtPos(const GlobalPosition& globalPos) const\n\n"
259 " or overload this function\n\n"
260 " template<class ElementSolution>\n"
261 " const LameParams& biotCoefficient(const Element& element,\n"
262 " const FVElementGeometry& fvGeometry,\n"
263 " const ElemVolVars& elemVolVars,\n"
264 " const FluxVarsCache& fluxVarsCache) const\n\n");
265
266 return this->asImp_().biotCoefficientAtPos(fluxVarsCache.ipGlobal());
267 }
268};
269
270} // end namespace Dumux
271
272#endif
A helper function for class member function introspection.
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: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 poro-elastic geomechanical problems.
Definition: geomechanics/poroelastic/fvspatialparams.hh:88
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:219
Scalar effectiveFluidDensity(const Element &element, const SubControlVolume &scv) const
Returns the effective fluid density within an scv.
Definition: geomechanics/poroelastic/fvspatialparams.hh:109
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:175
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:251
FVPoroElasticSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry)
The constructor.
Definition: geomechanics/poroelastic/fvspatialparams.hh:98
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:137