3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test_3d2pproblem.hh
Go to the documentation of this file.
1/*****************************************************************************
2 * See the file COPYING for full copying permissions. *
3 * *
4 * This program is free software: you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation, either version 3 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
16 *****************************************************************************/
17
24#ifndef DUMUX_TEST_3D2P_PROBLEM_HH
25#define DUMUX_TEST_3D2P_PROBLEM_HH
26
27#if HAVE_DUNE_ALUGRID
28#include <dune/alugrid/grid.hh>
29#endif
30
34
43
45
48
49
50namespace Dumux
51{
56template<class TypeTag>
57class Test3D2PProblem;
58
60// Specify the properties
62namespace Properties
63{
65
66// Set the grid type
67#if HAVE_DUNE_ALUGRID
68SET_TYPE_PROP(ThreeDTwoPTest, Grid, Dune::ALUGrid<3, 3, Dune::cube, Dune::nonconforming>);
69#endif
70
71// Set the problem property
73
74// Set the fluid system
75template<class TypeTag>
76struct FluidSystem<TypeTag, TTag::ThreeDTwoPTest>
77{
78 using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
82};
83
84#if PROBLEM == 1
85SET_INT_PROP(ThreeDTwoPTest, Formulation, SequentialTwoPCommonIndices::pnSw);
87#endif
88
90
91NEW_TYPE_TAG(FVTwoPTest, INHERITS_FROM(FVPressureTwoP, FVTransportTwoP, IMPESTwoP, ThreeDTwoPTest));
92NEW_TYPE_TAG(FVAdaptiveTwoPTest, INHERITS_FROM(FVPressureTwoPAdaptive, FVTransportTwoP, IMPESTwoPAdaptive, ThreeDTwoPTest));
93NEW_TYPE_TAG(MPFALTwoPTest, INHERITS_FROM(FvMpfaL3dPressureTwoP, FVTransportTwoP, IMPESTwoP, ThreeDTwoPTest));
94NEW_TYPE_TAG(MPFALAdaptiveTwoPTest, INHERITS_FROM(FvMpfaL3dPressureTwoPAdaptive, FVTransportTwoP, IMPESTwoPAdaptive, ThreeDTwoPTest));
95NEW_TYPE_TAG(MimeticTwoPTest, INHERITS_FROM(MimeticPressureTwoP, FVTransportTwoP, IMPESTwoP, ThreeDTwoPTest));
96NEW_TYPE_TAG(MimeticAdaptiveTwoPTest, INHERITS_FROM(MimeticPressureTwoPAdaptive, FVTransportTwoP, IMPESTwoPAdaptive, ThreeDTwoPTest));
97}
98
110template<class TypeTag>
111class Test3D2PProblem: public IMPESProblem2P<TypeTag>
112{
115using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
116using Grid = typename GridView::Grid;
117
118using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
119
120using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
121using FluidState = typename GET_PROP_TYPE(TypeTag, FluidState);
122
123using TimeManager = typename GET_PROP_TYPE(TypeTag, TimeManager);
124
125using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
126using PrimaryVariables = typename GET_PROP(TypeTag, SolutionTypes)::PrimaryVariables;
127
128enum
129{
130 dim = GridView::dimension, dimWorld = GridView::dimensionworld
131};
132
133enum
134{
135 wPhaseIdx = Indices::wPhaseIdx,
136 nPhaseIdx = Indices::nPhaseIdx,
137#if PROBLEM == 1
138 pNIdx = Indices::pnIdx,
139#else
140 pWIdx = Indices::pwIdx,
141#endif
142 swIdx = Indices::swIdx,
143 pressureEqIdx = Indices::pressureEqIdx,
144 satEqIdx = Indices::satEqIdx
145};
146
147using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
148
149using Element = typename GridView::Traits::template Codim<0>::Entity;
150using Intersection = typename GridView::Intersection;
151using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
152using LocalPosition = Dune::FieldVector<Scalar, dim>;
153
154public:
155
156Test3D2PProblem(TimeManager& timeManager, Grid& grid) :
157ParentType(timeManager, grid), inflowEdge_(0), outflowEdge_(0)
158{
159 int refinementFactor = 0;
160 if (hasParam("Grid.RefinementFactor") && !GET_PROP_VALUE(TypeTag, AdaptiveGrid))
161 {
162 refinementFactor = getParam<Scalar>("Grid.RefinementFactor");
163 grid.globalRefine(refinementFactor);
164 }
165
166 Scalar minDist = this->bBoxMax().two_norm();
167 Scalar maxDist = this->bBoxMin().two_norm();
168
169 // calculate the bounding box of the grid view
170 for (const auto& vertex : vertices(grid.leafGridView())) {
171 GlobalPosition vertexCoord(vertex.geometry().center());
172
173 Scalar dist = vertexCoord.two_norm();
174 if (dist > maxDist)
175 {
176 maxDist = dist;
177 outflowEdge_ = vertex.geometry().center();
178 }
179 if (dist < minDist)
180 {
181 minDist = dist;
182 inflowEdge_ = vertex.geometry().center();
183 }
184 }
185
186 int outputInterval = 0;
187 if (hasParam("Problem.OutputInterval"))
188 {
189 outputInterval = getParam<int>("Problem.OutputInterval");
190 }
191 this->setOutputInterval(outputInterval);
192
193 Scalar outputTimeInterval = 1e6;
194 if (hasParam("Problem.OutputTimeInterval"))
195 {
196 outputTimeInterval = getParam<Scalar>("Problem.OutputTimeInterval");
197 }
198 this->setOutputTimeInterval(outputTimeInterval);
199}
200
204// \{
205
211std::string name() const
212{
213 return getParam<std::string>("Problem.OutputName", "test_3d2p");
214}
215
217{
218 return false;
219}
220
226Scalar temperatureAtPos(const GlobalPosition& globalPos) const
227{
228 return 273.15 + 10; // -> 10°C
229}
230
231// \}
232
233Scalar referencePressureAtPos(const GlobalPosition& globalPos) const
234{
235 return 1e5; // -> 10°C
236}
237
238void sourceAtPos(PrimaryVariables &values,const GlobalPosition& globalPos) const
239{
240 values = 0;
241
242#if PROBLEM == 2 //Nine-Spot
243 if (globalPos[0] < 0.1 * outflowEdge_[0] + eps_ && globalPos[1] < 0.1 * outflowEdge_[1] && globalPos[2] < 0.1 * outflowEdge_[2])
244 {
245 values[wPhaseIdx] = 1;
246 }
247#endif
248}
249
250void source(PrimaryVariables &values,const Element& element) const
251{
252 values = 0;
253
254#if PROBLEM == 2 //Nine-Spot
255 int numVertices = element.geometry().corners();
256 for(int i = 0; i < numVertices; i++)
257 {
258 GlobalPosition globalPos(element.template subEntity<dim>(i).geometry().center());
259
260 if (globalPos[0] < inflowEdge_[0] + eps_ && globalPos[1] < inflowEdge_[1] + eps_ && globalPos[2] < inflowEdge_[2] + eps_)
261 {
262 values[wPhaseIdx] = 1;
263 break;
264 }
265 }
266#endif
267}
268
269void boundaryTypesAtPos(BoundaryTypes &bcTypes, const GlobalPosition& globalPos) const
270{
271#if PROBLEM == 2 //Nine-Spot
272 if (globalPos[0] > 0.9 * outflowEdge_[0] && globalPos[1] > 0.9 * outflowEdge_[1] && globalPos[2] > 0.9 * outflowEdge_[2])
273 {
274 bcTypes.setAllDirichlet();
275 }
276 else
277 {
278 bcTypes.setAllNeumann();
279 }
280#else
281 if (globalPos[0] < eps_)
282 {
283 bcTypes.setAllDirichlet();
284 }
285 else if (globalPos[0] > this->bBoxMax()[0] - eps_)
286 {
287 bcTypes.setNeumann(pressureEqIdx);
288 bcTypes.setOutflow(satEqIdx);
289 }
290 // all other boundaries
291 else
292 {
293 bcTypes.setAllNeumann();
294 }
295#endif
296}
297
298void boundaryTypes(BoundaryTypes &bcTypes, const Intersection& intersection) const
299{
300#if PROBLEM == 2 //Nine-Spot
301 auto element = intersection.inside();
302 int numVertices = element.geometry().corners();
303 for(int i = 0; i < numVertices; i++)
304 {
305 GlobalPosition globalPos(element.template subEntity<dim>(i).geometry().center());
306
307 if (globalPos[0] > outflowEdge_[0] - eps_ && globalPos[1] > outflowEdge_[1] - eps_ && globalPos[2] > outflowEdge_[2] - eps_)
308 {
309 bcTypes.setAllDirichlet();
310 break;
311 }
312 else
313 {
314 bcTypes.setAllNeumann();
315 }
316 }
317#else
318 GlobalPosition globalPos(intersection.geometry().center());
319
320 boundaryTypesAtPos(bcTypes,globalPos);
321#endif
322}
323
324void dirichletAtPos(PrimaryVariables &values, const GlobalPosition& globalPos) const
325{
326 values = 0;
327
328#if PROBLEM == 2 //Nine-Spot
329 values[swIdx] = 0.8;
330 values[pWIdx] = 1;
331#elif PROBLEM == 0
332 if (globalPos[0] < eps_)
333 {
334 values[swIdx] = 0.8;
335 values[pWIdx] = 1;
336 }
337#elif PROBLEM == 1
338 if (globalPos[0] < eps_)
339 {
340 values[swIdx] = 1.0;
341 values[pNIdx] = 1e5;
342 }
343#endif
344}
345
346void neumannAtPos(PrimaryVariables &values, const GlobalPosition& globalPos) const
347{
348 values = 0;
349
350#if PROBLEM == 0 //Buckley-Leverett
351 if (globalPos[0] > this->bBoxMax()[0] - eps_)
352 {
353 values[nPhaseIdx] = 3e-3;
354 }
355#endif
356}
357
358void initialAtPos(PrimaryVariables &values,
359 const GlobalPosition& globalPos) const
360{
361#if PROBLEM == 1
362 values[pNIdx] = 0;
363 values[swIdx] = 0.0;
364#else
365 values[pWIdx] = 0;
366 values[swIdx] = 0.2;
367#endif
368}
369
370private:
371static constexpr Scalar eps_ = 1e-6;
372GlobalPosition inflowEdge_;
373GlobalPosition outflowEdge_;
374};
375} //end namespace
376
377#endif
#define GET_PROP_VALUE(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:282
#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 gaseous phase consisting of a single component.
A liquid phase consisting of a single component.
Properties for the MPFA-O method.
Properties for the MPFA-O method.
Class defining a standard, saturation dependent indicator for grid adaption.
Cfl-flux-function to evaluate a Cfl-Condition after Coats 2003.
spatial parameters for the 2p 3d 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_INT_PROP(SequentialOneP, NumEq, 1)
Set number of equations to 1 for isothermal one-phase models.
Property tag AdaptionIndicator
Class defining the refinement/coarsening indicator.
Definition: gridadaptproperties.hh:55
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 AdaptiveGrid
Defines if the grid is h-adaptive.
Definition: gridadaptproperties.hh:49
Property tag EvalCflFluxFunction
Type of the evaluation of the CFL-condition.
Definition: transportproperties.hh:50
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
The formulation of the model.
Definition: common/properties.hh:237
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
Class defining a standard, saturation dependent indicator for grid adaption.
Definition: gridadaptionindicatorlocal.hh:40
Base class for all 2-phase problems which use an IMPES algorithm.
Definition: dumux/porousmediumflow/2p/sequential/impes/problem.hh:41
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
void setOutputTimeInterval(const Scalar timeInterval)
Sets a time interval for Output.
Definition: impetproblem.hh:481
const GlobalPosition & bBoxMin() const
The coordinate of the corner of the GridView's bounding box with the smallest values.
Definition: impetproblem.hh:648
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 sequential 2p models in 3d
Definition: test_3d2pproblem.hh:112
void boundaryTypesAtPos(BoundaryTypes &bcTypes, const GlobalPosition &globalPos) const
Definition: test_3d2pproblem.hh:269
void source(PrimaryVariables &values, const Element &element) const
Definition: test_3d2pproblem.hh:250
Test3D2PProblem(TimeManager &timeManager, Grid &grid)
Definition: test_3d2pproblem.hh:156
bool shouldWriteRestartFile() const
Definition: test_3d2pproblem.hh:216
void sourceAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const
Definition: test_3d2pproblem.hh:238
Scalar referencePressureAtPos(const GlobalPosition &globalPos) const
Definition: test_3d2pproblem.hh:233
void dirichletAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const
Definition: test_3d2pproblem.hh:324
void boundaryTypes(BoundaryTypes &bcTypes, const Intersection &intersection) const
Definition: test_3d2pproblem.hh:298
void initialAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const
Definition: test_3d2pproblem.hh:358
Scalar temperatureAtPos(const GlobalPosition &globalPos) const
Returns the temperature within the domain.
Definition: test_3d2pproblem.hh:226
std::string name() const
The problem name.
Definition: test_3d2pproblem.hh:211
void neumannAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const
Definition: test_3d2pproblem.hh:346
typename GET_PROP_TYPE(TypeTag, Scalar) Scalar
Definition: test_3d2pproblem.hh:78
spatial parameters for the 2p 3d test
Definition: test_3d2pspatialparams.hh:69
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.
Defines the properties required for (immiscible) twophase sequential models.
Defines the properties required for finite volume pressure models in a two-phase sequential model.
Defines the properties required for (immiscible) twophase sequential models.