3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/porousmediumflow/2p/implicit/boxdfm/problem.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_INCOMPRESSIBLE_TWOPBOXDFM_TEST_PROBLEM_HH
25#define DUMUX_INCOMPRESSIBLE_TWOPBOXDFM_TEST_PROBLEM_HH
26
27#if HAVE_DUNE_ALUGRID
28#include <dune/alugrid/grid.hh>
29#endif
30#if HAVE_UG
31#include <dune/grid/uggrid.hh>
32#endif
33#include <dune/grid/yaspgrid.hh>
34
39
44
45#include "spatialparams.hh"
46
47#ifndef GRIDTYPE
48#define GRIDTYPE Dune::ALUGrid<2, 2, Dune::simplex, Dune::conforming>;
49#endif
50
51namespace Dumux {
52
53// forward declarations
54template<class TypeTag> class TwoPTestProblem;
55
56namespace Properties {
57
58// we need to derive first from twop and then from the box-dfm Model
59// because the flux variables cache type of TwoP is overwritten in BoxDfmModel
60// Create new type tags
61namespace TTag {
62struct TwoPIncompressibleBoxDfm { using InheritsFrom = std::tuple<BoxDfmModel, TwoP>; };
63} // end namespace TTag
64
65// Set the grid type
66template<class TypeTag>
67struct Grid<TypeTag, TTag::TwoPIncompressibleBoxDfm> { using type = GRIDTYPE; };
68
69// Set the problem type
70template<class TypeTag>
71struct Problem<TypeTag, TTag::TwoPIncompressibleBoxDfm> { using type = TwoPTestProblem<TypeTag>; };
72
73// Set the spatial parameters
74template<class TypeTag>
75struct SpatialParams<TypeTag, TTag::TwoPIncompressibleBoxDfm>
76{
77private:
80public:
82};
83
84// the local residual containing the analytic derivative methods
85template<class TypeTag>
86struct LocalResidual<TypeTag, TTag::TwoPIncompressibleBoxDfm> { using type = TwoPIncompressibleLocalResidual<TypeTag>; };
87
88// Set the fluid system
89template<class TypeTag>
90struct FluidSystem<TypeTag, TTag::TwoPIncompressibleBoxDfm>
91{
96};
97
98// Enable caching
99template<class TypeTag>
100struct EnableGridVolumeVariablesCache<TypeTag, TTag::TwoPIncompressibleBoxDfm> { static constexpr bool value = false; };
101template<class TypeTag>
102struct EnableGridFluxVariablesCache<TypeTag, TTag::TwoPIncompressibleBoxDfm> { static constexpr bool value = false; };
103template<class TypeTag>
104struct EnableGridGeometryCache<TypeTag, TTag::TwoPIncompressibleBoxDfm> { static constexpr bool value = false; };
105
106// Enable the box-interface solver
107template<class TypeTag>
108struct EnableBoxInterfaceSolver<TypeTag, TTag::TwoPIncompressibleBoxDfm> { static constexpr bool value = true; };
109} // end namespace Properties
110
115template<class TypeTag>
116class TwoPTestProblem : public PorousMediumFlowProblem<TypeTag>
117{
118 using ParentType = PorousMediumFlowProblem<TypeTag>;
119
121 using Element = typename GridView::template Codim<0>::Entity;
122 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
123
129 using SubControlVolume = typename GridGeometry::SubControlVolume;
130
131 // some indices for convenience
134 enum
135 {
136 pressureH2OIdx = Indices::pressureIdx,
137 saturationDNAPLIdx = Indices::saturationIdx,
138 contiDNAPLEqIdx = Indices::conti0EqIdx + FluidSystem::comp1Idx,
139 waterPhaseIdx = FluidSystem::phase0Idx,
140 dnaplPhaseIdx = FluidSystem::phase1Idx
141 };
142
143 static constexpr Scalar eps_ = 1e-6;
144 static constexpr int dimWorld = GridView::dimensionworld;
145
146public:
147 TwoPTestProblem(std::shared_ptr<const GridGeometry> gridGeometry)
149 {}
150
156 template<class ElementSolution>
157 Scalar extrusionFactor(const Element& element,
158 const SubControlVolume& scv,
159 const ElementSolution& elemSol) const
160 {
161 // In the box-scheme, we compute fluxes etc element-wise,
162 // thus per element we compute only half a fracture !!!
163 static const Scalar aHalf = getParam<Scalar>("SpatialParams.FractureAperture")/2.0;
164
165 if (scv.isOnFracture())
166 return aHalf;
167
168 return 1.0;
169 }
170
177 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
178 {
179 BoundaryTypes values;
180 values.setAllNeumann();
181 if (globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_ || globalPos[0] < 1e-6)
182 values.setAllDirichlet();
183 return values;
184 }
185
191 PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const
192 {
193 auto values = initialAtPos(globalPos);
194 if (globalPos[0] < 1e-6)
195 values[saturationDNAPLIdx] = 0.5;
196 return values;
197 }
198
207 NumEqVector neumannAtPos(const GlobalPosition& globalPos) const
208 { return NumEqVector(0.0); }
209
215 PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const
216 {
217 PrimaryVariables values;
218
219 // pressure gradient from left to right
220 values[pressureH2OIdx] = 2e5 - 1e5*globalPos[0]/this->gridGeometry().bBoxMax()[0];
221 values[saturationDNAPLIdx] = 0;
222 return values;
223 }
224
226 Scalar temperature() const { return 293.15; /* 10°C */ }
227};
228
229} // end namespace Dumux
230
231#endif
A much simpler (and thus potentially less buggy) version of pure water.
A simple implementation of Trichloroethene (TCE), a DNAPL.
A liquid phase consisting of a single component.
A fluid system for two-phase models assuming immiscibility and thermodynamic equilibrium.
#define GRIDTYPE
The properties for the incompressible 2p-boxdfm test.
Definition: test/porousmediumflow/2p/implicit/boxdfm/problem.hh:48
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
Class to specify the type of a boundary.
Definition: common/boundarytypes.hh:38
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:50
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:588
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
Definition: common/properties.hh:91
Definition: common/properties.hh:169
If disabled, the volume variables are not stored (reduces memory, but is slower)
Definition: common/properties.hh:178
specifies if data on flux vars should be saved (faster, but more memory consuming)
Definition: common/properties.hh:188
The type of the spatial parameters object.
Definition: common/properties.hh:221
The type of the fluid system to use.
Definition: common/properties.hh:223
Definition: common/properties.hh:244
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
Element-wise calculation of the residual and its derivatives for a two-phase, incompressible test pro...
Definition: 2p/incompressiblelocalresidual.hh:49
Base class for all fully implicit porous media problems.
Definition: dumux/porousmediumflow/problem.hh:39
The incompressible 2p-boxdfm test problem.
Definition: test/porousmediumflow/2p/implicit/incompressible/problem.hh:112
TwoPTestProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/porousmediumflow/2p/implicit/boxdfm/problem.hh:147
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Specifies which kind of boundary condition should be used for which equation on a given boundary segm...
Definition: test/porousmediumflow/2p/implicit/boxdfm/problem.hh:177
Scalar temperature() const
Returns the temperature for an isothermal problem.
Definition: test/porousmediumflow/2p/implicit/boxdfm/problem.hh:226
NumEqVector neumannAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Neumann boundary segment.
Definition: test/porousmediumflow/2p/implicit/boxdfm/problem.hh:207
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial values for a control volume.
Definition: test/porousmediumflow/2p/implicit/boxdfm/problem.hh:215
Scalar extrusionFactor(const Element &element, const SubControlVolume &scv, const ElementSolution &elemSol) const
Returns how much the domain is extruded at a given sub-control volume.
Definition: test/porousmediumflow/2p/implicit/boxdfm/problem.hh:157
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet boundary segment.
Definition: test/porousmediumflow/2p/implicit/boxdfm/problem.hh:191
Definition: test/porousmediumflow/2p/implicit/boxdfm/problem.hh:62
std::tuple< BoxDfmModel, TwoP > InheritsFrom
Definition: test/porousmediumflow/2p/implicit/boxdfm/problem.hh:62
GRIDTYPE type
Definition: test/porousmediumflow/2p/implicit/boxdfm/problem.hh:67
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/2p/implicit/boxdfm/problem.hh:92
The spatial params for the incompressible 2p test.
Definition: porousmediumflow/2p/implicit/boxdfm/spatialparams.hh:44
Adaption of the fully implicit scheme to the two-phase flow model.
Defines a type tag and some properties for porous medium flow models using the box scheme extended to...
Base class for all porous media problems.
Element-wise calculation of the residual and its derivatives for a two-phase, incompressible test pro...
Definition of the spatial parameters for the MaxwellStefan problem.