GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/2p/fracture/problem.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 19 21 90.5%
Functions: 6 12 50.0%
Branches: 53 90 58.9%

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 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 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
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) {}
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 6795088 BoundaryTypes values;
72
73 6795088 values.setAllDirichlet();
74 6795088 if (onInlet_(globalPos))
75 values.setAllNeumann();
76
8/8
✓ Branch 0 taken 4161686 times.
✓ Branch 1 taken 2633402 times.
✓ Branch 2 taken 4161686 times.
✓ Branch 3 taken 2633402 times.
✓ Branch 4 taken 2646150 times.
✓ Branch 5 taken 1515536 times.
✓ Branch 6 taken 2646150 times.
✓ Branch 7 taken 1515536 times.
13590176 if (globalPos[2] > 1.0 - eps_ || globalPos[2] < eps_)
77 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 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
88 {
89
4/8
✓ Branch 1 taken 372344 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 372344 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 372344 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 372344 times.
✗ Branch 11 not taken.
2126296 const auto depth = this->gridGeometry().bBoxMax()[dimWorld-1] - globalPos[dimWorld-1];
90
3/6
✓ Branch 1 taken 372344 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 372344 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 372344 times.
✗ Branch 8 not taken.
1594722 const auto g = this->spatialParams().gravity(globalPos)[dimWorld-1];
91
92 540076 PrimaryVariables values;
93
1/2
✓ Branch 1 taken 372344 times.
✗ Branch 2 not taken.
531574 values[pressureIdx] = 1e5 + 1000*g*depth;
94
2/4
✓ Branch 1 taken 372344 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 372344 times.
✗ Branch 5 not taken.
1063148 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 NumEqVector neumannAtPos(const GlobalPosition &globalPos) const
107 {
108 3430628 NumEqVector values(0.0);
109 3660966 if (onInlet_(globalPos)) {
110 460676 values[contiTCEEqIdx] = -0.04; // kg / (m * s)
111 }
112 3430628 return values;
113 }
114
115 /*!
116 * \brief Evaluates the initial values for a control volume.
117 *
118 * \param globalPos The global position
119 */
120 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
121 17004 { return dirichletAtPos(globalPos);}
122
123
124 private:
125
126 bool onInlet_(const GlobalPosition &globalPos) const
127
30/48
✗ 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 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 84392 times.
✓ Branch 17 taken 1012704 times.
✓ Branch 18 taken 84392 times.
✓ Branch 19 taken 1012704 times.
✓ Branch 20 taken 76720 times.
✓ Branch 21 taken 7672 times.
✓ Branch 22 taken 76720 times.
✓ Branch 23 taken 7672 times.
✓ Branch 24 taken 153618 times.
✓ Branch 25 taken 2179914 times.
✓ Branch 26 taken 153618 times.
✓ Branch 27 taken 2179914 times.
✓ Branch 28 taken 153618 times.
✗ Branch 29 not taken.
✓ Branch 30 taken 153618 times.
✗ Branch 31 not taken.
✓ Branch 32 taken 33976 times.
✓ Branch 33 taken 251532 times.
✓ Branch 34 taken 33976 times.
✓ Branch 35 taken 251532 times.
✓ Branch 36 taken 16988 times.
✓ Branch 37 taken 16988 times.
✓ Branch 38 taken 16988 times.
✓ Branch 39 taken 16988 times.
✓ Branch 40 taken 702680 times.
✓ Branch 41 taken 5806900 times.
✓ Branch 42 taken 702680 times.
✓ Branch 43 taken 5806900 times.
✓ Branch 44 taken 351340 times.
✓ Branch 45 taken 351340 times.
✓ Branch 46 taken 351340 times.
✓ Branch 47 taken 351340 times.
20451432 { 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