3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
26#ifndef DUMUX_FREEFLOW_NAVIER_STOKES_ENERGY_VOLUME_VARIABLES_HH
27#define DUMUX_FREEFLOW_NAVIER_STOKES_ENERGY_VOLUME_VARIABLES_HH
28
29#include <type_traits>
30#include <dune/common/std/type_traits.hh>
31
32
33namespace Dumux {
34
35namespace Detail {
36
38
39template<bool enableEnergyBalance, class Traits>
41{
43};
44
45template<class Traits>
46struct FreeFlowHeatCondType<true, Traits>
47{
48 using type = typename Traits::HeatConductionType;
49};
50
51} // end namespace Detail
52
57template<class Traits, class Impl>
59{
60 using Scalar = typename Traits::PrimaryVariables::value_type;
61 static constexpr bool enableEnergyBalance = Traits::ModelTraits::enableEnergyBalance();
62
63public:
64 using FluidState = typename Traits::FluidState;
65 using FluidSystem = typename Traits::FluidSystem;
67
77 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
78 Scalar getTemperature(const ElementSolution& elemSol,
79 const Problem& problem,
80 const Element& element,
81 const SubControlVolume& scv) const
82 {
83 if constexpr (enableEnergyBalance)
84 return elemSol[scv.localDofIndex()][Traits::ModelTraits::Indices::temperatureIdx];
85 else
86 return problem.spatialParams().temperature(element, scv, elemSol);
87 }
88
89
92 {
93 if constexpr (enableEnergyBalance)
94 lambdaEff_ = Traits::EffectiveThermalConductivityModel::effectiveThermalConductivity(asImp_());
95 }
96
103 Scalar internalEnergy(const int phaseIdx = 0) const
104 {
105 if constexpr (enableEnergyBalance)
106 return asImp_().fluidState().internalEnergy(0);
107 else
108 return 0.0;
109 }
110
117 Scalar enthalpy(const int phaseIdx = 0) const
118 {
119 if constexpr (enableEnergyBalance)
120 return asImp_().fluidState().enthalpy(0);
121 else
122 return 0.0;
123 }
124
130 Scalar temperatureFluid(const int phaseIdx = 0) const
131 { return asImp_().fluidState().temperature(0); }
132
133
138 Scalar fluidThermalConductivity(const int phaseIdx = 0) const
139 { return FluidSystem::thermalConductivity(asImp_().fluidState(), 0); }
140
145 Scalar effectiveThermalConductivity(const int phaseIdx = 0) const
146 { return lambdaEff_; }
147
148
151 template<class ParameterCache>
152 static Scalar enthalpy(const FluidState& fluidState,
153 const ParameterCache& paramCache)
154 {
155 if constexpr (enableEnergyBalance)
156 return FluidSystem::enthalpy(fluidState, paramCache, 0);
157 else
158 return 0.0;
159 }
160
161protected:
163 const Impl &asImp_() const { return *static_cast<const Impl*>(this); }
164 Impl &asImp_() { return *static_cast<Impl*>(this); }
165};
166
167} // end namespace Dumux
168
169#endif
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
Definition: freeflow/navierstokes/energy/volumevariables.hh:37
Definition: freeflow/navierstokes/energy/volumevariables.hh:41
typename Traits::HeatConductionType type
Definition: freeflow/navierstokes/energy/volumevariables.hh:48
The isothermal base class.
Definition: freeflow/navierstokes/energy/volumevariables.hh:59
Scalar lambdaEff_
Definition: freeflow/navierstokes/energy/volumevariables.hh:162
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:103
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:78
const Impl & asImp_() const
Definition: freeflow/navierstokes/energy/volumevariables.hh:163
static Scalar enthalpy(const FluidState &fluidState, const ParameterCache &paramCache)
Definition: freeflow/navierstokes/energy/volumevariables.hh:152
void updateEffectiveThermalConductivity()
The effective thermal conductivity is zero for isothermal models.
Definition: freeflow/navierstokes/energy/volumevariables.hh:91
typename Detail::FreeFlowHeatCondType< enableEnergyBalance, Traits >::type HeatConductionType
Definition: freeflow/navierstokes/energy/volumevariables.hh:66
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:130
typename Traits::FluidState FluidState
Definition: freeflow/navierstokes/energy/volumevariables.hh:64
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:138
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:145
typename Traits::FluidSystem FluidSystem
Definition: freeflow/navierstokes/energy/volumevariables.hh:65
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:117