GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/test/freeflow/shallowwater/roughchannel/limitednikuradse/spatialparams.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 17 17 100.0%
Functions: 3 3 100.0%
Branches: 6 12 50.0%

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 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
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
2 : 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 8092700 Scalar gravity(const GlobalPosition& globalPos) const
57 {
58 8092700 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 1071465 const FrictionLaw<VolumeVariables>& frictionLaw(const Element& element,
69 const SubControlVolume& scv) const
70 {
71 1071465 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 1073965 Scalar bedSurface(const Element& element,
82 const SubControlVolume& scv) const
83 {
84 // todo depends on index e.g. eIdx = scv.elementIndex();
85 1073965 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 0 not taken.
✓ Branch 1 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