GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/test/porousmediumflow/1p/incompressible/problem.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 20 20 100.0%
Functions: 13 13 100.0%
Branches: 65 72 90.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_INCOMPRESSIBLE_ONEP_TEST_PROBLEM_HH
14 #define DUMUX_INCOMPRESSIBLE_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 namespace Dumux {
22 /*!
23 * \ingroup OnePTests
24 * \brief Test problem for the incompressible one-phase model
25 */
26 template<class TypeTag>
27 34 class OnePTestProblem : public PorousMediumFlowProblem<TypeTag>
28 {
29 using ParentType = PorousMediumFlowProblem<TypeTag>;
30 using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView;
31 using Element = typename GridView::template Codim<0>::Entity;
32 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
33 using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
34 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
35 using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
36 using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>;
37 static constexpr int dimWorld = GridView::dimensionworld;
38 using GlobalPosition = Dune::FieldVector<Scalar,dimWorld>;
39
40 public:
41 18 OnePTestProblem(std::shared_ptr<const GridGeometry> gridGeometry)
42
2/4
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 18 times.
✗ Branch 5 not taken.
54 : ParentType(gridGeometry), velocity_(0.0)
43 {
44
1/2
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
18 Scalar permeability = getParam<Scalar>("SpatialParams.Permeability");
45
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
18 dp_dy_ = -1.0e+5;
46
47
1/2
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
18 const bool checkIsConstantVelocity = getParam<bool>("Problem.CheckIsConstantVelocity", false);
48
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 13 times.
18 if(checkIsConstantVelocity)
49 {
50 5 velocity_[dimWorld-1] = -permeability * dp_dy_;
51 5 velocity_[dimWorld-1] /= FluidSystem::viscosity(
52 5 this->spatialParams().temperatureAtPos(GlobalPosition(0.0)), Scalar{1.0e5}
53 );
54 }
55 18 }
56
57 /*!
58 * \brief Specifies which kind of boundary condition should be
59 * used for which equation on a given boundary control volume.
60 *
61 * \param globalPos The position of the center of the finite volume
62 */
63
14/14
✓ Branch 0 taken 2418 times.
✓ Branch 1 taken 836 times.
✓ Branch 2 taken 1644 times.
✓ Branch 3 taken 548 times.
✓ Branch 4 taken 1770 times.
✓ Branch 5 taken 590 times.
✓ Branch 6 taken 1068 times.
✓ Branch 7 taken 356 times.
✓ Branch 8 taken 438 times.
✓ Branch 9 taken 146 times.
✓ Branch 10 taken 324 times.
✓ Branch 11 taken 108 times.
✓ Branch 12 taken 324 times.
✓ Branch 13 taken 108 times.
10678 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
64 {
65 10678 BoundaryTypes values;
66
67
14/14
✓ Branch 0 taken 2418 times.
✓ Branch 1 taken 836 times.
✓ Branch 2 taken 1644 times.
✓ Branch 3 taken 548 times.
✓ Branch 4 taken 1770 times.
✓ Branch 5 taken 590 times.
✓ Branch 6 taken 1068 times.
✓ Branch 7 taken 356 times.
✓ Branch 8 taken 438 times.
✓ Branch 9 taken 146 times.
✓ Branch 10 taken 324 times.
✓ Branch 11 taken 108 times.
✓ Branch 12 taken 324 times.
✓ Branch 13 taken 108 times.
10678 Scalar eps = 1.0e-6;
68
28/28
✓ Branch 0 taken 2418 times.
✓ Branch 1 taken 836 times.
✓ Branch 2 taken 836 times.
✓ Branch 3 taken 1582 times.
✓ Branch 4 taken 1644 times.
✓ Branch 5 taken 548 times.
✓ Branch 6 taken 548 times.
✓ Branch 7 taken 1096 times.
✓ Branch 8 taken 1770 times.
✓ Branch 9 taken 590 times.
✓ Branch 10 taken 590 times.
✓ Branch 11 taken 1180 times.
✓ Branch 12 taken 1068 times.
✓ Branch 13 taken 356 times.
✓ Branch 14 taken 356 times.
✓ Branch 15 taken 712 times.
✓ Branch 16 taken 438 times.
✓ Branch 17 taken 146 times.
✓ Branch 18 taken 146 times.
✓ Branch 19 taken 292 times.
✓ Branch 20 taken 324 times.
✓ Branch 21 taken 108 times.
✓ Branch 22 taken 108 times.
✓ Branch 23 taken 216 times.
✓ Branch 24 taken 324 times.
✓ Branch 25 taken 108 times.
✓ Branch 26 taken 108 times.
✓ Branch 27 taken 216 times.
10678 if (globalPos[dimWorld-1] < eps || globalPos[dimWorld-1] > this->gridGeometry().bBoxMax()[dimWorld-1] - eps)
69 values.setAllDirichlet();
70 else
71 values.setAllNeumann();
72
73 return values;
74 }
75
76 /*!
77 * \brief Evaluates the boundary conditions for a Dirichlet control volume.
78 *
79 * \param globalPos The center of the finite volume which ought to be set.
80 *
81 * For this method, the \a values parameter stores primary variables.
82 */
83 2944 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
84 {
85 2944 PrimaryVariables values(0);
86
1/2
✓ Branch 1 taken 300 times.
✗ Branch 2 not taken.
2944 values[0] = 1.0e+5 + dp_dy_*(globalPos[dimWorld-1] - this->gridGeometry().bBoxMax()[dimWorld-1]);
87
88 return values;
89 }
90
91 /*!
92 * \brief Returns the velocity
93 *
94 * The velocity is given for the case of a linear pressure solution
95 * with constant permeablity and without gravity.
96 */
97 5 const GlobalPosition velocity() const
98 {
99
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 return velocity_;
100 }
101
102 private:
103 Scalar dp_dy_;
104 GlobalPosition velocity_;
105 };
106
107 } // end namespace Dumux
108
109 #endif
110