3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/porousmediumflow/richards/implicit/lens/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 *****************************************************************************/
27#ifndef DUMUX_RICHARDS_LENSPROBLEM_HH
28#define DUMUX_RICHARDS_LENSPROBLEM_HH
29
30#include <dune/grid/yaspgrid.hh>
31#if HAVE_DUNE_ALUGRID
32#include <dune/alugrid/grid.hh>
33#endif
34#if HAVE_UG
35#include <dune/grid/uggrid.hh>
36#endif
37
41
45
46#include "spatialparams.hh"
47
48namespace Dumux {
49
50template <class TypeTag>
51class RichardsLensProblem;
52
53// Specify the properties for the lens problem
54namespace Properties {
55// Create new type tags
56namespace TTag {
57struct RichardsLens { using InheritsFrom = std::tuple<Richards>; };
58struct RichardsLensBox { using InheritsFrom = std::tuple<RichardsLens, BoxModel>; };
59struct RichardsLensCC { using InheritsFrom = std::tuple<RichardsLens, CCTpfaModel>; };
60} // end namespace TTag
61
62#ifndef GRIDTYPE
63// Use 2d YaspGrid
64template<class TypeTag>
65struct Grid<TypeTag, TTag::RichardsLens> { using type = Dune::YaspGrid<2>; };
66#else
67// Use GRIDTYPE from CMakeLists.txt
68template<class TypeTag>
69struct Grid<TypeTag, TTag::RichardsLens> { using type = GRIDTYPE; };
70#endif
71
72// Set the physical problem to be solved
73template<class TypeTag>
74struct Problem<TypeTag, TTag::RichardsLens> { using type = RichardsLensProblem<TypeTag>; };
75
76// Set the spatial parameters
77template<class TypeTag>
78struct SpatialParams<TypeTag, TTag::RichardsLens>
79{
82};
83} // end namespace Dumux
84
111template <class TypeTag>
113{
122 enum {
123 // copy some indices for convenience
124 pressureIdx = Indices::pressureIdx,
125 conti0EqIdx = Indices::conti0EqIdx,
126 bothPhases = Indices::bothPhases,
127
128 // world dimension
129 dimWorld = GridView::dimensionworld
130 };
131 using Element = typename GridView::template Codim<0>::Entity;
132
133 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
134
135public:
136 RichardsLensProblem(std::shared_ptr<const GridGeometry> gridGeometry)
138 {
139 name_ = getParam<std::string>("Problem.Name");
140 }
141
145 // \{
146
152 const std::string& name() const
153 { return name_; }
154
160 Scalar temperature() const
161 { return 273.15 + 10; }; // -> 10°C
162
170 { return 1.0e5; };
171
172 // \}
173
177 // \{
178
185 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
186 {
187 BoundaryTypes bcTypes;
188 if (onLeftBoundary_(globalPos) || onRightBoundary_(globalPos))
189 bcTypes.setAllDirichlet();
190 else
191 bcTypes.setAllNeumann();
192 return bcTypes;
193 }
194
202 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
203 {
204 return initial_(globalPos);
205 }
206
215 NumEqVector neumannAtPos(const GlobalPosition &globalPos) const
216 {
217 NumEqVector values(0.0);
218 if (onInlet_(globalPos))
219 values[conti0EqIdx] = -0.04; // kg/(m*s)
220 return values;
221 }
222
226 // \{
227
236 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
237 { return initial_(globalPos); };
238
239 // \}
240
241private:
242 PrimaryVariables initial_(const GlobalPosition &globalPos) const
243 {
244 PrimaryVariables values(0.0);
245 const Scalar sw = 0.0;
246 using MaterialLaw = typename ParentType::SpatialParams::MaterialLaw;
247 const Scalar pc = MaterialLaw::pc(this->spatialParams().materialLawParamsAtPos(globalPos), sw);
248 values[pressureIdx] = nonWettingReferencePressure() - pc;
249 values.setState(bothPhases);
250 return values;
251 }
252
253 bool onLeftBoundary_(const GlobalPosition &globalPos) const
254 {
255 return globalPos[0] < this->gridGeometry().bBoxMin()[0] + eps_;
256 }
257
258 bool onRightBoundary_(const GlobalPosition &globalPos) const
259 {
260 return globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_;
261 }
262
263 bool onLowerBoundary_(const GlobalPosition &globalPos) const
264 {
265 return globalPos[1] < this->gridGeometry().bBoxMin()[1] + eps_;
266 }
267
268 bool onUpperBoundary_(const GlobalPosition &globalPos) const
269 {
270 return globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_;
271 }
272
273 bool onInlet_(const GlobalPosition &globalPos) const
274 {
275 Scalar width = this->gridGeometry().bBoxMax()[0] - this->gridGeometry().bBoxMin()[0];
276 Scalar lambda = (this->gridGeometry().bBoxMax()[0] - globalPos[0])/width;
277 return onUpperBoundary_(globalPos) && 0.5 < lambda + eps_ && lambda < 2.0/3.0 + eps_;
278 }
279
280 static constexpr Scalar eps_ = 1.5e-7;
281
282 GlobalPosition lensLowerLeft_;
283 GlobalPosition lensUpperRight_;
284 std::string name_;
285};
286
287} // end namespace Dumux
288
289#endif
Defines a type tag and some properties for models using the box scheme.
Properties for all models using cell-centered finite volume scheme with TPFA.
A much simpler (and thus potentially less buggy) version of pure water.
A liquid phase consisting of a single component.
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
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
UndefinedProperty 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 spatial parameters object.
Definition: common/properties.hh:221
Base class for all fully implicit porous media problems.
Definition: dumux/porousmediumflow/problem.hh:39
SpatialParams & spatialParams()
Returns the spatial parameters object.
Definition: dumux/porousmediumflow/problem.hh:146
A water infiltration problem with a low-permeability lens embedded into a high-permeability domain wh...
Definition: test/porousmediumflow/richards/implicit/lens/problem.hh:113
Scalar nonWettingReferencePressure() const
Returns the reference pressure [Pa] of the non-wetting fluid phase within a finite volume.
Definition: test/porousmediumflow/richards/implicit/lens/problem.hh:169
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/richards/implicit/lens/problem.hh:185
NumEqVector neumannAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Neumann boundary segment.
Definition: test/porousmediumflow/richards/implicit/lens/problem.hh:215
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial values for a control volume.
Definition: test/porousmediumflow/richards/implicit/lens/problem.hh:236
Scalar temperature() const
Returns the temperature [K] within a finite volume.
Definition: test/porousmediumflow/richards/implicit/lens/problem.hh:160
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet boundary segment.
Definition: test/porousmediumflow/richards/implicit/lens/problem.hh:202
const std::string & name() const
The problem name.
Definition: test/porousmediumflow/richards/implicit/lens/problem.hh:152
RichardsLensProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/porousmediumflow/richards/implicit/lens/problem.hh:136
Definition: test/porousmediumflow/richards/implicit/lens/problem.hh:57
std::tuple< Richards > InheritsFrom
Definition: test/porousmediumflow/richards/implicit/lens/problem.hh:57
Definition: test/porousmediumflow/richards/implicit/lens/problem.hh:58
std::tuple< RichardsLens, BoxModel > InheritsFrom
Definition: test/porousmediumflow/richards/implicit/lens/problem.hh:58
Definition: test/porousmediumflow/richards/implicit/lens/problem.hh:59
std::tuple< RichardsLens, CCTpfaModel > InheritsFrom
Definition: test/porousmediumflow/richards/implicit/lens/problem.hh:59
Dune::YaspGrid< 2 > type
Definition: test/porousmediumflow/richards/implicit/lens/problem.hh:65
The spatial parameters for the RichardsLensProblem.
Definition: porousmediumflow/richards/implicit/lens/spatialparams.hh:43
This model implements a variant of the Richards' equation for quasi-twophase flow.
Base class for all porous media problems.
#define GRIDTYPE
Definition: test/porousmediumflow/1p/implicit/incompressible/problem.hh:48
Definition of the spatial parameters for the MaxwellStefan problem.