version 3.10-dev
freeflow/navierstokes/energy/volumevariables.hh
Go to the documentation of this file.
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//
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
21namespace Dumux {
22
23namespace Detail {
24
26
27template<bool enableEnergyBalance, class Traits>
29{
31};
32
33template<class Traits>
34struct FreeFlowHeatCondType<true, Traits>
35{
36 using type = typename Traits::HeatConductionType;
37};
38
39} // end namespace Detail
40
45template<class Traits, class Impl>
47{
48 using Scalar = typename Traits::PrimaryVariables::value_type;
49 static constexpr bool enableEnergyBalance = Traits::ModelTraits::enableEnergyBalance();
50
51public:
52 using FluidState = typename Traits::FluidState;
53 using FluidSystem = typename Traits::FluidSystem;
55
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 return elemSol[scv.localDofIndex()][Traits::ModelTraits::Indices::temperatureIdx];
73 else
74 return problem.spatialParams().temperature(element, scv, elemSol);
75 }
76
77
80 {
81 if constexpr (enableEnergyBalance)
82 lambdaEff_ = Traits::EffectiveThermalConductivityModel::effectiveThermalConductivity(asImp_());
83 }
84
91 Scalar internalEnergy(const int phaseIdx = 0) const
92 {
93 if constexpr (enableEnergyBalance)
94 return asImp_().fluidState().internalEnergy(0);
95 else
96 return 0.0;
97 }
98
105 Scalar enthalpy(const int phaseIdx = 0) const
106 {
107 if constexpr (enableEnergyBalance)
108 return asImp_().fluidState().enthalpy(0);
109 else
110 return 0.0;
111 }
112
118 Scalar temperatureFluid(const int phaseIdx = 0) const
119 { return asImp_().fluidState().temperature(0); }
120
121
126 Scalar fluidThermalConductivity(const int phaseIdx = 0) const
127 { return FluidSystem::thermalConductivity(asImp_().fluidState(), 0); }
128
133 Scalar effectiveThermalConductivity(const int phaseIdx = 0) const
134 { return lambdaEff_; }
135
136
139 template<class ParameterCache>
140 static Scalar enthalpy(const FluidState& fluidState,
141 const ParameterCache& paramCache)
142 {
143 if constexpr (enableEnergyBalance)
144 return FluidSystem::enthalpy(fluidState, paramCache, 0);
145 else
146 return 0.0;
147 }
148
149protected:
151 const Impl &asImp_() const { return *static_cast<const Impl*>(this); }
152 Impl &asImp_() { return *static_cast<Impl*>(this); }
153};
154
155} // end namespace Dumux
156
157#endif
The isothermal base class.
Definition: freeflow/navierstokes/energy/volumevariables.hh:47
Scalar lambdaEff_
Definition: freeflow/navierstokes/energy/volumevariables.hh:150
Impl & asImp_()
Definition: freeflow/navierstokes/energy/volumevariables.hh:152
Scalar internalEnergy(const int phaseIdx=0) const
Returns the total internal energy of a phase in the sub-control volume.
Definition: freeflow/navierstokes/energy/volumevariables.hh:91
Scalar getTemperature(const ElementSolution &elemSol, const Problem &problem, const Element &element, const SubControlVolume &scv) const
Returns the temperature at a given sub-control volume.
Definition: freeflow/navierstokes/energy/volumevariables.hh:66
const Impl & asImp_() const
Definition: freeflow/navierstokes/energy/volumevariables.hh:151
static Scalar enthalpy(const FluidState &fluidState, const ParameterCache &paramCache)
Definition: freeflow/navierstokes/energy/volumevariables.hh:140
void updateEffectiveThermalConductivity()
The effective thermal conductivity is zero for isothermal models.
Definition: freeflow/navierstokes/energy/volumevariables.hh:79
typename Detail::FreeFlowHeatCondType< enableEnergyBalance, Traits >::type HeatConductionType
Definition: freeflow/navierstokes/energy/volumevariables.hh:54
Scalar temperatureFluid(const int phaseIdx=0) const
Returns the temperature of a fluid phase assuming thermal nonequilibrium the sub-control volume.
Definition: freeflow/navierstokes/energy/volumevariables.hh:118
typename Traits::FluidState FluidState
Definition: freeflow/navierstokes/energy/volumevariables.hh:52
Scalar fluidThermalConductivity(const int phaseIdx=0) const
Returns the thermal conductivity of a fluid phase in the sub-control volume.
Definition: freeflow/navierstokes/energy/volumevariables.hh:126
Scalar effectiveThermalConductivity(const int phaseIdx=0) const
Returns the effective thermal conductivity in the sub-control volume. Specific to equilibirum models...
Definition: freeflow/navierstokes/energy/volumevariables.hh:133
typename Traits::FluidSystem FluidSystem
Definition: freeflow/navierstokes/energy/volumevariables.hh:53
Scalar enthalpy(const int phaseIdx=0) const
Returns the total enthalpy of a phase in the sub-control volume.
Definition: freeflow/navierstokes/energy/volumevariables.hh:105
Definition: adapt.hh:17
Definition: freeflow/navierstokes/energy/volumevariables.hh:25
typename Traits::HeatConductionType type
Definition: freeflow/navierstokes/energy/volumevariables.hh:36
Definition: freeflow/navierstokes/energy/volumevariables.hh:29