GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: dumux/test/porousmediumflow/2p/fracture/problem.hh
Date: 2025-04-12 19:19:20
Exec Total Coverage
Lines: 23 23 100.0%
Functions: 6 6 100.0%
Branches: 36 44 81.8%

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 TwoPTests
10 * \brief A discrete fracture network embedded in an impermeable matrix.
11 *
12 * The fracture is a 2D network embedded in 3D.
13 */
14 #ifndef DUMUX_TWOP_FRACTURE_TEST_PROBLEM_HH
15 #define DUMUX_TWOP_FRACTURE_TEST_PROBLEM_HH
16
17 #include <dumux/common/properties.hh>
18 #include <dumux/common/parameters.hh>
19 #include <dumux/common/boundarytypes.hh>
20 #include <dumux/common/numeqvector.hh>
21
22 #include <dumux/porousmediumflow/problem.hh>
23
24 namespace Dumux {
25
26 /*!
27 * \ingroup TwoPTests
28 * \brief Trichloroethene (DNAPL) transport through a fracture network (2d in 3d).
29 */
30 template <class TypeTag>
31 6 class FractureProblem : public PorousMediumFlowProblem<TypeTag>
32 {
33 using ParentType = PorousMediumFlowProblem<TypeTag>;
34 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
35 using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView;
36 using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
37 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
38 using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices;
39 using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
40 using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>;
41 using NumEqVector = Dumux::NumEqVector<PrimaryVariables>;
42
43 enum
44 {
45 // primary variable indices
46 pressureIdx = Indices::pressureIdx,
47 saturationIdx = Indices::saturationIdx,
48
49 // equation indices
50 contiTCEEqIdx = Indices::conti0EqIdx + FluidSystem::comp1Idx,
51
52 // world dimension
53 dimWorld = GridView::dimensionworld
54 };
55 using Element = typename GridView::template Codim<0>::Entity;
56 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
57
58 public:
59 6 FractureProblem(std::shared_ptr<const GridGeometry> gridGeometry)
60
2/4
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
18 : ParentType(gridGeometry) {}
61
62
63 /*!
64 * \brief Specifies which kind of boundary condition should be
65 * used for which equation on a given boundary segment.
66 *
67 * \param globalPos The global position where to set the BC types
68 */
69 6795088 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
70 {
71
2/2
✓ Branch 0 taken 13590176 times.
✓ Branch 1 taken 6795088 times.
20385264 BoundaryTypes values;
72
73 6795088 values.setAllDirichlet();
74
2/2
✓ Branch 0 taken 736656 times.
✓ Branch 1 taken 368328 times.
1104984 if (onInlet_(globalPos))
75
2/2
✓ Branch 0 taken 4161686 times.
✓ Branch 1 taken 2633402 times.
6795088 values.setAllNeumann();
76
4/4
✓ Branch 0 taken 4161686 times.
✓ Branch 1 taken 2633402 times.
✓ Branch 2 taken 2646150 times.
✓ Branch 3 taken 1515536 times.
6795088 if (globalPos[2] > 1.0 - eps_ || globalPos[2] < eps_)
77 6795088 values.setAllNeumann();
78
79 6795088 return values;
80 }
81
82 /*!
83 * \brief Evaluates the boundary conditions for a Dirichlet boundary segment.
84 *
85 * \param globalPos The global position
86 */
87 540076 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
88 {
89
2/4
✓ Branch 1 taken 393434 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 91560 times.
✗ Branch 5 not taken.
531574 const auto depth = this->gridGeometry().bBoxMax()[dimWorld-1] - globalPos[dimWorld-1];
90
2/4
✓ Branch 1 taken 393434 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 91560 times.
✗ Branch 5 not taken.
531574 const auto g = this->spatialParams().gravity(globalPos)[dimWorld-1];
91
92 540076 PrimaryVariables values;
93
2/4
✓ Branch 1 taken 393434 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 91560 times.
✗ Branch 5 not taken.
531574 values[pressureIdx] = 1e5 + 1000*g*depth;
94 values[saturationIdx] = 0.0;
95 return values;
96 }
97
98 /*!
99 * \brief Evaluates the boundary conditions for a Neumann boundary segment.
100 *
101 * \param globalPos The position of the integration point of the boundary segment.
102 *
103 * For this method, the \a values parameter stores the mass flux
104 * in normal direction of each phase. Negative values mean influx.
105 */
106 3430628 NumEqVector neumannAtPos(const GlobalPosition &globalPos) const
107 {
108 3430628 NumEqVector values(0.0);
109 3430628 if (onInlet_(globalPos)) {
110 values[contiTCEEqIdx] = -0.04; // kg / (m * s)
111 }
112 return values;
113 }
114
115 /*!
116 * \brief Evaluates the initial values for a control volume.
117 *
118 * \param globalPos The global position
119 */
120 8502 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
121 8502 { return dirichletAtPos(globalPos);}
122
123
124 private:
125
126
6/6
✓ Branch 0 taken 84392 times.
✓ Branch 1 taken 1012704 times.
✓ Branch 2 taken 187594 times.
✓ Branch 3 taken 2431446 times.
✓ Branch 4 taken 702680 times.
✓ Branch 5 taken 5806900 times.
10225716 bool onInlet_(const GlobalPosition &globalPos) const
127
12/12
✓ Branch 0 taken 84392 times.
✓ Branch 1 taken 1012704 times.
✓ Branch 2 taken 7672 times.
✓ Branch 3 taken 76720 times.
✓ Branch 4 taken 187594 times.
✓ Branch 5 taken 2431446 times.
✓ Branch 6 taken 16988 times.
✓ Branch 7 taken 170606 times.
✓ Branch 8 taken 702680 times.
✓ Branch 9 taken 5806900 times.
✓ Branch 10 taken 351340 times.
✓ Branch 11 taken 351340 times.
10225716 { return globalPos[0] < eps_ && globalPos[1] > -0.5 - eps_; }
128
129 static constexpr Scalar eps_ = 1.5e-7;
130 std::string name_;
131 };
132
133 } // end namespace Dumux
134
135 #endif
136