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 OnePNCTests | ||
10 | * \brief Definition of a problem involving salt | ||
11 | * water intrusion into a fresh water aquifer. | ||
12 | */ | ||
13 | |||
14 | #ifndef DUMUX_SALTWATERINTRUSION_TEST_PROBLEM_HH | ||
15 | #define DUMUX_SALTWATERINTRUSION_TEST_PROBLEM_HH | ||
16 | |||
17 | #include <dumux/common/properties.hh> | ||
18 | #include <dumux/common/parameters.hh> | ||
19 | |||
20 | #include <dumux/common/boundarytypes.hh> | ||
21 | #include <dumux/porousmediumflow/problem.hh> | ||
22 | |||
23 | namespace Dumux { | ||
24 | |||
25 | /*! | ||
26 | * \ingroup OnePNCTests | ||
27 | * \brief Definition of a problem involving salt water intrusion into a | ||
28 | * fresh water aquifer. | ||
29 | * | ||
30 | * The aquifer is in contact with salt water with a specific salinity on the | ||
31 | * right boundary. | ||
32 | */ | ||
33 | template <class TypeTag> | ||
34 | 1 | class SaltWaterIntrusionTestProblem : 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 Element = typename GridView::template Codim<0>::Entity; | ||
42 | using GlobalPosition = typename Element::Geometry::GlobalCoordinate; | ||
43 | using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; | ||
44 | using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; | ||
45 | using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; | ||
46 | using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; | ||
47 | |||
48 | // copy pressure index for convenience | ||
49 | enum { pressureIdx = Indices::pressureIdx }; | ||
50 | |||
51 | //! The test is defined using mass fractions | ||
52 | static_assert(!getPropValue<TypeTag, Properties::UseMoles>(), "This test uses mass fractions!"); | ||
53 | |||
54 | public: | ||
55 | 1 | SaltWaterIntrusionTestProblem(std::shared_ptr<const GridGeometry> gridGeometry) | |
56 |
6/16✓ 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 taken 1 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
|
3 | : ParentType(gridGeometry) |
57 | { | ||
58 | //initialize fluid system | ||
59 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | FluidSystem::init(); |
60 | 1 | } | |
61 | |||
62 | /*! | ||
63 | * \name Problem parameters | ||
64 | */ | ||
65 | // \{ | ||
66 | |||
67 | // \} | ||
68 | |||
69 | /*! | ||
70 | * \name Boundary conditions | ||
71 | */ | ||
72 | // \{ | ||
73 | |||
74 | /*! | ||
75 | * \brief Specifies which kind of boundary condition should be | ||
76 | * used for which equation on a given boundary segment. | ||
77 | * | ||
78 | * \param globalPos The position for which the bc type should be evaluated | ||
79 | */ | ||
80 | 9312 | BoundaryTypes boundaryTypesAtPos(const GlobalPosition& globalPos) const | |
81 | { | ||
82 | 9312 | BoundaryTypes values; | |
83 | 9312 | values.setAllNeumann(); | |
84 | |||
85 | // use Dirichlet BCs on the left and right boundary | ||
86 |
14/14✓ Branch 0 taken 8342 times.
✓ Branch 1 taken 970 times.
✓ Branch 2 taken 8342 times.
✓ Branch 3 taken 970 times.
✓ Branch 4 taken 970 times.
✓ Branch 5 taken 7372 times.
✓ Branch 6 taken 970 times.
✓ Branch 7 taken 7372 times.
✓ Branch 8 taken 970 times.
✓ Branch 9 taken 7372 times.
✓ Branch 10 taken 970 times.
✓ Branch 11 taken 7372 times.
✓ Branch 12 taken 970 times.
✓ Branch 13 taken 7372 times.
|
18624 | if(globalPos[0] < eps_ || globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_) |
87 | values.setAllDirichlet(); | ||
88 | |||
89 | 9312 | return values; | |
90 | } | ||
91 | |||
92 | /*! | ||
93 | * \brief Evaluates the boundary conditions for a Dirichlet boundary segment. | ||
94 | * | ||
95 | * \param globalPos The position for which the bc type should be evaluated | ||
96 | */ | ||
97 | PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const | ||
98 | { | ||
99 | 3880 | PrimaryVariables values = initialAtPos(globalPos); | |
100 | |||
101 | // salt water is in contact on the right boundary | ||
102 |
8/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 970 times.
✓ Branch 9 taken 970 times.
✓ Branch 10 taken 970 times.
✓ Branch 11 taken 970 times.
✓ Branch 12 taken 970 times.
✓ Branch 13 taken 970 times.
✓ Branch 14 taken 970 times.
✓ Branch 15 taken 970 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
|
7760 | if (globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_) |
103 | 1940 | values[FluidSystem::NaClIdx] = 0.035; // 3.5% salinity (sea water) | |
104 | |||
105 | return values; | ||
106 | } | ||
107 | |||
108 | // \} | ||
109 | |||
110 | /*! | ||
111 | * \name Volume terms | ||
112 | */ | ||
113 | // \{ | ||
114 | |||
115 | /*! | ||
116 | * \brief Evaluates the initial value for a control volume. | ||
117 | * | ||
118 | * \param globalPos The position for which the initial condition should be evaluated | ||
119 | */ | ||
120 | PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const | ||
121 | { | ||
122 |
8/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 970 times.
✓ Branch 9 taken 970 times.
✓ Branch 10 taken 970 times.
✓ Branch 11 taken 970 times.
✓ Branch 12 taken 970 times.
✓ Branch 13 taken 970 times.
✓ Branch 14 taken 970 times.
✓ Branch 15 taken 970 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
|
7760 | const Scalar depth = this->gridGeometry().bBoxMax()[1] - globalPos[1]; |
123 | 2066 | PrimaryVariables priVars; | |
124 |
2/6✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 970 times.
✓ Branch 3 taken 970 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1940 | priVars[pressureIdx] = 1e5 + depth*9.81*1000; // hydrostatic pressure (assume rho_water = 1000.0) |
125 |
4/12✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 970 times.
✓ Branch 5 taken 970 times.
✓ Branch 6 taken 970 times.
✓ Branch 7 taken 970 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
3880 | priVars[FluidSystem::NaClIdx] = 0.0; // initially only fresh water is present |
126 | return priVars; | ||
127 | } | ||
128 | |||
129 | // \} | ||
130 | |||
131 | private: | ||
132 | static constexpr Scalar eps_ = 1e-6; | ||
133 | }; | ||
134 | |||
135 | } // end namespace Dumux | ||
136 | |||
137 | #endif | ||
138 |