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 TwoPOneCTests | ||
10 | * \brief Non-isothermal steam injection test problem for the 2p1cni model. | ||
11 | */ | ||
12 | |||
13 | #ifndef DUMUX_STEAM_INJECTIONPROBLEM_HH | ||
14 | #define DUMUX_STEAM_INJECTIONPROBLEM_HH | ||
15 | |||
16 | #include <dumux/common/properties.hh> | ||
17 | #include <dumux/common/parameters.hh> | ||
18 | #include <dumux/common/boundarytypes.hh> | ||
19 | #include <dumux/common/numeqvector.hh> | ||
20 | |||
21 | #include <dumux/porousmediumflow/problem.hh> | ||
22 | |||
23 | namespace Dumux { | ||
24 | |||
25 | /*! | ||
26 | * \ingroup TwoPOneCTests | ||
27 | * \brief Non-isothermal 2D problem where steam is injected on the lower left side of the domain. | ||
28 | * | ||
29 | */ | ||
30 | template <class TypeTag> | ||
31 | 4 | class InjectionProblem : public PorousMediumFlowProblem<TypeTag> | |
32 | { | ||
33 | using ParentType = PorousMediumFlowProblem<TypeTag>; | ||
34 | |||
35 | using Scalar = GetPropType<TypeTag, Properties::Scalar>; | ||
36 | using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>; | ||
37 | using Indices = typename ModelTraits::Indices; | ||
38 | using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; | ||
39 | using BoundaryTypes = Dumux::BoundaryTypes<ModelTraits::numEq()>; | ||
40 | |||
41 | using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; | ||
42 | using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; | ||
43 | |||
44 | using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; | ||
45 | using ElementVolumeVariables = typename GridVariables::GridVolumeVariables::LocalView; | ||
46 | using ElementFluxVariablesCache = typename GridVariables::GridFluxVariablesCache::LocalView; | ||
47 | |||
48 | using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; | ||
49 | using FVElementGeometry = typename GridGeometry::LocalView; | ||
50 | using SubControlVolume = typename FVElementGeometry::SubControlVolume; | ||
51 | using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; | ||
52 | using GridView = typename GridGeometry::GridView; | ||
53 | using Element = typename GridView::template Codim<0>::Entity; | ||
54 | |||
55 | // copy some indices for convenience | ||
56 | enum { | ||
57 | pressureIdx = Indices::pressureIdx, | ||
58 | switchIdx = Indices::switchIdx, | ||
59 | |||
60 | conti0EqIdx = Indices::conti0EqIdx, | ||
61 | energyEqIdx = Indices::energyEqIdx, | ||
62 | |||
63 | // phase state | ||
64 | liquidPhaseOnly = Indices::liquidPhaseOnly | ||
65 | }; | ||
66 | |||
67 | using GlobalPosition = typename Element::Geometry::GlobalCoordinate; | ||
68 | |||
69 | public: | ||
70 | 4 | InjectionProblem(std::shared_ptr<const GridGeometry> gridGeometry) | |
71 |
3/6✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 4 times.
✗ Branch 9 not taken.
|
12 | : ParentType(gridGeometry) |
72 | 4 | { FluidSystem::init(); } | |
73 | |||
74 | |||
75 | //! \copydoc Dumux::FVProblem::source() | ||
76 | 868800 | NumEqVector source(const Element &element, | |
77 | const FVElementGeometry& fvGeometry, | ||
78 | const ElementVolumeVariables& elemVolVars, | ||
79 | const SubControlVolume &scv) const | ||
80 | 1737600 | { return NumEqVector(0.0); } | |
81 | |||
82 | /*! | ||
83 | * \brief Specifies which kind of boundary condition should be | ||
84 | * used for which equation on a given boundary segment | ||
85 | * | ||
86 | * \param globalPos The global position | ||
87 | */ | ||
88 | 70246 | BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const | |
89 | { | ||
90 |
2/2✓ Branch 0 taken 58046 times.
✓ Branch 1 taken 12200 times.
|
70246 | BoundaryTypes bcTypes; |
91 | |||
92 |
6/6✓ Branch 0 taken 58046 times.
✓ Branch 1 taken 12200 times.
✓ Branch 2 taken 24244 times.
✓ Branch 3 taken 33802 times.
✓ Branch 4 taken 33802 times.
✓ Branch 5 taken 36444 times.
|
106690 | if(globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_ || globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_) |
93 | 70246 | bcTypes.setAllDirichlet(); | |
94 | else | ||
95 | 70246 | bcTypes.setAllNeumann(); | |
96 | |||
97 | 70246 | return bcTypes; | |
98 | } | ||
99 | |||
100 | /*! | ||
101 | * \brief Evaluates the boundary conditions for a Dirichlet boundary segment. | ||
102 | * | ||
103 | * \param globalPos The global position | ||
104 | */ | ||
105 | 12320 | PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const | |
106 | { | ||
107 | 12320 | return initialAtPos(globalPos); | |
108 | } | ||
109 | |||
110 | /*! | ||
111 | * \brief Evaluates the boundary conditions for a Neumann boundary segment. | ||
112 | * | ||
113 | * This is the method for the case where the Neumann condition is | ||
114 | * potentially solution dependent and requires some quantities that | ||
115 | * are specific to the fully-implicit method. | ||
116 | * | ||
117 | * \param element The finite element | ||
118 | * \param fvGeometry The finite-volume geometry | ||
119 | * \param elemVolVars All volume variables for the element | ||
120 | * \param elemFluxVarsCache Flux variables caches for all faces in stencil | ||
121 | * \param scvf The sub-control volume face | ||
122 | * | ||
123 | * For this method, the \a values parameter stores the flux | ||
124 | * in normal direction of each phase. Negative values mean influx. | ||
125 | * E.g. for the mass balance that would the mass flux in \f$ [ kg / (m^2 \cdot s)] \f$. | ||
126 | */ | ||
127 | 63630 | NumEqVector neumann(const Element& element, | |
128 | const FVElementGeometry& fvGeometry, | ||
129 | const ElementVolumeVariables& elemVolVars, | ||
130 | const ElementFluxVariablesCache& elemFluxVarsCache, | ||
131 | const SubControlVolumeFace& scvf) const | ||
132 | { | ||
133 |
2/2✓ Branch 0 taken 20955 times.
✓ Branch 1 taken 42675 times.
|
63630 | NumEqVector values(0.0); |
134 | |||
135 |
2/2✓ Branch 0 taken 6420 times.
✓ Branch 1 taken 12840 times.
|
19260 | const auto& ipGlobal = scvf.ipGlobal(); |
136 | |||
137 |
2/2✓ Branch 0 taken 20955 times.
✓ Branch 1 taken 42675 times.
|
63630 | if (ipGlobal[0] < eps_) |
138 | { | ||
139 |
4/4✓ Branch 0 taken 10860 times.
✓ Branch 1 taken 31815 times.
✓ Branch 2 taken 26385 times.
✓ Branch 3 taken 5430 times.
|
42675 | if (ipGlobal[1] > 2.0 - eps_ && ipGlobal[1] < 3.0 + eps_) |
140 | { | ||
141 | const Scalar massRate = 1e-1; | ||
142 | values[conti0EqIdx] = -massRate; | ||
143 | values[energyEqIdx] = -massRate * 2690e3; | ||
144 | } | ||
145 | } | ||
146 | return values; | ||
147 | } | ||
148 | |||
149 | /*! | ||
150 | * \brief Evaluates the initial values for a control volume. | ||
151 | * | ||
152 | * \param globalPos The global position | ||
153 | */ | ||
154 | 14382 | PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const | |
155 | { | ||
156 | 14382 | PrimaryVariables values(0.0); | |
157 | |||
158 | 14382 | const Scalar densityW = 1000.0; | |
159 |
1/2✓ Branch 1 taken 7305 times.
✗ Branch 2 not taken.
|
12320 | values[pressureIdx] = 101300.0 + (this->gridGeometry().bBoxMax()[1] - globalPos[1])*densityW*9.81; // hydrostatic pressure |
160 |
1/2✓ Branch 1 taken 7305 times.
✗ Branch 2 not taken.
|
12320 | values[switchIdx] = 283.13; |
161 | |||
162 |
1/2✓ Branch 1 taken 7305 times.
✗ Branch 2 not taken.
|
12320 | values.setState(liquidPhaseOnly); |
163 | |||
164 | return values; | ||
165 | } | ||
166 | |||
167 | private: | ||
168 | |||
169 | static constexpr Scalar eps_ = 1e-6; | ||
170 | }; | ||
171 | } // end namespace Dumux | ||
172 | |||
173 | #endif | ||
174 |