GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/multidomain/poromechanics/el2p/spatialparams_poroelastic.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 9 29 31.0%
Functions: 1 6 16.7%
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 PoromechanicsTests
10 * \brief Definition of the spatial parameters for the poro-elastic problem.
11 */
12 #ifndef DUMUX_POROELASTIC_SPATIAL_PARAMS_HH
13 #define DUMUX_POROELASTIC_SPATIAL_PARAMS_HH
14
15 #include <dumux/geomechanics/lameparams.hh>
16 #include <dumux/geomechanics/poroelastic/fvspatialparams.hh>
17 #include <dumux/material/fluidmatrixinteractions/porositydeformation.hh>
18
19 namespace Dumux {
20
21 /*!
22 * \ingroup PoromechanicsTests
23 * \brief Definition of the spatial parameters for the poro-elastic
24 * sub-problem in the coupled poro-mechanical el2p problem.
25 */
26 template<class Scalar, class GridGeometry, class CouplingManager, class FluidSystem>
27 class PoroElasticSpatialParams : public FVPoroElasticSpatialParams< GridGeometry,
28 Scalar,
29 PoroElasticSpatialParams<Scalar, GridGeometry, CouplingManager,
30 FluidSystem> >
31 {
32 using ThisType = PoroElasticSpatialParams<Scalar, GridGeometry, CouplingManager, FluidSystem>;
33 using ParentType = FVPoroElasticSpatialParams<GridGeometry, Scalar, ThisType>;
34
35 using SubControlVolume = typename GridGeometry::SubControlVolume;
36 using GridView = typename GridGeometry::GridView;
37 using Element = typename GridView::template Codim<0>::Entity;
38 using FVElementGeometry = typename GridGeometry::LocalView;
39 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
40
41 public:
42 //! Export the type of the lame parameters
43 using LameParams = Dumux::LameParams<Scalar>;
44
45 2 PoroElasticSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry,
46 std::shared_ptr<CouplingManager> couplingManagerPtr)
47 : ParentType(gridGeometry)
48 , couplingManager_(couplingManagerPtr)
49
3/12
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
4 , initPorosity_(getParam<Scalar>("SpatialParams.InitialPorosity"))
50 {
51 // Young's modulus [Pa]
52 2 Scalar E = 6.e9;
53 // Poisson's ratio [-]
54 2 Scalar nu = 0.2;
55 // Lame parameters [Pa]
56 2 lameParams_.setLambda( (E * nu) / ((1 + nu)*(1 - 2 * nu)) );
57 2 lameParams_.setMu( E / (2 * (1 + nu)) );
58 2 }
59
60 //! Defines the Lame parameters.
61 const LameParams& lameParamsAtPos(const GlobalPosition& globalPos) const
62 1176576 { return lameParams_; }
63
64 //! Returns the porosity of the porous medium.
65 template<class ElementSolution>
66 Scalar porosity(const Element& element,
67 const SubControlVolume& scv,
68 const ElementSolution& elemSol) const
69
70 {
71 430080 return PorosityDeformation<Scalar>::evaluatePorosity(this->gridGeometry(), element, scv, elemSol, initPorosity_);
72 }
73
74 /*!
75 * \brief Returns the effective fluid density.
76 */
77 Scalar effectiveFluidDensity(const Element& element, const SubControlVolume& scv) const
78 {
79 // get porous medium flow volume variables from coupling manager
80 const auto& pmFlowVolVars = couplingManager().getPMFlowVolVars(element);
81
82 Scalar wPhaseDensity = pmFlowVolVars.density(FluidSystem::phase0Idx);
83 Scalar nPhaseDensity = pmFlowVolVars.density(FluidSystem::phase1Idx);
84 Scalar Sw = pmFlowVolVars.saturation(FluidSystem::phase0Idx);
85 Scalar Sn = pmFlowVolVars.saturation(FluidSystem::phase1Idx);
86 return (wPhaseDensity * Sw + nPhaseDensity * Sn);
87 }
88
89 /*!
90 * \brief Returns the effective pore pressure.
91 */
92 template<class ElementVolumeVariables, class FluxVarsCache >
93 Scalar effectivePorePressure(const Element& element,
94 const FVElementGeometry& fvGeometry,
95 const ElementVolumeVariables& elemVolVars,
96 const FluxVarsCache& fluxVarsCache) const
97 {
98 // get porous medium flow volume variables from coupling manager
99 const auto& pmFlowVolVars = couplingManager().getPMFlowVolVars(element);
100
101 Scalar pw = pmFlowVolVars.pressure(FluidSystem::phase0Idx);
102 Scalar pn = pmFlowVolVars.pressure(FluidSystem::phase1Idx);
103 Scalar Sw = pmFlowVolVars.saturation(FluidSystem::phase0Idx);
104 Scalar Sn = pmFlowVolVars.saturation(FluidSystem::phase1Idx);
105 return (pw * Sw + pn * Sn);
106 }
107
108 //! Returns the Biot coefficient of the porous medium.
109 Scalar biotCoefficientAtPos(const GlobalPosition& globalPos) const
110 { return 1.0; }
111
112 //! Returns the temperature in the domain at the given position
113 Scalar temperatureAtPos(const GlobalPosition& globalPos) const
114 { return 273.15 + 10; }
115
116 //! Returns reference to the coupling manager.
117 const CouplingManager& couplingManager() const
118 { return *couplingManager_; }
119
120 private:
121 std::shared_ptr<const CouplingManager> couplingManager_;
122 Scalar initPorosity_;
123 LameParams lameParams_;
124 };
125
126 } // end namespace Dumux
127
128 #endif
129