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 TracerTests | ||
10 | * \brief Multiple tracer bands are diluted by diffusion and two-phase flow. | ||
11 | */ | ||
12 | #ifndef DUMUX_TWOP_TRACER_TEST_PROBLEM_HH | ||
13 | #define DUMUX_TWOP_TRACER_TEST_PROBLEM_HH | ||
14 | |||
15 | #include <dumux/common/boundarytypes.hh> | ||
16 | |||
17 | #include <dumux/porousmediumflow/problem.hh> | ||
18 | |||
19 | namespace Dumux { | ||
20 | /*! | ||
21 | * \ingroup TracerTests | ||
22 | * | ||
23 | * \brief Definition of the tracer problem: | ||
24 | * Multiple tracer bands are diluted by diffusion and two-phase flow. | ||
25 | * | ||
26 | * This problem uses the \ref TracerModel model. | ||
27 | */ | ||
28 | template <class TypeTag> | ||
29 | 1 | class TwoPTracerTestProblem : public PorousMediumFlowProblem<TypeTag> | |
30 | { | ||
31 | using ParentType = PorousMediumFlowProblem<TypeTag>; | ||
32 | |||
33 | using Scalar = GetPropType<TypeTag, Properties::Scalar>; | ||
34 | using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; | ||
35 | using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; | ||
36 | using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; | ||
37 | using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; | ||
38 | using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; | ||
39 | using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; | ||
40 | using SpatialParams = GetPropType<TypeTag, Properties::SpatialParams>; | ||
41 | |||
42 | //! property that defines whether mole or mass fractions are used | ||
43 | static constexpr bool useMoles = getPropValue<TypeTag, Properties::UseMoles>(); | ||
44 | |||
45 | using Element = typename GridGeometry::GridView::template Codim<0>::Entity; | ||
46 | using GlobalPosition = typename Element::Geometry::GlobalCoordinate; | ||
47 | |||
48 | public: | ||
49 | 1 | TwoPTracerTestProblem(std::shared_ptr<const GridGeometry> gridGeometry) | |
50 |
5/14✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
3 | : ParentType(gridGeometry) |
51 | { | ||
52 | // stating in the console whether mole or mass fractions are used | ||
53 | if(useMoles) | ||
54 | std::cout<<"problem uses mole fractions" << '\n'; | ||
55 | else | ||
56 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
2 | std::cout<<"problem uses mass fractions" << '\n'; |
57 | |||
58 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | stripeWidth_ = getParam<Scalar>("Problem.StripeWidth", 0.125); |
59 | 1 | } | |
60 | |||
61 | /*! | ||
62 | * \name Boundary conditions | ||
63 | */ | ||
64 | // \{ | ||
65 | |||
66 | /*! | ||
67 | * \brief Specifies which kind of boundary condition should be | ||
68 | * used for which equation on a given boundary segment. | ||
69 | * | ||
70 | * \param globalPos The position for which the bc type should be evaluated | ||
71 | */ | ||
72 | BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const | ||
73 | { | ||
74 |
8/10✓ Branch 0 taken 6528 times.
✓ Branch 1 taken 1632 times.
✓ Branch 2 taken 6528 times.
✓ Branch 3 taken 1632 times.
✓ Branch 4 taken 6400 times.
✓ Branch 5 taken 1600 times.
✓ Branch 6 taken 12928 times.
✓ Branch 7 taken 3232 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
40480 | BoundaryTypes values; |
75 | 145728 | if (onLeftBoundary_(globalPos) || onRightBoundary_(globalPos)) | |
76 | values.setAllDirichlet(); | ||
77 | else | ||
78 | values.setAllNeumann(); | ||
79 | return values; | ||
80 | } | ||
81 | // \} | ||
82 | |||
83 | /*! | ||
84 | * \name Volume terms | ||
85 | */ | ||
86 | // \{ | ||
87 | |||
88 | /*! | ||
89 | * \brief Evaluates the boundary conditions for a Dirichlet boundary segment. | ||
90 | * | ||
91 | * \param globalPos The global position | ||
92 | */ | ||
93 | ✗ | PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const | |
94 | { | ||
95 | 12928 | PrimaryVariables initialValues(0.0); | |
96 | ✗ | return initialValues; | |
97 | } | ||
98 | |||
99 | /*! | ||
100 | * \brief Evaluates the initial value for a control volume. | ||
101 | * | ||
102 | * \param globalPos The position for which the initial condition should be evaluated | ||
103 | * | ||
104 | * For this method, the \a values parameter stores primary | ||
105 | * variables. | ||
106 | */ | ||
107 | 1536 | PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const | |
108 | { | ||
109 |
2/2✓ Branch 0 taken 1184 times.
✓ Branch 1 taken 352 times.
|
1536 | PrimaryVariables initialValues(0.0); |
110 | |||
111 | 4512 | if (onStripe1_(globalPos) || onStripe2_(globalPos) || onStripe3_(globalPos)) | |
112 | { | ||
113 | if (useMoles) | ||
114 | initialValues = 1e-9; | ||
115 | else | ||
116 | 288 | initialValues = 1e-9*FluidSystem::molarMass(0)/this->spatialParams().fluidMolarMass(globalPos); | |
117 | } | ||
118 | 1536 | return initialValues; | |
119 | } | ||
120 | |||
121 | private: | ||
122 | static constexpr Scalar eps_ = 1e-6; | ||
123 | Scalar stripeWidth_; | ||
124 | |||
125 | bool onUpperBoundary_(const GlobalPosition &globalPos) const | ||
126 | { | ||
127 | return globalPos[1] > this->gridGeometry().bBoxMax()[1] - 0.1 - eps_; | ||
128 | } | ||
129 | |||
130 | bool onLeftBoundary_(const GlobalPosition &globalPos) const | ||
131 | { | ||
132 |
40/50✓ Branch 0 taken 6528 times.
✓ Branch 1 taken 1632 times.
✓ Branch 2 taken 6528 times.
✓ Branch 3 taken 1632 times.
✓ Branch 4 taken 6528 times.
✓ Branch 5 taken 1632 times.
✓ Branch 6 taken 6528 times.
✓ Branch 7 taken 1632 times.
✓ Branch 8 taken 6528 times.
✓ Branch 9 taken 1632 times.
✓ Branch 10 taken 6528 times.
✓ Branch 11 taken 1632 times.
✓ Branch 12 taken 6528 times.
✓ Branch 13 taken 1632 times.
✓ Branch 14 taken 6528 times.
✓ Branch 15 taken 1632 times.
✓ Branch 16 taken 6528 times.
✓ Branch 17 taken 1632 times.
✓ Branch 18 taken 6528 times.
✓ Branch 19 taken 1632 times.
✓ Branch 20 taken 6400 times.
✓ Branch 21 taken 1600 times.
✓ Branch 22 taken 6400 times.
✓ Branch 23 taken 1600 times.
✓ Branch 24 taken 6400 times.
✓ Branch 25 taken 1600 times.
✓ Branch 26 taken 6400 times.
✓ Branch 27 taken 1600 times.
✓ Branch 28 taken 6400 times.
✓ Branch 29 taken 1600 times.
✓ Branch 30 taken 12928 times.
✓ Branch 31 taken 3232 times.
✓ Branch 32 taken 12928 times.
✓ Branch 33 taken 3232 times.
✓ Branch 34 taken 12928 times.
✓ Branch 35 taken 3232 times.
✓ Branch 36 taken 12928 times.
✓ Branch 37 taken 3232 times.
✓ Branch 38 taken 12928 times.
✓ Branch 39 taken 3232 times.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
|
202400 | return globalPos[0] < this->gridGeometry().bBoxMin()[0] + eps_; |
133 | } | ||
134 | |||
135 | bool onRightBoundary_(const GlobalPosition &globalPos) const | ||
136 | { | ||
137 |
40/50✓ Branch 0 taken 1632 times.
✓ Branch 1 taken 4896 times.
✓ Branch 2 taken 1632 times.
✓ Branch 3 taken 4896 times.
✓ Branch 4 taken 1632 times.
✓ Branch 5 taken 4896 times.
✓ Branch 6 taken 1632 times.
✓ Branch 7 taken 4896 times.
✓ Branch 8 taken 1632 times.
✓ Branch 9 taken 4896 times.
✓ Branch 10 taken 1632 times.
✓ Branch 11 taken 4896 times.
✓ Branch 12 taken 1632 times.
✓ Branch 13 taken 4896 times.
✓ Branch 14 taken 1632 times.
✓ Branch 15 taken 4896 times.
✓ Branch 16 taken 1632 times.
✓ Branch 17 taken 4896 times.
✓ Branch 18 taken 1632 times.
✓ Branch 19 taken 4896 times.
✓ Branch 20 taken 1600 times.
✓ Branch 21 taken 4800 times.
✓ Branch 22 taken 1600 times.
✓ Branch 23 taken 4800 times.
✓ Branch 24 taken 1600 times.
✓ Branch 25 taken 4800 times.
✓ Branch 26 taken 1600 times.
✓ Branch 27 taken 4800 times.
✓ Branch 28 taken 1600 times.
✓ Branch 29 taken 4800 times.
✓ Branch 30 taken 3232 times.
✓ Branch 31 taken 9696 times.
✓ Branch 32 taken 3232 times.
✓ Branch 33 taken 9696 times.
✓ Branch 34 taken 3232 times.
✓ Branch 35 taken 9696 times.
✓ Branch 36 taken 3232 times.
✓ Branch 37 taken 9696 times.
✓ Branch 38 taken 3232 times.
✓ Branch 39 taken 9696 times.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
|
161920 | return globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_; |
138 | } | ||
139 | |||
140 | bool onStripe1_(const GlobalPosition &globalPos) const | ||
141 | { | ||
142 |
6/6✓ Branch 0 taken 1184 times.
✓ Branch 1 taken 352 times.
✓ Branch 2 taken 1184 times.
✓ Branch 3 taken 352 times.
✓ Branch 4 taken 1184 times.
✓ Branch 5 taken 352 times.
|
4608 | const auto xMax = this->gridGeometry().bBoxMax()[0]; |
143 | return ( | ||
144 |
4/4✓ Branch 0 taken 1184 times.
✓ Branch 1 taken 352 times.
✓ Branch 2 taken 1184 times.
✓ Branch 3 taken 352 times.
|
3072 | ( (xMax /4.0 - stripeWidth_*0.5) < globalPos[0] + eps_ ) && |
145 |
4/4✓ Branch 0 taken 1152 times.
✓ Branch 1 taken 32 times.
✓ Branch 2 taken 1152 times.
✓ Branch 3 taken 32 times.
|
2368 | ( (xMax/4.0 + stripeWidth_*0.5) > globalPos[0] + eps_ ) |
146 | ); | ||
147 | } | ||
148 | |||
149 | bool onStripe2_(const GlobalPosition &globalPos) const | ||
150 | { | ||
151 |
6/6✓ Branch 0 taken 800 times.
✓ Branch 1 taken 704 times.
✓ Branch 2 taken 800 times.
✓ Branch 3 taken 704 times.
✓ Branch 4 taken 800 times.
✓ Branch 5 taken 704 times.
|
4512 | const auto xMax = this->gridGeometry().bBoxMax()[0]; |
152 | return ( | ||
153 |
4/4✓ Branch 0 taken 800 times.
✓ Branch 1 taken 704 times.
✓ Branch 2 taken 800 times.
✓ Branch 3 taken 704 times.
|
3008 | ( (2.0 * xMax /4.0 - stripeWidth_*0.5) < globalPos[0] + eps_ ) && |
154 |
4/4✓ Branch 0 taken 768 times.
✓ Branch 1 taken 32 times.
✓ Branch 2 taken 768 times.
✓ Branch 3 taken 32 times.
|
1600 | ( (2.0 * xMax/4.0 + stripeWidth_*0.5) > globalPos[0] + eps_ ) |
155 | ); | ||
156 | } | ||
157 | |||
158 | bool onStripe3_(const GlobalPosition &globalPos) const | ||
159 | { | ||
160 |
6/6✓ Branch 0 taken 416 times.
✓ Branch 1 taken 1056 times.
✓ Branch 2 taken 416 times.
✓ Branch 3 taken 1056 times.
✓ Branch 4 taken 416 times.
✓ Branch 5 taken 1056 times.
|
4416 | const auto xMax = this->gridGeometry().bBoxMax()[0]; |
161 | return ( | ||
162 |
4/4✓ Branch 0 taken 416 times.
✓ Branch 1 taken 1056 times.
✓ Branch 2 taken 416 times.
✓ Branch 3 taken 1056 times.
|
2944 | ( (3.0 * xMax /4.0 - stripeWidth_*0.5) < globalPos[0] + eps_ ) && |
163 |
4/4✓ Branch 0 taken 32 times.
✓ Branch 1 taken 384 times.
✓ Branch 2 taken 32 times.
✓ Branch 3 taken 384 times.
|
832 | ( (3.0 * xMax/4.0 + stripeWidth_*0.5) > globalPos[0] + eps_ ) |
164 | ); | ||
165 | } | ||
166 | |||
167 | }; | ||
168 | |||
169 | } //end namespace Dumux | ||
170 | |||
171 | #endif | ||
172 |