3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
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 * 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_NAVIERSTOKES_MASS_1P_VOLUME_VARIABLES_HH
26#define DUMUX_FREEFLOW_NAVIERSTOKES_MASS_1P_VOLUME_VARIABLES_HH
27
30
31namespace Dumux {
32
37template <class Traits>
40, public NavierStokesEnergyVolumeVariables<Traits, NavierStokesMassOnePVolumeVariables<Traits>>
41{
44 using Scalar = typename Traits::PrimaryVariables::value_type;
45
46public:
48 using PrimaryVariables = typename Traits::PrimaryVariables;
50 using Indices = typename Traits::ModelTraits::Indices;
52 using FluidSystem = typename Traits::FluidSystem;
54 using FluidState = typename Traits::FluidState;
55
57 static constexpr int numFluidPhases() { return Traits::ModelTraits::numFluidPhases(); }
59 static constexpr int numFluidComponents() { return Traits::ModelTraits::numFluidComponents(); }
60
70 template<class ElementSolution, class Problem, class Element, class SubControlVolume>
71 void update(const ElementSolution& elemSol,
72 const Problem& problem,
73 const Element& element,
74 const SubControlVolume& scv)
75 {
76 ParentType::update(elemSol, problem, element, scv);
77 completeFluidState(elemSol, problem, element,scv, fluidState_);
79 }
80
91 template<class ElemSol, class Problem, class Element, class Scv>
92 void completeFluidState(const ElemSol& elemSol,
93 const Problem& problem,
94 const Element& element,
95 const Scv& scv,
97 {
98 fluidState.setTemperature(/*phaseIdx=*/0, EnergyVolumeVariables::getTemperature(elemSol, problem, element, scv));
99
100 const auto& priVars = elemSol[scv.localDofIndex()];
101 fluidState.setPressure(/*phaseIdx=*/0, priVars[Indices::pressureIdx]);
102
103 // saturation in a single phase is always 1 and thus redundant
104 // to set. But since we use the fluid state shared by the
105 // immiscible multi-phase models, so we have to set it here...
106 fluidState.setSaturation(/*phaseIdx=*/0, 1.0);
107
108 typename FluidSystem::ParameterCache paramCache;
109 paramCache.updatePhase(fluidState, /*phaseIdx=*/0);
110
111 Scalar value = FluidSystem::density(fluidState, paramCache, /*phaseIdx=*/0);
112 fluidState.setDensity(/*phaseIdx=*/0, value);
113
114 value = FluidSystem::viscosity(fluidState, paramCache, /*phaseIdx=*/0);
115 fluidState.setViscosity(/*phaseIdx=*/0, value);
116
117 // compute and set the enthalpy
118 value = EnergyVolumeVariables::enthalpy(fluidState, paramCache);
119 fluidState.setEnthalpy(/*phaseIdx=*/0, value);
120 }
121
126 Scalar pressure(int phaseIdx = 0) const
127 { return fluidState_.pressure(phaseIdx); }
128
132 const FluidState& fluidState() const
133 { return fluidState_; }
134
139 Scalar viscosity(int phaseIdx = 0) const
140 { return fluidState_.viscosity(phaseIdx); }
141
146 Scalar density(int phaseIdx = 0) const
147 { return fluidState_.density(phaseIdx); }
148
156 Scalar temperature() const
157 { return fluidState_.temperature(); }
158
159protected:
161};
162
163} // end namespace Dumux
164
165#endif
Definition: adapt.hh:29
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
The isothermal base class.
Definition: freeflow/navierstokes/energy/volumevariables.hh:59
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:78
void updateEffectiveThermalConductivity()
The effective thermal conductivity is zero for isothermal models.
Definition: freeflow/navierstokes/energy/volumevariables.hh:91
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:117
Volume variables for the single-phase Navier-Stokes model.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:41
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:71
typename Traits::ModelTraits::Indices Indices
export the indices type
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:50
FluidState fluidState_
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:160
const FluidState & fluidState() const
Returns the fluid state of the control volume.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:132
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:92
Scalar viscosity(int phaseIdx=0) const
Returns the dynamic viscosity of the fluid within the control volume.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:139
typename Traits::PrimaryVariables PrimaryVariables
export the type used for the primary variables
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:48
typename Traits::FluidState FluidState
Export the fluid state type.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:54
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:146
static constexpr int numFluidPhases()
Return number of phases considered by the model.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:57
typename Traits::FluidSystem FluidSystem
Export the underlying fluid system.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:52
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:126
static constexpr int numFluidComponents()
Return number of components considered by the model.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:59
Scalar temperature() const
Returns the temperature inside the sub-control volume.
Definition: freeflow/navierstokes/mass/1p/volumevariables.hh:156
Volume variables for the single-phase Navier-Stokes model.
Definition: scalarvolumevariables.hh:37
const PrimaryVariables & priVars() const
Return the primary variable vector.
Definition: scalarvolumevariables.hh:97
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:65
Base class for the model specific class which provides access to all volume averaged quantities.