Line | Branch | Exec | Source |
---|---|---|---|
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-FileCopyrightText: Copyright © DuMux Project contributors, see AUTHORS.md in root folder | ||
5 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
6 | // | ||
7 | /*! | ||
8 | * \file | ||
9 | * \ingroup ShallowWaterModels | ||
10 | * \copydoc Dumux::ShallowWaterVolumeVariables | ||
11 | */ | ||
12 | #ifndef DUMUX_FREEFLOW_SHALLOW_WATER_VOLUME_VARIABLES_HH | ||
13 | #define DUMUX_FREEFLOW_SHALLOW_WATER_VOLUME_VARIABLES_HH | ||
14 | |||
15 | namespace Dumux { | ||
16 | |||
17 | /*! | ||
18 | * \ingroup ShallowWaterModels | ||
19 | * \brief Volume variables for the shallow water equations model. | ||
20 | */ | ||
21 | template <class Traits> | ||
22 | 38335554 | class ShallowWaterVolumeVariables | |
23 | { | ||
24 | using Indices = typename Traits::ModelTraits::Indices; | ||
25 | using Scalar = typename Traits::PrimaryVariables::value_type; | ||
26 | |||
27 | public: | ||
28 | using PrimaryVariables = typename Traits::PrimaryVariables; | ||
29 | //! export the underlying fluid system | ||
30 | using FluidSystem = typename Traits::FluidSystem; | ||
31 | |||
32 | template<class ElemSol, class Problem, class Element, class Scv> | ||
33 | 53295930 | void update(const ElemSol &elemSol, | |
34 | const Problem &problem, | ||
35 | const Element &element, | ||
36 | const Scv &scv) | ||
37 | { | ||
38 | |||
39 | 53295930 | priVars_ = elemSol[scv.localDofIndex()]; | |
40 | 45972570 | bedSurface_ = problem.spatialParams().bedSurface(element,scv); | |
41 | } | ||
42 | |||
43 | /*! | ||
44 | * \brief Return the extrusion factor (dummy variable). | ||
45 | * | ||
46 | */ | ||
47 | Scalar extrusionFactor() const | ||
48 | { return 1.0; } | ||
49 | |||
50 | //! Return the vector of primary variables | ||
51 | 80173 | const PrimaryVariables& priVars() const | |
52 |
1/2✓ Branch 0 taken 80173 times.
✗ Branch 1 not taken.
|
80173 | { return priVars_; } |
53 | |||
54 | /*! | ||
55 | * \brief Return water detph h inside the sub-control volume. | ||
56 | * | ||
57 | */ | ||
58 | 193519669 | Scalar waterDepth() const | |
59 | { | ||
60 |
3/7✓ Branch 0 taken 1071465 times.
✓ Branch 1 taken 3659458 times.
✓ Branch 2 taken 2302069 times.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 4 not taken.
|
189204316 | return priVars_[Indices::waterdepthIdx]; |
61 | } | ||
62 | |||
63 | /*! | ||
64 | * \brief Return water velocity component inside the sub-control volume. | ||
65 | * | ||
66 | * \param directionIndex index of the direction staring at x = 0 | ||
67 | */ | ||
68 | 188936424 | Scalar velocity(int directionIndex) const | |
69 | { | ||
70 | |||
71 |
2/2✓ Branch 3 taken 40109 times.
✓ Branch 4 taken 40064 times.
|
185763277 | return priVars_[Indices::velocityOffset + directionIndex]; |
72 | } | ||
73 | |||
74 | /*! | ||
75 | * \brief Return the bed surface inside the sub-control volume. | ||
76 | * | ||
77 | */ | ||
78 | 160334264 | Scalar bedSurface() const | |
79 | { | ||
80 |
2/2✓ Branch 0 taken 2281176 times.
✓ Branch 1 taken 2302069 times.
|
163886740 | return bedSurface_; |
81 | } | ||
82 | |||
83 | /*! | ||
84 | * \brief Returns the mass density \f$\mathrm{[kg/m^3]}\f$ of the fluid | ||
85 | */ | ||
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 | |||
96 | /*! | ||
97 | * \brief Return the dynamic viscosity \f$\mathrm{[Pa s]}\f$ of the fluid | ||
98 | */ | ||
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 | |||
109 | private: | ||
110 | PrimaryVariables priVars_; | ||
111 | Scalar bedSurface_; | ||
112 | }; | ||
113 | |||
114 | } // end namespace Dumux | ||
115 | |||
116 | #endif | ||
117 |