GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/1p/incompressible/problem.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 16 18 88.9%
Functions: 13 20 65.0%
Branches: 121 150 80.7%

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-FileCopyrightInfo: 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
5/14
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 18 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 18 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 18 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 18 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 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 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 15 velocity_[dimWorld-1] /= FluidSystem::viscosity(
52 10 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 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
64 {
65
14/16
✓ Branch 0 taken 2208 times.
✓ Branch 1 taken 766 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.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
10398 BoundaryTypes values;
66
67 10398 Scalar eps = 1.0e-6;
68
98/112
✓ Branch 0 taken 2208 times.
✓ Branch 1 taken 766 times.
✓ Branch 2 taken 2208 times.
✓ Branch 3 taken 766 times.
✓ Branch 4 taken 766 times.
✓ Branch 5 taken 1442 times.
✓ Branch 6 taken 766 times.
✓ Branch 7 taken 1442 times.
✓ Branch 8 taken 766 times.
✓ Branch 9 taken 1442 times.
✓ Branch 10 taken 766 times.
✓ Branch 11 taken 1442 times.
✓ Branch 12 taken 766 times.
✓ Branch 13 taken 1442 times.
✓ Branch 14 taken 1644 times.
✓ Branch 15 taken 548 times.
✓ Branch 16 taken 1644 times.
✓ Branch 17 taken 548 times.
✓ Branch 18 taken 548 times.
✓ Branch 19 taken 1096 times.
✓ Branch 20 taken 548 times.
✓ Branch 21 taken 1096 times.
✓ Branch 22 taken 548 times.
✓ Branch 23 taken 1096 times.
✓ Branch 24 taken 548 times.
✓ Branch 25 taken 1096 times.
✓ Branch 26 taken 548 times.
✓ Branch 27 taken 1096 times.
✓ Branch 28 taken 1770 times.
✓ Branch 29 taken 590 times.
✓ Branch 30 taken 1770 times.
✓ Branch 31 taken 590 times.
✓ Branch 32 taken 590 times.
✓ Branch 33 taken 1180 times.
✓ Branch 34 taken 590 times.
✓ Branch 35 taken 1180 times.
✓ Branch 36 taken 590 times.
✓ Branch 37 taken 1180 times.
✓ Branch 38 taken 590 times.
✓ Branch 39 taken 1180 times.
✓ Branch 40 taken 590 times.
✓ Branch 41 taken 1180 times.
✓ Branch 42 taken 1068 times.
✓ Branch 43 taken 356 times.
✓ Branch 44 taken 1068 times.
✓ Branch 45 taken 356 times.
✓ Branch 46 taken 356 times.
✓ Branch 47 taken 712 times.
✓ Branch 48 taken 356 times.
✓ Branch 49 taken 712 times.
✓ Branch 50 taken 356 times.
✓ Branch 51 taken 712 times.
✓ Branch 52 taken 356 times.
✓ Branch 53 taken 712 times.
✓ Branch 54 taken 356 times.
✓ Branch 55 taken 712 times.
✓ Branch 56 taken 438 times.
✓ Branch 57 taken 146 times.
✓ Branch 58 taken 438 times.
✓ Branch 59 taken 146 times.
✓ Branch 60 taken 146 times.
✓ Branch 61 taken 292 times.
✓ Branch 62 taken 146 times.
✓ Branch 63 taken 292 times.
✓ Branch 64 taken 146 times.
✓ Branch 65 taken 292 times.
✓ Branch 66 taken 146 times.
✓ Branch 67 taken 292 times.
✓ Branch 68 taken 146 times.
✓ Branch 69 taken 292 times.
✓ Branch 70 taken 324 times.
✓ Branch 71 taken 108 times.
✓ Branch 72 taken 324 times.
✓ Branch 73 taken 108 times.
✓ Branch 74 taken 108 times.
✓ Branch 75 taken 216 times.
✓ Branch 76 taken 108 times.
✓ Branch 77 taken 216 times.
✓ Branch 78 taken 108 times.
✓ Branch 79 taken 216 times.
✓ Branch 80 taken 108 times.
✓ Branch 81 taken 216 times.
✓ Branch 82 taken 108 times.
✓ Branch 83 taken 216 times.
✓ Branch 84 taken 324 times.
✓ Branch 85 taken 108 times.
✓ Branch 86 taken 324 times.
✓ Branch 87 taken 108 times.
✓ Branch 88 taken 108 times.
✓ Branch 89 taken 216 times.
✓ Branch 90 taken 108 times.
✓ Branch 91 taken 216 times.
✓ Branch 92 taken 108 times.
✓ Branch 93 taken 216 times.
✓ Branch 94 taken 108 times.
✓ Branch 95 taken 216 times.
✓ Branch 96 taken 108 times.
✓ Branch 97 taken 216 times.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✗ Branch 107 not taken.
✗ Branch 108 not taken.
✗ Branch 109 not taken.
✗ Branch 110 not taken.
✗ Branch 111 not taken.
20796 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 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
84 {
85 2884 PrimaryVariables values(0);
86 14420 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 const GlobalPosition velocity() const
98 {
99 return velocity_;
100 }
101
102 private:
103 Scalar dp_dy_;
104 GlobalPosition velocity_;
105 };
106
107 } // end namespace Dumux
108
109 #endif
110