version 3.8
freeflow/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//
13#ifndef DUMUX_FREEFLOW_VOLUME_VARIABLES_HH
14#define DUMUX_FREEFLOW_VOLUME_VARIABLES_HH
15
17
18namespace Dumux {
19
20// forward declaration
21template <class Traits, class Impl, bool enableEnergyBalance>
23
29template <class Traits, class Impl>
30using FreeFlowVolumeVariables = FreeFlowVolumeVariablesImplementation<Traits, Impl, Traits::ModelTraits::enableEnergyBalance()>;
31
36template <class Traits, class Impl>
37class FreeFlowVolumeVariablesImplementation<Traits, Impl, false>
38{
39 using Scalar = typename Traits::PrimaryVariables::value_type;
40
41public:
43 using PrimaryVariables = typename Traits::PrimaryVariables;
45 using Indices = typename Traits::ModelTraits::Indices;
46
48 static constexpr int numFluidPhases() { return Traits::ModelTraits::numFluidPhases(); }
50 static constexpr int numFluidComponents() { return Traits::ModelTraits::numFluidComponents(); }
51
61 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
62 void update(const ElementSolution &elemSol,
63 const Problem &problem,
64 const Element &element,
65 const SubControlVolume& scv)
66 {
67 priVars_ = elemSol[scv.localDofIndex()];
68 extrusionFactor_ = problem.spatialParams().extrusionFactor(element, scv, elemSol);
69 }
70
80 Scalar extrusionFactor() const
81 { return extrusionFactor_; }
82
88 Scalar priVar(const int pvIdx) const
89 { return priVars_[pvIdx]; }
90
92 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
93 static Scalar temperature(const ElementSolution &elemSol,
94 const Problem& problem,
95 const Element &element,
96 const SubControlVolume &scv)
97 {
98 return problem.spatialParams().temperature(element, scv, elemSol);
99 }
100
103 template<class FluidState, class ParameterCache>
104 static Scalar enthalpy(const FluidState& fluidState,
105 const ParameterCache& paramCache)
106 {
107 return 0;
108 }
109
110protected:
111 const Impl &asImp_() const { return *static_cast<const Impl*>(this); }
112 Impl &asImp_() { return *static_cast<Impl*>(this); }
115};
116
121template <class Traits, class Impl>
123: public FreeFlowVolumeVariablesImplementation<Traits, Impl, false>
124{
126 using Scalar = typename Traits::PrimaryVariables::value_type;
127
128public:
130 using PrimaryVariables = typename Traits::PrimaryVariables;
132 using FluidSystem = typename Traits::FluidSystem;
134 using Indices = typename Traits::ModelTraits::Indices;
135
136
146 template<class ElemSol, class Problem, class Element, class Scv>
147 void update(const ElemSol &elemSol,
148 const Problem &problem,
149 const Element &element,
150 const Scv &scv)
151 {
152 ParentType::update(elemSol, problem, element, scv);
153 }
154
159 Scalar internalEnergy(int phaseIdx = 0) const
160 { return ParentType::asImp_().fluidState().internalEnergy(0); }
161
166 Scalar enthalpy(int phaseIdx = 0) const
167 { return ParentType::asImp_().fluidState().enthalpy(0); }
168
172 Scalar componentEnthalpy(unsigned int compIdx) const
173 { return FluidSystem::componentEnthalpy(ParentType::asImp_().fluidState(), 0, compIdx); }
174
179 Scalar thermalConductivity() const
180 { return FluidSystem::thermalConductivity(ParentType::asImp_().fluidState(), 0); }
181
187 {
188 return thermalConductivity();
189 }
190
195 Scalar heatCapacity() const
196 { return FluidSystem::heatCapacity(ParentType::asImp_().fluidState(), 0); }
197
199 template<class ElemSol, class Problem, class Element, class Scv>
200 static Scalar temperature(const ElemSol &elemSol,
201 const Problem& problem,
202 const Element &element,
203 const Scv &scv)
204 {
205 return elemSol[scv.localDofIndex()][Indices::temperatureIdx];
206 }
207
210 template<class FluidState, class ParameterCache>
211 static Scalar enthalpy(const FluidState& fluidState,
212 const ParameterCache& paramCache)
213 {
214 return FluidSystem::enthalpy(fluidState, paramCache, 0);
215 }
216};
217} // end namespace Dumux
218
219#endif
Volume variables for isothermal free-flow models.
Definition: freeflow/volumevariables.hh:38
static Scalar enthalpy(const FluidState &fluidState, const ParameterCache &paramCache)
Definition: freeflow/volumevariables.hh:104
static constexpr int numFluidComponents()
return number of components considered by the model
Definition: freeflow/volumevariables.hh:50
const Impl & asImp_() const
Definition: freeflow/volumevariables.hh:111
static Scalar temperature(const ElementSolution &elemSol, const Problem &problem, const Element &element, const SubControlVolume &scv)
The temperature is obtained from the problem as a constant for isothermal models.
Definition: freeflow/volumevariables.hh:93
void update(const ElementSolution &elemSol, const Problem &problem, const Element &element, const SubControlVolume &scv)
Update all quantities for a given control volume.
Definition: freeflow/volumevariables.hh:62
Impl & asImp_()
Definition: freeflow/volumevariables.hh:112
Scalar extrusionFactor_
Definition: freeflow/volumevariables.hh:114
Scalar priVar(const int pvIdx) const
Return a component of primary variable vector.
Definition: freeflow/volumevariables.hh:88
Scalar extrusionFactor() const
Return how much the sub-control volume is extruded.
Definition: freeflow/volumevariables.hh:80
typename Traits::ModelTraits::Indices Indices
export the type encapsulating primary variable indices
Definition: freeflow/volumevariables.hh:45
static constexpr int numFluidPhases()
return number of phases considered by the model
Definition: freeflow/volumevariables.hh:48
typename Traits::PrimaryVariables PrimaryVariables
export the type used for the primary variables
Definition: freeflow/volumevariables.hh:43
PrimaryVariables priVars_
Definition: freeflow/volumevariables.hh:113
Scalar heatCapacity() const
Return the specific isobaric heat capacity in the sub-control volume.
Definition: freeflow/volumevariables.hh:195
static Scalar enthalpy(const FluidState &fluidState, const ParameterCache &paramCache)
Definition: freeflow/volumevariables.hh:211
void update(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv)
Update all quantities for a given control volume.
Definition: freeflow/volumevariables.hh:147
static Scalar temperature(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv)
The temperature is a primary variable for non-isothermal models.
Definition: freeflow/volumevariables.hh:200
Scalar thermalConductivity() const
Returns the thermal conductivity of the fluid phase in the sub-control volume.
Definition: freeflow/volumevariables.hh:179
Scalar internalEnergy(int phaseIdx=0) const
Returns the total internal energy of a phase in the sub-control volume.
Definition: freeflow/volumevariables.hh:159
Scalar enthalpy(int phaseIdx=0) const
Returns the total enthalpy of a phase in the sub-control volume.
Definition: freeflow/volumevariables.hh:166
Scalar componentEnthalpy(unsigned int compIdx) const
Returns the component enthalpy in the sub-control volume.
Definition: freeflow/volumevariables.hh:172
typename Traits::FluidSystem FluidSystem
export the underlying fluid system
Definition: freeflow/volumevariables.hh:132
Scalar effectiveThermalConductivity() const
Returns the effective thermal conductivity of the fluid-flow in the sub-control volume.
Definition: freeflow/volumevariables.hh:186
Definition: freeflow/volumevariables.hh:22
Represents all relevant thermodynamic quantities of a multi-phase fluid system assuming immiscibility...
Definition: adapt.hh:17