GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/test/porousmediumflow/1p/compressible/instationary/problem.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 13 13 100.0%
Functions: 3 3 100.0%
Branches: 47 60 78.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-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 OnePTests
10 * \brief The properties for the incompressible test
11 */
12
13 #ifndef DUMUX_COMPRESSIBLE_ONEP_TEST_PROBLEM_HH
14 #define DUMUX_COMPRESSIBLE_ONEP_TEST_PROBLEM_HH
15
16 #include <dumux/common/properties.hh>
17 #include <dumux/common/parameters.hh>
18
19 #include <dumux/common/boundarytypes.hh>
20 #include <dumux/porousmediumflow/problem.hh>
21
22 #include <dumux/material/components/h2o.hh>
23 #include <dumux/material/components/tabulatedcomponent.hh>
24 namespace Dumux {
25 /*!
26 * \ingroup OnePTests
27 * \brief Test problem for the compressible one-phase model.
28 */
29 template<class TypeTag>
30 4 class OnePTestProblem : public PorousMediumFlowProblem<TypeTag>
31 {
32 using ParentType = PorousMediumFlowProblem<TypeTag>;
33 using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView;
34 using Element = typename GridView::template Codim<0>::Entity;
35 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
36 using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
37 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
38 using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>;
39 static constexpr int dimWorld = GridView::dimensionworld;
40 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
41
42 public:
43 4 OnePTestProblem(std::shared_ptr<const GridGeometry> gridGeometry)
44
2/4
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
12 : ParentType(gridGeometry)
45 {
46 Components::TabulatedComponent<Components::H2O<Scalar>>
47
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 ::init(273.15, 294.15, 10, 1.0e4, 1.0e6, 200);
48 4 }
49
50 /*!
51 * \brief Specifies which kind of boundary condition should be
52 * used for which equation on a given boundary control volume.
53 *
54 * \param globalPos The position of the center of the finite volume
55 */
56
10/12
✓ Branch 0 taken 2856 times.
✓ Branch 1 taken 1020 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 8904 times.
✓ Branch 5 taken 2968 times.
✓ Branch 6 taken 12402 times.
✓ Branch 7 taken 4134 times.
✓ Branch 8 taken 3180 times.
✓ Branch 9 taken 1060 times.
✓ Branch 10 taken 12084 times.
✓ Branch 11 taken 4028 times.
52636 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
57 {
58 52636 BoundaryTypes values;
59
60
10/12
✓ Branch 0 taken 2856 times.
✓ Branch 1 taken 1020 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 8904 times.
✓ Branch 5 taken 2968 times.
✓ Branch 6 taken 12402 times.
✓ Branch 7 taken 4134 times.
✓ Branch 8 taken 3180 times.
✓ Branch 9 taken 1060 times.
✓ Branch 10 taken 12084 times.
✓ Branch 11 taken 4028 times.
52636 Scalar eps = 1.0e-6;
61
20/24
✓ Branch 0 taken 2856 times.
✓ Branch 1 taken 1020 times.
✓ Branch 2 taken 1020 times.
✓ Branch 3 taken 1836 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 8904 times.
✓ Branch 9 taken 2968 times.
✓ Branch 10 taken 2968 times.
✓ Branch 11 taken 5936 times.
✓ Branch 12 taken 12402 times.
✓ Branch 13 taken 4134 times.
✓ Branch 14 taken 4134 times.
✓ Branch 15 taken 8268 times.
✓ Branch 16 taken 3180 times.
✓ Branch 17 taken 1060 times.
✓ Branch 18 taken 1060 times.
✓ Branch 19 taken 2120 times.
✓ Branch 20 taken 12084 times.
✓ Branch 21 taken 4028 times.
✓ Branch 22 taken 4028 times.
✓ Branch 23 taken 8056 times.
52636 if (globalPos[dimWorld-1] < eps || globalPos[dimWorld-1] > this->gridGeometry().bBoxMax()[dimWorld-1] - eps)
62 values.setAllDirichlet();
63 else
64 values.setAllNeumann();
65
66 return values;
67 }
68
69 /*!
70 * \brief Evaluates the boundary conditions for a Dirichlet control volume.
71 *
72 * \param globalPos The center of the finite volume which ought to be set.
73 *
74 * For this method, the \a values parameter stores primary variables.
75 */
76 10096 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
77 {
78
2/3
✓ Branch 2 taken 2120 times.
✗ Branch 3 not taken.
✓ Branch 1 taken 2120 times.
10096 PrimaryVariables values(0);
79
2/3
✓ Branch 2 taken 2120 times.
✗ Branch 3 not taken.
✓ Branch 1 taken 2120 times.
10096 values[0] = 1.0e+5*(2.0 - globalPos[dimWorld-1]);
80 return values;
81 }
82
83 /*!
84 * \brief Evaluates the initial conditions
85 *
86 * \param globalPos The center of the finite volume which ought to be set.
87 */
88 421 PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
89 {
90 return PrimaryVariables(1.0e5);
91 }
92 };
93
94 } // end namespace Dumux
95
96 #endif
97