3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
fvporoelastic.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#warning "This file is deprecated, use FVPoroElasticSpatialParams from dumux/geomechanics/poroelastic/fvspatialparams.hh instead!"
28
29#include <memory>
30
34
35namespace Dumux {
36
37#ifndef DOXYGEN
38namespace Detail {
39// helper struct detecting if the user-defined spatial params class has a lameParamsAtPos function
40template<class GlobalPosition>
41struct hasLameParamsAtPos
42{
43 template<class SpatialParams>
44 auto operator()(const SpatialParams& a)
45 -> decltype(a.lameParamsAtPos(std::declval<GlobalPosition>()))
46 {}
47};
48
49// helper struct detecting if the user-defined spatial params class has a reactiveVolumeFractionAtPos function
50template<class GlobalPosition, class SolidSystem>
51struct hasReactiveVolumeFractionAtPos
52{
53 template<class SpatialParams>
54 auto operator()(const SpatialParams& a)
55 -> decltype(a.template reactiveVolumeFractionAtPos<SolidSystem>(std::declval<GlobalPosition>(), 0))
56 {}
57};
58
59// helper struct detecting if the user-defined spatial params class has a biotCoefficientAtPos function
60template<class GlobalPosition>
61struct hasBiotCoeffAtPos
62{
63 template<class SpatialParams>
64 auto operator()(const SpatialParams& a)
65 -> decltype(a.biotCoefficientAtPos(std::declval<GlobalPosition>()))
66 {}
67};
68
69} // end namespace Detail
70#endif
71
76template<class Scalar, class GridGeometry, class Implementation>
77class
78[[deprecated("Use FVPoroElasticSpatialParams from dumux/geomechanics/poroelastic/fvspatialparams.hh instead. This class will be removed after 3.5.")]]
80{
81 using FVElementGeometry = typename GridGeometry::LocalView;
82 using SubControlVolume = typename GridGeometry::SubControlVolume;
83 using GridView = typename GridGeometry::GridView;
84 using Element = typename GridView::template Codim<0>::Entity;
85 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
86
87 enum { dimWorld = GridView::dimensionworld };
88
89public:
91 FVSpatialParamsPoroElastic(std::shared_ptr<const GridGeometry> gridGeometry)
92 : gridGeometry_(gridGeometry)
93 , gravity_(0.0)
94 {
95 const bool enableGravity = getParam<bool>("Problem.EnableGravity");
96 if (enableGravity)
97 gravity_[dimWorld-1] = -9.81;
98 }
99
110 const GlobalPosition& gravity(const GlobalPosition &pos) const
111 { return gravity_; }
112
123 template<class ElementSolution>
124 Scalar porosity(const Element& element,
125 const SubControlVolume& scv,
126 const ElementSolution& elemSol) const
127 {
128 static_assert(decltype(isValid(Detail::hasPorosityAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
129 " Your spatial params class has to either implement\n\n"
130 " Scalar porosityAtPos(const GlobalPosition& globalPos) const\n\n"
131 " or overload this function\n\n"
132 " template<class ElementSolution>\n"
133 " Scalar porosity(const Element& element,\n"
134 " const SubControlVolume& scv,\n"
135 " const ElementSolution& elemSol) const\n\n");
136
137 return asImp_().porosityAtPos(scv.center());
138 }
139
156 template<class SolidSystem, class ElementSolution,
157 typename std::enable_if_t<SolidSystem::isInert()
158 && SolidSystem::numInertComponents == 1
159 && !decltype(isValid(Detail::hasInertVolumeFractionAtPos<GlobalPosition, SolidSystem>())
160 (std::declval<Implementation>()))::value, int> = 0>
161 Scalar inertVolumeFraction(const Element& element,
162 const SubControlVolume& scv,
163 const ElementSolution& elemSol,
164 int compIdx) const
165 { return 1.0 - asImp_().porosity(element, scv, elemSol); }
166
167 // specialization if there are no inert components at all
168 template<class SolidSystem, class ElementSolution, typename std::enable_if_t<SolidSystem::numInertComponents == 0, int> = 0>
169 Scalar inertVolumeFraction(const Element& element,
170 const SubControlVolume& scv,
171 const ElementSolution& elemSol,
172 int compIdx) const
173 { return 0.0; }
174
175 // the more general interface forwarding to inertVolumeFractionAtPos
176 template<class SolidSystem, class ElementSolution,
177 typename std::enable_if_t<(SolidSystem::numInertComponents > 1) ||
178 (
179 (SolidSystem::numInertComponents > 0) &&
180 (
181 !SolidSystem::isInert()
182 || decltype(isValid(Detail::hasInertVolumeFractionAtPos<GlobalPosition, SolidSystem>())
183 (std::declval<Implementation>()))::value
184 )
185 ), int> = 0>
186 Scalar inertVolumeFraction(const Element& element,
187 const SubControlVolume& scv,
188 const ElementSolution& elemSol,
189 int compIdx) const
190 {
191 static_assert(decltype(isValid(Detail::hasInertVolumeFractionAtPos<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 asImp_().template inertVolumeFractionAtPos<SolidSystem>(scv.center(), compIdx);
203 }
204
219 template<class SolidSystem, class ElementSolution,
220 std::enable_if_t< SolidSystem::isInert() &&
221 !decltype(isValid(Detail::hasReactiveVolumeFractionAtPos<GlobalPosition, SolidSystem>())
222 (std::declval<Implementation>()))::value, int > = 0 >
223 Scalar reactiveVolumeFraction(const Element& element,
224 const SubControlVolume& scv,
225 const ElementSolution& elemSol,
226 int compIdx) const
227 { return 0.0; }
228
230 template<class SolidSystem, class ElementSolution,
231 std::enable_if_t< !SolidSystem::isInert() ||
232 decltype(isValid(Detail::hasReactiveVolumeFractionAtPos<GlobalPosition, SolidSystem>())
233 (std::declval<Implementation>()))::value, int > = 0 >
234 Scalar reactiveVolumeFraction(const Element& element,
235 const SubControlVolume& scv,
236 const ElementSolution& elemSol,
237 int compIdx) const
238 {
239 static_assert(decltype(isValid(Detail::hasReactiveVolumeFractionAtPos<GlobalPosition, SolidSystem>())(this->asImp_()))::value," \n\n"
240 " Your spatial params class has to either implement\n\n"
241 " template<class SolidSystem>\n"
242 " Scalar inertVolumeFractionAtPos(const GlobalPosition& globalPos, int compIdx) const\n\n"
243 " or overload this function\n\n"
244 " template<class SolidSystem, class ElementSolution>\n"
245 " Scalar inertVolumeFraction(const Element& element,\n"
246 " const SubControlVolume& scv,\n"
247 " const ElementSolution& elemSol,\n"
248 " int compIdx) const\n\n");
249
250 return asImp_().template reactiveVolumeFractionAtPos<SolidSystem>(scv.center(), compIdx);
251 }
252
266 template<class ElemVolVars, class FluxVarsCache>
267 decltype(auto) lameParams(const Element& element,
268 const FVElementGeometry& fvGeometry,
269 const ElemVolVars& elemVolVars,
270 const FluxVarsCache& fluxVarsCache) const
271 {
272 static_assert(decltype(isValid(Detail::hasLameParamsAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
273 " Your spatial params class has to either implement\n\n"
274 " const LameParams& lameParamsAtPos(const GlobalPosition& globalPos) const\n\n"
275 " or overload this function\n\n"
276 " template<class ElementSolution>\n"
277 " const LameParams& lameParams(const Element& element,\n"
278 " const FVElementGeometry& fvGeometry,\n"
279 " const ElemVolVars& elemVolVars,\n"
280 " const FluxVarsCache& fluxVarsCache) const\n\n");
281
282 return asImp_().lameParamsAtPos(fluxVarsCache.ipGlobal());
283 }
284
298 template<class ElemVolVars, class FluxVarsCache>
299 Scalar biotCoefficient(const Element& element,
300 const FVElementGeometry& fvGeometry,
301 const ElemVolVars& elemVolVars,
302 const FluxVarsCache& fluxVarsCache) const
303 {
304 static_assert(decltype(isValid(Detail::hasBiotCoeffAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
305 " Your spatial params class has to either implement\n\n"
306 " const LameParams& biotCoefficientAtPos(const GlobalPosition& globalPos) const\n\n"
307 " or overload this function\n\n"
308 " template<class ElementSolution>\n"
309 " const LameParams& biotCoefficient(const Element& element,\n"
310 " const FVElementGeometry& fvGeometry,\n"
311 " const ElemVolVars& elemVolVars,\n"
312 " const FluxVarsCache& fluxVarsCache) const\n\n");
313
314 return asImp_().biotCoefficientAtPos(fluxVarsCache.ipGlobal());
315 }
316
318 const GridGeometry& gridGeometry() const
319 { return *gridGeometry_; }
320
321protected:
322 Implementation &asImp_()
323 { return *static_cast<Implementation*>(this); }
324
325 const Implementation &asImp_() const
326 { return *static_cast<const Implementation*>(this); }
327
328private:
329 std::shared_ptr<const GridGeometry> gridGeometry_;
330 GlobalPosition gravity_;
331};
332} // end namespace Dumux
333#endif
A helper function for class member function introspection.
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
The base class for spatial parameters of one-phase problems using a fully implicit discretization met...
Definition: adapt.hh:29
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
The base class for spatial parameters of poro-elastic geomechanical problems.
Definition: fvporoelastic.hh:80
const GlobalPosition & gravity(const GlobalPosition &pos) const
Returns the acceleration due to gravity .
Definition: fvporoelastic.hh:110
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: fvporoelastic.hh:318
const Implementation & asImp_() const
Definition: fvporoelastic.hh:325
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: fvporoelastic.hh:223
Scalar inertVolumeFraction(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol, int compIdx) const
Function for defining the solid volume fraction. That is possibly solution dependent.
Definition: fvporoelastic.hh:161
decltype(auto) lameParams(const Element &element, const FVElementGeometry &fvGeometry, const ElemVolVars &elemVolVars, const FluxVarsCache &fluxVarsCache) const
Define the Lame parameters.
Definition: fvporoelastic.hh:267
Scalar porosity(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Function for defining the porosity. That is possibly solution dependent.
Definition: fvporoelastic.hh:124
Scalar biotCoefficient(const Element &element, const FVElementGeometry &fvGeometry, const ElemVolVars &elemVolVars, const FluxVarsCache &fluxVarsCache) const
Returns the Biot coefficient in an element.
Definition: fvporoelastic.hh:299
Implementation & asImp_()
Definition: fvporoelastic.hh:322
FVSpatialParamsPoroElastic(std::shared_ptr< const GridGeometry > gridGeometry)
The constructor.
Definition: fvporoelastic.hh:91