GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/test/porousmediumflow/1p/pointsources/timedependent/problem.hh
Date: 2024-09-21 20:52:54
Exec Total Coverage
Lines: 9 12 75.0%
Functions: 2 4 50.0%
Branches: 9 24 37.5%

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
14 #ifndef DUMUX_1P_SINGULARITY_TIME_DEP_PROBLEM_HH
15 #define DUMUX_1P_SINGULARITY_TIME_DEP_PROBLEM_HH
16
17 #include "../timeindependent/problem.hh"
18
19 namespace Dumux {
20 /*!
21 * \ingroup OnePTests
22 * \brief Test problem for the one-phase model:
23 * Water is injected in a single point in the middle of the domain.
24 *
25 * The domain is box shaped. All sides have Dirichlet boundary conditions.
26 *
27 * In the middle of the domain, water is injected simulating a small diameter well.
28 * The injection rate is time dependent.
29 */
30 template <class TypeTag>
31 1 class OnePSingularityProblemTimeDependent : public OnePSingularityProblem<TypeTag>
32 {
33 using ParentType = OnePSingularityProblem<TypeTag>;
34 using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView;
35 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
36 using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
37 using PointSource = GetPropType<TypeTag, Properties::PointSource>;
38
39 using Problem = GetPropType<TypeTag, Properties::Problem>;
40 using Element = typename GridView::template Codim<0>::Entity;
41 using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView;
42 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
43 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
44 using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
45
46 public:
47 1 OnePSingularityProblemTimeDependent(std::shared_ptr<const GridGeometry> gridGeometry)
48
2/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 : ParentType(gridGeometry)
49 1 {}
50
51 /*!
52 * \name Problem parameters
53 */
54 // \{
55
56 /*!
57 * \brief Applies a vector of point sources which
58 * are possibly solution dependent.
59 *
60 * \param pointSources A vector of PointSource s that contain
61 source values for all phases and space positions.
62 *
63 * For this method, the \a values method of the point source
64 * has to return the absolute mass rate in untis
65 * \f$ [ \textnormal{unit of conserved quantity} / s ] \f$.
66 * Positive values mean that mass is created, negative ones mean that it vanishes.
67 */
68 1 void addPointSources(std::vector<PointSource>& pointSources) const
69 {
70 // inject <time> kg/s water at position (0, 0), where <time> is the current simulation time
71 auto function = [](const Problem& problem,
72 const Element& element,
73 const FVElementGeometry& fvGeometry,
74 const ElementVolumeVariables& elemVolVars,
75 const SubControlVolume& scv)
76 72 { return PrimaryVariables(problem.getTime()); };
77
78
6/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 times.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
3 pointSources.push_back(PointSource({0.0, 0.0}, function));
79 1 }
80
81 //! Set the current time at which we evaluate the source
82 void setTime(Scalar time)
83
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 { time_ = time; }
84
85 //! Set the current time at which we evaluate the source
86 Scalar getTime() const
87 { return time_; }
88
89 private:
90 Scalar time_ = 0.0;
91 };
92
93 } // end namespace Dumux
94
95 #endif
96