version 3.8
freeflow/shallowwater/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//
12#ifndef DUMUX_FREEFLOW_SHALLOW_WATER_VOLUME_VARIABLES_HH
13#define DUMUX_FREEFLOW_SHALLOW_WATER_VOLUME_VARIABLES_HH
14
15namespace Dumux {
16
21template <class Traits>
23{
24 using Indices = typename Traits::ModelTraits::Indices;
25 using Scalar = typename Traits::PrimaryVariables::value_type;
26
27public:
28 using PrimaryVariables = typename Traits::PrimaryVariables;
30 using FluidSystem = typename Traits::FluidSystem;
31
32 template<class ElemSol, class Problem, class Element, class Scv>
33 void update(const ElemSol &elemSol,
34 const Problem &problem,
35 const Element &element,
36 const Scv &scv)
37 {
38
39 priVars_ = elemSol[scv.localDofIndex()];
40 bedSurface_ = problem.spatialParams().bedSurface(element,scv);
41 }
42
47 Scalar extrusionFactor() const
48 { return 1.0; }
49
52 { return priVars_; }
53
58 Scalar waterDepth() const
59 {
60 return priVars_[Indices::waterdepthIdx];
61 }
62
68 Scalar velocity(int directionIndex) const
69 {
70
71 return priVars_[Indices::velocityOffset + directionIndex];
72 }
73
78 Scalar bedSurface() const
79 {
80 return bedSurface_;
81 }
82
86 Scalar density(int phaseIdx = 0) const
87 {
88 static_assert(!FluidSystem::isCompressible(0),
89 "The shallow water model assumes incompressible fluids"
90 );
91
92 // call with hard-coded sensible default values for water/river applications for now
93 return FluidSystem::density(283.15, 1e5);
94 }
95
99 Scalar viscosity(int phaseIdx = 0) const
100 {
101 static_assert(FluidSystem::viscosityIsConstant(0),
102 "The shallow water model assumes fluids with constant viscosity"
103 );
104
105 // call with hard-coded sensible default values for water/river applications for now
106 return FluidSystem::viscosity(283.15, 1e5);
107 }
108
109private:
110 PrimaryVariables priVars_;
111 Scalar bedSurface_;
112};
113
114} // end namespace Dumux
115
116#endif
Volume variables for the shallow water equations model.
Definition: freeflow/shallowwater/volumevariables.hh:23
Scalar viscosity(int phaseIdx=0) const
Return the dynamic viscosity of the fluid.
Definition: freeflow/shallowwater/volumevariables.hh:99
Scalar extrusionFactor() const
Return the extrusion factor (dummy variable).
Definition: freeflow/shallowwater/volumevariables.hh:47
Scalar waterDepth() const
Return water detph h inside the sub-control volume.
Definition: freeflow/shallowwater/volumevariables.hh:58
typename Traits::FluidSystem FluidSystem
export the underlying fluid system
Definition: freeflow/shallowwater/volumevariables.hh:30
const PrimaryVariables & priVars() const
Return the vector of primary variables.
Definition: freeflow/shallowwater/volumevariables.hh:51
typename Traits::PrimaryVariables PrimaryVariables
Definition: freeflow/shallowwater/volumevariables.hh:28
void update(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv)
Definition: freeflow/shallowwater/volumevariables.hh:33
Scalar density(int phaseIdx=0) const
Returns the mass density of the fluid.
Definition: freeflow/shallowwater/volumevariables.hh:86
Scalar velocity(int directionIndex) const
Return water velocity component inside the sub-control volume.
Definition: freeflow/shallowwater/volumevariables.hh:68
Scalar bedSurface() const
Return the bed surface inside the sub-control volume.
Definition: freeflow/shallowwater/volumevariables.hh:78
static unsigned int directionIndex(Vector &&vector)
Returns the direction index of the facet (0 = x, 1 = y, 2 = z)
Definition: staggeredgeometryhelper.hh:121
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