3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test_impesadaptiveproblem.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_ADAPTIVE_PROBLEM_HH
25#define DUMUX_TEST_IMPES_ADAPTIVE_PROBLEM_HH
26
27#if HAVE_DUNE_ALUGRID
28#include <dune/alugrid/grid.hh>
29#endif
30
33
37
39
41
42namespace Dumux
43{
44
45template<class TypeTag>
46class TestIMPESAdaptiveProblem;
47
49// Specify the properties
51namespace Properties
52{
53NEW_TYPE_TAG(TestIMPESAdaptive, INHERITS_FROM(FVPressureTwoPAdaptive, FVTransportTwoP, IMPESTwoPAdaptive, TestIMPESAdaptiveSpatialParams));
54NEW_TYPE_TAG(TestIMPESAdaptiveRestart, INHERITS_FROM(TestIMPESAdaptive));
55
56// Set the grid type
57#if HAVE_DUNE_ALUGRID
58SET_TYPE_PROP(TestIMPESAdaptive, Grid, Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>);
59#endif
60
61// Set the problem property
63
64// Set the fluid system
65template<class TypeTag>
66struct FluidSystem<TypeTag, TTag::TestIMPESAdaptive>
67{
68 using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
72};
73}
74
87template<class TypeTag>
89{
91 using Grid = typename GET_PROP_TYPE(TypeTag, Grid);
92 using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
93
94 using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
95
96 using WettingPhase = typename GET_PROP(TypeTag, FluidSystem)::WettingPhase;
97
98 using TimeManager = typename GET_PROP_TYPE(TypeTag, TimeManager);
99
100 enum
101 {
102 dim = GridView::dimension, dimWorld = GridView::dimensionworld
103 };
104
105 enum
106 {
107 nPhaseIdx = Indices::nPhaseIdx,
108 pwIdx = Indices::pwIdx,
109 swIdx = Indices::swIdx,
110 eqIdxPress = Indices::pressureEqIdx,
111 eqIdxSat = Indices::satEqIdx
112 };
113
114 using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
115
116 using Element = typename GridView::Traits::template Codim<0>::Entity;
117 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
118
119 using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
120 using SolutionTypes = typename GET_PROP(TypeTag, SolutionTypes);
121 using PrimaryVariables = typename SolutionTypes::PrimaryVariables;
122
123public:
126 {
127 name_ = getParam<std::string>("Problem.Name");
128
129 // Refine the grid provided that no restart occurs. Otherwise, an
130 // already refined grid will be read.
131 if (!(hasParam("Restart") || hasParam("TimeManager.Restart")))
132 grid.globalRefine(getParam<int>("GridAdapt.MaxLevel"));
133
134 this->setOutputInterval(10);
135 }
136
140// \{
146 const std::string& name() const
147 {
148 return name_;
149 }
150
152 {
153 return true;
154 }
155
161 Scalar temperatureAtPos(const GlobalPosition& globalPos) const
162 {
163 return 273.15 + 10; // -> 10°C
164 }
165
166// \}
167
169 Scalar referencePressureAtPos(const GlobalPosition& globalPos) const
170 {
171 return 1e5; // -> 10°C
172 }
173
174 void source(PrimaryVariables &values, const Element& element) const
175 {
176 values = 0;
177 }
178
186 void boundaryTypesAtPos(BoundaryTypes &bcTypes, const GlobalPosition& globalPos) const
187 {
188 if (globalPos[0] < eps_)
189 {
190 bcTypes.setAllDirichlet();
191 }
192 else if (globalPos[0] > this->bBoxMax()[0] - eps_)
193 {
194 bcTypes.setNeumann(eqIdxPress);
195 bcTypes.setOutflow(eqIdxSat);
196 }
197 // all other boundaries
198 else
199 {
200 bcTypes.setAllNeumann();
201 }
202 }
203
205 void dirichletAtPos(PrimaryVariables &values, const GlobalPosition& globalPos) const
206 {
207 values = 0;
208 if (globalPos[0] < eps_)
209 {
210 if (getParam<bool>("Problem.EnableGravity"))
211 {
212 Scalar pRef = referencePressureAtPos(globalPos);
213 Scalar temp = temperatureAtPos(globalPos);
214
215 values[pwIdx] = (2e5 + (this->bBoxMax()[dim-1] - globalPos[dim-1]) * WettingPhase::density(temp, pRef) * this->gravity().two_norm());
216 }
217 else
218 {
219 values[pwIdx] = 2e5;
220 }
221 values[swIdx] = 0.8;
222 }
223 else
224 {
225 values[pwIdx] = 2e5;
226 values[swIdx] = 0.2;
227 }
228 }
229
231 void neumannAtPos(PrimaryVariables &values, const GlobalPosition& globalPos) const
232 {
233 values = 0;
234 if (globalPos[0] > this->bBoxMax()[0] - eps_)
235 {
236 values[nPhaseIdx] = 3e-4;
237 }
238 }
240 void initial(PrimaryVariables &values, const Element& element) const
241 {
242 values[pwIdx] = 0;
243 values[swIdx] = 0.2;
244 }
245
246private:
247 static constexpr Scalar eps_ = 1e-6;
248 std::string name_;
249};
250} //end namespace
251
252#endif // DUMUX_TEST_IMPES_ADAPTIVE_PROBLEM_HH
#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
A much simpler (and thus potentially less buggy) version of pure water.
A liquid phase consisting of a single component.
Cfl-flux-function to evaluate a Cfl-Condition after Coats 2003.
spatial parameters for the sequential 2p test
bool hasParam(const std::string &param)
Check whether a key exists in the parameter tree.
Definition: parameters.hh:446
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.
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
The type of the fluid system to use.
Definition: common/properties.hh:223
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
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
void setOutputInterval(const int interval)
Sets the interval for Output.
Definition: impetproblem.hh:492
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_impesadaptiveproblem.hh:89
void neumannAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const
set neumann condition for phases (flux, [kg/(m^2 s)])
Definition: test_impesadaptiveproblem.hh:231
void source(PrimaryVariables &values, const Element &element) const
Definition: test_impesadaptiveproblem.hh:174
Scalar temperatureAtPos(const GlobalPosition &globalPos) const
Returns the temperature within the domain.
Definition: test_impesadaptiveproblem.hh:161
void boundaryTypesAtPos(BoundaryTypes &bcTypes, const GlobalPosition &globalPos) const
Returns the type of boundary condition.
Definition: test_impesadaptiveproblem.hh:186
bool shouldWriteRestartFile() const
Definition: test_impesadaptiveproblem.hh:151
const std::string & name() const
The problem name.
Definition: test_impesadaptiveproblem.hh:146
void initial(PrimaryVariables &values, const Element &element) const
return initial solution -> only saturation values have to be given!
Definition: test_impesadaptiveproblem.hh:240
Scalar referencePressureAtPos(const GlobalPosition &globalPos) const
Returns the reference pressure for evaluation of constitutive relations.
Definition: test_impesadaptiveproblem.hh:169
TestIMPESAdaptiveProblem(TimeManager &timeManager, Grid &grid)
Definition: test_impesadaptiveproblem.hh:124
void dirichletAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const
set dirichlet condition (pressure [Pa], saturation [-])
Definition: test_impesadaptiveproblem.hh:205
typename GET_PROP_TYPE(TypeTag, Scalar) Scalar
Definition: test_impesadaptiveproblem.hh:68
spatial parameters for the sequential 2p test
Definition: test_impesadaptivespatialparams.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.