3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test_adaptive2p2c3dproblem.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_ADAPTIVE3D_2P2C_PROBLEM_HH
25#define DUMUX_TEST_ADAPTIVE3D_2P2C_PROBLEM_HH
26
27#if HAVE_UG
28#include <dune/grid/uggrid.hh>
29#endif
30#include <dune/grid/yaspgrid.hh>
31
32#include <dumux/common/math.hh>
38
40
41namespace Dumux
42{
47template<class TypeTag>
48class Adaptive2p2c3d;
49
50namespace Properties
51{
53
54// Set the grid type
55#if HAVE_UG
56SET_TYPE_PROP(Adaptive2p2c3d, Grid, Dune::UGGrid<3>);
57#else
58SET_TYPE_PROP(Adaptive2p2c3d, Grid, Dune::YaspGrid<3>);
59#endif
60
61// Set the problem property
63
64// Set the model properties
66
68
69// Select fluid system
70template<class TypeTag>
71struct FluidSystem<TypeTag, TTag::Adaptive2p2c3d>
72{
73 using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
75};
76
77// Specify indicator
79
82
83}
84
105template<class TypeTag = TTAG(Adaptive2p2c3d)>
106class Adaptive2p2c3d: public IMPETProblem2P2C<TypeTag>
107{
109using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
110using Grid = typename GET_PROP_TYPE(TypeTag, Grid);
111using TimeManager = typename GET_PROP_TYPE(TypeTag, TimeManager);
112
113using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
114using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
115using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
116
117using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
118using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables);
119enum
120{
121 dim = GridView::dimension, dimWorld = GridView::dimensionworld
122};
123
124enum
125{
126 wPhaseIdx = Indices::wPhaseIdx, nPhaseIdx = Indices::nPhaseIdx
127};
128
129using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
130
131using Element = typename GridView::Traits::template Codim<0>::Entity;
132using Intersection = typename GridView::Intersection;
133using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
134
135public:
136Adaptive2p2c3d(TimeManager& timeManager, Grid& grid) :
138 debugWriter_(grid.leafGridView(), "gridAfterAdapt")
139{
140 grid.globalRefine(getParam<int>("GridAdapt.MaxLevel"));
141
142 //Process parameter file
143 //Simulation Control
144 const int outputInterval = getParam<int>("Problem.OutputInterval");
145 this->setOutputInterval(outputInterval);
146
147 injectionrate_ = getParam<Scalar>("BoundaryConditions.Injectionrate");
148}
149
153// \{
155std::string name() const
156{
157 return getParam<std::string>("Problem.Name");
158}
159
162{
163 return false;
164}
165
167
170Scalar temperatureAtPos(const GlobalPosition& globalPos) const
171{
172 return 273.15 + 10; // -> 10°C
173}
174
175// \}
179Scalar referencePressureAtPos(const GlobalPosition& globalPos) const
180{
181 return 1e6;
182}
183
187void boundaryTypesAtPos(BoundaryTypes &bcTypes, const GlobalPosition& globalPos) const
188{
189 if (globalPos[0] > 10 - eps_ || globalPos[0] < eps_)
190 bcTypes.setAllDirichlet();
191 else
192 // all other boundaries
193 bcTypes.setAllNeumann();
194}
195
199void boundaryFormulation(typename Indices::BoundaryFormulation &bcFormulation, const Intersection& intersection) const
200{
201 bcFormulation = Indices::BoundaryFormulation::concentration;
202}
203
207void dirichletAtPos(PrimaryVariables &bcValues, const GlobalPosition& globalPos) const
208{
209 Scalar pRef = referencePressureAtPos(globalPos);
210 Scalar temp = temperatureAtPos(globalPos);
211
212 // Dirichlet for pressure equation
213 bcValues[Indices::pressureEqIdx] = (globalPos[0] < eps_) ? (2.5e5 - FluidSystem::H2O::liquidDensity(temp, pRef) * this->gravity()[dim-1])
214 : (2e5 - FluidSystem::H2O::liquidDensity(temp, pRef) * this->gravity()[dim-1]);
215
216 // Dirichlet values for transport equations
217 bcValues[Indices::contiWEqIdx] = 1.;
218 bcValues[Indices::contiNEqIdx] = 1.- bcValues[Indices::contiWEqIdx];
219}
220
224void neumannAtPos(PrimaryVariables &neumannValues, const GlobalPosition& globalPos) const
225{
226 this->setZero(neumannValues);
227}
228
232void sourceAtPos(PrimaryVariables &sourceValues, const GlobalPosition& globalPos) const
233{
234 this->setZero(sourceValues);
235 using std::abs;
236 if (abs(globalPos[0] - 4.8) < 0.5 + eps_ && abs(globalPos[1] - 4.8) < 0.5 + eps_)
237 sourceValues[Indices::contiNEqIdx] = injectionrate_;
238}
239
243void initialFormulation(typename Indices::BoundaryFormulation &initialFormulation, const Element& element) const
244{
245 initialFormulation = Indices::BoundaryFormulation::concentration;
246}
247
251Scalar initConcentrationAtPos(const GlobalPosition& globalPos) const
252{
253 return 1.0;
254}
255
256private:
257VtkMultiWriter<GridView> debugWriter_;
258Scalar injectionrate_;
259static constexpr Scalar eps_ = 1e-6;
260};
261} //end namespace
262
263#endif // DUMUX_TEST_ADAPTIVE3D_2P2C_PROBLEM_HH
Defines the properties required for the adaptive sequential 2p2c models.
Class defining a standard, saturation dependent indicator for grid adaption.
Linear capillary pressure and relative permeability <-> saturation relations.
A compositional two-phase fluid system with water and air as components in both, the liquid and the g...
Define some often used mathematical functions.
#define TTAG(TypeTagName)
Makes a type out of a type tag name.
Definition: propertysystemmacros.hh:58
#define GET_PROP_TYPE(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:283
#define NEW_TYPE_TAG(...)
Definition: propertysystemmacros.hh:130
spatial parameters for the sequential 2p2c test
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Property tag EnableCapillarity
Returns whether capillarity is regarded.
Definition: porousmediumflow/2p2c/sequential/properties.hh:60
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.
Property tag TransportModel
The type of the discretization of a transport model.
Definition: porousmediumflow/sequential/properties.hh:66
Type tag FVPressureOneP INHERITS_FROM(PressureOneP))
The type tag for the one-phase problems using a standard finite volume model.
Property tag Indices
Definition: porousmediumflow/sequential/properties.hh:59
Type tag MPFAProperties
Basic Type tag for MFPA models.
Definition: porousmediumflow/sequential/cellcentered/mpfa/properties.hh:92
SET_BOOL_PROP(FVPressureOneP, VisitFacesOnlyOnce, true)
Allow assembling algorithm for the pressure matrix to assemble only from one side of a cell-cell inte...
Property tag PressureModel
The type of the discretization of a pressure model.
Definition: porousmediumflow/sequential/properties.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
Definition: common/properties.hh:312
Simplifies writing multi-file VTK datasets.
Definition: vtkmultiwriter.hh:61
Policy for the H2O-air fluid system.
Definition: h2oair.hh:52
A compositional two-phase fluid system with water and air as components in both, the liquid and the g...
Definition: h2oair.hh:75
Class defining a standard, saturation dependent indicator for grid adaption.
Definition: gridadaptionindicator.hh:41
const GravityVector & gravity() const
Returns the acceleration due to gravity.
Definition: dumux/porousmediumflow/2p/sequential/impes/problem.hh:167
The finite volume model for the solution of the compositional pressure equation.
Definition: fv3dpressureadaptive.hh:78
Compositional transport step in a finite volume discretization.
Definition: fv3dtransportadaptive.hh:54
Base class for all compositional 2-phase problems which use an impet algorithm.
Definition: dumux/porousmediumflow/2p2c/sequential/problem.hh:43
void setZero(typename GET_PROP_TYPE(TTAG(Adaptive2p2c3d), PrimaryVariables) &values, const int equation=-1) const
Sets entries of the primary variable vector to zero.
Definition: dumux/porousmediumflow/2p2c/sequential/problem.hh:199
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
Grid & grid()
Returns the current grid which used by the problem.
Definition: impetproblem.hh:581
test problem for the grid-adaptive 3d 2p2c model
Definition: test_adaptive2p2c3dproblem.hh:107
void dirichletAtPos(PrimaryVariables &bcValues, const GlobalPosition &globalPos) const
Values for dirichlet boundary condition for pressure and or for transport.
Definition: test_adaptive2p2c3dproblem.hh:207
void initialFormulation(typename Indices::BoundaryFormulation &initialFormulation, const Element &element) const
Flag for the type of initial conditions.
Definition: test_adaptive2p2c3dproblem.hh:243
Adaptive2p2c3d(TimeManager &timeManager, Grid &grid)
Definition: test_adaptive2p2c3dproblem.hh:136
void boundaryFormulation(typename Indices::BoundaryFormulation &bcFormulation, const Intersection &intersection) const
Flag for the type of Dirichlet conditions.
Definition: test_adaptive2p2c3dproblem.hh:199
Scalar referencePressureAtPos(const GlobalPosition &globalPos) const
Returns the reference pressure.
Definition: test_adaptive2p2c3dproblem.hh:179
Scalar temperatureAtPos(const GlobalPosition &globalPos) const
Returns the temperature within the domain.
Definition: test_adaptive2p2c3dproblem.hh:170
void sourceAtPos(PrimaryVariables &sourceValues, const GlobalPosition &globalPos) const
Source of mass .
Definition: test_adaptive2p2c3dproblem.hh:232
bool shouldWriteRestartFile() const
Returns true if a restart file should be written.
Definition: test_adaptive2p2c3dproblem.hh:161
std::string name() const
The problem name.
Definition: test_adaptive2p2c3dproblem.hh:155
void neumannAtPos(PrimaryVariables &neumannValues, const GlobalPosition &globalPos) const
Value for neumann boundary condition .
Definition: test_adaptive2p2c3dproblem.hh:224
Scalar initConcentrationAtPos(const GlobalPosition &globalPos) const
Concentration initial condition (dimensionless)
Definition: test_adaptive2p2c3dproblem.hh:251
void boundaryTypesAtPos(BoundaryTypes &bcTypes, const GlobalPosition &globalPos) const
Type of boundary condition.
Definition: test_adaptive2p2c3dproblem.hh:187
typename GET_PROP_TYPE(TypeTag, Scalar) Scalar
Definition: test_adaptive2p2c3dproblem.hh:73
spatial parameters for the sequential 2p2c test
Definition: test_dec2p2c_spatialparams.hh:64
Base class for sequential 2p2c compositional problems.