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 Definition of a problem for the tracer problem: | ||
11 | * A rotating velocity field mixes a tracer band in a porous groundwater reservoir. | ||
12 | */ | ||
13 | |||
14 | #ifndef DUMUX_TRACER_TEST_PROBLEM_HH | ||
15 | #define DUMUX_TRACER_TEST_PROBLEM_HH | ||
16 | |||
17 | #include <dumux/common/properties.hh> | ||
18 | #include <dumux/common/parameters.hh> | ||
19 | #include <dumux/common/boundarytypes.hh> | ||
20 | |||
21 | #include <dumux/porousmediumflow/problem.hh> | ||
22 | |||
23 | namespace Dumux { | ||
24 | |||
25 | /*! | ||
26 | * \ingroup TracerTests | ||
27 | * | ||
28 | * \brief Definition of a problem for the tracer problem: | ||
29 | * A lens of contaminant tracer is diluted by diffusion and a rotating velocity field. | ||
30 | * | ||
31 | * This problem uses the \ref TracerModel model. | ||
32 | */ | ||
33 | template <class TypeTag> | ||
34 | 8 | class TracerTest : public PorousMediumFlowProblem<TypeTag> | |
35 | { | ||
36 | using ParentType = PorousMediumFlowProblem<TypeTag>; | ||
37 | |||
38 | using Scalar = GetPropType<TypeTag, Properties::Scalar>; | ||
39 | using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; | ||
40 | using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; | ||
41 | using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; | ||
42 | using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; | ||
43 | using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; | ||
44 | using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; | ||
45 | using SpatialParams = GetPropType<TypeTag, Properties::SpatialParams>; | ||
46 | |||
47 | //! property that defines whether mole or mass fractions are used | ||
48 | static constexpr bool useMoles = getPropValue<TypeTag, Properties::UseMoles>(); | ||
49 | using Element = typename GridGeometry::GridView::template Codim<0>::Entity; | ||
50 | using GlobalPosition = typename Element::Geometry::GlobalCoordinate; | ||
51 | |||
52 | public: | ||
53 | 8 | TracerTest(std::shared_ptr<const GridGeometry> gridGeometry) | |
54 |
5/14✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 8 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 8 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 8 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
24 | : ParentType(gridGeometry) |
55 | { | ||
56 | // stating in the console whether mole or mass fractions are used | ||
57 | if(useMoles) | ||
58 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
4 | std::cout<<"problem uses mole fractions" << '\n'; |
59 | else | ||
60 |
1/2✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
12 | std::cout<<"problem uses mass fractions" << '\n'; |
61 | 8 | } | |
62 | |||
63 | /*! | ||
64 | * \name Boundary conditions | ||
65 | */ | ||
66 | // \{ | ||
67 | |||
68 | /*! | ||
69 | * \brief Specifies which kind of boundary condition should be | ||
70 | * used for which equation on a given boundary segment. | ||
71 | * | ||
72 | * \param globalPos The position for which the bc type should be evaluated | ||
73 | */ | ||
74 | ✗ | BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const | |
75 | { | ||
76 | 429184 | BoundaryTypes values; | |
77 |
6/10✓ Branch 0 taken 159984 times.
✓ Branch 1 taken 8800 times.
✓ Branch 2 taken 8800 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 80800 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 170400 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 400 times.
|
429184 | values.setAllNeumann(); // no-flow |
78 | ✗ | return values; | |
79 | } | ||
80 | // \} | ||
81 | |||
82 | /*! | ||
83 | * \name Volume terms | ||
84 | */ | ||
85 | // \{ | ||
86 | |||
87 | /*! | ||
88 | * \brief Evaluates the initial value for a control volume. | ||
89 | * | ||
90 | * \param globalPos The position for which the initial condition should be evaluated | ||
91 | * | ||
92 | * For this method, the \a values parameter stores primary | ||
93 | * variables. | ||
94 | */ | ||
95 | ✗ | PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const | |
96 | { | ||
97 | 10000 | PrimaryVariables initialValues(0.0); | |
98 |
8/16✗ 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 6000 times.
✓ Branch 9 taken 4000 times.
✓ Branch 10 taken 6000 times.
✓ Branch 11 taken 4000 times.
✓ Branch 12 taken 2000 times.
✓ Branch 13 taken 4000 times.
✓ Branch 14 taken 2000 times.
✓ Branch 15 taken 4000 times.
|
20000 | if (globalPos[1] > 0.4 - eps_ && globalPos[1] < 0.6 + eps_) |
99 | { | ||
100 | if (useMoles) | ||
101 | initialValues = 1e-9; | ||
102 | else | ||
103 | initialValues = 1e-9*FluidSystem::molarMass(0)/this->spatialParams().fluidMolarMass(globalPos); | ||
104 | } | ||
105 | 10000 | return initialValues; } | |
106 | |||
107 | // \} | ||
108 | |||
109 | private: | ||
110 | static constexpr Scalar eps_ = 1e-6; | ||
111 | }; | ||
112 | |||
113 | } // end namespace Dumux | ||
114 | |||
115 | #endif | ||
116 |