3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
Loading...
Searching...
No Matches
test_adaptive2p2c2dproblem.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_ADAPTIVE2D_2P2C_PROBLEM_HH
25#define DUMUX_TEST_ADAPTIVE2D_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>
39
41
42namespace Dumux
43{
48template<class TypeTag>
49class Adaptive2p2c2d;
50
51namespace Properties
52{
54
55// Set the grid type
56#if HAVE_UG
57SET_TYPE_PROP(Adaptive2p2c2d, Grid, Dune::UGGrid<2>);
58#else
59SET_TYPE_PROP(Adaptive2p2c2d, Grid, Dune::YaspGrid<3>);
60#endif
61
62// Set the problem property
64
65// Select fluid system
66template<class TypeTag>
72
73// Set the 2d Transport and Pressure model (already set as default in properties file)
76
77// Specify indicator
79
82
83}
84
105template<class TypeTag = TTAG(Adaptive2p2c2d)>
106class Adaptive2p2c2d: public IMPETProblem2P2C<TypeTag>
107{
108using ParentType = IMPETProblem2P2C<TypeTag>;
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);
115
116using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
117using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables);
118
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:
136Adaptive2p2c2d(TimeManager& timeManager, Grid& grid)
137: ParentType(timeManager, grid)
138, debugWriter_(grid.leafGridView(), "gridAfterAdapt")
139{
140 this->setName(getParam<std::string>("Problem.SimulationName"));
141 this->setOutputInterval(getParam<int>("Problem.OutputInterval"));
142}
143
147// \{
148
151{
152 return false;
153}
154
156
159Scalar temperatureAtPos(const GlobalPosition& globalPos) const
160{
161 return 273.15 + 10; // -> 10°C
162}
163
164// \}
168Scalar referencePressureAtPos(const GlobalPosition& globalPos) const
169{
170 return 1e6;
171}
172
175void boundaryTypesAtPos(BoundaryTypes &bcTypes, const GlobalPosition& globalPos) const
176{
177 if (globalPos[0] > this->bBoxMax()[0] - eps_|| globalPos[0] < eps_)
178 bcTypes.setAllDirichlet();
179 else
180 // all other boundaries
181 bcTypes.setAllNeumann();
182}
183
187void boundaryFormulation(typename Indices::BoundaryFormulation &bcFormulation, const Intersection& intersection) const
188{
189 bcFormulation = Indices::concentration;
190}
191
195void dirichletAtPos(PrimaryVariables &bcValues, const GlobalPosition& globalPos) const
196{
197 Scalar pRef = referencePressureAtPos(globalPos);
198 Scalar temp = temperatureAtPos(globalPos);
199
200 // Dirichlet for pressure equation
201 bcValues[Indices::pressureEqIdx] = (globalPos[0] < eps_) ? (2.5e5 - FluidSystem::H2O::liquidDensity(temp, pRef) * this->gravity()[dim-1])
202 : (2e5 - FluidSystem::H2O::liquidDensity(temp, pRef) * this->gravity()[dim-1]);
203
204 // Dirichlet values for transport equations
205 bcValues[Indices::contiWEqIdx] = 1.;
206 bcValues[Indices::contiNEqIdx] = 1.- bcValues[Indices::contiWEqIdx];
207
208}
209
213void neumannAtPos(PrimaryVariables &neumannValues, const GlobalPosition& globalPos) const
214{
215 this->setZero(neumannValues);
216}
217
221void source(PrimaryVariables &values, const Element &element)
222{
223 this->setZero(values);
224 auto father = element;
225 // access level 1 entity
226 while (father.level() != this->gridAdapt().getMinLevel())
227 {
228 father = father.father();
229 }
230 GlobalPosition globalPos = father.geometry().center();
231
232 using std::abs;
233 if (abs(globalPos[0] - 4.8) < 0.5 + eps_ && abs(globalPos[1] - 4.8) < 0.5 + eps_)
234 values[Indices::contiNEqIdx] = 0.0001;
235}
236
240void initialFormulation(typename Indices::BoundaryFormulation &initialFormulation, const Element& element) const
241{
242 initialFormulation = Indices::concentration;
243}
244
248Scalar initConcentrationAtPos(const GlobalPosition& globalPos) const
249{
250 return 1.0;
251}
252
253private:
254//Grid grid_;
255VtkMultiWriter<GridView> debugWriter_;
256static constexpr Scalar eps_ = 1e-6;
257};
258} //end namespace
259
260#endif
#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
Define some often used mathematical functions.
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...
A two-phase fluid system with two components water Nitrogen for non-equilibrium models.
Class defining a standard, saturation dependent indicator for grid adaption.
Defines the properties required for the adaptive sequential 2p2c models.
spatial parameters for the sequential 2p2c test
T getParam(Args &&... args)
A free function to get a parameter from the parameter tree singleton.
Definition parameters.hh:428
#define INHERITS_FROM(...)
Syntactic sugar for NEW_TYPE_TAG.
Definition propertysystemmacros.hh:142
#define SET_INT_PROP(EffTypeTagName, PropTagName,...)
Set a property to a simple constant integer value.
Definition propertysystemmacros.hh:204
#define SET_TYPE_PROP(EffTypeTagName, PropTagName,...)
Set a property which defines a type.
Definition propertysystemmacros.hh:232
#define SET_BOOL_PROP(EffTypeTagName, PropTagName,...)
Set a property to a simple constant boolean value.
Definition propertysystemmacros.hh:218
make the local view function available whenever we use the grid geometry
Definition adapt.hh:29
Definition common/properties.hh:47
Property tag EnableCapillarity
Returns whether capillarity is regarded.
Definition porousmediumflow/2p2c/sequential/properties.hh:60
Type tag Test2P2CSpatialParams
Definition test_dec2p2c_spatialparams.hh:41
Property tag AdaptionIndicator
Class defining the refinement/coarsening indicator.
Definition gridadaptproperties.hh:55
Property tag TransportModel
The type of the discretization of a transport model.
Definition porousmediumflow/sequential/properties.hh:66
Property tag Indices
Definition porousmediumflow/sequential/properties.hh:59
Property tag PressureModel
The type of the discretization of a pressure model.
Definition porousmediumflow/sequential/properties.hh:65
Type tag for numeric models.
Definition grid.hh:35
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
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
Definition dumux/porousmediumflow/2p/sequential/impes/problem.hh:167
The finite volume model for the solution of the compositional pressure equation.
Definition fv2dpressureadaptive.hh:78
Compositional Transport step in a Finite Volume discretization for a adaptive 2D-grid.
Definition fv2dtransportadaptive.hh:57
IMPETProblem2P2C(TimeManager &timeManager, Grid &grid)
Definition dumux/porousmediumflow/2p2c/sequential/problem.hh:75
void setZero(typename GET_PROP_TYPE(TTAG(Adaptive2p2c2d), PrimaryVariables) &values, const int equation=-1) const
Definition dumux/porousmediumflow/2p2c/sequential/problem.hh:199
TimeManager & timeManager()
Definition impetproblem.hh:663
void setName(std::string newName)
Definition impetproblem.hh:565
void setOutputInterval(const int interval)
Definition impetproblem.hh:492
const GlobalPosition & bBoxMax() const
Definition impetproblem.hh:655
Grid & grid()
Definition impetproblem.hh:581
Test problem for the adaptive sequential 2p2c model in 2D.
Definition test_adaptive2p2c2dproblem.hh:107
Scalar initConcentrationAtPos(const GlobalPosition &globalPos) const
Concentration initial condition (dimensionless).
Definition test_adaptive2p2c2dproblem.hh:248
Adaptive2p2c2d(TimeManager &timeManager, Grid &grid)
Definition test_adaptive2p2c2dproblem.hh:136
Scalar temperatureAtPos(const GlobalPosition &globalPos) const
Returns the temperature within the domain.
Definition test_adaptive2p2c2dproblem.hh:159
void initialFormulation(typename Indices::BoundaryFormulation &initialFormulation, const Element &element) const
Flag for the type of initial conditions.
Definition test_adaptive2p2c2dproblem.hh:240
void neumannAtPos(PrimaryVariables &neumannValues, const GlobalPosition &globalPos) const
Value for neumann boundary condition .
Definition test_adaptive2p2c2dproblem.hh:213
bool shouldWriteRestartFile() const
Returns true if a restart file should be written.
Definition test_adaptive2p2c2dproblem.hh:150
void source(PrimaryVariables &values, const Element &element)
Evaluate the source term.
Definition test_adaptive2p2c2dproblem.hh:221
void boundaryFormulation(typename Indices::BoundaryFormulation &bcFormulation, const Intersection &intersection) const
Flag for the type of Dirichlet conditions.
Definition test_adaptive2p2c2dproblem.hh:187
void dirichletAtPos(PrimaryVariables &bcValues, const GlobalPosition &globalPos) const
Values for dirichlet boundary condition for pressure and or for transport.
Definition test_adaptive2p2c2dproblem.hh:195
void boundaryTypesAtPos(BoundaryTypes &bcTypes, const GlobalPosition &globalPos) const
Type of boundary condition.
Definition test_adaptive2p2c2dproblem.hh:175
Scalar referencePressureAtPos(const GlobalPosition &globalPos) const
Returns the reference pressure.
Definition test_adaptive2p2c2dproblem.hh:168
typename GET_PROP_TYPE(TypeTag, Scalar) Scalar
Definition test_adaptive2p2c2dproblem.hh:69
FluidSystems::H2OAir< Scalar, Components::H2O< Scalar > > type
Definition test_adaptive2p2c2dproblem.hh:70
Base class for sequential 2p2c compositional problems.