GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/freeflow/shallowwater/roughchannel/limitednikuradse/spatialparams.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 12 17 70.6%
Functions: 2 5 40.0%
Branches: 8 24 33.3%

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 rough channel problem with limited
11 * Nikuradse friction
12 */
13 #ifndef DUMUX_ROUGH_CHANNEL_SPATIAL_PARAMETERS_HH
14 #define DUMUX_ROUGH_CHANNEL_SPATIAL_PARAMETERS_HH
15
16 #include <dumux/common/parameters.hh>
17 #include <dumux/material/fluidmatrixinteractions/frictionlaws/frictionlaw.hh>
18 #include <dumux/material/fluidmatrixinteractions/frictionlaws/manning.hh>
19 #include <dumux/material/fluidmatrixinteractions/frictionlaws/nikuradse.hh>
20 #include <dumux/freeflow/spatialparams.hh>
21
22 namespace Dumux {
23
24 /*!
25 * \ingroup ShallowWaterTests
26 * \brief The spatial parameters class for the test with limited Nikuradse
27 * friction.
28 *
29 */
30 template<class GridGeometry, class Scalar, class VolumeVariables>
31 class RoughChannelSpatialParams
32 : public FreeFlowSpatialParams<GridGeometry, Scalar,
33 RoughChannelSpatialParams<GridGeometry, Scalar, VolumeVariables>>
34 {
35 using ThisType = RoughChannelSpatialParams<GridGeometry, Scalar, VolumeVariables>;
36 using ParentType = FreeFlowSpatialParams<GridGeometry, Scalar, ThisType>;
37 using GridView = typename GridGeometry::GridView;
38 using FVElementGeometry = typename GridGeometry::LocalView;
39 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
40 using Element = typename GridView::template Codim<0>::Entity;
41 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
42
43 public:
44 1 RoughChannelSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
45
4/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
3 : ParentType(gridGeometry)
46 {
47
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gravity_ = getParam<Scalar>("Problem.Gravity");
48
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 bedSlope_ = getParam<Scalar>("Problem.BedSlope");
49
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 initFrictionLaw_();
50 1 }
51
52 /*! \brief Define the gravitation.
53 *
54 * \return gravity constant
55 */
56 Scalar gravity(const GlobalPosition& globalPos) const
57 {
58 return gravity_;
59 }
60
61 /*! \brief Get the frictionLaw.
62 *
63 * Get the frictionLaw, which already includes the friction value.
64 *
65 * \return frictionLaw
66 */
67
68 const FrictionLaw<VolumeVariables>& frictionLaw(const Element& element,
69 const SubControlVolume& scv) const
70 {
71 2141754 return *frictionLaw_;
72 }
73
74 /*! \brief Define the bed surface
75 *
76 * \param element The current element
77 * \param scv The sub-control volume inside the element.
78 *
79 * \return The bed surface
80 */
81 Scalar bedSurface(const Element& element,
82 const SubControlVolume& scv) const
83 {
84 // todo depends on index e.g. eIdx = scv.elementIndex();
85 return 10.0 - element.geometry().center()[0] * bedSlope_;
86 }
87
88 private:
89 1 void initFrictionLaw_()
90 {
91 // Get the roughnessHeight which will be used to limit the friction law
92 1 const Scalar roughnessHeight = getParam<Scalar>("Problem.RoughnessHeight", 0.0);
93 1 const Scalar ks = getParam<Scalar>("Problem.Ks"); // equivalent sand roughness
94
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
1 frictionLaw_ = std::make_unique<FrictionLawNikuradse<VolumeVariables>>(ks, roughnessHeight);
95 1 }
96
97 Scalar gravity_;
98 Scalar bedSlope_;
99 std::string frictionLawType_;
100 std::unique_ptr<FrictionLaw<VolumeVariables>> frictionLaw_;
101 };
102
103 } // end namespace Dumux
104
105 #endif
106