GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/geomechanics/poroelastic/spatialparams.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 14 24 58.3%
Functions: 2 6 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 GeomechanicsTests
10 * \brief Definition of the spatial parameters for the poro-elastic problem.
11 */
12
13 #ifndef DUMUX_POROELASTIC_SPATIAL_PARAMS_HH
14 #define DUMUX_POROELASTIC_SPATIAL_PARAMS_HH
15
16 #include <dumux/geomechanics/lameparams.hh>
17 #include <dumux/geomechanics/poroelastic/fvspatialparams.hh>
18 #include <dumux/material/fluidmatrixinteractions/porositydeformation.hh>
19
20 namespace Dumux {
21
22 /*!
23 * \ingroup GeomechanicsTests
24 * \brief Definition of the spatial parameters for the poro-elastic problem.
25 */
26 template<class Scalar, class GridGeometry, class FluidSystem, class PrimaryVariables, class Indices>
27
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 PoroElasticSpatialParams : public FVPoroElasticSpatialParams< GridGeometry,
28 Scalar,
29 PoroElasticSpatialParams<Scalar, GridGeometry, FluidSystem, PrimaryVariables, Indices> >
30 {
31 using ThisType = PoroElasticSpatialParams<Scalar, GridGeometry, FluidSystem, PrimaryVariables, Indices>;
32 using ParentType = FVPoroElasticSpatialParams<GridGeometry, Scalar, ThisType>;
33
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 static constexpr Scalar pi = M_PI;
40 public:
41 //! Export the type of the lame parameters
42 using LameParams = Dumux::LameParams<Scalar>;
43
44 1 PoroElasticSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
45
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)
46 {
47 1 lameParams_.setLambda(2);
48 1 lameParams_.setMu(2);
49 1 }
50
51 //! Defines the Lame parameters.
52 const LameParams& lameParamsAtPos(const GlobalPosition& globalPos) const
53 14800 { return lameParams_; }
54
55 //! Returns the porosity of the porous medium.
56 template< class ElemSol >
57 Scalar porosity(const Element& element,
58 const SubControlVolume& scv,
59 const ElemSol& elemSol) const
60 {
61 PorosityDeformation<Scalar> poroLaw;
62 8000 return poroLaw.evaluatePorosity(this->gridGeometry(), element, scv, elemSol, /*refPoro*/0.3);
63 }
64
65 /*!
66 * \brief Returns the effective pore pressure
67 *
68 * \note We use the x-displacement as pressure solution. The shift to
69 * higher values is done to see a more pronounced effect in stresses.
70 *
71 * \param globalPos The global position
72 */
73 Scalar effectivePorePressureAtPos(const GlobalPosition& globalPos) const
74 {
75 using std::sin;
76 const auto x = globalPos[0];
77 const auto y = globalPos[1];
78 return (x-x*x)*sin(2.*pi*y) + 10;
79 }
80
81 /*!
82 * \brief Returns the effective pore pressure gradient
83 * \param globalPos The global position
84 */
85 7200 GlobalPosition effectivePorePressureGradient(const GlobalPosition& globalPos) const
86 {
87 using std::sin;
88 using std::cos;
89 14400 const auto x = globalPos[0];
90 14400 const auto y = globalPos[1];
91 return {{
92 7200 (1.-2.*x)*sin(2.*pi*y),
93 7200 2.*pi*(x-x*x)*cos(2.*pi*y),
94 21600 }};
95 }
96
97 /*!
98 * \brief Returns the effective fluid density.
99 *
100 * \param globalPos The global position
101 */
102 Scalar effectiveFluidDensityAtPos(const GlobalPosition& globalPos) const
103 {
104 return FluidSystem::density(
105 effectivePorePressureAtPos(globalPos),
106 this->temperatureAtPos(globalPos)
107 );
108 }
109
110 //! Returns the Biot coefficient of the porous medium.
111 Scalar biotCoefficientAtPos(const GlobalPosition& globalPos) const
112 { return 1.0; }
113
114 private:
115 LameParams lameParams_;
116 };
117
118 } // end namespace Dumux
119
120 #endif
121