3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/porousmediumflow/3p/implicit/infiltration/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 *****************************************************************************/
25#ifndef DUMUX_INFILTRATION_THREEP_PROBLEM_HH
26#define DUMUX_INFILTRATION_THREEP_PROBLEM_HH
27
28#include <dune/grid/yaspgrid.hh>
29
42
43#include "spatialparams.hh"
44
45namespace Dumux
46{
47
48template <class TypeTag>
49class InfiltrationThreePProblem;
50
51namespace Properties
52{
53// Create new type tags
54namespace TTag {
55struct InfiltrationThreeP { using InheritsFrom = std::tuple<ThreeP>; };
56struct InfiltrationThreePBox { using InheritsFrom = std::tuple<InfiltrationThreeP, BoxModel>; };
57struct InfiltrationThreePCCTpfa { using InheritsFrom = std::tuple<InfiltrationThreeP, CCTpfaModel>; };
58} // end namespace TTag
59
60// Set the grid type
61template<class TypeTag>
62struct Grid<TypeTag, TTag::InfiltrationThreeP> { using type = Dune::YaspGrid<2>; };
63
64// Set the problem property
65template<class TypeTag>
66struct Problem<TypeTag, TTag::InfiltrationThreeP> { using type = InfiltrationThreePProblem<TypeTag>; };
67
68// Set the fluid system
69template<class TypeTag>
70struct FluidSystem<TypeTag, TTag::InfiltrationThreeP>
71{
72private:
78public:
80};
81
82// Set the spatial parameters
83template<class TypeTag>
84struct SpatialParams<TypeTag, TTag::InfiltrationThreeP>
85{
89};
90
91}// end namespace Properties
92
122template <class TypeTag >
124{
126
130
131 enum {
132 pressureIdx = Indices::pressureIdx,
133 swIdx = Indices::swIdx,
134 snIdx = Indices::snIdx,
135
136 // world dimension
137 dimWorld = GridView::dimensionworld
138 };
139
145
146 using Element = typename GridView::template Codim<0>::Entity;
147 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
148
149public:
150 InfiltrationThreePProblem(std::shared_ptr<const GridGeometry> gridGeometry)
152 {
153 temperature_ = 273.15 + 10.0; // -> 10 degrees Celsius
154 FluidSystem::init(282.15, 284.15, 3, 8e4, 3e5, 200);
155
156 name_ = getParam<std::string>("Problem.Name");
157
158 this->spatialParams().plotMaterialLaw();
159 time_ = 0.0;
160 }
161
165 // \{
166 void setTime(Scalar time)
167 { time_ = time; }
168
174 const std::string& name() const
175 { return name_; }
176
184 Scalar temperatureAtPos(const GlobalPosition &globalPos) const
185 {
186 return temperature_;
187 }
188
189 // \}
190
194 // \{
195
202 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
203 {
204 BoundaryTypes values;
205
206 if(globalPos[0] > this->gridGeometry().bBoxMax()[0] - eps_
207 || globalPos[0] < this->gridGeometry().bBoxMin()[0] + eps_)
208 values.setAllDirichlet();
209 else
210 values.setAllNeumann();
211
212 return values;
213 }
214
222 PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
223 {
224 PrimaryVariables values(0.0);
225 initial_(values, globalPos);
226 return values;
227 }
236 NumEqVector neumannAtPos(const GlobalPosition &globalPos) const
237 {
238 NumEqVector values(0.0);
239
240 // negative values for injection
241 if (time_ < 2592000.0 - eps_)
242 {
243 if ((globalPos[0] < 175.0 + eps_) && (globalPos[0] > 155.0 - eps_)
244 && (globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_))
245 {
246 // mol fluxes, convert with M(Mesit.)=0,120 kg/mol --> 1.2e-4 kg/(sm)
247 values[Indices::conti0EqIdx + FluidSystem::nCompIdx] = -0.001;
248 }
249 }
250
251 return values;
252 }
253
254 // \}
255
259 // \{
260
269 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
270 {
271 PrimaryVariables values(0.0);
272 initial_(values, globalPos);
273 return values;
274 }
275
281 Scalar temperature() const
282 { return temperature_; }
283
284
285
286private:
287 // internal method for the initial condition (reused for the
288 // dirichlet conditions!)
289 void initial_(PrimaryVariables &values,
290 const GlobalPosition &globalPos) const
291 {
292 Scalar y = globalPos[1];
293 Scalar x = globalPos[0];
294 Scalar sw, swr=0.12, sgr=0.03;
295
296 if(y > (-1.E-3*x+5) - eps_)
297 {
298 Scalar pc = 9.81 * 1000.0 * (y - (-5E-4*x+5));
299 if (pc < 0.0) pc = 0.0;
300
301 sw = invertPcgw_(pc,
302 this->spatialParams().materialLawParamsAtPos(globalPos));
303 if (sw < swr) sw = swr;
304 if (sw > 1.-sgr) sw = 1.-sgr;
305
306 values[pressureIdx] = 1e5 ;
307 values[swIdx] = sw;
308 values[snIdx] = 0.;
309 }else {
310 values[pressureIdx] = 1e5 + 9.81 * 1000.0 * ((-5E-4*x+5) - y);
311 values[swIdx] = 1.-sgr;
312 values[snIdx] = 0.;
313 }
314 }
315
316 // small solver inverting the pc curve
317 template<class MaterialLawParams>
318 static Scalar invertPcgw_(Scalar pcIn, const MaterialLawParams &pcParams)
319 {
320 using MaterialLaw = typename ParentType::SpatialParams::MaterialLaw;
321 Scalar lower,upper;
322 int k;
323 int maxIt = 50;
324 Scalar bisLimit = 1.;
325 Scalar sw, pcgw;
326 lower=0.0; upper=1.0;
327 for (k=1; k<=25; k++)
328 {
329 sw = 0.5*(upper+lower);
330 pcgw = MaterialLaw::pcgw(pcParams, sw);
331 Scalar delta = pcgw-pcIn;
332 if (delta<0.) delta*=-1.;
333 if (delta<bisLimit)
334 {
335 return(sw);
336 }
337 if (k==maxIt) {
338 return(sw);
339 }
340 if (pcgw>pcIn) lower=sw;
341 else upper=sw;
342 }
343 return(sw);
344 }
345
346 Scalar temperature_;
347 static constexpr Scalar eps_ = 1e-6;
348 std::string name_;
349 Scalar time_;
350};
351
352} // end namespace Dumux
353
354#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.
The available discretization methods in Dumux.
A simple class for the air fluid properties.
Material properties of pure water .
Properties of mesitylene.
Tabulates all thermodynamic properties of a given untabulated chemical species.
A gaseous phase consisting of a single component.
A liquid phase consisting of a single component.
A fluid system for three-phase models assuming immiscibility and thermodynamic equilibrium.
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
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
The type of the fluid system to use.
Definition: common/properties.hh:223
Tabulates all thermodynamic properties of a given untabulated chemical species.
Definition: tabulatedcomponent.hh:82
A gaseous phase consisting of a single component.
Definition: 1pgas.hh:46
A liquid phase consisting of a single component.
Definition: 1pliquid.hh:46
A fluid system for three-phase models assuming immiscibility and thermodynamic equilibrium.
Definition: 3pimmiscible.hh:62
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
Isothermal NAPL infiltration problem: LNAPL contaminates the unsaturated and the saturated groundwate...
Definition: test/porousmediumflow/3p/implicit/infiltration/problem.hh:124
Scalar temperatureAtPos(const GlobalPosition &globalPos) const
Returns the temperature within the domain.
Definition: test/porousmediumflow/3p/implicit/infiltration/problem.hh:184
const std::string & name() const
The problem name.
Definition: test/porousmediumflow/3p/implicit/infiltration/problem.hh:174
void setTime(Scalar time)
Definition: test/porousmediumflow/3p/implicit/infiltration/problem.hh:166
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: test/porousmediumflow/3p/implicit/infiltration/problem.hh:269
PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Dirichlet boundary segment.
Definition: test/porousmediumflow/3p/implicit/infiltration/problem.hh:222
NumEqVector neumannAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Neumann boundary segment.
Definition: test/porousmediumflow/3p/implicit/infiltration/problem.hh:236
Scalar temperature() const
Returns the temperature within the domain.
Definition: test/porousmediumflow/3p/implicit/infiltration/problem.hh:281
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/3p/implicit/infiltration/problem.hh:202
InfiltrationThreePProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/porousmediumflow/3p/implicit/infiltration/problem.hh:150
Definition: test/porousmediumflow/3p/implicit/infiltration/problem.hh:55
std::tuple< ThreeP > InheritsFrom
Definition: test/porousmediumflow/3p/implicit/infiltration/problem.hh:55
Definition: test/porousmediumflow/3p/implicit/infiltration/problem.hh:56
std::tuple< InfiltrationThreeP, BoxModel > InheritsFrom
Definition: test/porousmediumflow/3p/implicit/infiltration/problem.hh:56
Definition: test/porousmediumflow/3p/implicit/infiltration/problem.hh:57
std::tuple< InfiltrationThreeP, CCTpfaModel > InheritsFrom
Definition: test/porousmediumflow/3p/implicit/infiltration/problem.hh:57
Dune::YaspGrid< 2 > type
Definition: test/porousmediumflow/3p/implicit/infiltration/problem.hh:62
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: test/porousmediumflow/3p/implicit/infiltration/problem.hh:86
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/3p/implicit/infiltration/problem.hh:87
Definition of the spatial parameters for the infiltration problem.
Definition: porousmediumflow/3p/implicit/infiltration/spatialparams.hh:46
Adaption of the fully implicit scheme to the three-phase flow model.
Base class for all porous media problems.
Definition of the spatial parameters for the MaxwellStefan problem.