Line | Branch | Exec | Source |
---|---|---|---|
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 | // SPDX-FileCopyrightText: Copyright © DuMux Project contributors, see AUTHORS.md in root folder | ||
5 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
6 | // | ||
7 | /*! | ||
8 | * \file | ||
9 | * \ingroup SpatialParameters | ||
10 | * \ingroup Elastic | ||
11 | * \brief The base class for spatial parameters of linear elastic geomechanical problems | ||
12 | */ | ||
13 | #ifndef DUMUX_SOLIDMECHANICS_ELASTIC_FV_SPATIAL_PARAMS_HH | ||
14 | #define DUMUX_SOLIDMECHANICS_ELASTIC_FV_SPATIAL_PARAMS_HH | ||
15 | |||
16 | #include <memory> | ||
17 | #include <utility> | ||
18 | |||
19 | #include <dune/common/exceptions.hh> | ||
20 | |||
21 | #include <dumux/common/fvspatialparams.hh> | ||
22 | #include <dumux/common/typetraits/isvalid.hh> | ||
23 | |||
24 | #include "spatialparamstraits_.hh" | ||
25 | |||
26 | namespace Dumux { | ||
27 | |||
28 | /*! | ||
29 | * \ingroup SpatialParameters | ||
30 | * \ingroup Elastic | ||
31 | * \brief The base class for spatial parameters of linear elastic geomechanical problems | ||
32 | */ | ||
33 | template<class GridGeometry, class Scalar, class Implementation> | ||
34 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | class FVElasticSpatialParams : public FVSpatialParams<GridGeometry, Scalar, Implementation> |
35 | { | ||
36 | using ParentType = FVSpatialParams<GridGeometry, Scalar, Implementation>; | ||
37 | using FVElementGeometry = typename GridGeometry::LocalView; | ||
38 | using SubControlVolume = typename GridGeometry::SubControlVolume; | ||
39 | using GridView = typename GridGeometry::GridView; | ||
40 | using Element = typename GridView::template Codim<0>::Entity; | ||
41 | using GlobalPosition = typename Element::Geometry::GlobalCoordinate; | ||
42 | |||
43 | public: | ||
44 | //! The constructor | ||
45 | 1 | FVElasticSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry) | |
46 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | : ParentType(gridGeometry) |
47 | 1 | {} | |
48 | |||
49 | /*! | ||
50 | * \brief Function for defining the solid volume fraction. | ||
51 | * That is possibly solution dependent. | ||
52 | * | ||
53 | * \param element The current element | ||
54 | * \param scv The sub-control volume inside the element. | ||
55 | * \param elemSol The solution at the dofs connected to the element. | ||
56 | * \param compIdx The solid component index | ||
57 | * \return the volume fraction of the inert solid component with index compIdx | ||
58 | */ | ||
59 | template<class SolidSystem, class ElementSolution> | ||
60 | Scalar inertVolumeFraction(const Element& element, | ||
61 | const SubControlVolume& scv, | ||
62 | const ElementSolution& elemSol, | ||
63 | int compIdx) const | ||
64 | { | ||
65 | static_assert(SolidSystem::isInert(), "Elastic model can only be used with inert solid systems"); | ||
66 | |||
67 | // when there is only one component, the volume fraction must be one | ||
68 | if constexpr (SolidSystem::numInertComponents == 1) | ||
69 | return 1.0; | ||
70 | |||
71 | // otherwise we require the user to define the solid composition | ||
72 | return this->asImp_().template inertVolumeFractionAtPos<SolidSystem>(scv.center(), compIdx); | ||
73 | } | ||
74 | |||
75 | /*! | ||
76 | * \brief Function for defining the solid volume fraction. | ||
77 | * That is possibly solution dependent. | ||
78 | * | ||
79 | * \param globalPos The global position | ||
80 | * \param compIdx The solid component index | ||
81 | * \return the volume fraction of the inert solid component with index compIdx | ||
82 | */ | ||
83 | template<class SolidSystem> | ||
84 | Scalar inertVolumeFractionAtPos(const GlobalPosition& globalPos, int compIdx) const | ||
85 | { DUNE_THROW(Dune::InvalidStateException, "The spatial parameters do not provide inertVolumeFractionAtPos() method."); } | ||
86 | |||
87 | /*! | ||
88 | * \brief Define the Lame parameters | ||
89 | * \note These are possibly solution dependent and are evaluated | ||
90 | * for an integration point inside the element. Therefore, | ||
91 | * a flux variables cache object is passed to this function | ||
92 | * containing data on shape functions at the integration point. | ||
93 | * | ||
94 | * \param element The current element | ||
95 | * \param fvGeometry The local finite volume geometry | ||
96 | * \param elemVolVars Primary/Secondary variables inside the element | ||
97 | * \param fluxVarsCache Contains data on shape functions at the integration point | ||
98 | * \return lame parameters | ||
99 | */ | ||
100 | template<class ElemVolVars, class FluxVarsCache> | ||
101 | decltype(auto) lameParams(const Element& element, | ||
102 | const FVElementGeometry& fvGeometry, | ||
103 | const ElemVolVars& elemVolVars, | ||
104 | const FluxVarsCache& fluxVarsCache) const | ||
105 | { | ||
106 | static_assert(decltype(isValid(Detail::hasLameParamsAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n" | ||
107 | " Your spatial params class has to either implement\n\n" | ||
108 | " const LameParams& lameParamsAtPos(const GlobalPosition& globalPos) const\n\n" | ||
109 | " or overload this function\n\n" | ||
110 | " template<class ElementSolution>\n" | ||
111 | " const LameParams& lameParams(const Element& element,\n" | ||
112 | " const FVElementGeometry& fvGeometry,\n" | ||
113 | " const ElemVolVars& elemVolVars,\n" | ||
114 | " const FluxVarsCache& fluxVarsCache) const\n\n"); | ||
115 | |||
116 | 7200 | return this->asImp_().lameParamsAtPos(fluxVarsCache.ipGlobal()); | |
117 | } | ||
118 | }; | ||
119 | |||
120 | } // end namespace Dumux | ||
121 | |||
122 | #endif | ||
123 |