version 3.8
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// 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_NAVIERSTOKES_VOLUME_VARIABLES_HH
14#define DUMUX_NAVIERSTOKES_VOLUME_VARIABLES_HH
15
17
18namespace Dumux {
19
24template <class Traits>
25class NavierStokesVolumeVariables : public FreeFlowVolumeVariables< Traits, NavierStokesVolumeVariables<Traits> >
26{
29
30 using Scalar = typename Traits::PrimaryVariables::value_type;
31
32public:
34 using FluidSystem = typename Traits::FluidSystem;
36 using FluidState = typename Traits::FluidState;
38 using Indices = typename Traits::ModelTraits::Indices;
39
49 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
50 void update(const ElementSolution& elemSol,
51 const Problem& problem,
52 const Element& element,
53 const SubControlVolume& scv)
54 {
55 ParentType::update(elemSol, problem, element, scv);
56 completeFluidState(elemSol, problem, element, scv, fluidState_);
57 }
58
62 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
63 static void completeFluidState(const ElementSolution& elemSol,
64 const Problem& problem,
65 const Element& element,
66 const SubControlVolume& scv,
68 {
69 const Scalar t = ParentType::temperature(elemSol, problem, element, scv);
70 fluidState.setTemperature(t);
71
72 fluidState.setPressure(0, elemSol[0][Indices::pressureIdx]);
73
74 // saturation in a single phase is always 1 and thus redundant
75 // to set. But since we use the fluid state shared by the
76 // immiscible multi-phase models, so we have to set it here...
77 fluidState.setSaturation(0, 1.0);
78
79 typename FluidSystem::ParameterCache paramCache;
80 paramCache.updateAll(fluidState);
81
82 Scalar value = FluidSystem::density(fluidState, paramCache, 0);
83 fluidState.setDensity(0, value);
84
85 value = FluidSystem::viscosity(fluidState, paramCache, 0);
86 fluidState.setViscosity(0, value);
87
88 // compute and set the enthalpy
89 value = ParentType::enthalpy(fluidState, paramCache);
90 fluidState.setEnthalpy(0, value);
91 }
92
97 Scalar pressure(int phaseIdx = 0) const
98 { return fluidState_.pressure(0); }
99
104 Scalar density(int phaseIdx = 0) const
105 { return fluidState_.density(0); }
106
114 Scalar temperature() const
115 { return fluidState_.temperature(); }
116
121 Scalar molarMass(int phaseIdx = 0) const
122 {
123 return fluidState_.averageMolarMass(0);
124 }
125
130 Scalar viscosity(int phaseIdx = 0) const
131 { return fluidState_.viscosity(0); }
132
137 Scalar effectiveViscosity() const
138 { return viscosity(); }
139
143 const FluidState& fluidState() const
144 { return fluidState_; }
145
146protected:
148};
149
150} // end namespace Dumux
151
152#endif
Definition: freeflow/volumevariables.hh:22
Volume variables for the single-phase Navier-Stokes model.
Definition: freeflow/navierstokes/volumevariables.hh:26
typename Traits::ModelTraits::Indices Indices
export the indices type
Definition: freeflow/navierstokes/volumevariables.hh:38
FluidState fluidState_
Definition: freeflow/navierstokes/volumevariables.hh:147
Scalar pressure(int phaseIdx=0) const
Return the effective pressure of a given phase within the control volume.
Definition: freeflow/navierstokes/volumevariables.hh:97
Scalar molarMass(int phaseIdx=0) const
Returns the molar mass of a given phase within the control volume.
Definition: freeflow/navierstokes/volumevariables.hh:121
Scalar density(int phaseIdx=0) const
Return the mass density of a given phase within the control volume.
Definition: freeflow/navierstokes/volumevariables.hh:104
Scalar effectiveViscosity() const
Return the effective dynamic viscosity of the fluid within the control volume.
Definition: freeflow/navierstokes/volumevariables.hh:137
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:50
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:63
typename Traits::FluidState FluidState
export the fluid state type
Definition: freeflow/navierstokes/volumevariables.hh:36
const FluidState & fluidState() const
Return the fluid state of the control volume.
Definition: freeflow/navierstokes/volumevariables.hh:143
Scalar temperature() const
Return temperature inside the sub-control volume.
Definition: freeflow/navierstokes/volumevariables.hh:114
Scalar viscosity(int phaseIdx=0) const
Return the dynamic viscosity of the fluid within the control volume.
Definition: freeflow/navierstokes/volumevariables.hh:130
typename Traits::FluidSystem FluidSystem
export the underlying fluid system
Definition: freeflow/navierstokes/volumevariables.hh:34
std::string temperature() noexcept
I/O name of temperature for equilibrium models.
Definition: name.hh:39
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:62
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:53
Definition: adapt.hh:17