3.2-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
freeflow/navierstokes/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_NAVIERSTOKES_VOLUME_VARIABLES_HH
26#define DUMUX_NAVIERSTOKES_VOLUME_VARIABLES_HH
27
29
30namespace Dumux {
31
36template <class Traits>
37class NavierStokesVolumeVariables : public FreeFlowVolumeVariables< Traits, NavierStokesVolumeVariables<Traits> >
38{
41
42 using Scalar = typename Traits::PrimaryVariables::value_type;
43
44public:
46 using FluidSystem = typename Traits::FluidSystem;
48 using FluidState = typename Traits::FluidState;
50 using Indices = typename Traits::ModelTraits::Indices;
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 ParentType::update(elemSol, problem, element, scv);
68 completeFluidState(elemSol, problem, element, scv, fluidState_);
69 }
70
74 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
75 static void completeFluidState(const ElementSolution& elemSol,
76 const Problem& problem,
77 const Element& element,
78 const SubControlVolume& scv,
80 {
81 const Scalar t = ParentType::temperature(elemSol, problem, element, scv);
82 fluidState.setTemperature(t);
83
84 fluidState.setPressure(0, elemSol[0][Indices::pressureIdx]);
85
86 // saturation in a single phase is always 1 and thus redundant
87 // to set. But since we use the fluid state shared by the
88 // immiscible multi-phase models, so we have to set it here...
89 fluidState.setSaturation(0, 1.0);
90
91 typename FluidSystem::ParameterCache paramCache;
92 paramCache.updateAll(fluidState);
93
94 Scalar value = FluidSystem::density(fluidState, paramCache, 0);
95 fluidState.setDensity(0, value);
96
97 value = FluidSystem::viscosity(fluidState, paramCache, 0);
98 fluidState.setViscosity(0, value);
99
100 // compute and set the enthalpy
101 value = ParentType::enthalpy(fluidState, paramCache);
102 fluidState.setEnthalpy(0, value);
103 }
104
109 Scalar pressure(int phaseIdx = 0) const
110 { return fluidState_.pressure(0); }
111
116 Scalar density(int phaseIdx = 0) const
117 { return fluidState_.density(0); }
118
126 Scalar temperature() const
127 { return fluidState_.temperature(); }
128
133 Scalar molarMass(int phaseIdx = 0) const
134 {
135 return fluidState_.averageMolarMass(0);
136 }
137
142 Scalar viscosity(int phaseIdx = 0) const
143 { return fluidState_.viscosity(0); }
144
149 Scalar effectiveViscosity() const
150 { return viscosity(); }
151
155 const FluidState& fluidState() const
156 { return fluidState_; }
157
158protected:
160};
161
162} // end namespace Dumux
163
164#endif // DUMUX_NAVIERSTOKES_VOLUME_VARIABLES_HH
Definition: adapt.hh:29
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:51
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:74
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
Volume variables for the single-phase Navier-Stokes model.
Definition: freeflow/navierstokes/volumevariables.hh:38
typename Traits::ModelTraits::Indices Indices
export the indices type
Definition: freeflow/navierstokes/volumevariables.hh:50
FluidState fluidState_
Definition: freeflow/navierstokes/volumevariables.hh:159
Scalar pressure(int phaseIdx=0) const
Return the effective pressure of a given phase within the control volume.
Definition: freeflow/navierstokes/volumevariables.hh:109
Scalar molarMass(int phaseIdx=0) const
Returns the molar mass of a given phase within the control volume.
Definition: freeflow/navierstokes/volumevariables.hh:133
Scalar density(int phaseIdx=0) const
Return the mass density of a given phase within the control volume.
Definition: freeflow/navierstokes/volumevariables.hh:116
Scalar effectiveViscosity() const
Return the effective dynamic viscosity of the fluid within the control volume.
Definition: freeflow/navierstokes/volumevariables.hh:149
void update(const ElementSolution &elemSol, const Problem &problem, const Element &element, const SubControlVolume &scv)
Update all quantities for a given control volume.
Definition: freeflow/navierstokes/volumevariables.hh:62
static void completeFluidState(const ElementSolution &elemSol, const Problem &problem, const Element &element, const SubControlVolume &scv, FluidState &fluidState)
Update the fluid state.
Definition: freeflow/navierstokes/volumevariables.hh:75
typename Traits::FluidState FluidState
export the fluid state type
Definition: freeflow/navierstokes/volumevariables.hh:48
const FluidState & fluidState() const
Return the fluid state of the control volume.
Definition: freeflow/navierstokes/volumevariables.hh:155
Scalar temperature() const
Return temperature inside the sub-control volume.
Definition: freeflow/navierstokes/volumevariables.hh:126
Scalar viscosity(int phaseIdx=0) const
Return the dynamic viscosity of the fluid within the control volume.
Definition: freeflow/navierstokes/volumevariables.hh:142
typename Traits::FluidSystem FluidSystem
export the underlying fluid system
Definition: freeflow/navierstokes/volumevariables.hh:46
Definition: freeflow/volumevariables.hh:34