3.2-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;
57 using Indices = typename Traits::ModelTraits::Indices;
58
60 static constexpr int numFluidPhases() { return Traits::ModelTraits::numFluidPhases(); }
62 static constexpr int numFluidComponents() { return Traits::ModelTraits::numFluidComponents(); }
63
73 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
74 void update(const ElementSolution &elemSol,
75 const Problem &problem,
76 const Element &element,
77 const SubControlVolume& scv)
78 {
79 priVars_ = elemSol[scv.localDofIndex()];
80 extrusionFactor_ = problem.extrusionFactor(element, scv, elemSol);
81 }
82
92 Scalar extrusionFactor() const
93 { return extrusionFactor_; }
94
100 Scalar priVar(const int pvIdx) const
101 { return priVars_[pvIdx]; }
102
104 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
105 static Scalar temperature(const ElementSolution &elemSol,
106 const Problem& problem,
107 const Element &element,
108 const SubControlVolume &scv)
109 {
110 return problem.temperatureAtPos(scv.dofPosition());
111 }
112
115 template<class FluidState, class ParameterCache>
116 static Scalar enthalpy(const FluidState& fluidState,
117 const ParameterCache& paramCache)
118 {
119 return 0;
120 }
121
122protected:
123 const Impl &asImp_() const { return *static_cast<const Impl*>(this); }
124 Impl &asImp_() { return *static_cast<Impl*>(this); }
127};
128
133template <class Traits, class Impl>
135: public FreeFlowVolumeVariablesImplementation<Traits, Impl, false>
136{
138 using Scalar = typename Traits::PrimaryVariables::value_type;
139
140public:
142 using PrimaryVariables = typename Traits::PrimaryVariables;
144 using FluidSystem = typename Traits::FluidSystem;
146 using Indices = typename Traits::ModelTraits::Indices;
147
148
158 template<class ElemSol, class Problem, class Element, class Scv>
159 void update(const ElemSol &elemSol,
160 const Problem &problem,
161 const Element &element,
162 const Scv &scv)
163 {
164 ParentType::update(elemSol, problem, element, scv);
165 }
166
171 Scalar internalEnergy(int phaseIdx = 0) const
172 { return ParentType::asImp_().fluidState().internalEnergy(0); }
173
178 Scalar enthalpy(int phaseIdx = 0) const
179 { return ParentType::asImp_().fluidState().enthalpy(0); }
180
184 Scalar componentEnthalpy(unsigned int compIdx) const
185 { return FluidSystem::componentEnthalpy(ParentType::asImp_().fluidState(), 0, compIdx); }
186
191 Scalar thermalConductivity() const
192 { return FluidSystem::thermalConductivity(ParentType::asImp_().fluidState(), 0); }
193
199 {
200 return thermalConductivity();
201 }
202
207 Scalar heatCapacity() const
208 { return FluidSystem::heatCapacity(ParentType::asImp_().fluidState(), 0); }
209
211 template<class ElemSol, class Problem, class Element, class Scv>
212 static Scalar temperature(const ElemSol &elemSol,
213 const Problem& problem,
214 const Element &element,
215 const Scv &scv)
216 {
217 return elemSol[scv.localDofIndex()][Indices::temperatureIdx];
218 }
219
222 template<class FluidState, class ParameterCache>
223 static Scalar enthalpy(const FluidState& fluidState,
224 const ParameterCache& paramCache)
225 {
226 return FluidSystem::enthalpy(fluidState, paramCache, 0);
227 }
228};
229} // end namespace Dumux
230
231#endif // DUMUX_FREEFLOW_VOLUME_VARIABLES_HH
Represents all relevant thermodynamic quantities of a multi-phase fluid system assuming immiscibility...
Definition: adapt.hh:29
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:116
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:123
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:105
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:74
Impl & asImp_()
Definition: freeflow/volumevariables.hh:124
Scalar extrusionFactor_
Definition: freeflow/volumevariables.hh:126
Scalar priVar(const int pvIdx) const
Return a component of primary variable vector.
Definition: freeflow/volumevariables.hh:100
Scalar extrusionFactor() const
Return how much the sub-control volume is extruded.
Definition: freeflow/volumevariables.hh:92
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:125
Scalar heatCapacity() const
Return the specific isobaric heat capacity in the sub-control volume.
Definition: freeflow/volumevariables.hh:207
static Scalar enthalpy(const FluidState &fluidState, const ParameterCache &paramCache)
Definition: freeflow/volumevariables.hh:223
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:159
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:212
Scalar thermalConductivity() const
Returns the thermal conductivity of the fluid phase in the sub-control volume.
Definition: freeflow/volumevariables.hh:191
Scalar internalEnergy(int phaseIdx=0) const
Returns the total internal energy of a phase in the sub-control volume.
Definition: freeflow/volumevariables.hh:171
Scalar enthalpy(int phaseIdx=0) const
Returns the total enthalpy of a phase in the sub-control volume.
Definition: freeflow/volumevariables.hh:178
Scalar componentEnthalpy(unsigned int compIdx) const
Returns the component enthalpy in the sub-control volume.
Definition: freeflow/volumevariables.hh:184
typename Traits::FluidSystem FluidSystem
export the underlying fluid system
Definition: freeflow/volumevariables.hh:144
Scalar effectiveThermalConductivity() const
Returns the effective thermal conductivity of the fluid-flow in the sub-control volume.
Definition: freeflow/volumevariables.hh:198