GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/2p/boxdfm/problem.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 16 17 94.1%
Functions: 7 9 77.8%
Branches: 35 76 46.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-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5 // SPDX-License-Identifier: GPL-3.0-or-later
6 //
7 /*!
8 * \ingroup TwoPTests
9 * \brief The properties for the incompressible 2p-boxdfm test.
10 */
11
12 #ifndef DUMUX_INCOMPRESSIBLE_TWOPBOXDFM_TEST_PROBLEM_HH
13 #define DUMUX_INCOMPRESSIBLE_TWOPBOXDFM_TEST_PROBLEM_HH
14
15 #include <dumux/common/properties.hh>
16 #include <dumux/common/parameters.hh>
17 #include <dumux/common/boundarytypes.hh>
18 #include <dumux/common/numeqvector.hh>
19
20 #include <dumux/porousmediumflow/problem.hh>
21
22 namespace Dumux {
23
24 /*!
25 * \ingroup TwoPTests
26 * \brief The incompressible 2p-boxdfm test problem.
27 */
28 template<class TypeTag>
29 6 class TwoPTestProblem : public PorousMediumFlowProblem<TypeTag>
30 {
31 using ParentType = PorousMediumFlowProblem<TypeTag>;
32
33 using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView;
34 using Element = typename GridView::template Codim<0>::Entity;
35 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
36
37 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
38 using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
39 using NumEqVector = Dumux::NumEqVector<PrimaryVariables>;
40 using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>;
41 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
42 using SubControlVolume = typename GridGeometry::SubControlVolume;
43
44 // some indices for convenience
45 using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
46 using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices;
47 enum
48 {
49 pressureH2OIdx = Indices::pressureIdx,
50 saturationDNAPLIdx = Indices::saturationIdx,
51 contiDNAPLEqIdx = Indices::conti0EqIdx + FluidSystem::comp1Idx,
52 waterPhaseIdx = FluidSystem::phase0Idx,
53 dnaplPhaseIdx = FluidSystem::phase1Idx
54 };
55
56 static constexpr Scalar eps_ = 1e-6;
57 static constexpr int dimWorld = GridView::dimensionworld;
58
59 public:
60 6 TwoPTestProblem(std::shared_ptr<const GridGeometry> gridGeometry)
61
5/14
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 6 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 6 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
18 : ParentType(gridGeometry)
62 6 {}
63
64 /*!
65 * \brief Specifies which kind of boundary condition should be
66 * used for which equation on a given boundary segment
67 *
68 * \param globalPos The global position
69 */
70 683278 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
71 {
72 683278 BoundaryTypes values;
73 683278 values.setAllNeumann();
74
14/14
✓ Branch 0 taken 561562 times.
✓ Branch 1 taken 121716 times.
✓ Branch 2 taken 561562 times.
✓ Branch 3 taken 121716 times.
✓ Branch 4 taken 561562 times.
✓ Branch 5 taken 121716 times.
✓ Branch 6 taken 561562 times.
✓ Branch 7 taken 121716 times.
✓ Branch 8 taken 561562 times.
✓ Branch 9 taken 121716 times.
✓ Branch 10 taken 159266 times.
✓ Branch 11 taken 402296 times.
✓ Branch 12 taken 159266 times.
✓ Branch 13 taken 402296 times.
3416390 if (globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_ || globalPos[0] < 1e-6)
75 values.setAllDirichlet();
76 683278 return values;
77 }
78
79 /*!
80 * \brief Evaluates the boundary conditions for a Dirichlet boundary segment.
81 *
82 * \param globalPos The global position
83 */
84 PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const
85 {
86 561964 auto values = initialAtPos(globalPos);
87
2/6
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 159266 times.
✓ Branch 3 taken 121716 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
280982 if (globalPos[0] < 1e-6)
88 318532 values[saturationDNAPLIdx] = 0.5;
89 return values;
90 }
91
92 /*!
93 * \brief Evaluates the boundary conditions for a Neumann boundary segment.
94 *
95 * \param globalPos The position of the integration point of the boundary segment.
96 *
97 * For this method, the \a values parameter stores the mass flux
98 * in normal direction of each phase. Negative values mean influx.
99 */
100 NumEqVector neumannAtPos(const GlobalPosition& globalPos) const
101 3973152 { return NumEqVector(0.0); }
102
103 /*!
104 * \brief Evaluates the initial values for a control volume.
105 *
106 * \param globalPos The global position
107 */
108 PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
109 {
110 284862 PrimaryVariables values;
111
112 // pressure gradient from left to right
113
10/30
✗ 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 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 159266 times.
✓ Branch 11 taken 121716 times.
✓ Branch 12 taken 159266 times.
✓ Branch 13 taken 121716 times.
✓ Branch 14 taken 159266 times.
✓ Branch 15 taken 121716 times.
✓ Branch 16 taken 159266 times.
✓ Branch 17 taken 121716 times.
✓ Branch 18 taken 159266 times.
✓ Branch 19 taken 121716 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
1414610 values[pressureH2OIdx] = 2e5 - 1e5*globalPos[0]/this->gridGeometry().bBoxMax()[0];
114
4/12
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 159266 times.
✓ Branch 5 taken 121716 times.
✓ Branch 6 taken 159266 times.
✓ Branch 7 taken 121716 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
565844 values[saturationDNAPLIdx] = 0;
115 return values;
116 }
117
118 };
119
120 } // end namespace Dumux
121
122 #endif
123