version 3.10-dev
freeflow/navierstokes/mass/1p/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_NAVIERSTOKES_MASS_1P_VOLUME_VARIABLES_HH
14#define DUMUX_FREEFLOW_NAVIERSTOKES_MASS_1P_VOLUME_VARIABLES_HH
15
18
19namespace Dumux {
20
25template <class Traits>
28, public NavierStokesEnergyVolumeVariables<Traits, NavierStokesMassOnePVolumeVariables<Traits>>
29{
32 using Scalar = typename Traits::PrimaryVariables::value_type;
33
34public:
36 using PrimaryVariables = typename Traits::PrimaryVariables;
38 using Indices = typename Traits::ModelTraits::Indices;
40 using FluidSystem = typename Traits::FluidSystem;
42 using FluidState = typename Traits::FluidState;
43
45 static constexpr int numFluidPhases() { return Traits::ModelTraits::numFluidPhases(); }
47 static constexpr int numFluidComponents() { return Traits::ModelTraits::numFluidComponents(); }
48
58 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
59 void update(const ElementSolution& elemSol,
60 const Problem& problem,
61 const Element& element,
62 const SubControlVolume& scv)
63 {
64 ParentType::update(elemSol, problem, element, scv);
65 completeFluidState(elemSol, problem, element,scv, fluidState_);
67 }
68
79 template<class ElemSol, class Problem, class Element, class Scv>
80 void completeFluidState(const ElemSol& elemSol,
81 const Problem& problem,
82 const Element& element,
83 const Scv& scv,
85 {
86 fluidState.setTemperature(/*phaseIdx=*/0, EnergyVolumeVariables::getTemperature(elemSol, problem, element, scv));
87
88 const auto& priVars = elemSol[scv.localDofIndex()];
89 fluidState.setPressure(/*phaseIdx=*/0, priVars[Indices::pressureIdx]);
90
91 // saturation in a single phase is always 1 and thus redundant
92 // to set. But since we use the fluid state shared by the
93 // immiscible multi-phase models, so we have to set it here...
94 fluidState.setSaturation(/*phaseIdx=*/0, 1.0);
95
96 typename FluidSystem::ParameterCache paramCache;
97 paramCache.updatePhase(fluidState, /*phaseIdx=*/0);
98
99 Scalar value = FluidSystem::density(fluidState, paramCache, /*phaseIdx=*/0);
100 fluidState.setDensity(/*phaseIdx=*/0, value);
101
102 value = FluidSystem::viscosity(fluidState, paramCache, /*phaseIdx=*/0);
103 fluidState.setViscosity(/*phaseIdx=*/0, value);
104
105 // compute and set the enthalpy
106 value = EnergyVolumeVariables::enthalpy(fluidState, paramCache);
107 fluidState.setEnthalpy(/*phaseIdx=*/0, value);
108 }
109
114 Scalar pressure(int phaseIdx = 0) const
115 { return fluidState_.pressure(phaseIdx); }
116
120 const FluidState& fluidState() const
121 { return fluidState_; }
122
127 Scalar viscosity(int phaseIdx = 0) const
128 { return fluidState_.viscosity(phaseIdx); }
129
134 Scalar density(int phaseIdx = 0) const
135 { return fluidState_.density(phaseIdx); }
136
141 Scalar temperature() const
142 { return fluidState_.temperature(); }
143
144protected:
146};
147
148} // end namespace Dumux
149
150#endif
The isothermal base class.
Definition: freeflow/navierstokes/energy/volumevariables.hh:47
Scalar getTemperature(const ElementSolution &elemSol, const Problem &problem, const Element &element, const SubControlVolume &scv) const
Returns the temperature at a given sub-control volume.
Definition: freeflow/navierstokes/energy/volumevariables.hh:66
void updateEffectiveThermalConductivity()
The effective thermal conductivity is zero for isothermal models.
Definition: freeflow/navierstokes/energy/volumevariables.hh:79
Scalar enthalpy(const int phaseIdx=0) const
Returns the total enthalpy of a phase in the sub-control volume.
Definition: freeflow/navierstokes/energy/volumevariables.hh:105
Volume variables for the single-phase Navier-Stokes model.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:29
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/mass/1p/volumevariables.hh:59
typename Traits::ModelTraits::Indices Indices
export the indices type
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:38
FluidState fluidState_
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:145
const FluidState & fluidState() const
Returns the fluid state of the control volume.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:120
void completeFluidState(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv, FluidState &fluidState)
Sets complete fluid state.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:80
Scalar viscosity(int phaseIdx=0) const
Returns the dynamic viscosity of the fluid within the control volume.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:127
typename Traits::PrimaryVariables PrimaryVariables
export the type used for the primary variables
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:36
typename Traits::FluidState FluidState
Export the fluid state type.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:42
Scalar density(int phaseIdx=0) const
Returns the mass density of a given phase within the control volume.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:134
static constexpr int numFluidPhases()
Return number of phases considered by the model.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:45
typename Traits::FluidSystem FluidSystem
Export the underlying fluid system.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:40
Scalar pressure(int phaseIdx=0) const
Returns the effective pressure of a given phase within the control volume.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:114
static constexpr int numFluidComponents()
Return number of components considered by the model.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:47
Scalar temperature() const
Returns the temperature inside the sub-control volume.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:141
Volume variables for the single-phase Navier-Stokes model.
Definition: scalarvolumevariables.hh:24
const PrimaryVariables & priVars() const
Return the primary variable vector.
Definition: scalarvolumevariables.hh:84
void update(const ElementSolution &elemSol, const Problem &problem, const Element &element, const SubControlVolume &scv)
Update all quantities for a given control volume.
Definition: scalarvolumevariables.hh:52
Base class for the model specific class which provides access to all volume averaged quantities.
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