GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/2pncmin/isothermal/spatialparams.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 15 27 55.6%
Functions: 4 18 22.2%
Branches: 17 44 38.6%

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 TwoPNCMinTests
10 * \brief Spatial parameters for the dissolution problem where water is injected in a for flushing precipitated salt clogging a gas reservoir.
11 */
12
13 #ifndef DUMUX_INJECTION_SPATIAL_PARAMETERS_HH
14 #define DUMUX_INJECTION_SPATIAL_PARAMETERS_HH
15
16 #include <dumux/porousmediumflow/fvspatialparamsmp.hh>
17 #include <dumux/material/fluidmatrixinteractions/2p/brookscorey.hh>
18 #include <dumux/material/fluidmatrixinteractions/porosityprecipitation.hh>
19 #include <dumux/material/fluidmatrixinteractions/permeabilitykozenycarman.hh>
20
21 namespace Dumux {
22
23 /*!
24 * \ingroup TwoPNCMinTests
25 * \brief Spatial parameters for the dissolution problem
26 * where water is injected in a for flushing precipitated salt clogging a gas reservoir.
27 */
28 template<class GridGeometry, class Scalar>
29
1/6
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
2 class DissolutionSpatialParams
30 : public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar,
31 DissolutionSpatialParams<GridGeometry, Scalar>>
32 {
33 using GridView = typename GridGeometry::GridView;
34 using FVElementGeometry = typename GridGeometry::LocalView;
35 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
36 using Element = typename GridView::template Codim<0>::Entity;
37
38 using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar,
39 DissolutionSpatialParams<GridGeometry, Scalar>>;
40
41 using PcKrSwCurve = FluidMatrix::BrooksCoreyDefault<Scalar>;
42
43 using GlobalPosition = typename SubControlVolume::GlobalPosition;
44
45 public:
46 // type used for the permeability (i.e. tensor or scalar)
47 using PermeabilityType = Scalar;
48
49 2 DissolutionSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
50 : ParentType(gridGeometry)
51
7/18
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 2 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 2 times.
✓ Branch 18 taken 2 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
6 , pcKrSwCurve_("SpatialParams")
52 {
53
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 solubilityLimit_ = getParam<Scalar>("SpatialParams.SolubilityLimit", 0.26);
54
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 referencePorosity_ = getParam<Scalar>("SpatialParams.referencePorosity", 0.11);
55
1/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
2 referencePermeability_ = getParam<Scalar>("SpatialParams.referencePermeability", 2.23e-14);
56
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 temperature_ = getParam<Scalar>("Problem.Temperature");
57 2 }
58
59 /*!
60 * \brief Returns the temperature within the domain.
61 *
62 * \param element The finite volume element
63 * \param scv The sub-control volume
64 * \param elemSol The element solution
65 */
66 template<class ElementSolution>
67 Scalar temperature(const Element& element,
68 const SubControlVolume& scv,
69 const ElementSolution& elemSol) const
70 { return temperature_; }
71
72 /*!
73 * \brief Defines the minimum porosity \f$[-]\f$ distribution
74 *
75 * \param element The finite element
76 * \param scv The sub-control volume
77 */
78 Scalar minimalPorosity(const Element& element, const SubControlVolume &scv) const
79 { return 1e-5; }
80
81 /*!
82 * \brief Defines the volume fraction of the inert component
83 *
84 * \param globalPos The global position in the domain
85 * \param compIdx The index of the inert solid component
86 */
87 template<class SolidSystem>
88 Scalar inertVolumeFractionAtPos(const GlobalPosition& globalPos, int compIdx) const
89 2217181 { return 1.0-referencePorosity_; }
90
91 /*!
92 * \brief Defines the reference porosity \f$[-]\f$ distribution.
93 *
94 * This is the porosity of the porous medium without any of the
95 * considered solid phases.
96 *
97 * \param element The finite element
98 * \param scv The sub-control volume
99 */
100 Scalar referencePorosity(const Element& element, const SubControlVolume &scv) const
101 { return referencePorosity_; }
102
103 /*! Intrinsic permeability tensor K \f$[m^2]\f$ depending
104 * on the position in the domain
105 *
106 * \param element The finite volume element
107 * \param scv The sub-control volume
108 * \param elemSol The element solution
109 *
110 * Solution dependent permeability function
111 */
112 template<class ElementSolution>
113 2217181 PermeabilityType permeability(const Element& element,
114 const SubControlVolume& scv,
115 const ElementSolution& elemSol) const
116 {
117
1/2
✓ Branch 2 taken 621000 times.
✗ Branch 3 not taken.
4434362 auto priVars = evalSolution(element, element.geometry(), elemSol, scv.center(), /*ignoreState=*/true);
118
119
1/2
✓ Branch 0 taken 2217181 times.
✗ Branch 1 not taken.
2217181 Scalar sumPrecipitates = priVars[/*numComp*/3];
120
121 using std::max;
122
1/2
✓ Branch 0 taken 2217181 times.
✗ Branch 1 not taken.
2217181 const auto poro = max(/*minPoro*/1e-5, referencePorosity_ - sumPrecipitates);
123 2217181 return permLaw_.evaluatePermeability(referencePermeability_, referencePorosity_, poro);
124 }
125
126 Scalar solubilityLimit() const
127 { return solubilityLimit_; }
128
129 Scalar theta(const SubControlVolume &scv) const
130 { return 10.0; }
131
132 /*!
133 * \brief Returns the fluid-matrix interaction law at a given location
134 * \param globalPos A global coordinate vector
135 */
136 auto fluidMatrixInteractionAtPos(const GlobalPosition &globalPos) const
137 {
138
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 2217181 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2217181 times.
8868724 return makeFluidMatrixInteraction(pcKrSwCurve_);
139 }
140
141 // define which phase is to be considered as the wetting phase
142 template<class FluidSystem>
143 int wettingPhaseAtPos(const GlobalPosition& globalPos) const
144 { return FluidSystem::H2OIdx; }
145
146 private:
147
148 PermeabilityKozenyCarman<PermeabilityType> permLaw_;
149
150 Scalar solubilityLimit_;
151 Scalar referencePorosity_;
152 PermeabilityType referencePermeability_ = 0.0;
153 const PcKrSwCurve pcKrSwCurve_;
154 Scalar temperature_;
155 };
156
157 } // end namespace Dumux
158
159 #endif
160