3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test_impesproblem.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 *****************************************************************************/
24#ifndef DUMUX_TEST_IMPES_PROBLEM_HH
25#define DUMUX_TEST_IMPES_PROBLEM_HH
26
27#include <dune/grid/yaspgrid.hh>
28
31
35
36//following includes are only needed if a global pressure formulation is chosen!
37//Then only a total velocity can be reconstructed for the transport step
40
42
44
46
47namespace Dumux
48{
49
50template<class TypeTag>
51class IMPESTestProblem;
52
54// Specify the properties
56namespace Properties
57{
58NEW_TYPE_TAG(IMPESTest, INHERITS_FROM(FVPressureTwoP, FVTransportTwoP, IMPESTwoP, TestIMPESSpatialParams));
59
60// Set the grid type
61SET_TYPE_PROP(IMPESTest, Grid, Dune::YaspGrid<2>);
62
63// Set the problem property
65
67//Switch to a p_n-S_w formulation
68//
69//SET_INT_PROP(IMPESTest, Formulation, SequentialTwoPCommonIndices::pnsn);
70//
72
74//Switch to a p_global-S_w formulation
75//
76//SET_INT_PROP(IMPESTest, Formulation, SequentialTwoPCommonIndices::pGlobalSw);
77//
78//Define the capillary pressure term in the transport equation -> only needed in case of a p_global-S_w formulation!
79//SET_TYPE_PROP(IMPESTest, CapillaryFlux, CapillaryDiffusion<TypeTag>);
80//
81//Define the gravity term in the transport equation -> only needed in case of a p_global-S_w formulation!
82//SET_TYPE_PROP(IMPESTest, GravityFlux, GravityPart<TypeTag>);
83//
85
86// Set the fluid system
87template<class TypeTag>
88struct FluidSystem<TypeTag, TTag::IMPESTest>
89{
90 using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
94};
95
97
98// set up an additional problem where the AMG backend is used
99NEW_TYPE_TAG(IMPESTestWithAMG, INHERITS_FROM(IMPESTest));
100// use the AMG backend for the corresponding test
102// Set the grid type
103SET_TYPE_PROP(IMPESTestWithAMG, Grid, Dune::YaspGrid<2>);
104
105} // end namespace Properties
106
119template<class TypeTag>
120class IMPESTestProblem: public IMPESProblem2P<TypeTag>
121{
123using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
124using Grid = typename GridView::Grid;
125
126using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
127
128using WettingPhase = typename GET_PROP(TypeTag, FluidSystem)::WettingPhase;
129
130using TimeManager = typename GET_PROP_TYPE(TypeTag, TimeManager);
131
132enum
133{
134 dim = GridView::dimension, dimWorld = GridView::dimensionworld
135};
136
137enum
138{
139 nPhaseIdx = Indices::nPhaseIdx,
140 pwIdx = Indices::pwIdx,
141 swIdx = Indices::swIdx,
142 eqIdxPress = Indices::pressureEqIdx,
143 eqIdxSat = Indices::satEqIdx
144};
145
146using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
147
148using Element = typename GridView::Traits::template Codim<0>::Entity;
149using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
150
151using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
152using SolutionTypes = typename GET_PROP(TypeTag, SolutionTypes);
153using PrimaryVariables = typename SolutionTypes::PrimaryVariables;
154
155public:
156IMPESTestProblem(TimeManager &timeManager, Grid &grid) :
158{
159 name_ = getParam<std::string>("Problem.Name");
160}
161
165// \{
166
172const std::string name() const
173{
174 return name_;
175}
176
178{
179 return false;
180}
181
187Scalar temperatureAtPos(const GlobalPosition& globalPos) const
188{
189 return 273.15 + 10; // -> 10°C
190}
191
192// \}
193
195Scalar referencePressureAtPos(const GlobalPosition& globalPos) const
196{
197 return 1e5; // -> 10°C
198}
199
200void source(PrimaryVariables &values,const Element& element) const
201{
202 values = 0;
203}
204
212void boundaryTypesAtPos(BoundaryTypes &bcTypes, const GlobalPosition& globalPos) const
213{
214 if (globalPos[0] < eps_)
215 {
216 bcTypes.setAllDirichlet();
217 }
218 else if (globalPos[0] > this->bBoxMax()[0] - eps_)
219 {
220 bcTypes.setNeumann(eqIdxPress);
221 bcTypes.setOutflow(eqIdxSat);
222 }
223 // all other boundaries
224 else
225 {
226 bcTypes.setAllNeumann();
227 }
228}
229
231void dirichletAtPos(PrimaryVariables &values, const GlobalPosition& globalPos) const
232{
233 values = 0;
234 if (globalPos[0] < eps_)
235 {
236 if (getParam<bool>("Problem.EnableGravity"))
237 {
238 Scalar pRef = referencePressureAtPos(globalPos);
239 Scalar temp = temperatureAtPos(globalPos);
240
241 values[pwIdx] = (2e5 + (this->bBoxMax()[dim-1] - globalPos[dim-1])
242 * WettingPhase::density(temp, pRef)
243 * this->gravity().two_norm());
244 }
245 else
246 {
247 values[pwIdx] = 2e5;
248 }
249 values[swIdx] = 0.8;
250 }
251 else
252 {
253 values[pwIdx] = 2e5;
254 values[swIdx] = 0.2;
255 }
256}
257
259void neumannAtPos(PrimaryVariables &values, const GlobalPosition& globalPos) const
260{
261 values = 0;
262 if (globalPos[0] > this->bBoxMax()[0] - eps_)
263 {
264 values[nPhaseIdx] = 3e-4;
265 }
266}
268void initial(PrimaryVariables &values,
269 const Element& element) const
270{
271 values[pwIdx] = 0;
272 values[swIdx] = 0.2;
273}
274
275private:
276
277static constexpr Scalar eps_ = 1e-6;
278std::string name_;
279};
280} //end namespace
281
282#endif
#define GET_PROP(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:281
#define GET_PROP_TYPE(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:283
#define NEW_TYPE_TAG(...)
Definition: propertysystemmacros.hh:130
Provides a parallel linear solver based on the ISTL AMG preconditioner and the ISTL BiCGSTAB solver.
A much simpler (and thus potentially less buggy) version of pure water.
A liquid phase consisting of a single component.
Class for defining the diffusive capillary pressure term of a 2p saturation equation.
Cfl-flux-function to evaluate a Cfl-Condition after Coats 2003.
Class for defining the gravity term of a two-phase flow saturation equation.
spatial parameters for the sequential 2p test
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
SET_TYPE_PROP(FVPressureOneP, Velocity, FVVelocity1P< TypeTag >)
Set velocity reconstruction implementation standard cell centered finite volume schemes as default.
Type tag FVPressureOneP INHERITS_FROM(PressureOneP))
The type tag for the one-phase problems using a standard finite volume model.
Property tag EvalCflFluxFunction
Type of the evaluation of the CFL-condition.
Definition: transportproperties.hh:50
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
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
TODO: Remove this property as soon as the decoupled models are integrated.
Definition: common/properties.hh:95
The type of the fluid system to use.
Definition: common/properties.hh:223
A linear solver based on the ISTL AMG preconditioner and the ISTL BiCGSTAB solver.
Definition: amgbackend.hh:81
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
Base class for all 2-phase problems which use an IMPES algorithm.
Definition: dumux/porousmediumflow/2p/sequential/impes/problem.hh:41
const GravityVector & gravity() const
Returns the acceleration due to gravity.
Definition: dumux/porousmediumflow/2p/sequential/impes/problem.hh:167
Cfl-flux-function to evaluate a Cfl-Condition after Coats 2003.
Definition: evalcflfluxcoats.hh:40
base class for problems using a sequential implicit-explicit strategy
Definition: impetproblem.hh:46
TimeManager & timeManager()
Returns TimeManager object used by the simulation.
Definition: impetproblem.hh:663
const GlobalPosition & bBoxMax() const
The coordinate of the corner of the GridView's bounding box with the largest values.
Definition: impetproblem.hh:655
Grid & grid()
Returns the current grid which used by the problem.
Definition: impetproblem.hh:581
test problem for the sequential 2p model
Definition: test_impesproblem.hh:121
void initial(PrimaryVariables &values, const Element &element) const
return initial solution -> only saturation values have to be given!
Definition: test_impesproblem.hh:268
bool shouldWriteRestartFile() const
Definition: test_impesproblem.hh:177
void neumannAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const
set neumann condition for phases (flux, [kg/(m^2 s)])
Definition: test_impesproblem.hh:259
void dirichletAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const
set dirichlet condition (pressure [Pa], saturation [-])
Definition: test_impesproblem.hh:231
const std::string name() const
The problem name.
Definition: test_impesproblem.hh:172
void source(PrimaryVariables &values, const Element &element) const
Definition: test_impesproblem.hh:200
IMPESTestProblem(TimeManager &timeManager, Grid &grid)
Definition: test_impesproblem.hh:156
void boundaryTypesAtPos(BoundaryTypes &bcTypes, const GlobalPosition &globalPos) const
Returns the type of boundary condition.
Definition: test_impesproblem.hh:212
Scalar referencePressureAtPos(const GlobalPosition &globalPos) const
Returns the reference pressure for evaluation of constitutive relations.
Definition: test_impesproblem.hh:195
Scalar temperatureAtPos(const GlobalPosition &globalPos) const
Returns the temperature within the domain.
Definition: test_impesproblem.hh:187
typename GET_PROP_TYPE(TypeTag, Scalar) Scalar
Definition: test_impesproblem.hh:90
spatial parameters for the sequential 2p test
Definition: test_impesspatialparams.hh:65
Specifies the properties for immiscible 2p transport.
Base class for all 2-phase problems which use an IMPES algorithm.
Defines the properties required for finite volume pressure models in a two-phase sequential model.