GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/freeflow/shallowwater/volumevariables.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 8 16 50.0%
Functions: 0 10 0.0%
Branches: 32 44 72.7%

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-FileCopyrightInfo: 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 76699088 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 void update(const ElemSol &elemSol,
34 const Problem &problem,
35 const Element &element,
36 const Scv &scv)
37 {
38
39 53315446 priVars_ = elemSol[scv.localDofIndex()];
40
2/4
✓ Branch 5 taken 375320 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 375320 times.
✗ Branch 9 not taken.
106733420 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 const PrimaryVariables& priVars() const
52 80173 { return priVars_; }
53
54 /*!
55 * \brief Return water detph h inside the sub-control volume.
56 *
57 */
58 Scalar waterDepth() const
59 {
60
12/20
✓ Branch 0 taken 1070877 times.
✓ Branch 1 taken 1386896 times.
✓ Branch 2 taken 1070877 times.
✓ Branch 3 taken 1386896 times.
✓ Branch 4 taken 2281176 times.
✓ Branch 5 taken 2302069 times.
✓ Branch 6 taken 2281176 times.
✓ Branch 7 taken 2302069 times.
✓ Branch 8 taken 2281176 times.
✓ Branch 9 taken 2302069 times.
✓ Branch 10 taken 2281176 times.
✓ Branch 11 taken 2302069 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
917520090 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 Scalar velocity(int directionIndex) const
69 {
70
71
16/16
✓ Branch 16 taken 40109 times.
✓ Branch 17 taken 40064 times.
✓ Branch 18 taken 40109 times.
✓ Branch 19 taken 40064 times.
✓ Branch 20 taken 40109 times.
✓ Branch 21 taken 40064 times.
✓ Branch 22 taken 40109 times.
✓ Branch 23 taken 40064 times.
✓ Branch 24 taken 40109 times.
✓ Branch 25 taken 40064 times.
✓ Branch 26 taken 40109 times.
✓ Branch 27 taken 40064 times.
✓ Branch 28 taken 40109 times.
✓ Branch 29 taken 40064 times.
✓ Branch 30 taken 40109 times.
✓ Branch 31 taken 40064 times.
1483078148 return priVars_[Indices::velocityOffset + directionIndex];
72 }
73
74 /*!
75 * \brief Return the bed surface inside the sub-control volume.
76 *
77 */
78 Scalar bedSurface() const
79 {
80 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
1/2
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
7 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
1/2
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
7 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