3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
fvelastic.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_MATERIAL_GEOMECHANICS_ELASTIC_FV_SPATIAL_PARAMS_HH
25#define DUMUX_MATERIAL_GEOMECHANICS_ELASTIC_FV_SPATIAL_PARAMS_HH
26
27#warning "This file is deprecated, use FVElasticSpatialParams from dumux/geomechanics/elastic/fvspatialparams.hh instead!"
28
29#include <memory>
30
31#include <dune/common/exceptions.hh>
32
35
36namespace Dumux {
37
38#ifndef DOXYGEN
39namespace Detail {
40// helper struct detecting if the user-defined spatial params class has a lameParamsAtPos function
41template<class GlobalPosition>
42struct hasLameParamsAtPos
43{
44 template<class SpatialParams>
45 auto operator()(const SpatialParams& a)
46 -> decltype(a.lameParamsAtPos(std::declval<GlobalPosition>()))
47 {}
48};
49
50} // end namespace Detail
51#endif
52
57template<class Scalar, class GridGeometry, class Implementation>
58class
59[[deprecated("Use FVElasticSpatialParams from dumux/geomechanics/elastic/fvspatialparams.hh instead. This class will be removed after 3.5.")]]
61{
62 using FVElementGeometry = typename GridGeometry::LocalView;
63 using SubControlVolume = typename GridGeometry::SubControlVolume;
64 using GridView = typename GridGeometry::GridView;
65 using Element = typename GridView::template Codim<0>::Entity;
66 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
67
68 enum { dimWorld = GridView::dimensionworld };
69
70public:
72 FVSpatialParamsElastic(std::shared_ptr<const GridGeometry> gridGeometry)
73 : gridGeometry_(gridGeometry)
74 , gravity_(0.0)
75 {
76 const bool enableGravity = getParam<bool>("Problem.EnableGravity");
77 if (enableGravity)
78 gravity_[dimWorld-1] = -9.81;
79 }
80
91 const GlobalPosition& gravity(const GlobalPosition &pos) const
92 { return gravity_; }
93
104 template<class SolidSystem, class ElementSolution>
105 Scalar inertVolumeFraction(const Element& element,
106 const SubControlVolume& scv,
107 const ElementSolution& elemSol,
108 int compIdx) const
109 {
110 static_assert(SolidSystem::isInert(), "Elastic model can only be used with inert solid systems");
111
112 // when there is only one component, the volume fraction must be one
113 if (SolidSystem::numInertComponents == 1)
114 return 1.0;
115
116 // otherwise we require the user to define the solid composition
117 return asImp_().template inertVolumeFractionAtPos<SolidSystem>(scv.center(), compIdx);
118 }
119
128 template<class SolidSystem>
129 Scalar inertVolumeFractionAtPos(const GlobalPosition& globalPos, int compIdx) const
130 { DUNE_THROW(Dune::InvalidStateException, "The spatial parameters do not provide inertVolumeFractionAtPos() method."); }
131
145 template<class ElemVolVars, class FluxVarsCache>
146 decltype(auto) lameParams(const Element& element,
147 const FVElementGeometry& fvGeometry,
148 const ElemVolVars& elemVolVars,
149 const FluxVarsCache& fluxVarsCache) const
150 {
151 static_assert(decltype(isValid(Detail::hasLameParamsAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
152 " Your spatial params class has to either implement\n\n"
153 " const LameParams& lameParamsAtPos(const GlobalPosition& globalPos) const\n\n"
154 " or overload this function\n\n"
155 " template<class ElementSolution>\n"
156 " const LameParams& lameParams(const Element& element,\n"
157 " const FVElementGeometry& fvGeometry,\n"
158 " const ElemVolVars& elemVolVars,\n"
159 " const FluxVarsCache& fluxVarsCache) const\n\n");
160
161 return asImp_().lameParamsAtPos(fluxVarsCache.ipGlobal());
162 }
163
165 const GridGeometry& gridGeometry() const
166 { return *gridGeometry_; }
167
168protected:
169 Implementation &asImp_()
170 { return *static_cast<Implementation*>(this); }
171
172 const Implementation &asImp_() const
173 { return *static_cast<const Implementation*>(this); }
174
175private:
176 std::shared_ptr<const GridGeometry> gridGeometry_;
177 GlobalPosition gravity_;
178};
179} // end namespace Dumuxs
180#endif
A helper function for class member function introspection.
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
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 linear elastic geomechanical problems.
Definition: fvelastic.hh:61
const Implementation & asImp_() const
Definition: fvelastic.hh:172
decltype(auto) lameParams(const Element &element, const FVElementGeometry &fvGeometry, const ElemVolVars &elemVolVars, const FluxVarsCache &fluxVarsCache) const
Define the Lame parameters.
Definition: fvelastic.hh:146
Scalar inertVolumeFractionAtPos(const GlobalPosition &globalPos, int compIdx) const
Function for defining the solid volume fraction. That is possibly solution dependent.
Definition: fvelastic.hh:129
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: fvelastic.hh:165
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: fvelastic.hh:105
Implementation & asImp_()
Definition: fvelastic.hh:169
FVSpatialParamsElastic(std::shared_ptr< const GridGeometry > gridGeometry)
The constructor.
Definition: fvelastic.hh:72
const GlobalPosition & gravity(const GlobalPosition &pos) const
Returns the acceleration due to gravity .
Definition: fvelastic.hh:91