GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/dumux/poromechanics/poroelastic/fvspatialparams.hh
Date: 2025-04-19 19:19:10
Exec Total Coverage
Lines: 8 10 80.0%
Functions: 4 4 100.0%
Branches: 2 4 50.0%

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 PoroElastic
11 * \brief The base class for spatial parameters of poro-elastic geomechanical problems
12 */
13 #ifndef DUMUX_POROMECHANICS_POROELASTIC_FV_SPATIAL_PARAMS_HH
14 #define DUMUX_POROMECHANICS_POROELASTIC_FV_SPATIAL_PARAMS_HH
15
16 #include <memory>
17 #include <utility>
18
19 #include <dumux/common/typetraits/isvalid.hh>
20 #include <dumux/common/fvporousmediumspatialparams.hh>
21
22 #include "spatialparamstraits_.hh"
23
24 namespace Dumux {
25
26 /*!
27 * \ingroup SpatialParameters
28 * \ingroup PoroElastic
29 * \brief The base class for spatial parameters of poro-elastic geomechanical problems
30 */
31 template<class GridGeometry, class Scalar, class Implementation>
32
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 class FVPoroElasticSpatialParams
33 : public FVPorousMediumSpatialParams<GridGeometry, Scalar, Implementation>
34 {
35 using ParentType = FVPorousMediumSpatialParams<GridGeometry, Scalar, Implementation>;
36 using FVElementGeometry = typename GridGeometry::LocalView;
37 using SubControlVolume = typename GridGeometry::SubControlVolume;
38 using GridView = typename GridGeometry::GridView;
39 using Element = typename GridView::template Codim<0>::Entity;
40 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
41
42 public:
43 //! The constructor
44 4 FVPoroElasticSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
45
1/2
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 : ParentType(gridGeometry)
46 4 {}
47
48 /*!
49 * \brief Returns the effective fluid density within an scv.
50 * \note This is only enabled if the model considers fluid phases.
51 *
52 * \param element The current element
53 * \param scv The sub-control volume
54 */
55 Scalar effectiveFluidDensity(const Element& element,
56 const SubControlVolume& scv) const
57 {
58 static_assert(decltype(isValid(Detail::hasEffFluidDensityAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
59 " Your problem class has to either implement\n\n"
60 " Scalar effectiveFluidDensityAtPos(const GlobalPosition& globalPos) const\n\n"
61 " or overload this function\n\n"
62 " template<class ElementSolution>\n"
63 " Scalar effectiveFluidDensity(const Element& element,\n\
64 const SubControlVolume& scv) const\n\n");
65
66 return this->asImp_().effectiveFluidDensityAtPos(scv.center());
67 }
68
69 /*!
70 * \brief Returns the effective pore pressure
71 * \note This is only enabled if the model considers fluid phases.
72 * This is possibly solution dependent and is evaluated
73 * for an integration point inside the element. Therefore,
74 * a flux variables cache object is passed to this function
75 * containing data on shape functions at the integration point.
76 *
77 * \param element The current element
78 * \param fvGeometry The local finite volume geometry
79 * \param elemVolVars Primary/Secondary variables inside the element
80 * \param fluxVarsCache Contains data on shape functions at the integration point
81 */
82 template<class ElemVolVars, class FluxVarsCache>
83 7400 Scalar effectivePorePressure(const Element& element,
84 const FVElementGeometry& fvGeometry,
85 const ElemVolVars& elemVolVars,
86 const FluxVarsCache& fluxVarsCache) const
87 {
88 static_assert(decltype(isValid(Detail::hasEffPorePressureAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
89 " Your problem class has to either implement\n\n"
90 " Scalar effectivePorePressureAtPos(const GlobalPosition& globalPos) const\n\n"
91 " or overload this function\n\n"
92 " template<class ElementSolution>\n"
93 " Scalar effectivePorePressure(const Element& element,\n"
94 " const FVElementGeometry& fvGeometry,\n"
95 " const ElemVolVars& elemVolVars,\n"
96 " const FluxVarsCache& fluxVarsCache) const\n\n");
97
98 7400 return this->asImp_().effectivePorePressureAtPos(element.geometry().center());
99 }
100
101 /*!
102 * \brief Function for defining the solid volume fraction of a solid
103 * component that takes part in some sort of reaction. The reaction
104 * may be described in a flow model coupled to the poroelastic model,
105 * so implementations may access quantities of the coupled domain.
106 *
107 * \param element The current element
108 * \param scv The sub-control volume inside the element.
109 * \param elemSol The solution at the dofs connected to the element.
110 * \param compIdx The solid component index
111 * \return the volume fraction of the inert solid component with index compIdx
112 *
113 * \note This overload is enabled if there are only inert solid components
114 * and the user did not choose to implement a reactiveVolumeFractionAtPos
115 * function. The reactive volume fraction is zero in this case.
116 */
117 template<class SolidSystem, class ElementSolution,
118 std::enable_if_t< SolidSystem::isInert() &&
119 !decltype(isValid(Detail::hasReactiveVolumeFractionAtPos<GlobalPosition, SolidSystem>())
120 (std::declval<Implementation>()))::value, int > = 0 >
121 Scalar reactiveVolumeFraction(const Element& element,
122 const SubControlVolume& scv,
123 const ElementSolution& elemSol,
124 int compIdx) const
125 { return 0.0; }
126
127 //! overload for the case of reactive solids or user-provided overload
128 template<class SolidSystem, class ElementSolution,
129 std::enable_if_t< !SolidSystem::isInert() ||
130 decltype(isValid(Detail::hasReactiveVolumeFractionAtPos<GlobalPosition, SolidSystem>())
131 (std::declval<Implementation>()))::value, int > = 0 >
132 Scalar reactiveVolumeFraction(const Element& element,
133 const SubControlVolume& scv,
134 const ElementSolution& elemSol,
135 int compIdx) const
136 {
137 static_assert(decltype(isValid(Detail::hasReactiveVolumeFractionAtPos<GlobalPosition, SolidSystem>())(this->asImp_()))::value," \n\n"
138 " Your spatial params class has to either implement\n\n"
139 " template<class SolidSystem>\n"
140 " Scalar inertVolumeFractionAtPos(const GlobalPosition& globalPos, int compIdx) const\n\n"
141 " or overload this function\n\n"
142 " template<class SolidSystem, class ElementSolution>\n"
143 " Scalar inertVolumeFraction(const Element& element,\n"
144 " const SubControlVolume& scv,\n"
145 " const ElementSolution& elemSol,\n"
146 " int compIdx) const\n\n");
147
148 return this->asImp_().template reactiveVolumeFractionAtPos<SolidSystem>(scv.center(), compIdx);
149 }
150
151 /*!
152 * \brief Define the Lame parameters
153 * \note These are possibly solution dependent and are evaluated
154 * for an integration point inside the element. Therefore,
155 * a flux variables cache object is passed to this function
156 * containing data on shape functions at the integration point.
157 *
158 * \param element The current element
159 * \param fvGeometry The local finite volume geometry
160 * \param elemVolVars Primary/Secondary variables inside the element
161 * \param fluxVarsCache Contains data on shape functions at the integration point
162 * \return lame parameters
163 */
164 template<class ElemVolVars, class FluxVarsCache>
165 decltype(auto) lameParams(const Element& element,
166 const FVElementGeometry& fvGeometry,
167 const ElemVolVars& elemVolVars,
168 const FluxVarsCache& fluxVarsCache) const
169 {
170 static_assert(decltype(isValid(Detail::hasLameParamsAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
171 " Your spatial params class has to either implement\n\n"
172 " const LameParams& lameParamsAtPos(const GlobalPosition& globalPos) const\n\n"
173 " or overload this function\n\n"
174 " template<class ElementSolution>\n"
175 " const LameParams& lameParams(const Element& element,\n"
176 " const FVElementGeometry& fvGeometry,\n"
177 " const ElemVolVars& elemVolVars,\n"
178 " const FluxVarsCache& fluxVarsCache) const\n\n");
179
180 1197376 return this->asImp_().lameParamsAtPos(fluxVarsCache.ipGlobal());
181 }
182
183 /*!
184 * \brief Returns the Biot coefficient in an element
185 * \note This is possibly solution dependent and is evaluated
186 * for an integration point inside the element. Therefore,
187 * a flux variables cache object is passed to this function
188 * containing data on shape functions at the integration point.
189 *
190 * \param element The current element
191 * \param fvGeometry The local finite volume geometry
192 * \param elemVolVars Primary/Secondary variables inside the element
193 * \param fluxVarsCache Contains data on shape functions at the integration point
194 * \return Biot coefficient
195 */
196 template<class ElemVolVars, class FluxVarsCache>
197 Scalar biotCoefficient(const Element& element,
198 const FVElementGeometry& fvGeometry,
199 const ElemVolVars& elemVolVars,
200 const FluxVarsCache& fluxVarsCache) const
201 {
202 static_assert(decltype(isValid(Detail::hasBiotCoeffAtPos<GlobalPosition>())(this->asImp_()))::value," \n\n"
203 " Your spatial params class has to either implement\n\n"
204 " const LameParams& biotCoefficientAtPos(const GlobalPosition& globalPos) const\n\n"
205 " or overload this function\n\n"
206 " template<class ElementSolution>\n"
207 " const LameParams& biotCoefficient(const Element& element,\n"
208 " const FVElementGeometry& fvGeometry,\n"
209 " const ElemVolVars& elemVolVars,\n"
210 " const FluxVarsCache& fluxVarsCache) const\n\n");
211
212 1197176 return this->asImp_().biotCoefficientAtPos(fluxVarsCache.ipGlobal());
213 }
214 };
215
216 } // end namespace Dumux
217
218 #endif
219