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 RichardsTests | ||
10 | * \brief A water infiltration problem with a low-permeability lens | ||
11 | * embedded into a high-permeability domain which uses the | ||
12 | * Richards box model. | ||
13 | */ | ||
14 | |||
15 | #ifndef DUMUX_RICHARDS_LENSPROBLEM_HH | ||
16 | #define DUMUX_RICHARDS_LENSPROBLEM_HH | ||
17 | |||
18 | #include <dumux/common/properties.hh> | ||
19 | #include <dumux/common/parameters.hh> | ||
20 | #include <dumux/common/boundarytypes.hh> | ||
21 | #include <dumux/common/numeqvector.hh> | ||
22 | |||
23 | #include <dumux/porousmediumflow/problem.hh> | ||
24 | |||
25 | namespace Dumux { | ||
26 | |||
27 | /*! | ||
28 | * \ingroup RichardsTests | ||
29 | * | ||
30 | * \brief A water infiltration problem with a low-permeability lens | ||
31 | * embedded into a high-permeability domain which uses the | ||
32 | * Richards model. | ||
33 | * | ||
34 | * The domain is box shaped. Left and right boundaries are Dirichlet | ||
35 | * boundaries with fixed water pressure (fixed Saturation \f$S_w = 0\f$), | ||
36 | * bottom boundary is closed (Neumann 0 boundary), the top boundary | ||
37 | * (Neumann 0 boundary) is also closed except for infiltration | ||
38 | * section, where water is infiltrating into an initially unsaturated | ||
39 | * porous medium. This problem is very similar to the LensProblem | ||
40 | * which uses the TwoPBoxModel, with the main difference being that | ||
41 | * the domain is initially fully saturated by gas instead of water and | ||
42 | * water instead of a %DNAPL infiltrates from the top. | ||
43 | * | ||
44 | * This problem uses the \ref RichardsModel | ||
45 | */ | ||
46 | template <class TypeTag> | ||
47 | class RichardsLensProblem : public PorousMediumFlowProblem<TypeTag> | ||
48 | { | ||
49 | using ParentType = PorousMediumFlowProblem<TypeTag>; | ||
50 | using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; | ||
51 | using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; | ||
52 | using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; | ||
53 | using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; | ||
54 | using Scalar = GetPropType<TypeTag, Properties::Scalar>; | ||
55 | using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; | ||
56 | using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; | ||
57 | enum { | ||
58 | // copy some indices for convenience | ||
59 | pressureIdx = Indices::pressureIdx, | ||
60 | conti0EqIdx = Indices::conti0EqIdx, | ||
61 | |||
62 | // world dimension | ||
63 | dimWorld = GridView::dimensionworld | ||
64 | }; | ||
65 | using Element = typename GridView::template Codim<0>::Entity; | ||
66 | |||
67 | using GlobalPosition = typename Element::Geometry::GlobalCoordinate; | ||
68 | |||
69 | public: | ||
70 | 23 | RichardsLensProblem(std::shared_ptr<const GridGeometry> gridGeometry) | |
71 |
9/24✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 23 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 23 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 23 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 23 times.
✓ Branch 15 taken 23 times.
✗ Branch 16 not taken.
✓ Branch 18 taken 23 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 23 times.
✗ Branch 22 not taken.
✓ Branch 24 taken 23 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
|
69 | : ParentType(gridGeometry) |
72 | { | ||
73 |
2/4✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 23 times.
|
23 | name_ = getParam<std::string>("Problem.Name"); |
74 | 23 | } | |
75 | |||
76 | /*! | ||
77 | * \name Problem parameters | ||
78 | */ | ||
79 | // \{ | ||
80 | |||
81 | /*! | ||
82 | * \brief The problem name | ||
83 | * | ||
84 | * This is used as a prefix for files generated by the simulation. | ||
85 | */ | ||
86 | const std::string& name() const | ||
87 |
1/2✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
|
23 | { return name_; } |
88 | |||
89 | /*! | ||
90 | * \brief Returns the reference pressure [Pa] of the nonwetting | ||
91 | * fluid phase within a finite volume | ||
92 | * | ||
93 | * This problem assumes a constant reference pressure of 1 bar. | ||
94 | */ | ||
95 | ✗ | Scalar nonwettingReferencePressure() const | |
96 | ✗ | { return 1.0e5; }; | |
97 | |||
98 | // \} | ||
99 | |||
100 | /*! | ||
101 | * \name Boundary conditions | ||
102 | */ | ||
103 | // \{ | ||
104 | |||
105 | /*! | ||
106 | * \brief Specifies which kind of boundary condition should be | ||
107 | * used for which equation on a given boundary segment. | ||
108 | * | ||
109 | * \param globalPos The position for which the boundary type is set | ||
110 | */ | ||
111 | BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const | ||
112 | { | ||
113 |
10/14✓ Branch 0 taken 34650 times.
✓ Branch 1 taken 8730 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 28564 times.
✓ Branch 5 taken 6956 times.
✓ Branch 6 taken 45362 times.
✓ Branch 7 taken 11174 times.
✓ Branch 8 taken 7252 times.
✓ Branch 9 taken 1776 times.
✓ Branch 10 taken 19092 times.
✓ Branch 11 taken 4588 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
168144 | BoundaryTypes bcTypes; |
114 | 606128 | if (onLeftBoundary_(globalPos) || onRightBoundary_(globalPos)) | |
115 | bcTypes.setAllDirichlet(); | ||
116 | else | ||
117 | bcTypes.setAllNeumann(); | ||
118 | return bcTypes; | ||
119 | } | ||
120 | |||
121 | /*! | ||
122 | * \brief Evaluates the boundary conditions for a Dirichlet boundary segment. | ||
123 | * | ||
124 | * \param globalPos The position for which the Dirichlet value is set | ||
125 | * | ||
126 | * For this method, the \a values parameter stores primary variables. | ||
127 | */ | ||
128 | PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const | ||
129 | { | ||
130 | 33740 | return initial_(globalPos); | |
131 | } | ||
132 | |||
133 | /*! | ||
134 | * \brief Evaluates the boundary conditions for a Neumann boundary segment. | ||
135 | * | ||
136 | * For this method, the \a values parameter stores the mass flux | ||
137 | * in normal direction of each phase. Negative values mean influx. | ||
138 | * | ||
139 | * \param globalPos The position for which the Neumann value is set | ||
140 | */ | ||
141 | NumEqVector neumannAtPos(const GlobalPosition &globalPos) const | ||
142 | { | ||
143 |
4/6✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 55620 times.
✓ Branch 3 taken 55620 times.
✓ Branch 4 taken 20720 times.
✓ Branch 5 taken 20720 times.
|
152680 | NumEqVector values(0.0); |
144 | 138794 | if (onInlet_(globalPos)) | |
145 | values[conti0EqIdx] = -0.04; // kg/(m*s) | ||
146 | return values; | ||
147 | } | ||
148 | |||
149 | /*! | ||
150 | * \name Volume terms | ||
151 | */ | ||
152 | // \{ | ||
153 | |||
154 | /*! | ||
155 | * \brief Evaluates the initial values for a control volume. | ||
156 | * | ||
157 | * For this method, the \a values parameter stores primary | ||
158 | * variables. | ||
159 | * | ||
160 | * \param globalPos The position for which the boundary type is set | ||
161 | */ | ||
162 | PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const | ||
163 | 6424 | { return initial_(globalPos); }; | |
164 | |||
165 | // \} | ||
166 | |||
167 | private: | ||
168 | 40164 | PrimaryVariables initial_(const GlobalPosition &globalPos) const | |
169 | { | ||
170 | 40164 | PrimaryVariables values(0.0); | |
171 | 40164 | const Scalar sw = 0.0; | |
172 | 120492 | const Scalar pc = this->spatialParams().fluidMatrixInteractionAtPos(globalPos).pc(sw); | |
173 | 40164 | values[pressureIdx] = nonwettingReferencePressure() - pc; | |
174 | 40164 | return values; | |
175 | } | ||
176 | |||
177 | bool onLeftBoundary_(const GlobalPosition &globalPos) const | ||
178 | { | ||
179 |
50/70✓ Branch 0 taken 34650 times.
✓ Branch 1 taken 8730 times.
✓ Branch 2 taken 34650 times.
✓ Branch 3 taken 8730 times.
✓ Branch 4 taken 34650 times.
✓ Branch 5 taken 8730 times.
✓ Branch 6 taken 34650 times.
✓ Branch 7 taken 8730 times.
✓ Branch 8 taken 34650 times.
✓ Branch 9 taken 8730 times.
✗ 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 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 28564 times.
✓ Branch 21 taken 6956 times.
✓ Branch 22 taken 28564 times.
✓ Branch 23 taken 6956 times.
✓ Branch 24 taken 28564 times.
✓ Branch 25 taken 6956 times.
✓ Branch 26 taken 28564 times.
✓ Branch 27 taken 6956 times.
✓ Branch 28 taken 28564 times.
✓ Branch 29 taken 6956 times.
✓ Branch 30 taken 45362 times.
✓ Branch 31 taken 11174 times.
✓ Branch 32 taken 45362 times.
✓ Branch 33 taken 11174 times.
✓ Branch 34 taken 45362 times.
✓ Branch 35 taken 11174 times.
✓ Branch 36 taken 45362 times.
✓ Branch 37 taken 11174 times.
✓ Branch 38 taken 45362 times.
✓ Branch 39 taken 11174 times.
✓ Branch 40 taken 7252 times.
✓ Branch 41 taken 1776 times.
✓ Branch 42 taken 7252 times.
✓ Branch 43 taken 1776 times.
✓ Branch 44 taken 7252 times.
✓ Branch 45 taken 1776 times.
✓ Branch 46 taken 7252 times.
✓ Branch 47 taken 1776 times.
✓ Branch 48 taken 7252 times.
✓ Branch 49 taken 1776 times.
✓ Branch 50 taken 19092 times.
✓ Branch 51 taken 4588 times.
✓ Branch 52 taken 19092 times.
✓ Branch 53 taken 4588 times.
✓ Branch 54 taken 19092 times.
✓ Branch 55 taken 4588 times.
✓ Branch 56 taken 19092 times.
✓ Branch 57 taken 4588 times.
✓ Branch 58 taken 19092 times.
✓ Branch 59 taken 4588 times.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
|
840720 | return globalPos[0] < this->gridGeometry().bBoxMin()[0] + eps_; |
180 | } | ||
181 | |||
182 | bool onRightBoundary_(const GlobalPosition &globalPos) const | ||
183 | { | ||
184 |
50/70✓ Branch 0 taken 8730 times.
✓ Branch 1 taken 25920 times.
✓ Branch 2 taken 8730 times.
✓ Branch 3 taken 25920 times.
✓ Branch 4 taken 8730 times.
✓ Branch 5 taken 25920 times.
✓ Branch 6 taken 8730 times.
✓ Branch 7 taken 25920 times.
✓ Branch 8 taken 8730 times.
✓ Branch 9 taken 25920 times.
✗ 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 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 6956 times.
✓ Branch 21 taken 21608 times.
✓ Branch 22 taken 6956 times.
✓ Branch 23 taken 21608 times.
✓ Branch 24 taken 6956 times.
✓ Branch 25 taken 21608 times.
✓ Branch 26 taken 6956 times.
✓ Branch 27 taken 21608 times.
✓ Branch 28 taken 6956 times.
✓ Branch 29 taken 21608 times.
✓ Branch 30 taken 11174 times.
✓ Branch 31 taken 34188 times.
✓ Branch 32 taken 11174 times.
✓ Branch 33 taken 34188 times.
✓ Branch 34 taken 11174 times.
✓ Branch 35 taken 34188 times.
✓ Branch 36 taken 11174 times.
✓ Branch 37 taken 34188 times.
✓ Branch 38 taken 11174 times.
✓ Branch 39 taken 34188 times.
✓ Branch 40 taken 1776 times.
✓ Branch 41 taken 5476 times.
✓ Branch 42 taken 1776 times.
✓ Branch 43 taken 5476 times.
✓ Branch 44 taken 1776 times.
✓ Branch 45 taken 5476 times.
✓ Branch 46 taken 1776 times.
✓ Branch 47 taken 5476 times.
✓ Branch 48 taken 1776 times.
✓ Branch 49 taken 5476 times.
✓ Branch 50 taken 4588 times.
✓ Branch 51 taken 14504 times.
✓ Branch 52 taken 4588 times.
✓ Branch 53 taken 14504 times.
✓ Branch 54 taken 4588 times.
✓ Branch 55 taken 14504 times.
✓ Branch 56 taken 4588 times.
✓ Branch 57 taken 14504 times.
✓ Branch 58 taken 4588 times.
✓ Branch 59 taken 14504 times.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
|
674600 | return globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_; |
185 | } | ||
186 | |||
187 | bool onLowerBoundary_(const GlobalPosition &globalPos) const | ||
188 | { | ||
189 | return globalPos[1] < this->gridGeometry().bBoxMin()[1] + eps_; | ||
190 | } | ||
191 | |||
192 | bool onUpperBoundary_(const GlobalPosition &globalPos) const | ||
193 | { | ||
194 |
12/18✗ 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 taken 55620 times.
✓ Branch 7 taken 55620 times.
✓ Branch 8 taken 55620 times.
✓ Branch 9 taken 55620 times.
✓ Branch 10 taken 55620 times.
✓ Branch 11 taken 55620 times.
✓ Branch 12 taken 20720 times.
✓ Branch 13 taken 20720 times.
✓ Branch 14 taken 20720 times.
✓ Branch 15 taken 20720 times.
✓ Branch 16 taken 20720 times.
✓ Branch 17 taken 20720 times.
|
458040 | return globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_; |
195 | } | ||
196 | |||
197 | bool onInlet_(const GlobalPosition &globalPos) const | ||
198 | { | ||
199 |
24/36✗ 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 taken 55620 times.
✓ Branch 13 taken 55620 times.
✓ Branch 14 taken 55620 times.
✓ Branch 15 taken 55620 times.
✓ Branch 16 taken 55620 times.
✓ Branch 17 taken 55620 times.
✓ Branch 18 taken 55620 times.
✓ Branch 19 taken 55620 times.
✓ Branch 20 taken 55620 times.
✓ Branch 21 taken 55620 times.
✓ Branch 22 taken 55620 times.
✓ Branch 23 taken 55620 times.
✓ Branch 24 taken 20720 times.
✓ Branch 25 taken 20720 times.
✓ Branch 26 taken 20720 times.
✓ Branch 27 taken 20720 times.
✓ Branch 28 taken 20720 times.
✓ Branch 29 taken 20720 times.
✓ Branch 30 taken 20720 times.
✓ Branch 31 taken 20720 times.
✓ Branch 32 taken 20720 times.
✓ Branch 33 taken 20720 times.
✓ Branch 34 taken 20720 times.
✓ Branch 35 taken 20720 times.
|
916080 | Scalar width = this->gridGeometry().bBoxMax()[0] - this->gridGeometry().bBoxMin()[0]; |
200 |
16/24✗ 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 taken 55620 times.
✓ Branch 9 taken 55620 times.
✓ Branch 10 taken 55620 times.
✓ Branch 11 taken 55620 times.
✓ Branch 12 taken 55620 times.
✓ Branch 13 taken 55620 times.
✓ Branch 14 taken 55620 times.
✓ Branch 15 taken 55620 times.
✓ Branch 16 taken 20720 times.
✓ Branch 17 taken 20720 times.
✓ Branch 18 taken 20720 times.
✓ Branch 19 taken 20720 times.
✓ Branch 20 taken 20720 times.
✓ Branch 21 taken 20720 times.
✓ Branch 22 taken 20720 times.
✓ Branch 23 taken 20720 times.
|
610720 | Scalar lambda = (this->gridGeometry().bBoxMax()[0] - globalPos[0])/width; |
201 |
20/30✗ 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 taken 55620 times.
✓ Branch 11 taken 55620 times.
✓ Branch 12 taken 55620 times.
✓ Branch 13 taken 55620 times.
✓ Branch 14 taken 55620 times.
✓ Branch 15 taken 55620 times.
✓ Branch 16 taken 27810 times.
✓ Branch 17 taken 27810 times.
✓ Branch 18 taken 17550 times.
✓ Branch 19 taken 10260 times.
✓ Branch 20 taken 20720 times.
✓ Branch 21 taken 20720 times.
✓ Branch 22 taken 20720 times.
✓ Branch 23 taken 20720 times.
✓ Branch 24 taken 20720 times.
✓ Branch 25 taken 20720 times.
✓ Branch 26 taken 10360 times.
✓ Branch 27 taken 10360 times.
✓ Branch 28 taken 6734 times.
✓ Branch 29 taken 3626 times.
|
458040 | return onUpperBoundary_(globalPos) && 0.5 < lambda + eps_ && lambda < 2.0/3.0 + eps_; |
202 | } | ||
203 | |||
204 | static constexpr Scalar eps_ = 1.5e-7; | ||
205 | |||
206 | GlobalPosition lensLowerLeft_; | ||
207 | GlobalPosition lensUpperRight_; | ||
208 | std::string name_; | ||
209 | }; | ||
210 | |||
211 | } // end namespace Dumux | ||
212 | |||
213 | #endif | ||
214 |