Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
*
* \brief The spatial parameters for the fully implicit tutorial problem
* which uses the twophase box model.
*/
#ifndef DUMUX_EX2_TUTORIAL_SPATIAL_PARAMS_IMPLICIT_HH
#define DUMUX_EX2_TUTORIAL_SPATIAL_PARAMS_IMPLICIT_HH
// include parent spatialparameters
#include <dumux/material/spatialparams/implicit.hh>
// include material laws
#include <dumux/material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh> /*@\label{tutorial-implicit:rawLawInclude}@*/
#include <dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh>
#include <dumux/material/fluidmatrixinteractions/2p/linearmaterial.hh>
namespace Dumux {
//forward declaration
template<class TypeTag>
class Ex2TutorialSpatialParamsImplicit;
namespace Properties
{
// The spatial parameters TypeTag
NEW_TYPE_TAG(Ex2TutorialSpatialParamsImplicit);/*@\label{tutorial-implicit:define-spatialparameters-typetag}@*/
// Set the spatial parameters
SET_TYPE_PROP(Ex2TutorialSpatialParamsImplicit, SpatialParams,
Ex2TutorialSpatialParamsImplicit<TypeTag>); /*@\label{tutorial-implicit:set-spatialparameters}@*/
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
// Set the material law
SET_PROP(Ex2TutorialSpatialParamsImplicit, MaterialLaw)
{
private:
// material law typedefs
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
// select material law to be used
typedef RegularizedBrooksCorey<Scalar> RawMaterialLaw; /*@\label{tutorial-implicit:rawlaw}@*/
public:
// adapter for absolute law
typedef EffToAbsLaw<RawMaterialLaw> type; /*@\label{tutorial-implicit:eff2abs}@*/
};
}
/*!
* \ingroup TwoPBoxModel
*
* \brief The spatial parameters for the fully implicit tutorial problem
* which uses the twophase box model.
*/
template<class TypeTag>
class Ex2TutorialSpatialParamsImplicit: public ImplicitSpatialParams<TypeTag> /*@\label{tutorial-implicit:tutorialSpatialParameters}@*/
{
// Get informations for current implementation via property system
typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
enum
{
dim = Grid::dimension,
dimWorld = Grid::dimensionworld
};
// Get object types for function arguments
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
typedef typename Grid::Traits::template Codim<0>::Entity Element;
typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition;
public:
// get material law from property system
typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
// determine appropriate parameters depending on selected materialLaw
typedef typename MaterialLaw::Params MaterialLawParams; /*@\label{tutorial-implicit:matLawObjectType}@*/
/*! Intrinsic permeability tensor K \f$[m^2]\f$ depending
* on the position in the domain
*
* \param element The finite volume element
* \param fvGeometry The finite-volume geometry in the box scheme
* \param scvIdx The local vertex index
*
* Alternatively, the function intrinsicPermeabilityAtPos(const GlobalPosition& globalPos)
* could be defined, where globalPos is the vector including the global coordinates
* of the finite volume.
*/
const Dune::FieldMatrix<Scalar, dim, dim> &intrinsicPermeability(const Element &element, /*@\label{tutorial-implicit:permeability}@*/
const FVElementGeometry &fvGeometry,
const int scvIdx) const
{
GlobalPosition globalPos = element.geometry().corner(scvIdx);
if (globalPos[0] > 25 && globalPos[0] < 75 && globalPos[1] > 15 && globalPos[1] < 35)
return KLense_;
else
return K_;
}
/*! Defines the porosity \f$[-]\f$ of the porous medium depending
* on the position in the domain
*
* \param element The finite volume element
* \param fvGeometry The finite-volume geometry in the box scheme
* \param scvIdx The local vertex index
*
* Alternatively, the function porosityAtPos(const GlobalPosition& globalPos)
* could be defined, where globalPos is the vector including the global coordinates
* of the finite volume.
*/
Scalar porosity(const Element &element, /*@\label{tutorial-implicit:porosity}@*/
const FVElementGeometry &fvGeometry,
const int scvIdx) const
{
GlobalPosition globalPos = element.geometry().corner(scvIdx);
if (globalPos[0] > 25 && globalPos[0] < 75 && globalPos[1] > 15 && globalPos[1] < 35)
return porosityLense_;
else
return porosity_;
}
/*! Returns the parameter object for the material law (i.e. Brooks-Corey)
* depending on the position in the domain
*
* \param element The finite volume element
* \param fvGeometry The finite-volume geometry in the box scheme
* \param scvIdx The local vertex index
*
* Alternatively, the function materialLawParamsAtPos(const GlobalPosition& globalPos)
* could be defined, where globalPos is the vector including the global coordinates
* of the finite volume.
*/
const MaterialLawParams& materialLawParams(const Element &element, /*@\label{tutorial-implicit:matLawParams}@*/
const FVElementGeometry &fvGeometry,
const int scvIdx) const
{
GlobalPosition globalPos = element.geometry().corner(scvIdx);
if (globalPos[0] > 25 && globalPos[0] < 75 && globalPos[1] > 15 && globalPos[1] < 35)
return materialParamsLense_;
else
return materialParams_;
}
// constructor
Ex2TutorialSpatialParamsImplicit(const GridView& gridView) :
ImplicitSpatialParams<TypeTag>(gridView),
K_(0), KLense_(0)
{
//set main diagonal entries of the permeability tensor to a value
//setting to one value means: isotropic, homogeneous
for (int i = 0; i < dim; i++)
{
K_[i][i] = 1e-7;
KLense_[i][i] = 1e-9;
}
porosity_ = 0.2;
porosityLense_ = 0.15;
//set residual saturations
materialParams_.setSwr(0.0); /*@\label{tutorial-implicit:setLawParams}@*/
materialParams_.setSnr(0.0);
//parameters of Brooks & Corey Law
materialParams_.setPe(1000.0);
materialParams_.setLambda(1.8);
//set residual saturations for lense
materialParamsLense_.setSwr(0.0); /*@\label{tutorial-implicit:setLawParams}@*/
materialParamsLense_.setSnr(0.0);
//parameters of Brooks & Corey Law
materialParamsLense_.setPe(1500.0);
materialParamsLense_.setLambda(2.0);
}
private:
Dune::FieldMatrix<Scalar, dim, dim> K_;
Dune::FieldMatrix<Scalar, dim, dim> KLense_;
Scalar porosity_;
Scalar porosityLense_;
// Object that holds the values/parameters of the selected material law.
MaterialLawParams materialParams_; /*@\label{tutorial-implicit:matParamsObject}@*/
MaterialLawParams materialParamsLense_;
};
} // end namespace
#endif