GCC Code Coverage Report


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