3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
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 * 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 2 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 *****************************************************************************/
24#ifndef DUMUX_FREEFLOW_SHALLOW_WATER_VOLUME_VARIABLES_HH
25#define DUMUX_FREEFLOW_SHALLOW_WATER_VOLUME_VARIABLES_HH
26
27namespace Dumux {
28
33template <class Traits>
35{
36 using Indices = typename Traits::ModelTraits::Indices;
37 using Scalar = typename Traits::PrimaryVariables::value_type;
38
39public:
40 using PrimaryVariables = typename Traits::PrimaryVariables;
42 using FluidSystem = typename Traits::FluidSystem;
43
44 template<class ElemSol, class Problem, class Element, class Scv>
45 void update(const ElemSol &elemSol,
46 const Problem &problem,
47 const Element &element,
48 const Scv &scv)
49 {
50
51 priVars_ = elemSol[scv.localDofIndex()];
52 bedSurface_ = problem.spatialParams().bedSurface(element,scv);
53 }
54
59 Scalar extrusionFactor() const
60 { return 1.0; }
61
64 { return priVars_; }
65
70 Scalar waterDepth() const
71 {
72 return priVars_[Indices::waterdepthIdx];
73 }
74
80 Scalar velocity(int directionIndex) const
81 {
82
83 return priVars_[Indices::velocityOffset + directionIndex];
84 }
85
90 Scalar bedSurface() const
91 {
92 return bedSurface_;
93 }
94
99 Scalar density(int phaseIdx = 0) const
100 {
101 static_assert(!FluidSystem::isCompressible(0),
102 "The shallow water model assumes incompressible fluids"
103 );
104
105 // call with hard-coded sensible default values for water/river applications for now
106 return FluidSystem::density(283.15, 1e5);
107
108 }
109
110private:
111 PrimaryVariables priVars_;
112 Scalar bedSurface_;
113};
114
115} // end namespace Dumux
116
117#endif
static unsigned int directionIndex(Vector &&vector)
Returns the direction index of the facet (0 = x, 1 = y, 2 = z)
Definition: staggeredgeometryhelper.hh:133
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
Volume variables for the shallow water equations model.
Definition: freeflow/shallowwater/volumevariables.hh:35
Scalar extrusionFactor() const
Return the extrusion factor (dummy variable).
Definition: freeflow/shallowwater/volumevariables.hh:59
Scalar waterDepth() const
Return water detph h inside the sub-control volume.
Definition: freeflow/shallowwater/volumevariables.hh:70
typename Traits::FluidSystem FluidSystem
export the underlying fluid system
Definition: freeflow/shallowwater/volumevariables.hh:42
const PrimaryVariables & priVars() const
Return the vector of primary variables.
Definition: freeflow/shallowwater/volumevariables.hh:63
typename Traits::PrimaryVariables PrimaryVariables
Definition: freeflow/shallowwater/volumevariables.hh:40
void update(const ElemSol &elemSol, const Problem &problem, const Element &element, const Scv &scv)
Definition: freeflow/shallowwater/volumevariables.hh:45
Scalar density(int phaseIdx=0) const
Return the fluid density.
Definition: freeflow/shallowwater/volumevariables.hh:99
Scalar velocity(int directionIndex) const
Return water velocity component inside the sub-control volume.
Definition: freeflow/shallowwater/volumevariables.hh:80
Scalar bedSurface() const
Return the bed surface inside the sub-control volume.
Definition: freeflow/shallowwater/volumevariables.hh:90