GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/test/freeflow/shallowwater/poiseuilleflow/vertical/spatialparams.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 13 13 100.0%
Functions: 1 1 100.0%
Branches: 8 14 57.1%

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 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 #include <dumux/material/fluidmatrixinteractions/frictionlaws/frictionlaw.hh>
20 #include <dumux/material/fluidmatrixinteractions/frictionlaws/viscousnoslip.hh>
21
22 namespace Dumux {
23
24 /*!
25 * \ingroup ShallowWaterTests
26 * \brief The spatial parameters class for the Poiseuille flow test.
27 *
28 */
29 template<class GridGeometry, class Scalar, class VolumeVariables>
30 class PoiseuilleFlowSpatialParams
31 : public FreeFlowSpatialParams<GridGeometry, Scalar,
32 PoiseuilleFlowSpatialParams<GridGeometry, Scalar, VolumeVariables>>
33 {
34 using ThisType = PoiseuilleFlowSpatialParams<GridGeometry, Scalar, VolumeVariables>;
35 using ParentType = FreeFlowSpatialParams<GridGeometry, Scalar, ThisType>;
36 using GridView = typename GridGeometry::GridView;
37 using FVElementGeometry = typename GridGeometry::LocalView;
38 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
39 using Element = typename GridView::template Codim<0>::Entity;
40 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
41
42 public:
43 1 PoiseuilleFlowSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry)
44
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
2 : ParentType(gridGeometry)
45 {
46
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gravity_ = getParam<Scalar>("Problem.Gravity");
47
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 bedSlope_ = getParam<Scalar>("Problem.BedSlope");
48
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 channelLength_ = this->gridGeometry().bBoxMax()[0] - this->gridGeometry().bBoxMin()[0];
49
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 frictionLaw_ = std::make_unique<FrictionLawViscousNoSlip<VolumeVariables>>();
50 1 }
51
52 2288 Scalar gravity(const GlobalPosition& globalPos) const
53
2/2
✓ Branch 1 taken 192 times.
✓ Branch 2 taken 160 times.
2248 { return gravity_; }
54
55 632 Scalar bedSurface(const Element& element, const SubControlVolume& scv) const
56 552 { return bedSlope_*(channelLength_ - scv.center()[0]); }
57
58 320 const FrictionLaw<VolumeVariables>& frictionLaw(const Element& element, const SubControlVolume& scv) const
59 320 { return *frictionLaw_; }
60
61 private:
62 Scalar gravity_;
63 Scalar bedSlope_;
64 Scalar channelLength_;
65
66 std::unique_ptr<FrictionLaw<VolumeVariables>> frictionLaw_;
67 };
68
69 } // end namespace Dumux
70
71 #endif
72