GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux-testing/systemtest/porousmediumflow/1p/problem.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 12 12 100.0%
Functions: 3 3 100.0%
Branches: 24 48 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 #ifndef DUMUX_1PTEST_PROBLEM_HH
8 #define DUMUX_1PTEST_PROBLEM_HH
9
10 #include <dumux/common/properties.hh>
11 #include <dumux/common/parameters.hh>
12
13 #include <dumux/common/boundarytypes.hh>
14 #include <dumux/porousmediumflow/problem.hh>
15
16 namespace Dumux {
17
18 template <class TypeTag>
19 24 class OnePTestProblem : public PorousMediumFlowProblem<TypeTag>
20 {
21 using ParentType = PorousMediumFlowProblem<TypeTag>;
22 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
23 using GridView = typename GridGeometry::GridView;
24 using Element = typename GridView::template Codim<0>::Entity;
25 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
26
27 using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
28 using BoundaryTypes = Dumux::BoundaryTypes<PrimaryVariables::size()>;
29
30 static constexpr int dimWorld = GridView::dimensionworld;
31 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
32
33 using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices;
34
35 public:
36 24 OnePTestProblem(std::shared_ptr<const GridGeometry> gridGeometry)
37
3/6
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 24 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 24 times.
✗ Branch 9 not taken.
72 : ParentType(gridGeometry)
38 {
39
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 name_ = getParam<std::string>("Problem.Name");
40 24 }
41
42
2/4
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 24 times.
✗ Branch 5 not taken.
48 std::string name() const { return name_; }
43
44 /*!
45 * \brief Specifies which kind of boundary condition should be
46 * used for which equation on a given boundary control volume.
47 */
48
4/8
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1440 times.
✓ Branch 5 taken 480 times.
✓ Branch 6 taken 2880 times.
✓ Branch 7 taken 960 times.
5760 BoundaryTypes boundaryTypesAtPos(const GlobalPosition& globalPos) const
49 {
50
4/8
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1440 times.
✓ Branch 5 taken 480 times.
✓ Branch 6 taken 2880 times.
✓ Branch 7 taken 960 times.
5760 BoundaryTypes values;
51
52
8/16
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1440 times.
✓ Branch 9 taken 480 times.
✓ Branch 10 taken 480 times.
✓ Branch 11 taken 960 times.
✓ Branch 12 taken 2880 times.
✓ Branch 13 taken 960 times.
✓ Branch 14 taken 960 times.
✓ Branch 15 taken 1920 times.
5760 if (globalPos[dimWorld-1] < eps_ || globalPos[dimWorld-1] > this->gridGeometry().bBoxMax()[dimWorld-1] - eps_)
53 values.setAllDirichlet();
54 else
55 values.setAllNeumann();
56
57 return values;
58 }
59
60 /*!
61 * \brief Evaluate the boundary conditions for a dirichlet control volume.
62 */
63 960 PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const
64 {
65
1/2
✓ Branch 1 taken 960 times.
✗ Branch 2 not taken.
960 PrimaryVariables values(0);
66
1/2
✓ Branch 1 taken 960 times.
✗ Branch 2 not taken.
960 values[Indices::pressureIdx] = 1.0e+5*(2.0 - globalPos[dimWorld-1]);
67 return values;
68 }
69
70 /*!
71 * \brief Evaluate the initial value for a control volume.
72 */
73 PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
74 {
75 PrimaryVariables priVars(0.0);
76 priVars[Indices::pressureIdx] = 1.0e+5;
77 return priVars;
78 }
79
80 private:
81 std::string name_;
82 static constexpr Scalar eps_ = 1.0e-6;
83 };
84
85 } //end namespace Dumux
86
87 #endif
88