3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
geomechanics/elastic/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_ELASTIC_FV_SPATIAL_PARAMS_HH
25#define DUMUX_GEOMECHANICS_ELASTIC_FV_SPATIAL_PARAMS_HH
26
27#include <memory>
28
29#include <dune/common/exceptions.hh>
30
33#include <dumux/geomechanics/spatialparamstraits_.hh>
34
35namespace Dumux {
36
41template<class GridGeometry, class Scalar, class Implementation>
42class FVElasticSpatialParams : public FVSpatialParams<GridGeometry, Scalar, Implementation>
43{
45 using FVElementGeometry = typename GridGeometry::LocalView;
46 using SubControlVolume = typename GridGeometry::SubControlVolume;
47 using GridView = typename GridGeometry::GridView;
48 using Element = typename GridView::template Codim<0>::Entity;
49 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
50
51public:
53 FVElasticSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
55 {}
56
67 template<class SolidSystem, class ElementSolution>
68 Scalar inertVolumeFraction(const Element& element,
69 const SubControlVolume& scv,
70 const ElementSolution& elemSol,
71 int compIdx) const
72 {
73 static_assert(SolidSystem::isInert(), "Elastic model can only be used with inert solid systems");
74
75 // when there is only one component, the volume fraction must be one
76 if constexpr (SolidSystem::numInertComponents == 1)
77 return 1.0;
78
79 // otherwise we require the user to define the solid composition
80 return this->asImp_().template inertVolumeFractionAtPos<SolidSystem>(scv.center(), compIdx);
81 }
82
91 template<class SolidSystem>
92 Scalar inertVolumeFractionAtPos(const GlobalPosition& globalPos, int compIdx) const
93 { DUNE_THROW(Dune::InvalidStateException, "The spatial parameters do not provide inertVolumeFractionAtPos() method."); }
94
108 template<class ElemVolVars, class FluxVarsCache>
109 decltype(auto) lameParams(const Element& element,
110 const FVElementGeometry& fvGeometry,
111 const ElemVolVars& elemVolVars,
112 const FluxVarsCache& fluxVarsCache) const
113 {
114 static_assert(decltype(isValid(Detail::hasLameParamsAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
115 " Your spatial params class has to either implement\n\n"
116 " const LameParams& lameParamsAtPos(const GlobalPosition& globalPos) const\n\n"
117 " or overload this function\n\n"
118 " template<class ElementSolution>\n"
119 " const LameParams& lameParams(const Element& element,\n"
120 " const FVElementGeometry& fvGeometry,\n"
121 " const ElemVolVars& elemVolVars,\n"
122 " const FluxVarsCache& fluxVarsCache) const\n\n");
123
124 return this->asImp_().lameParamsAtPos(fluxVarsCache.ipGlobal());
125 }
126};
127
128} // end namespace Dumux
129
130#endif
A helper function for class member function introspection.
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 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 linear elastic geomechanical problems.
Definition: geomechanics/elastic/fvspatialparams.hh:43
Scalar inertVolumeFractionAtPos(const GlobalPosition &globalPos, int compIdx) const
Function for defining the solid volume fraction. That is possibly solution dependent.
Definition: geomechanics/elastic/fvspatialparams.hh:92
decltype(auto) lameParams(const Element &element, const FVElementGeometry &fvGeometry, const ElemVolVars &elemVolVars, const FluxVarsCache &fluxVarsCache) const
Define the Lame parameters.
Definition: geomechanics/elastic/fvspatialparams.hh:109
FVElasticSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry)
The constructor.
Definition: geomechanics/elastic/fvspatialparams.hh:53
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: geomechanics/elastic/fvspatialparams.hh:68
Basic spatial parameters to be used with finite-volume schemes.