GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/freeflow/navierstokes/volumevariables.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 9 27 33.3%
Functions: 0 137 0.0%
Branches: 80 188 42.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 NavierStokesModel
10 *
11 * \copydoc Dumux::NavierStokesVolumeVariables
12 */
13 #ifndef DUMUX_NAVIERSTOKES_VOLUME_VARIABLES_HH
14 #define DUMUX_NAVIERSTOKES_VOLUME_VARIABLES_HH
15
16 #include <dumux/freeflow/volumevariables.hh>
17
18 namespace Dumux {
19
20 /*!
21 * \ingroup NavierStokesModel
22 * \brief Volume variables for the single-phase Navier-Stokes model.
23 */
24 template <class Traits>
25
3/6
✓ Branch 1 taken 51340 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 51340 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 51340 times.
✗ Branch 8 not taken.
169980 class NavierStokesVolumeVariables : public FreeFlowVolumeVariables< Traits, NavierStokesVolumeVariables<Traits> >
26 {
27 using ThisType = NavierStokesVolumeVariables<Traits>;
28 using ParentType = FreeFlowVolumeVariables<Traits, ThisType>;
29
30 using Scalar = typename Traits::PrimaryVariables::value_type;
31
32 public:
33 //! export the underlying fluid system
34 using FluidSystem = typename Traits::FluidSystem;
35 //! export the fluid state type
36 using FluidState = typename Traits::FluidState;
37 //! export the indices type
38 using Indices = typename Traits::ModelTraits::Indices;
39
40 /*!
41 * \brief Update all quantities for a given control volume
42 *
43 * \param elemSol A vector containing all primary variables connected to the element
44 * \param problem The object specifying the problem which ought to
45 * be simulated
46 * \param element An element which contains part of the control volume
47 * \param scv The sub-control volume
48 */
49 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
50 void update(const ElementSolution& elemSol,
51 const Problem& problem,
52 const Element& element,
53 const SubControlVolume& scv)
54 {
55
7/14
✓ Branch 1 taken 735280 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 307760 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3186380 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1319840 times.
✓ Branch 11 taken 73500 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 37120 times.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 334400 times.
✗ Branch 18 not taken.
68986804 ParentType::update(elemSol, problem, element, scv);
56
7/14
✓ Branch 1 taken 735280 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 307760 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3186380 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1319840 times.
✓ Branch 11 taken 73500 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 37120 times.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 334400 times.
✗ Branch 18 not taken.
68986804 completeFluidState(elemSol, problem, element, scv, fluidState_);
57 }
58
59 /*!
60 * \brief Update the fluid state
61 */
62 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
63 static void completeFluidState(const ElementSolution& elemSol,
64 const Problem& problem,
65 const Element& element,
66 const SubControlVolume& scv,
67 FluidState& fluidState)
68 {
69 const Scalar t = ParentType::temperature(elemSol, problem, element, scv);
70 fluidState.setTemperature(t);
71
72 fluidState.setPressure(0, elemSol[0][Indices::pressureIdx]);
73
74 // saturation in a single phase is always 1 and thus redundant
75 // to set. But since we use the fluid state shared by the
76 // immiscible multi-phase models, so we have to set it here...
77 fluidState.setSaturation(0, 1.0);
78
79 typename FluidSystem::ParameterCache paramCache;
80 paramCache.updateAll(fluidState);
81
82 Scalar value = FluidSystem::density(fluidState, paramCache, 0);
83 fluidState.setDensity(0, value);
84
85 value = FluidSystem::viscosity(fluidState, paramCache, 0);
86 fluidState.setViscosity(0, value);
87
88 // compute and set the enthalpy
89 value = ParentType::enthalpy(fluidState, paramCache);
90 fluidState.setEnthalpy(0, value);
91 }
92
93 /*!
94 * \brief Return the effective pressure \f$\mathrm{[Pa]}\f$ of a given phase within
95 * the control volume.
96 */
97 Scalar pressure(int phaseIdx = 0) const
98 97038370 { return fluidState_.pressure(0); }
99
100 /*!
101 * \brief Return the mass density \f$\mathrm{[kg/m^3]}\f$ of a given phase within the
102 * control volume.
103 */
104 Scalar density(int phaseIdx = 0) const
105
36/79
✓ Branch 1 taken 2216760 times.
✓ Branch 2 taken 1678432 times.
✓ Branch 4 taken 71757 times.
✓ Branch 5 taken 14039 times.
✓ Branch 6 taken 222656 times.
✓ Branch 7 taken 3848768 times.
✓ Branch 8 taken 16907456 times.
✓ Branch 9 taken 83252480 times.
✓ Branch 10 taken 50834088 times.
✓ Branch 11 taken 120334612 times.
✓ Branch 12 taken 43173202 times.
✓ Branch 13 taken 60803898 times.
✓ Branch 14 taken 2134010 times.
✓ Branch 15 taken 46661554 times.
✓ Branch 16 taken 1437854 times.
✓ Branch 17 taken 35034034 times.
✓ Branch 18 taken 932454 times.
✓ Branch 19 taken 28272874 times.
✓ Branch 20 taken 932454 times.
✓ Branch 21 taken 28272874 times.
✓ Branch 22 taken 970854 times.
✓ Branch 23 taken 28259434 times.
✓ Branch 24 taken 532038 times.
✓ Branch 25 taken 21210250 times.
✓ Branch 26 taken 167846 times.
✓ Branch 27 taken 8975274 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 11520 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 25344 times.
✗ Branch 33 not taken.
✓ Branch 34 taken 20032 times.
✗ Branch 35 not taken.
✓ Branch 36 taken 27872 times.
✗ Branch 37 not taken.
✓ Branch 38 taken 20032 times.
✗ Branch 39 not taken.
✓ Branch 40 taken 20032 times.
✗ Branch 41 not taken.
✓ Branch 42 taken 20032 times.
✗ Branch 43 not taken.
✓ Branch 44 taken 20032 times.
✗ Branch 45 not taken.
✓ Branch 46 taken 8512 times.
✗ Branch 47 not taken.
✓ Branch 48 taken 8512 times.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 75 not taken.
✗ Branch 76 not taken.
✗ Branch 77 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
1970935210 { return fluidState_.density(0); }
106
107 /*!
108 * \brief Return temperature \f$\mathrm{[K]}\f$ inside the sub-control volume.
109 *
110 */
111 Scalar temperature() const
112 70151904 { return fluidState_.temperature(); }
113
114 /*!
115 * \brief Returns the molar mass of a given phase within the
116 * control volume.
117 */
118 Scalar molarMass(int phaseIdx = 0) const
119 {
120 return fluidState_.averageMolarMass(0);
121 }
122
123 /*!
124 * \brief Return the dynamic viscosity \f$\mathrm{[Pa s]}\f$ of the fluid within the
125 * control volume.
126 */
127 Scalar viscosity(int phaseIdx = 0) const
128
27/53
✓ Branch 1 taken 3700630 times.
✓ Branch 2 taken 64006518 times.
✓ Branch 3 taken 12504490 times.
✓ Branch 4 taken 63989686 times.
✓ Branch 5 taken 12067160 times.
✓ Branch 6 taken 71391768 times.
✓ Branch 7 taken 12067160 times.
✓ Branch 8 taken 71391768 times.
✓ Branch 9 taken 9045782 times.
✓ Branch 10 taken 16135370 times.
✓ Branch 11 taken 150822 times.
✓ Branch 12 taken 16100266 times.
✓ Branch 13 taken 150822 times.
✓ Branch 14 taken 16100266 times.
✓ Branch 15 taken 150822 times.
✓ Branch 16 taken 16100266 times.
✓ Branch 17 taken 150822 times.
✓ Branch 18 taken 16100266 times.
✓ Branch 19 taken 150822 times.
✓ Branch 20 taken 16100266 times.
✓ Branch 21 taken 20032 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 20032 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 20032 times.
✗ Branch 26 not taken.
✓ Branch 27 taken 20032 times.
✗ Branch 28 not taken.
✓ Branch 29 taken 20032 times.
✗ Branch 30 not taken.
✓ Branch 31 taken 20032 times.
✗ Branch 32 not taken.
✓ Branch 33 taken 20032 times.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 50 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
947849998 { return fluidState_.viscosity(0); }
129
130 /*!
131 * \brief Return the effective dynamic viscosity \f$\mathrm{[Pa s]}\f$ of the fluid within the
132 * control volume.
133 */
134 Scalar effectiveViscosity() const
135 79879758 { return viscosity(); }
136
137 /*!
138 * \brief Return the fluid state of the control volume.
139 */
140 const FluidState& fluidState() const
141 183580392 { return fluidState_; }
142
143 protected:
144 FluidState fluidState_;
145 };
146
147 } // end namespace Dumux
148
149 #endif
150