GCC Code Coverage Report


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