GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/1p/pointsources/timeindependent/problem.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 10 18 55.6%
Functions: 5 24 20.8%
Branches: 18 46 39.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 * \file
9 * \ingroup OnePTests
10 * \brief A test problem for the one-phase model:
11 * Water is injected in one single point in the middle of the domain.
12 */
13 #ifndef DUMUX_1P_SINGULARITY_PROBLEM_HH
14 #define DUMUX_1P_SINGULARITY_PROBLEM_HH
15 #include <dumux/common/properties.hh>
16 #include <dumux/common/parameters.hh>
17
18 #include <dumux/common/boundarytypes.hh>
19 #include <dumux/porousmediumflow/problem.hh>
20
21 namespace Dumux {
22
23 /*!
24 * \ingroup OnePTests
25 * \brief Test problem for the one-phase model:
26 * Water is injected in a single point in the middle of the domain.
27 *
28 * The domain is box shaped. All sides have Dirichlet boundary conditions.
29 *
30 * In the middle of the domain, water is injected simulating a small diameter well.
31 */
32 template <class TypeTag>
33 class OnePSingularityProblem : public PorousMediumFlowProblem<TypeTag>
34 {
35 using ParentType = PorousMediumFlowProblem<TypeTag>;
36 using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView;
37 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
38
39 // copy some indices for convenience
40 using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices;
41 enum { dimWorld = GridView::dimensionworld };
42 enum {
43 // index of the primary variable
44 pressureIdx = Indices::pressureIdx
45 };
46
47 using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
48 using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>;
49 using PointSource = GetPropType<TypeTag, Properties::PointSource>;
50 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
51 using Element = typename GridGeometry::GridView::template Codim<0>::Entity;
52 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
53
54 public:
55 5 OnePSingularityProblem(std::shared_ptr<const GridGeometry> gridGeometry)
56
7/20
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 5 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 5 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 5 times.
✓ Branch 15 taken 5 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 5 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
15 : ParentType(gridGeometry)
57 {
58
2/4
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
5 name_ = getParam<std::string>("Problem.Name");
59 5 }
60
61 /*!
62 * \name Problem parameters
63 */
64 // \{
65
66 /*!
67 * \brief The problem name.
68 *
69 * This is used as a prefix for files generated by the simulation.
70 */
71 const std::string& name() const
72 {
73
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 return name_;
74 }
75
76 // \}
77 /*!
78 * \name Boundary conditions
79 */
80 // \{
81
82 /*!
83 * \brief Specifies which kind of boundary condition should be
84 * used for which equation on a given boundary control volume.
85 *
86 * \param globalPos The position of the center of the finite volume
87 */
88 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
89 {
90
4/8
✓ Branch 0 taken 6156 times.
✓ Branch 1 taken 11748 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 8904 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 17808 times.
✗ Branch 7 not taken.
44616 BoundaryTypes bcTypes;
91
4/8
✓ Branch 0 taken 6156 times.
✓ Branch 1 taken 11748 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 8904 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 17808 times.
✗ Branch 7 not taken.
44616 bcTypes.setAllDirichlet();
92 return bcTypes;
93 }
94
95 /*!
96 * \brief Evaluates the boundary conditions for a Dirichlet control volume.
97 *
98 * \param globalPos The center of the finite volume which ought to be set.
99 *
100 * For this method, the \a values parameter stores primary variables.
101 */
102 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
103 {
104 26808 return initialAtPos(globalPos);
105 }
106
107 // \}
108
109 /*!
110 * \name Volume terms
111 */
112 // \{
113
114 /*!
115 * \brief Applies a vector of point sources which
116 * are possibly solution dependent.
117 *
118 * \param pointSources A vector of PointSource s that contain
119 source values for all phases and space positions.
120 *
121 * For this method, the \a values method of the point source
122 * has to return the absolute mass rate in untis
123 * \f$ [ \textnormal{unit of conserved quantity} / s ] \f$.
124 * Positive values mean that mass is created, negative ones mean that it vanishes.
125 */
126 void addPointSources(std::vector<PointSource>& pointSources) const
127 {
128 // inject 10 kg/s water at origin;
129 pointSources.push_back(PointSource(GlobalPosition(0.0), {10}));
130 }
131
132 /*!
133 * \brief Evaluates the initial value for a control volume.
134 *
135 * For this method, the \a priVars parameter stores primary
136 * variables.
137 */
138 PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
139 {
140 64742 PrimaryVariables priVars(0.0);
141 64742 priVars[pressureIdx] = 1.0e5;
142 return priVars;
143 }
144
145 // \}
146
147 private:
148 std::string name_;
149 };
150
151 } // end namespace Dumux
152
153 #endif
154