3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
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 * 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 *****************************************************************************/
25#ifndef DUMUX_FREEFLOW_VOLUME_VARIABLES_HH
26#define DUMUX_FREEFLOW_VOLUME_VARIABLES_HH
27
29
30namespace Dumux {
31
32// forward declaration
33template <class Traits, class Impl, bool enableEnergyBalance>
35
41template <class Traits, class Impl>
42using FreeFlowVolumeVariables = FreeFlowVolumeVariablesImplementation<Traits, Impl, Traits::ModelTraits::enableEnergyBalance()>;
43
48template <class Traits, class Impl>
49class FreeFlowVolumeVariablesImplementation<Traits, Impl, false>
50{
51 using Scalar = typename Traits::PrimaryVariables::value_type;
52
53public:
55 using PrimaryVariables = typename Traits::PrimaryVariables;
58
60 static constexpr int numFluidPhases() { return Traits::ModelTraits::numFluidPhases(); }
62 static constexpr int numFluidComponents() { return Traits::ModelTraits::numFluidComponents(); }
63
64
74 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
75 void update(const ElementSolution &elemSol,
76 const Problem &problem,
77 const Element &element,
78 const SubControlVolume& scv)
79 {
80 priVars_ = elemSol[scv.localDofIndex()];
81 extrusionFactor_ = problem.extrusionFactor(element, scv, elemSol);
82 }
83
93 Scalar extrusionFactor() const
94 { return extrusionFactor_; }
95
101 Scalar priVar(const int pvIdx) const
102 { return priVars_[pvIdx]; }
103
105 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
106 static Scalar temperature(const ElementSolution &elemSol,
107 const Problem& problem,
108 const Element &element,
109 const SubControlVolume &scv)
110 {
111 return problem.temperatureAtPos(scv.dofPosition());
112 }
113
116 template<class FluidState, class ParameterCache>
117 static Scalar enthalpy(const FluidState& fluidState,
118 const ParameterCache& paramCache)
119 {
120 return 0;
121 }
122
123protected:
124 const Impl &asImp_() const { return *static_cast<const Impl*>(this); }
125 Impl &asImp_() { return *static_cast<Impl*>(this); }
128};
129
134template <class Traits, class Impl>
136: public FreeFlowVolumeVariablesImplementation<Traits, Impl, false>
137{
139 using Scalar = typename Traits::PrimaryVariables::value_type;
140
141public:
143 using PrimaryVariables = typename Traits::PrimaryVariables;
145 using FluidSystem = typename Traits::FluidSystem;
148
149
159 template<class ElemSol, class Problem, class Element, class Scv>
160 void update(const ElemSol &elemSol,
161 const Problem &problem,
162 const Element &element,
163 const Scv &scv)
164 {
165 ParentType::update(elemSol, problem, element, scv);
166 }
167
172 Scalar internalEnergy(int phaseIdx = 0) const
173 { return ParentType::asImp_().fluidState().internalEnergy(0); }
174
179 Scalar enthalpy(int phaseIdx = 0) const
180 { return ParentType::asImp_().fluidState().enthalpy(0); }
181
185 Scalar componentEnthalpy(unsigned int compIdx) const
186 { return FluidSystem::componentEnthalpy(ParentType::asImp_().fluidState(), 0, compIdx); }
187
192 Scalar thermalConductivity() const
193 { return FluidSystem::thermalConductivity(ParentType::asImp_().fluidState(), 0); }
194
200 {
201 return thermalConductivity();
202 }
203
208 Scalar heatCapacity() const
209 { return FluidSystem::heatCapacity(ParentType::asImp_().fluidState(), 0); }
210
212 template<class ElemSol, class Problem, class Element, class Scv>
213 static Scalar temperature(const ElemSol &elemSol,
214 const Problem& problem,
215 const Element &element,
216 const Scv &scv)
217 {
218 return elemSol[scv.localDofIndex()][Indices::temperatureIdx];
219 }
220
223 template<class FluidState, class ParameterCache>
224 static Scalar enthalpy(const FluidState& fluidState,
225 const ParameterCache& paramCache)
226 {
227 return FluidSystem::enthalpy(fluidState, paramCache, 0);
228 }
229};
230} // end namespace Dumux
231
232#endif // DUMUX_FREEFLOW_VOLUME_VARIABLES_HH
Represents all relevant thermodynamic quantities of a multi-phase fluid system assuming immiscibility...
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Property tag Indices
Definition: porousmediumflow/sequential/properties.hh:59
Definition: freeflow/volumevariables.hh:34
Volume variables for isothermal free-flow models.
Definition: freeflow/volumevariables.hh:50
static Scalar enthalpy(const FluidState &fluidState, const ParameterCache &paramCache)
Definition: freeflow/volumevariables.hh:117
static constexpr int numFluidComponents()
return number of components considered by the model
Definition: freeflow/volumevariables.hh:62
const Impl & asImp_() const
Definition: freeflow/volumevariables.hh:124
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:106
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:75
Impl & asImp_()
Definition: freeflow/volumevariables.hh:125
Scalar extrusionFactor_
Definition: freeflow/volumevariables.hh:127
Scalar priVar(const int pvIdx) const
Return a component of primary variable vector.
Definition: freeflow/volumevariables.hh:101
Scalar extrusionFactor() const
Return how much the sub-control volume is extruded.
Definition: freeflow/volumevariables.hh:93
typename Traits::ModelTraits::Indices Indices
export the type encapsulating primary variable indices
Definition: freeflow/volumevariables.hh:57
static constexpr int numFluidPhases()
return number of phases considered by the model
Definition: freeflow/volumevariables.hh:60
typename Traits::PrimaryVariables PrimaryVariables
export the type used for the primary variables
Definition: freeflow/volumevariables.hh:55
PrimaryVariables priVars_
Definition: freeflow/volumevariables.hh:126
Scalar heatCapacity() const
Return the specific isobaric heat capacity in the sub-control volume.
Definition: freeflow/volumevariables.hh:208
static Scalar enthalpy(const FluidState &fluidState, const ParameterCache &paramCache)
Definition: freeflow/volumevariables.hh:224
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:160
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:213
Scalar thermalConductivity() const
Returns the thermal conductivity of the fluid phase in the sub-control volume.
Definition: freeflow/volumevariables.hh:192
Scalar internalEnergy(int phaseIdx=0) const
Returns the total internal energy of a phase in the sub-control volume.
Definition: freeflow/volumevariables.hh:172
Scalar enthalpy(int phaseIdx=0) const
Returns the total enthalpy of a phase in the sub-control volume.
Definition: freeflow/volumevariables.hh:179
Scalar componentEnthalpy(unsigned int compIdx) const
Returns the component enthalpy in the sub-control volume.
Definition: freeflow/volumevariables.hh:185
typename Traits::FluidSystem FluidSystem
export the underlying fluid system
Definition: freeflow/volumevariables.hh:145
Scalar effectiveThermalConductivity() const
Returns the effective thermal conductivity of the fluid-flow in the sub-control volume.
Definition: freeflow/volumevariables.hh:199