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 flowing from bottom to top through and around a low permeable lens. | ||
12 | */ | ||
13 | |||
14 | #ifndef DUMUX_1PTEST_PROBLEM_HH | ||
15 | #define DUMUX_1PTEST_PROBLEM_HH | ||
16 | #include <dumux/common/properties.hh> | ||
17 | #include <dumux/common/parameters.hh> | ||
18 | |||
19 | #include <dumux/common/boundarytypes.hh> | ||
20 | #include <dumux/porousmediumflow/problem.hh> | ||
21 | namespace Dumux { | ||
22 | |||
23 | /*! | ||
24 | * \ingroup OnePTests | ||
25 | * \brief Test problem for the one-phase model: | ||
26 | * water is flowing from bottom to top through and around a low permeable lens. | ||
27 | * | ||
28 | * The domain is box shaped. All sides are closed (Neumann 0 boundary) | ||
29 | * except the top and bottom boundaries (Dirichlet), where water is | ||
30 | * flowing from bottom to top. | ||
31 | * | ||
32 | * In the middle of the domain, a lens with low permeability | ||
33 | * compared to the surrounding material is defined. | ||
34 | */ | ||
35 | template <class TypeTag> | ||
36 | class OnePTestProblem : public PorousMediumFlowProblem<TypeTag> | ||
37 | { | ||
38 | using ParentType = PorousMediumFlowProblem<TypeTag>; | ||
39 | using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; | ||
40 | using Element = typename GridView::template Codim<0>::Entity; | ||
41 | using Scalar = GetPropType<TypeTag, Properties::Scalar>; | ||
42 | |||
43 | // copy some indices for convenience | ||
44 | using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; | ||
45 | |||
46 | enum { | ||
47 | // index of the primary variable | ||
48 | pressureIdx = Indices::pressureIdx | ||
49 | }; | ||
50 | |||
51 | using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; | ||
52 | using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; | ||
53 | using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; | ||
54 | |||
55 | static constexpr int dimWorld = GridView::dimensionworld; | ||
56 | |||
57 | using GlobalPosition = typename Element::Geometry::GlobalCoordinate; | ||
58 | |||
59 | public: | ||
60 | 5 | OnePTestProblem(std::shared_ptr<const GridGeometry> gridGeometry) | |
61 |
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) |
62 | { | ||
63 |
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"); |
64 | 5 | } | |
65 | |||
66 | /*! | ||
67 | * \name Problem parameters | ||
68 | */ | ||
69 | // \{ | ||
70 | |||
71 | /*! | ||
72 | * \brief The problem name. | ||
73 | * | ||
74 | * This is used as a prefix for files generated by the simulation. | ||
75 | */ | ||
76 | std::string name() const | ||
77 | { | ||
78 |
2/6✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
5 | return name_; |
79 | } | ||
80 | |||
81 | // \} | ||
82 | /*! | ||
83 | * \name Boundary conditions | ||
84 | */ | ||
85 | // \{ | ||
86 | |||
87 | /*! | ||
88 | * \brief Specifies which kind of boundary condition should be | ||
89 | * used for which equation on a given boundary control volume. | ||
90 | * | ||
91 | * \param globalPos The position of the center of the finite volume | ||
92 | */ | ||
93 | BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const | ||
94 | { | ||
95 |
12/14✓ Branch 0 taken 332 times.
✓ Branch 1 taken 76 times.
✓ Branch 2 taken 44 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 656 times.
✓ Branch 5 taken 160 times.
✓ Branch 6 taken 918 times.
✓ Branch 7 taken 210 times.
✓ Branch 8 taken 180 times.
✓ Branch 9 taken 60 times.
✓ Branch 10 taken 684 times.
✓ Branch 11 taken 228 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
3552 | BoundaryTypes values; |
96 | |||
97 |
84/98✓ Branch 0 taken 332 times.
✓ Branch 1 taken 76 times.
✓ Branch 2 taken 332 times.
✓ Branch 3 taken 76 times.
✓ Branch 4 taken 76 times.
✓ Branch 5 taken 256 times.
✓ Branch 6 taken 76 times.
✓ Branch 7 taken 256 times.
✓ Branch 8 taken 76 times.
✓ Branch 9 taken 256 times.
✓ Branch 10 taken 76 times.
✓ Branch 11 taken 256 times.
✓ Branch 12 taken 76 times.
✓ Branch 13 taken 256 times.
✓ Branch 14 taken 44 times.
✓ Branch 15 taken 4 times.
✓ Branch 16 taken 44 times.
✓ Branch 17 taken 4 times.
✓ Branch 18 taken 4 times.
✓ Branch 19 taken 40 times.
✓ Branch 20 taken 4 times.
✓ Branch 21 taken 40 times.
✓ Branch 22 taken 4 times.
✓ Branch 23 taken 40 times.
✓ Branch 24 taken 4 times.
✓ Branch 25 taken 40 times.
✓ Branch 26 taken 4 times.
✓ Branch 27 taken 40 times.
✓ Branch 28 taken 656 times.
✓ Branch 29 taken 160 times.
✓ Branch 30 taken 656 times.
✓ Branch 31 taken 160 times.
✓ Branch 32 taken 160 times.
✓ Branch 33 taken 496 times.
✓ Branch 34 taken 160 times.
✓ Branch 35 taken 496 times.
✓ Branch 36 taken 160 times.
✓ Branch 37 taken 496 times.
✓ Branch 38 taken 160 times.
✓ Branch 39 taken 496 times.
✓ Branch 40 taken 160 times.
✓ Branch 41 taken 496 times.
✓ Branch 42 taken 918 times.
✓ Branch 43 taken 210 times.
✓ Branch 44 taken 918 times.
✓ Branch 45 taken 210 times.
✓ Branch 46 taken 210 times.
✓ Branch 47 taken 708 times.
✓ Branch 48 taken 210 times.
✓ Branch 49 taken 708 times.
✓ Branch 50 taken 210 times.
✓ Branch 51 taken 708 times.
✓ Branch 52 taken 210 times.
✓ Branch 53 taken 708 times.
✓ Branch 54 taken 210 times.
✓ Branch 55 taken 708 times.
✓ Branch 56 taken 180 times.
✓ Branch 57 taken 60 times.
✓ Branch 58 taken 180 times.
✓ Branch 59 taken 60 times.
✓ Branch 60 taken 60 times.
✓ Branch 61 taken 120 times.
✓ Branch 62 taken 60 times.
✓ Branch 63 taken 120 times.
✓ Branch 64 taken 60 times.
✓ Branch 65 taken 120 times.
✓ Branch 66 taken 60 times.
✓ Branch 67 taken 120 times.
✓ Branch 68 taken 60 times.
✓ Branch 69 taken 120 times.
✓ Branch 70 taken 684 times.
✓ Branch 71 taken 228 times.
✓ Branch 72 taken 684 times.
✓ Branch 73 taken 228 times.
✓ Branch 74 taken 228 times.
✓ Branch 75 taken 456 times.
✓ Branch 76 taken 228 times.
✓ Branch 77 taken 456 times.
✓ Branch 78 taken 228 times.
✓ Branch 79 taken 456 times.
✓ Branch 80 taken 228 times.
✓ Branch 81 taken 456 times.
✓ Branch 82 taken 228 times.
✓ Branch 83 taken 456 times.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 96 not taken.
✗ Branch 97 not taken.
|
7104 | if (globalPos[dimWorld-1] < eps_ || globalPos[dimWorld-1] > this->gridGeometry().bBoxMax()[dimWorld-1] - eps_) |
98 | values.setAllDirichlet(); | ||
99 | else | ||
100 | values.setAllNeumann(); | ||
101 | |||
102 | return values; | ||
103 | } | ||
104 | |||
105 | /*! | ||
106 | * \brief Evaluates the boundary conditions for a Dirichlet control volume. | ||
107 | * | ||
108 | * \param globalPos The center of the finite volume which ought to be set. | ||
109 | * | ||
110 | * For this method, the \a values parameter stores primary variables. | ||
111 | */ | ||
112 | ✗ | PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const | |
113 | { | ||
114 |
1/2✓ Branch 1 taken 216 times.
✗ Branch 2 not taken.
|
584 | PrimaryVariables values(0); |
115 |
2/4✓ Branch 1 taken 216 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 216 times.
✗ Branch 5 not taken.
|
1168 | values[pressureIdx] = 1.0e+5*(2.0 - globalPos[dimWorld-1]); |
116 | ✗ | return values; | |
117 | } | ||
118 | |||
119 | // \} | ||
120 | |||
121 | /*! | ||
122 | * \name Volume terms | ||
123 | */ | ||
124 | // \{ | ||
125 | |||
126 | /*! | ||
127 | * \brief Evaluates the initial value for a control volume. | ||
128 | * | ||
129 | * For this method, the \a priVars parameter stores primary | ||
130 | * variables. | ||
131 | */ | ||
132 | ✗ | PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const | |
133 | { | ||
134 | 374 | PrimaryVariables priVars(0.0); | |
135 | 374 | priVars[pressureIdx] = 1.0e+5; | |
136 | ✗ | return priVars; | |
137 | } | ||
138 | |||
139 | // \} | ||
140 | |||
141 | private: | ||
142 | std::string name_; | ||
143 | static constexpr Scalar eps_ = 1.0e-6; | ||
144 | }; | ||
145 | |||
146 | } // end namespace Dumux | ||
147 | |||
148 | #endif | ||
149 |