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-FileCopyrightText: 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 | 5 | 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 |
3/6✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 5 times.
✗ Branch 9 not taken.
|
15 | : ParentType(gridGeometry) |
62 | { | ||
63 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
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 | 5 | std::string name() const | |
77 | { | ||
78 |
2/4✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
10 | 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 |
12/12✓ 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.
|
3552 | BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const |
94 | { | ||
95 |
12/12✓ 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.
|
3552 | BoundaryTypes values; |
96 | |||
97 |
24/24✓ Branch 0 taken 332 times.
✓ Branch 1 taken 76 times.
✓ Branch 2 taken 76 times.
✓ Branch 3 taken 256 times.
✓ Branch 4 taken 44 times.
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 4 times.
✓ Branch 7 taken 40 times.
✓ Branch 8 taken 656 times.
✓ Branch 9 taken 160 times.
✓ Branch 10 taken 160 times.
✓ Branch 11 taken 496 times.
✓ Branch 12 taken 918 times.
✓ Branch 13 taken 210 times.
✓ Branch 14 taken 210 times.
✓ Branch 15 taken 708 times.
✓ Branch 16 taken 180 times.
✓ Branch 17 taken 60 times.
✓ Branch 18 taken 60 times.
✓ Branch 19 taken 120 times.
✓ Branch 20 taken 684 times.
✓ Branch 21 taken 228 times.
✓ Branch 22 taken 228 times.
✓ Branch 23 taken 456 times.
|
3552 | 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 | 584 | PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const | |
113 | { | ||
114 |
2/3✓ Branch 1 taken 104 times.
✓ Branch 2 taken 120 times.
✗ Branch 3 not taken.
|
584 | PrimaryVariables values(0); |
115 |
2/3✓ Branch 1 taken 104 times.
✓ Branch 2 taken 120 times.
✗ Branch 3 not taken.
|
584 | 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 | PrimaryVariables priVars(0.0); | ||
135 | 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 |