GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/porousmediumflow/1p/volumevariables.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 32 38 84.2%
Functions: 25 252 9.9%
Branches: 179 262 68.3%

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 OnePModel
10 * \brief Class to encapsulate the quantities required by the single-phase
11 * porous medium flow model per sub-control volume.
12 */
13
14 #ifndef DUMUX_1P_VOLUME_VARIABLES_HH
15 #define DUMUX_1P_VOLUME_VARIABLES_HH
16
17 #include <dumux/porousmediumflow/volumevariables.hh>
18 #include <dumux/porousmediumflow/nonisothermal/volumevariables.hh>
19 #include <dumux/material/fluidstates/immiscible.hh>
20 #include <dumux/material/solidstates/updatesolidvolumefractions.hh>
21
22 namespace Dumux {
23
24 /*!
25 * \ingroup OnePModel
26 * \brief Contains the quantities which are constant within a
27 * sub-control volume in the one-phase model.
28 *
29 * \tparam Traits Class encapsulating types to be used
30 */
31 template<class Traits>
32
36/44
✓ Branch 0 taken 5124 times.
✓ Branch 1 taken 244335 times.
✓ Branch 2 taken 5124 times.
✓ Branch 3 taken 239189 times.
✓ Branch 4 taken 10270 times.
✓ Branch 5 taken 239189 times.
✓ Branch 6 taken 13600 times.
✓ Branch 7 taken 189696 times.
✓ Branch 8 taken 13600 times.
✓ Branch 9 taken 18024 times.
✓ Branch 10 taken 17359 times.
✓ Branch 11 taken 18024 times.
✓ Branch 12 taken 2239 times.
✓ Branch 13 taken 12856 times.
✓ Branch 14 taken 2239 times.
✓ Branch 15 taken 63579 times.
✓ Branch 16 taken 5104 times.
✓ Branch 17 taken 60499 times.
✓ Branch 18 taken 40 times.
✓ Branch 19 taken 65259 times.
✓ Branch 20 taken 40 times.
✓ Branch 21 taken 608 times.
✓ Branch 22 taken 482495 times.
✓ Branch 23 taken 608 times.
✓ Branch 24 taken 8112 times.
✓ Branch 25 taken 477951 times.
✓ Branch 26 taken 8112 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 486063 times.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✓ Branch 31 taken 100760 times.
✗ Branch 32 not taken.
✓ Branch 33 taken 3384 times.
✓ Branch 34 taken 97376 times.
✓ Branch 35 taken 3384 times.
✓ Branch 37 taken 97376 times.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✓ Branch 40 taken 1354 times.
✗ Branch 41 not taken.
✓ Branch 42 taken 1354 times.
✗ Branch 43 not taken.
✓ Branch 44 taken 1354 times.
62652905 class OnePVolumeVariables
33 : public PorousMediumFlowVolumeVariables< Traits>
34 , public EnergyVolumeVariables<Traits, OnePVolumeVariables<Traits> >
35 {
36 using ThisType = OnePVolumeVariables<Traits>;
37 using ParentType = PorousMediumFlowVolumeVariables<Traits>;
38 using EnergyVolVars = EnergyVolumeVariables<Traits, OnePVolumeVariables<Traits> >;
39
40 using Scalar = typename Traits::PrimaryVariables::value_type;
41 using PermeabilityType = typename Traits::PermeabilityType;
42 static constexpr int numFluidComps = ParentType::numFluidComponents();
43 public:
44 //! Export the underlying fluid system
45 using FluidSystem = typename Traits::FluidSystem;
46 //! Export the fluid state type
47 using FluidState = typename Traits::FluidState;
48 //! Export the indices
49 using Indices = typename Traits::ModelTraits::Indices;
50 //! Export type of solid state
51 using SolidState = typename Traits::SolidState;
52 //! Export type of solid system
53 using SolidSystem = typename Traits::SolidSystem;
54
55 /*!
56 * \brief Updates all quantities for a given control volume.
57 *
58 * \param elemSol A vector containing all primary variables connected to the element
59 * \param problem The object specifying the problem which ought to
60 * be simulated
61 * \param element An element which contains part of the control volume
62 * \param scv The sub-control volume
63 */
64 template<class ElemSol, class Problem, class Element, class Scv>
65 6184722 void update(const ElemSol& elemSol,
66 const Problem& problem,
67 const Element& element,
68 const Scv& scv)
69 {
70
15/26
✗ Branch 0 not taken.
✓ Branch 1 taken 12056 times.
✓ Branch 2 taken 2940 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 85580 times.
✓ Branch 5 taken 6864 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1136 times.
✓ Branch 9 taken 15888 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1765 times.
✓ Branch 12 taken 1056 times.
✗ Branch 13 not taken.
✓ Branch 16 taken 542815 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 12 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 481261 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 48 times.
✓ Branch 25 taken 3384 times.
✗ Branch 26 not taken.
✓ Branch 29 taken 21948 times.
✗ Branch 30 not taken.
✓ Branch 34 taken 528 times.
✗ Branch 35 not taken.
14754145 ParentType::update(elemSol, problem, element, scv);
71
72 // porosity
73
14/24
✓ Branch 1 taken 12056 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 73420 times.
✓ Branch 5 taken 6864 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1056 times.
✓ Branch 9 taken 15888 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1685 times.
✓ Branch 12 taken 1056 times.
✗ Branch 13 not taken.
✓ Branch 16 taken 542815 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 12 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 481261 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 48 times.
✓ Branch 25 taken 3384 times.
✗ Branch 26 not taken.
✓ Branch 29 taken 21948 times.
✗ Branch 30 not taken.
✓ Branch 34 taken 528 times.
✗ Branch 35 not taken.
18078027 completeFluidState(elemSol, problem, element, scv, fluidState_, solidState_);
74
75 // porosity and permeability
76
15/20
✓ Branch 0 taken 3370 times.
✓ Branch 1 taken 8686 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1709 times.
✓ Branch 4 taken 1242 times.
✓ Branch 5 taken 6126 times.
✓ Branch 6 taken 528 times.
✓ Branch 7 taken 5638 times.
✓ Branch 8 taken 528 times.
✓ Branch 9 taken 5029 times.
✓ Branch 10 taken 12 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 477999 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1170 times.
✓ Branch 17 taken 24 times.
✓ Branch 18 taken 3384 times.
✓ Branch 19 taken 528 times.
✗ Branch 20 not taken.
17905587 updateSolidVolumeFractions(elemSol, problem, element, scv, solidState_, numFluidComps);
77 15156289 EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv, solidState_);
78
27/40
✓ Branch 0 taken 3370 times.
✓ Branch 1 taken 8766 times.
✓ Branch 2 taken 3370 times.
✓ Branch 3 taken 6190 times.
✓ Branch 4 taken 5516 times.
✓ Branch 5 taken 1685 times.
✓ Branch 6 taken 2964 times.
✓ Branch 7 taken 152 times.
✓ Branch 8 taken 2879 times.
✓ Branch 9 taken 5670 times.
✓ Branch 10 taken 1778 times.
✓ Branch 11 taken 6126 times.
✓ Branch 12 taken 528 times.
✓ Branch 13 taken 6166 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 6166 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 5557 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 12 times.
✓ Branch 20 taken 5029 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 12 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 477999 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 477999 times.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✓ Branch 31 taken 1170 times.
✗ Branch 32 not taken.
✓ Branch 33 taken 1194 times.
✗ Branch 34 not taken.
✓ Branch 35 taken 3408 times.
✗ Branch 36 not taken.
✓ Branch 37 taken 528 times.
✓ Branch 38 taken 3384 times.
✗ Branch 39 not taken.
✓ Branch 40 taken 528 times.
✗ Branch 41 not taken.
26017772 permeability_ = problem.spatialParams().permeability(element, scv, elemSol);
79
16/20
✓ Branch 0 taken 3370 times.
✓ Branch 1 taken 8766 times.
✓ Branch 2 taken 2940 times.
✓ Branch 3 taken 1709 times.
✓ Branch 4 taken 1322 times.
✓ Branch 5 taken 6126 times.
✓ Branch 6 taken 528 times.
✓ Branch 7 taken 5638 times.
✓ Branch 8 taken 528 times.
✓ Branch 9 taken 5029 times.
✓ Branch 10 taken 12 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 477999 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1170 times.
✓ Branch 17 taken 24 times.
✓ Branch 18 taken 3384 times.
✓ Branch 19 taken 528 times.
✗ Branch 20 not taken.
14579139 EnergyVolVars::updateEffectiveThermalConductivity();
80 6184722 }
81
82 /*!
83 * \brief Sets complete fluid state
84 *
85 * \param elemSol A vector containing all primary variables connected to the element
86 * \param problem The object specifying the problem which ought to
87 * be simulated
88 * \param element An element which contains part of the control volume
89 * \param scv The sub-control volume
90 * \param fluidState A container with the current (physical) state of the fluid
91 * \param solidState A container with the current (physical) state of the solid
92 */
93 template<class ElemSol, class Problem, class Element, class Scv>
94 231930 void completeFluidState(const ElemSol& elemSol,
95 const Problem& problem,
96 const Element& element,
97 const Scv& scv,
98 FluidState& fluidState,
99 SolidState& solidState)
100 {
101
4/11
✗ Branch 1 not taken.
✓ Branch 2 taken 2940 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 12160 times.
✗ Branch 8 not taken.
✓ Branch 11 taken 80 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 80 times.
✗ Branch 15 not taken.
2751524 EnergyVolVars::updateTemperature(elemSol, problem, element, scv, fluidState, solidState);
102
3/5
✓ Branch 1 taken 80 times.
✓ Branch 2 taken 2940 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 80 times.
✗ Branch 5 not taken.
2739276 fluidState.setSaturation(/*phaseIdx=*/0, 1.);
103
104
3/5
✓ Branch 1 taken 80 times.
✓ Branch 2 taken 2940 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 80 times.
✗ Branch 5 not taken.
2739276 const auto& priVars = elemSol[scv.localDofIndex()];
105
3/5
✓ Branch 1 taken 80 times.
✓ Branch 2 taken 2940 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 80 times.
✗ Branch 5 not taken.
2971206 fluidState.setPressure(/*phaseIdx=*/0, priVars[Indices::pressureIdx]);
106
107 // saturation in a single phase is always 1 and thus redundant
108 // to set. But since we use the fluid state shared by the
109 // immiscible multi-phase models, so we have to set it here...
110 3153668 fluidState.setSaturation(/*phaseIdx=*/0, 1.0);
111
112 typename FluidSystem::ParameterCache paramCache;
113 3153668 paramCache.updatePhase(fluidState, /*phaseIdx=*/0);
114
115
3/5
✓ Branch 1 taken 80 times.
✓ Branch 2 taken 2940 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 80 times.
✗ Branch 5 not taken.
2739276 Scalar value = FluidSystem::density(fluidState, paramCache, /*phaseIdx=*/0);
116
3/5
✓ Branch 1 taken 80 times.
✓ Branch 2 taken 2940 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 80 times.
✗ Branch 5 not taken.
2739276 fluidState.setDensity(/*phaseIdx=*/0, value);
117
118
3/5
✓ Branch 1 taken 80 times.
✓ Branch 2 taken 2940 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 80 times.
✗ Branch 5 not taken.
2739276 value = FluidSystem::viscosity(fluidState, paramCache, /*phaseIdx=*/0);
119
3/5
✓ Branch 1 taken 80 times.
✓ Branch 2 taken 2940 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 80 times.
✗ Branch 5 not taken.
2739276 fluidState.setViscosity(/*phaseIdx=*/0, value);
120
121 // compute and set the enthalpy
122
0/2
✗ Branch 1 not taken.
✗ Branch 2 not taken.
3154908 value = EnergyVolVars::enthalpy(fluidState, paramCache, /*phaseIdx=*/0);
123
6/10
✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2940 times.
✓ Branch 4 taken 80 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2940 times.
✓ Branch 7 taken 80 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 80 times.
✗ Branch 11 not taken.
5478552 fluidState.setEnthalpy(/*phaseIdx=*/0, value);
124 231930 }
125
126 /*!
127 * \brief Returns the temperature \f$\mathrm{[K]}\f$ inside the sub-control volume.
128 *
129 * Note that we assume thermodynamic equilibrium, i.e. the
130 * temperatures of the rock matrix and of all fluid phases are
131 * identical.
132 */
133 Scalar temperature() const
134
1/2
✓ Branch 0 taken 284520 times.
✗ Branch 1 not taken.
3374903 { return fluidState_.temperature(); }
135
136 /*!
137 * \brief Returns the phase state for the control volume.
138 */
139 const SolidState &solidState() const
140
2/4
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 72 times.
✗ Branch 5 not taken.
7179068 { return solidState_; }
141
142 /*!
143 * \brief Returns the effective pressure \f$\mathrm{[Pa]}\f$ of a given phase within
144 * the control volume.
145 */
146 Scalar pressure(int phaseIdx = 0) const
147
9/10
✓ Branch 0 taken 4996 times.
✓ Branch 1 taken 2670479 times.
✓ Branch 2 taken 4996 times.
✓ Branch 3 taken 2584869 times.
✓ Branch 4 taken 32058562 times.
✓ Branch 5 taken 1092264 times.
✓ Branch 6 taken 32058562 times.
✓ Branch 7 taken 1092264 times.
✓ Branch 8 taken 57 times.
✗ Branch 9 not taken.
230864327 { return fluidState_.pressure(phaseIdx); }
148
149 /*!
150 * \brief Returns the saturation.
151 */
152 Scalar saturation(int phaseIdx = 0) const
153 { return 1.0; }
154
155 /*!
156 * \brief Returns the mass density \f$\mathrm{[kg/m^3]}\f$ of a given phase within the
157 * control volume.
158 */
159 Scalar density(int phaseIdx = 0) const
160
8/8
✓ Branch 0 taken 1002843 times.
✓ Branch 1 taken 32026383 times.
✓ Branch 2 taken 64937 times.
✓ Branch 3 taken 31972671 times.
✓ Branch 4 taken 935716 times.
✓ Branch 5 taken 1604467 times.
✓ Branch 6 taken 932611 times.
✓ Branch 7 taken 1590821 times.
271934175 { return fluidState_.density(phaseIdx); }
161
162 /*!
163 * \brief Returns the dynamic viscosity \f$\mathrm{[Pa s]}\f$ of the fluid within the
164 * control volume.
165 */
166 Scalar viscosity(int phaseIdx = 0) const
167
4/4
✓ Branch 0 taken 955633 times.
✓ Branch 1 taken 33547664 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 31948673 times.
66598220 { return fluidState_.viscosity(phaseIdx); }
168
169 /*!
170 * \brief Returns the mobility \f$\mathrm{[1/(Pa s)]}\f$.
171 *
172 * This function enables the use of ImplicitDarcyFluxVariables
173 * with the 1p fully implicit model, ALTHOUGH the term mobility is
174 * usually not employed in the one phase context.
175 *
176 * \param phaseIdx The phase index
177 */
178 Scalar mobility(int phaseIdx = 0) const
179
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 46770 times.
216420597 { return 1.0/fluidState_.viscosity(phaseIdx); }
180
181 /*!
182 * \brief Returns the average porosity \f$\mathrm{[-]}\f$ within the control volume.
183 */
184 Scalar porosity() const
185 32751796 { return solidState_.porosity(); }
186
187 /*!
188 * \brief Returns the permeability within the control volume in \f$[m^2]\f$.
189 */
190 const PermeabilityType& permeability() const
191 45955400 { return permeability_; }
192
193 /*!
194 * \brief Returns the fluid state of the control volume.
195 */
196 const FluidState &fluidState() const
197 11743085 { return fluidState_; }
198
199 protected:
200 FluidState fluidState_;
201 SolidState solidState_;
202 PermeabilityType permeability_;
203 };
204
205 } // end namespace Dumux
206
207 #endif
208