GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/freeflow/shallowwater/poiseuilleflow/spatialparams.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 11 13 84.6%
Functions: 3 6 50.0%
Branches: 6 36 16.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 ShallowWaterTests
10 * \brief The spatial parameters for the Poiseuille flow problem.
11 */
12 #ifndef DUMUX_POISEUILLE_FLOW_SPATIAL_PARAMETERS_HH
13 #define DUMUX_POISEUILLE_FLOW_SPATIAL_PARAMETERS_HH
14
15 #include <dumux/common/exceptions.hh>
16 #include <dumux/common/parameters.hh>
17 #include <dumux/freeflow/spatialparams.hh>
18
19 namespace Dumux {
20
21 /*!
22 * \ingroup ShallowWaterTests
23 * \brief The spatial parameters class for the Poiseuille flow test.
24 *
25 */
26 template<class GridGeometry, class Scalar, class VolumeVariables>
27
1/6
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
6 class PoiseuilleFlowSpatialParams
28 : public FreeFlowSpatialParams<GridGeometry, Scalar,
29 PoiseuilleFlowSpatialParams<GridGeometry, Scalar, VolumeVariables>>
30 {
31 using ThisType = PoiseuilleFlowSpatialParams<GridGeometry, Scalar, VolumeVariables>;
32 using ParentType = FreeFlowSpatialParams<GridGeometry, Scalar, ThisType>;
33 using GridView = typename GridGeometry::GridView;
34 using FVElementGeometry = typename GridGeometry::LocalView;
35 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
36 using Element = typename GridView::template Codim<0>::Entity;
37 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
38
39 public:
40 6 PoiseuilleFlowSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
41
2/8
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
6 : ParentType(gridGeometry)
42 {
43
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 gravity_ = getParam<Scalar>("Problem.Gravity");
44
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 bedSlope_ = getParam<Scalar>("Problem.BedSlope");
45
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 hBoundary_ = getParam<Scalar>("Problem.HBoundary");
46 6 }
47
48 Scalar gravity(const GlobalPosition& globalPos) const
49 { return gravity_; }
50
51 Scalar gravity() const
52 { return gravity_; }
53
54 //! Define the bed surface
55 582442 Scalar bedSurface(const Element& element, const SubControlVolume& scv) const
56 {
57
0/12
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
3494652 const Scalar length = this->gridGeometry().bBoxMax()[0] - this->gridGeometry().bBoxMin()[0];
58 // The bed level sloped downwards from the left boundary to the right boundary
59 // The water level boundary condition hBoundary_ is specified at the right boundary
60 582442 const Scalar leftBedLevel = - hBoundary_ + length*bedSlope_;
61 // todo depends on index e.g. eIdx = scv.elementIndex();
62
0/4
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
582442 return leftBedLevel - element.geometry().center()[0] * bedSlope_;
63 }
64
65 private:
66 Scalar gravity_;
67 Scalar bedSlope_;
68 Scalar hBoundary_;
69 };
70
71 } // end namespace Dumux
72
73 #endif
74