GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/multidomain/poromechanics/el2p/spatialparams_2p.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 17 22 77.3%
Functions: 3 6 50.0%
Branches: 21 54 38.9%

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 The spatial parameters class for the two-phase sub problem in the el2p test problem.
11 */
12
13 #ifndef DUMUX_2P_TEST_SPATIALPARAMS_HH
14 #define DUMUX_2P_TEST_SPATIALPARAMS_HH
15
16 #include <dumux/discretization/elementsolution.hh>
17
18 #include <dumux/porousmediumflow/fvspatialparamsmp.hh>
19 #include <dumux/material/fluidmatrixinteractions/2p/brookscorey.hh>
20 #include <dumux/material/gstatrandomfield.hh>
21 #include <dumux/material/fluidmatrixinteractions/porositydeformation.hh>
22 #include <dumux/material/fluidmatrixinteractions/permeabilitykozenycarman.hh>
23
24 namespace Dumux {
25
26 /*!
27 * \ingroup PoromechanicsTests
28 * \brief The spatial parameters class for the two-phase sub problem in the el2p test problem.
29 */
30 template<class GridGeometry, class Scalar, class CouplingManager>
31 class TwoPSpatialParams : public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar,
32 TwoPSpatialParams<GridGeometry, Scalar, CouplingManager>>
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 using ThisType = TwoPSpatialParams<GridGeometry, Scalar, CouplingManager>;
40 using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, ThisType>;
41
42 using PcKrSwCurve = FluidMatrix::BrooksCoreyDefault<Scalar>;
43
44 public:
45 // export permeability type
46 using PermeabilityType = Scalar;
47
48 2 TwoPSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry,
49 std::shared_ptr<CouplingManager> couplingManagerPtr)
50 : ParentType(gridGeometry)
51 , couplingManagerPtr_(couplingManagerPtr)
52 2 , initPermeability_(getParam<Scalar>("SpatialParams.Permeability"))
53
5/18
✓ 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 11 taken 2 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 2 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
4 , initPorosity_(getParam<Scalar>("SpatialParams.InitialPorosity"))
54 {
55 // given Van Genuchten m
56 2 const Scalar m = 0.457;
57 // Brooks Corey lambda
58 using std::pow;
59 2 const Scalar brooksCoreyLambda = m / (1 - m) * (1 - pow(0.5, 1/m));
60
61
5/12
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 2 times.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
4 auto baseParams = PcKrSwCurve::makeBasicParams("SpatialParams");
62
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 baseParams.setLambda(brooksCoreyLambda);
63
5/12
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 2 times.
✓ Branch 12 taken 2 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
4 const auto effToAbsParams = PcKrSwCurve::makeEffToAbsParams("SpatialParams");
64
65
3/6
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
2 pcKrSwCurve_ = std::make_unique<PcKrSwCurve>(baseParams, effToAbsParams);
66 2 }
67
68 //! Returns the porosity for a sub-control volume.
69 template< class ElementSolution >
70 5318080 Scalar porosity(const Element& element,
71 const SubControlVolume& scv,
72 const ElementSolution& elemSol) const
73 {
74 static constexpr auto poroMechId = CouplingManager::poroMechId;
75
76
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 5318080 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5318080 times.
10636160 const auto& poroMechGridGeom = couplingManagerPtr_->problem(poroMechId).gridGeometry();
77 15954240 const auto poroMechElemSol = elementSolution(element, couplingManagerPtr_->curSol(poroMechId), poroMechGridGeom);
78
79 // evaluate the deformation-dependent porosity at the scv center
80 10636160 return PorosityDeformation<Scalar>::evaluatePorosity(poroMechGridGeom, element, scv.center(), poroMechElemSol, initPorosity_);
81 }
82
83 //! Functions for defining the (intrinsic) permeability \f$[m^2]\f$.
84 template< class ElementSolution >
85 2659040 PermeabilityType permeability(const Element& element,
86 const SubControlVolume& scv,
87 const ElementSolution& elemSol) const
88 {
89 PermeabilityKozenyCarman<PermeabilityType> permLaw;
90 2659040 return permLaw.evaluatePermeability(initPermeability_, initPorosity_, porosity(element, scv, elemSol));
91 }
92
93 /*!
94 * \brief Returns the parameters for the material law at a given location
95 *
96 * \param globalPos The global coordinates for the given location
97 */
98 auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const
99 {
100 15954240 return makeFluidMatrixInteraction(*pcKrSwCurve_);
101 }
102
103 /*!
104 * \brief Function for defining which phase is to be considered as the wetting phase.
105 *
106 * \return the wetting phase index
107 * \param globalPos The global position
108 */
109 template<class FluidSystem>
110 int wettingPhaseAtPos(const GlobalPosition& globalPos) const
111 {
112 return FluidSystem::phase0Idx;
113 }
114
115 //! Returns reference to the coupling manager.
116 const CouplingManager& couplingManager() const
117 { return *couplingManagerPtr_; }
118
119 //! Returns the temperature in the domain at the given position
120 Scalar temperatureAtPos(const GlobalPosition& globalPos) const
121 { return 273.15 + 10; }
122
123 private:
124 std::shared_ptr<const CouplingManager> couplingManagerPtr_;
125 Scalar initPermeability_;
126 Scalar initPorosity_;
127 std::unique_ptr<const PcKrSwCurve> pcKrSwCurve_;
128 };
129
130 } // end namespace Dumux
131
132 #endif
133