GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/freeflow/navierstokes/energy/volumevariables.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 8 18 44.4%
Functions: 0 48 0.0%
Branches: 0 15 0.0%

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 FreeflowNIModel
10 * \brief Base class for the model specific class which provides
11 * access to all volume averaged quantities.
12 */
13
14 #ifndef DUMUX_FREEFLOW_NAVIER_STOKES_ENERGY_VOLUME_VARIABLES_HH
15 #define DUMUX_FREEFLOW_NAVIER_STOKES_ENERGY_VOLUME_VARIABLES_HH
16
17 #include <type_traits>
18 #include <dune/common/std/type_traits.hh>
19
20
21 namespace Dumux {
22
23 namespace Detail {
24
25 struct EmptyFreeFlowHeatCondType {};
26
27 template<bool enableEnergyBalance, class Traits>
28 struct FreeFlowHeatCondType
29 {
30 using type = EmptyFreeFlowHeatCondType;
31 };
32
33 template<class Traits>
34 struct FreeFlowHeatCondType<true, Traits>
35 {
36 using type = typename Traits::HeatConductionType;
37 };
38
39 } // end namespace Detail
40
41 /*!
42 * \ingroup FreeflowNIModel
43 * \brief The isothermal base class
44 */
45 template<class Traits, class Impl>
46 class NavierStokesEnergyVolumeVariables
47 {
48 using Scalar = typename Traits::PrimaryVariables::value_type;
49 static constexpr bool enableEnergyBalance = Traits::ModelTraits::enableEnergyBalance();
50
51 public:
52 using FluidState = typename Traits::FluidState;
53 using FluidSystem = typename Traits::FluidSystem;
54 using HeatConductionType = typename Detail::FreeFlowHeatCondType<enableEnergyBalance, Traits>::type;
55
56 /*!
57 * \brief Returns the temperature at a given sub-control volume
58 *
59 * \param elemSol A vector containing all primary variables connected to the element
60 * \param problem The object specifying the problem which ought to
61 * be simulated
62 * \param element An element which contains part of the control volume
63 * \param scv The sub-control volume
64 */
65 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
66 Scalar getTemperature(const ElementSolution& elemSol,
67 const Problem& problem,
68 const Element& element,
69 const SubControlVolume& scv) const
70 {
71 if constexpr (enableEnergyBalance)
72
0/6
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
20256345 return elemSol[scv.localDofIndex()][Traits::ModelTraits::Indices::temperatureIdx];
73 else
74
0/7
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
21031162 return problem.spatialParams().temperature(element, scv, elemSol);
75 }
76
77
78 //! The effective thermal conductivity is zero for isothermal models
79 void updateEffectiveThermalConductivity()
80 {
81 if constexpr (enableEnergyBalance)
82 14887545 lambdaEff_ = Traits::EffectiveThermalConductivityModel::effectiveThermalConductivity(asImp_());
83 }
84
85 /*!
86 * \brief Returns the total internal energy of a phase in the
87 * sub-control volume.
88 *
89 * \param phaseIdx The phase index
90 */
91 Scalar internalEnergy(const int phaseIdx = 0) const
92 {
93 if constexpr (enableEnergyBalance)
94 6930000 return asImp_().fluidState().internalEnergy(0);
95 else
96 return 0.0;
97 }
98
99 /*!
100 * \brief Returns the total enthalpy of a phase in the sub-control
101 * volume.
102 *
103 * \param phaseIdx The phase index
104 */
105 Scalar enthalpy(const int phaseIdx = 0) const
106 {
107 if constexpr (enableEnergyBalance)
108 46867800 return asImp_().fluidState().enthalpy(0);
109 else
110 return 0.0;
111 }
112
113 /*!
114 * \brief Returns the temperature of a fluid phase assuming thermal nonequilibrium
115 * the sub-control volume.
116 * \param phaseIdx The local index of the phases
117 */
118 Scalar temperatureFluid(const int phaseIdx = 0) const
119 { return asImp_().fluidState().temperature(0); }
120
121
122 /*!
123 * \brief Returns the thermal conductivity \f$\mathrm{[W/(m*K)]}\f$
124 * of a fluid phase in the sub-control volume.
125 */
126 Scalar fluidThermalConductivity(const int phaseIdx = 0) const
127 5441915 { return FluidSystem::thermalConductivity(asImp_().fluidState(), 0); }
128
129 /*!
130 * \brief Returns the effective thermal conductivity \f$\mathrm{[W/(m*K)]}\f$ in
131 * the sub-control volume. Specific to equilibirum models (case fullThermalEquilibrium).
132 */
133 Scalar effectiveThermalConductivity(const int phaseIdx = 0) const
134 { return lambdaEff_; }
135
136
137 //! The phase enthalpy is zero for isothermal models
138 //! This is needed for completing the fluid state
139 template<class ParameterCache>
140 static Scalar enthalpy(const FluidState& fluidState,
141 const ParameterCache& paramCache)
142 {
143 if constexpr (enableEnergyBalance)
144
0/2
✗ Branch 7 not taken.
✗ Branch 8 not taken.
6752115 return FluidSystem::enthalpy(fluidState, paramCache, 0);
145 else
146 return 0.0;
147 }
148
149 protected:
150 Scalar lambdaEff_;
151 const Impl &asImp_() const { return *static_cast<const Impl*>(this); }
152 4743315 Impl &asImp_() { return *static_cast<Impl*>(this); }
153 };
154
155 } // end namespace Dumux
156
157 #endif
158