3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test_multiphysics2p2cproblem.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_2P2C_PROBLEM_HH
25#define DUMUX_TEST_2P2C_PROBLEM_HH
26
27#include <dune/grid/yaspgrid.hh>
28
33
36
38
39namespace Dumux
40{
45template<class TypeTag>
46class TestMultTwoPTwoCProblem;
47
48// Specify the properties
49namespace Properties
50{
51NEW_TYPE_TAG(TestMultTwoPTwoC, INHERITS_FROM(SequentialTwoPTwoC, Test2P2CSpatialParams));
52
54
55// Set the grid type
56SET_TYPE_PROP(TestMultTwoPTwoC, Grid, Dune::YaspGrid<3>);
57
58// Set the problem property
60
61// Set the model properties
63
65
66SET_INT_PROP(TestMultTwoPTwoC, PressureFormulation, GET_PROP_TYPE(TypeTag, Indices)::pressureNw);
67
68// Select fluid system
69template<class TypeTag>
70struct FluidSystem<TypeTag, TTag::TestMultTwoPTwoC>
71{
72 using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
74};
75
76SET_BOOL_PROP(TestMultTwoPTwoC, EnableCapillarity, true);
77SET_INT_PROP(TestMultTwoPTwoC, BoundaryMobility, GET_PROP_TYPE(TypeTag, Indices)::satDependent);
78}
79
97template<class TypeTag>
99{
101using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
102using Grid = typename GridView::Grid;
103using TimeManager = typename GET_PROP_TYPE(TypeTag, TimeManager);
104using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
105
106using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
107
108using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
109using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables);
110
111enum
112{
113 dim = GridView::dimension, dimWorld = GridView::dimensionworld
114};
115
116using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
117
118using Element = typename GridView::Traits::template Codim<0>::Entity;
119using Intersection = typename GridView::Intersection;
120using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
121
122public:
123TestMultTwoPTwoCProblem(TimeManager &timeManager, Grid &grid, const GlobalPosition& upperRight = 0) :
124ParentType(timeManager, grid), lowerLeft_(0), upperRight_(upperRight), depthBOR_(1000.0)
125{}
126
130// \{
131
133
135std::string name() const
136{
137 return "test_multiphysics2p2c";
138}
140/* The default behaviour is to write no restart file.
141 */
143{
144 return false;
145}
146
148
151Scalar temperatureAtPos(const GlobalPosition& globalPos) const
152{
153 return 273.15 + 10; // -> 10°C
154}
155
156// \}
160Scalar referencePressureAtPos(const GlobalPosition& globalPos) const
161{
162 return 1e6;
163}
167void boundaryTypesAtPos(BoundaryTypes &bcTypes, const GlobalPosition& globalPos) const
168{
169 if (globalPos[0] > 10 - eps_ || globalPos[0] < eps_)
170 bcTypes.setAllDirichlet();
171 else
172 // all other boundaries
173 bcTypes.setAllNeumann();
174}
175
179void boundaryFormulation(typename Indices::BoundaryFormulation &bcFormulation, const Intersection& intersection) const
180{
181 bcFormulation = Indices::concentration;
182}
186void dirichletAtPos(PrimaryVariables &bcValues ,const GlobalPosition& globalPos) const
187{
188 Scalar pRef = referencePressureAtPos(globalPos);
189 Scalar temp = temperatureAtPos(globalPos);
190
191 // Dirichlet for pressure equation
192 bcValues[Indices::pressureEqIdx] = (globalPos[0] < eps_) ? (2.5e5 - FluidSystem::H2O::liquidDensity(temp, pRef) * this->gravity()[dim-1])
193 : (2e5 - FluidSystem::H2O::liquidDensity(temp, pRef) * this->gravity()[dim-1]);
194
195 // Dirichlet values for transport equations
196 bcValues[Indices::contiWEqIdx] = 1.;
197 bcValues[Indices::contiNEqIdx] = 1.- bcValues[Indices::contiWEqIdx];
198
199}
203void neumannAtPos(PrimaryVariables &neumannValues, const GlobalPosition& globalPos) const
204{
205 neumannValues[Indices::contiNEqIdx] = 0.;
206 neumannValues[Indices::contiWEqIdx] = 0.;
207}
211void sourceAtPos(PrimaryVariables &sourceValues, const GlobalPosition& globalPos) const
212{
213 this->setZero(sourceValues);
214 using std::abs;
215 if (abs(globalPos[0] - 4.8) < 0.5 + eps_ && abs(globalPos[1] - 4.8) < 0.5 + eps_)
216 sourceValues[Indices::contiNEqIdx] = 0.0001;
217}
221void initialFormulation(typename Indices::BoundaryFormulation &initialFormulation, const Element& element) const
222{
223 initialFormulation = Indices::concentration;
224}
228Scalar initConcentrationAtPos(const GlobalPosition& globalPos) const
229{
230 return 1;
231}
232
233private:
234GlobalPosition lowerLeft_;
235GlobalPosition upperRight_;
236
237static constexpr Scalar eps_ = 1e-6;
238const Scalar depthBOR_;
239};
240} //end namespace
241
242#endif
#define GET_PROP_TYPE(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:283
#define NEW_TYPE_TAG(...)
Definition: propertysystemmacros.hh:130
A compositional two-phase fluid system with water and air as components in both, the liquid and the g...
Storage container for discretized data for multi-physics models.
Finite volume 2p2c pressure model with multi-physics.
Finite volume discretization of the component transport equation.
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
Property tag BoundaryMobility
Definition: porousmediumflow/2p2c/sequential/properties.hh:61
Type tag Test2P2CSpatialParams
Definition: test_dec2p2c_spatialparams.hh:41
SET_INT_PROP(SequentialOneP, NumEq, 1)
Set number of equations to 1 for isothermal one-phase models.
Property tag CellData
Defines data object to be stored.
Definition: porousmediumflow/sequential/properties.hh:72
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
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
A compositional two-phase fluid system with water and air as components in both, the liquid and the g...
Definition: h2oair.hh:75
const GravityVector & gravity() const
Returns the acceleration due to gravity.
Definition: dumux/porousmediumflow/2p/sequential/impes/problem.hh:167
Storage container for discretized data for multiphysics models.
Definition: celldatamultiphysics.hh:45
The finite volume model for the solution of the compositional pressure equation.
Definition: fvpressuremultiphysics.hh:70
Compositional transport step in a finite volume discretization.
Definition: fvtransportmultiphysics.hh:56
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(TypeTag, PrimaryVariables) &values, const int equation=-1) const
Sets entries of the primary variable vector to zero.
Definition: dumux/porousmediumflow/2p2c/sequential/problem.hh:199
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
Grid & grid()
Returns the current grid which used by the problem.
Definition: impetproblem.hh:581
test problem for the multiphysics 2p2c model
Definition: test_multiphysics2p2cproblem.hh:99
void neumannAtPos(PrimaryVariables &neumannValues, const GlobalPosition &globalPos) const
Value for neumann boundary condition .
Definition: test_multiphysics2p2cproblem.hh:203
Scalar initConcentrationAtPos(const GlobalPosition &globalPos) const
Concentration initial condition (dimensionless)
Definition: test_multiphysics2p2cproblem.hh:228
bool shouldWriteRestartFile() const
Returns true if a restart file should be written.
Definition: test_multiphysics2p2cproblem.hh:142
std::string name() const
The problem name.
Definition: test_multiphysics2p2cproblem.hh:135
void dirichletAtPos(PrimaryVariables &bcValues, const GlobalPosition &globalPos) const
Values for dirichlet boundary condition for pressure and or for transport.
Definition: test_multiphysics2p2cproblem.hh:186
void boundaryTypesAtPos(BoundaryTypes &bcTypes, const GlobalPosition &globalPos) const
Type of boundary condition.
Definition: test_multiphysics2p2cproblem.hh:167
Scalar temperatureAtPos(const GlobalPosition &globalPos) const
Returns the temperature within the domain.
Definition: test_multiphysics2p2cproblem.hh:151
TestMultTwoPTwoCProblem(TimeManager &timeManager, Grid &grid, const GlobalPosition &upperRight=0)
Definition: test_multiphysics2p2cproblem.hh:123
Scalar referencePressureAtPos(const GlobalPosition &globalPos) const
Returns the reference pressure.
Definition: test_multiphysics2p2cproblem.hh:160
void sourceAtPos(PrimaryVariables &sourceValues, const GlobalPosition &globalPos) const
Source of mass .
Definition: test_multiphysics2p2cproblem.hh:211
void boundaryFormulation(typename Indices::BoundaryFormulation &bcFormulation, const Intersection &intersection) const
Flag for the type of Dirichlet conditions.
Definition: test_multiphysics2p2cproblem.hh:179
void initialFormulation(typename Indices::BoundaryFormulation &initialFormulation, const Element &element) const
Flag for the type of initial conditions.
Definition: test_multiphysics2p2cproblem.hh:221
typename GET_PROP_TYPE(TypeTag, Scalar) Scalar
Definition: test_multiphysics2p2cproblem.hh:72
Base class for sequential 2p2c compositional problems.