3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/porousmediumflow/2p/implicit/incompressible/problem.hh
Go to the documentation of this file.
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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
23#ifndef DUMUX_INCOMPRESSIBLE_TWOP_TEST_PROBLEM_HH
24#define DUMUX_INCOMPRESSIBLE_TWOP_TEST_PROBLEM_HH
25
26#include <dune/grid/yaspgrid.hh>
27
31
36
40
41#include "spatialparams.hh"
42
43#ifndef ENABLEINTERFACESOLVER
44#define ENABLEINTERFACESOLVER 0
45#endif
46
47namespace Dumux {
48// forward declarations
49template<class TypeTag> class TwoPTestProblem;
50
51namespace Properties {
52// Create new type tags
53namespace TTag {
54struct TwoPIncompressible { using InheritsFrom = std::tuple<TwoP>; };
55struct TwoPIncompressibleTpfa { using InheritsFrom = std::tuple<TwoPIncompressible, CCTpfaModel>; };
56struct TwoPIncompressibleMpfa { using InheritsFrom = std::tuple<TwoPIncompressible, CCMpfaModel>; };
57struct TwoPIncompressibleBox { using InheritsFrom = std::tuple<TwoPIncompressible, BoxModel>; };
58} // end namespace TTag
59
60// Set the grid type
61template<class TypeTag>
62struct Grid<TypeTag, TTag::TwoPIncompressible> { using type = Dune::YaspGrid<2>; };
63
64// Set the problem type
65template<class TypeTag>
66struct Problem<TypeTag, TTag::TwoPIncompressible> { using type = TwoPTestProblem<TypeTag>; };
67
68// the local residual containing the analytic derivative methods
69template<class TypeTag>
70struct LocalResidual<TypeTag, TTag::TwoPIncompressible> { using type = TwoPIncompressibleLocalResidual<TypeTag>; };
71
72// Set the fluid system
73template<class TypeTag>
74struct FluidSystem<TypeTag, TTag::TwoPIncompressible>
75{
80};
81
82// Set the spatial parameters
83template<class TypeTag>
84struct SpatialParams<TypeTag, TTag::TwoPIncompressible>
85{
86private:
89public:
91};
92
93// Enable caching
94template<class TypeTag>
95struct EnableGridVolumeVariablesCache<TypeTag, TTag::TwoPIncompressible> { static constexpr bool value = false; };
96template<class TypeTag>
97struct EnableGridFluxVariablesCache<TypeTag, TTag::TwoPIncompressible> { static constexpr bool value = false; };
98template<class TypeTag>
99struct EnableGridGeometryCache<TypeTag, TTag::TwoPIncompressible> { static constexpr bool value = false; };
100
101// Maybe enable the box-interface solver
102template<class TypeTag>
103struct EnableBoxInterfaceSolver<TypeTag, TTag::TwoPIncompressible> { static constexpr bool value = ENABLEINTERFACESOLVER; };
104} // end namespace Properties
105
110template<class TypeTag>
112{
115 using Element = typename GridView::template Codim<0>::Entity;
121 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
124 enum {
125 pressureH2OIdx = Indices::pressureIdx,
126 saturationDNAPLIdx = Indices::saturationIdx,
127 contiDNAPLEqIdx = Indices::conti0EqIdx + FluidSystem::comp1Idx,
128 waterPhaseIdx = FluidSystem::phase0Idx,
129 dnaplPhaseIdx = FluidSystem::phase1Idx
130 };
131
132public:
133 TwoPTestProblem(std::shared_ptr<const GridGeometry> gridGeometry)
135
142 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
143 {
144 BoundaryTypes values;
145 if (onLeftBoundary_(globalPos) || onRightBoundary_(globalPos))
146 values.setAllDirichlet();
147 else
148 values.setAllNeumann();
149 return values;
150 }
151
157 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
158 {
159 PrimaryVariables values;
161 fluidState.setTemperature(temperature());
162 fluidState.setPressure(waterPhaseIdx, /*pressure=*/1e5);
163 fluidState.setPressure(dnaplPhaseIdx, /*pressure=*/1e5);
164
165 Scalar densityW = FluidSystem::density(fluidState, waterPhaseIdx);
166
167 Scalar height = this->gridGeometry().bBoxMax()[1] - this->gridGeometry().bBoxMin()[1];
168 Scalar depth = this->gridGeometry().bBoxMax()[1] - globalPos[1];
169 Scalar alpha = 1 + 1.5/height;
170 Scalar width = this->gridGeometry().bBoxMax()[0] - this->gridGeometry().bBoxMin()[0];
171 Scalar factor = (width*alpha + (1.0 - alpha)*globalPos[0])/width;
172
173 // hydrostatic pressure scaled by alpha
174 values[pressureH2OIdx] = 1e5 - factor*densityW*this->spatialParams().gravity(globalPos)[1]*depth;
175 values[saturationDNAPLIdx] = 0.0;
176
177 return values;
178 }
179
188 NumEqVector neumannAtPos(const GlobalPosition &globalPos) const
189 {
190 NumEqVector values(0.0);
191 if (onInlet_(globalPos))
192 values[contiDNAPLEqIdx] = -0.04; // kg / (m * s)
193
194 // in the test with the oil wet lens, use higher injection rate
195 if (this->spatialParams().lensIsOilWet())
196 values[contiDNAPLEqIdx] *= 10;
197
198 return values;
199 }
200
206 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
207 {
208 PrimaryVariables values;
210 fluidState.setTemperature(temperature());
211 fluidState.setPressure(waterPhaseIdx, /*pressure=*/1e5);
212 fluidState.setPressure(dnaplPhaseIdx, /*pressure=*/1e5);
213
214 Scalar densityW = FluidSystem::density(fluidState, waterPhaseIdx);
215
216 Scalar depth = this->gridGeometry().bBoxMax()[1] - globalPos[1];
217
218 // hydrostatic pressure
219 values[pressureH2OIdx] = 1e5 - densityW*this->spatialParams().gravity(globalPos)[1]*depth;
220 values[saturationDNAPLIdx] = 0;
221 return values;
222 }
223
231 Scalar temperature() const
232 {
233 return 293.15; // 10°C
234 }
235
236private:
237 bool onLeftBoundary_(const GlobalPosition &globalPos) const
238 {
239 return globalPos[0] < this->gridGeometry().bBoxMin()[0] + eps_;
240 }
241
242 bool onRightBoundary_(const GlobalPosition &globalPos) const
243 {
244 return globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_;
245 }
246
247 bool onLowerBoundary_(const GlobalPosition &globalPos) const
248 {
249 return globalPos[1] < this->gridGeometry().bBoxMin()[1] + eps_;
250 }
251
252 bool onUpperBoundary_(const GlobalPosition &globalPos) const
253 {
254 return globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_;
255 }
256
257 bool onInlet_(const GlobalPosition &globalPos) const
258 {
259 Scalar width = this->gridGeometry().bBoxMax()[0] - this->gridGeometry().bBoxMin()[0];
260 Scalar lambda = (this->gridGeometry().bBoxMax()[0] - globalPos[0])/width;
261 return onUpperBoundary_(globalPos) && 0.5 < lambda && lambda < 2.0/3.0;
262 }
263
264 static constexpr Scalar eps_ = 1e-6;
265};
266
267} // end namespace Dumux
268
269#endif
Defines a type tag and some properties for models using the box scheme.
Properties for all models using cell-centered finite volume scheme with mpfa.
Properties for all models using cell-centered finite volume scheme with TPFA.
A much simpler (and thus potentially less buggy) version of pure water.
A simple implementation of Trichloroethene (TCE), a DNAPL.
A liquid phase consisting of a single component.
A fluid system for two-phase models assuming immiscibility and thermodynamic equilibrium.
#define ENABLEINTERFACESOLVER
The properties for the incompressible 2p test.
Definition: test/porousmediumflow/2p/implicit/incompressible/problem.hh:44
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:50
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:588
The DUNE grid type.
Definition: common/properties.hh:57
Property to specify the type of a problem which has to be solved.
Definition: common/properties.hh:69
Definition: common/properties.hh:91
Definition: common/properties.hh:169
If disabled, the volume variables are not stored (reduces memory, but is slower)
Definition: common/properties.hh:178
specifies if data on flux vars should be saved (faster, but more memory consuming)
Definition: common/properties.hh:188
The type of the spatial parameters object.
Definition: common/properties.hh:221
The type of the fluid system to use.
Definition: common/properties.hh:223
Definition: common/properties.hh:244
A liquid phase consisting of a single component.
Definition: 1pliquid.hh:46
A fluid system for two-phase models assuming immiscibility and thermodynamic equilibrium.
Definition: 2pimmiscible.hh:59
Element-wise calculation of the residual and its derivatives for a two-phase, incompressible test pro...
Definition: 2p/incompressiblelocalresidual.hh:49
Base class for all fully implicit porous media problems.
Definition: dumux/porousmediumflow/problem.hh:39
SpatialParams & spatialParams()
Returns the spatial parameters object.
Definition: dumux/porousmediumflow/problem.hh:146
The incompressible 2p-boxdfm test problem.
Definition: test/porousmediumflow/2p/implicit/incompressible/problem.hh:112
TwoPTestProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/porousmediumflow/2p/implicit/incompressible/problem.hh:133
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Specifies which kind of boundary condition should be used for which equation on a given boundary segm...
Definition: test/porousmediumflow/2p/implicit/incompressible/problem.hh:142
Scalar temperature() const
Returns the temperature for an isothermal problem.
Definition: test/porousmediumflow/2p/implicit/boxdfm/problem.hh:226
NumEqVector neumannAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Neumann boundary segment.
Definition: test/porousmediumflow/2p/implicit/incompressible/problem.hh:188
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial values for a control volume.
Definition: test/porousmediumflow/2p/implicit/incompressible/problem.hh:206
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet boundary segment.
Definition: test/porousmediumflow/2p/implicit/incompressible/problem.hh:157
The spatial params for the incompressible 2p test.
Definition: porousmediumflow/2p/implicit/boxdfm/spatialparams.hh:44
Definition: test/porousmediumflow/2p/implicit/incompressible/problem.hh:54
std::tuple< TwoP > InheritsFrom
Definition: test/porousmediumflow/2p/implicit/incompressible/problem.hh:54
Definition: test/porousmediumflow/2p/implicit/incompressible/problem.hh:55
std::tuple< TwoPIncompressible, CCTpfaModel > InheritsFrom
Definition: test/porousmediumflow/2p/implicit/incompressible/problem.hh:55
Definition: test/porousmediumflow/2p/implicit/incompressible/problem.hh:56
std::tuple< TwoPIncompressible, CCMpfaModel > InheritsFrom
Definition: test/porousmediumflow/2p/implicit/incompressible/problem.hh:56
Definition: test/porousmediumflow/2p/implicit/incompressible/problem.hh:57
std::tuple< TwoPIncompressible, BoxModel > InheritsFrom
Definition: test/porousmediumflow/2p/implicit/incompressible/problem.hh:57
Dune::YaspGrid< 2 > type
Definition: test/porousmediumflow/2p/implicit/incompressible/problem.hh:62
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/2p/implicit/incompressible/problem.hh:76
Adaption of the fully implicit scheme to the two-phase flow model.
Base class for all porous media problems.
Element-wise calculation of the residual and its derivatives for a two-phase, incompressible test pro...
Definition of the spatial parameters for the MaxwellStefan problem.