24#ifndef DUMUX_GEOMECHANICS_ELASTIC_FV_SPATIAL_PARAMS_HH
25#define DUMUX_GEOMECHANICS_ELASTIC_FV_SPATIAL_PARAMS_HH
29#include <dune/common/exceptions.hh>
40template<
class GlobalPosition>
41struct hasLameParamsAtPos
43 template<
class SpatialParams>
44 auto operator()(
const SpatialParams& a)
45 ->
decltype(a.lameParamsAtPos(std::declval<GlobalPosition>()))
56template<
class Scalar,
class Gr
idGeometry,
class Implementation>
59 using FVElementGeometry =
typename GridGeometry::LocalView;
60 using SubControlVolume =
typename GridGeometry::SubControlVolume;
61 using GridView =
typename GridGeometry::GridView;
62 using Element =
typename GridView::template Codim<0>::Entity;
63 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
65 enum { dimWorld = GridView::dimensionworld };
73 const bool enableGravity = getParam<bool>(
"Problem.EnableGravity");
75 gravity_[dimWorld-1] = -9.81;
88 const GlobalPosition&
gravity(
const GlobalPosition &pos)
const
101 template<
class Sol
idSystem,
class ElementSolution>
103 const SubControlVolume& scv,
104 const ElementSolution& elemSol,
107 static_assert(SolidSystem::isInert(),
"Elastic model can only be used with inert solid systems");
110 if (SolidSystem::numInertComponents == 1)
114 return asImp_().template inertVolumeFractionAtPos<SolidSystem>(scv.center(), compIdx);
125 template<
class Sol
idSystem>
127 { DUNE_THROW(Dune::InvalidStateException,
"The spatial parameters do not provide inertVolumeFractionAtPos() method."); }
142 template<
class ElemVolVars,
class FluxVarsCache>
144 const FVElementGeometry& fvGeometry,
145 const ElemVolVars& elemVolVars,
146 const FluxVarsCache& fluxVarsCache)
const
148 static_assert(
decltype(
isValid(Detail::hasLameParamsAtPos<GlobalPosition>())(this->
asImp_()))::value,
" \n\n"
149 " Your spatial params class has to either implement\n\n"
150 " const LameParams& lameParamsAtPos(const GlobalPosition& globalPos) const\n\n"
151 " or overload this function\n\n"
152 " template<class ElementSolution>\n"
153 " const LameParams& lameParams(const Element& element,\n"
154 " const FVElementGeometry& fvGeometry,\n"
155 " const ElemVolVars& elemVolVars,\n"
156 " const FluxVarsCache& fluxVarsCache) const\n\n");
158 return asImp_().lameParamsAtPos(fluxVarsCache.ipGlobal());
163 {
return *gridGeometry_; }
167 {
return *
static_cast<Implementation*
>(
this); }
170 {
return *
static_cast<const Implementation*
>(
this); }
173 std::shared_ptr<const GridGeometry> gridGeometry_;
174 GlobalPosition gravity_;
A helper function for class member function introspection.
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
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:58
const Implementation & asImp_() const
Definition: fvelastic.hh:169
decltype(auto) lameParams(const Element &element, const FVElementGeometry &fvGeometry, const ElemVolVars &elemVolVars, const FluxVarsCache &fluxVarsCache) const
Define the Lame parameters.
Definition: fvelastic.hh:143
Scalar inertVolumeFractionAtPos(const GlobalPosition &globalPos, int compIdx) const
Function for defining the solid volume fraction. That is possibly solution dependent.
Definition: fvelastic.hh:126
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: fvelastic.hh:162
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:102
Implementation & asImp_()
Definition: fvelastic.hh:166
FVSpatialParamsElastic(std::shared_ptr< const GridGeometry > gridGeometry)
The constructor.
Definition: fvelastic.hh:69
const GlobalPosition & gravity(const GlobalPosition &pos) const
Returns the acceleration due to gravity .
Definition: fvelastic.hh:88