3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test_mpfa2pspatialparams.hh
Go to the documentation of this file.
1/*****************************************************************************
2 * See the file COPYING for full copying permissions. *
3 * *
4 * This program is free software: you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation, either version 3 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
16 *****************************************************************************/
23#ifndef TEST_2P_SPATIALPARAMETERS_HH
24#define TEST_2P_SPATIALPARAMETERS_HH
25
29
30
31namespace Dumux
32{
33
34template<class TypeTag>
36
37namespace Properties
38{
39// The spatial parameters TypeTag
41
42// Set the spatial parameters
44
45// Set the material law
46template<class TypeTag>
47struct MaterialLaw<TypeTag, TTag::Test2PSpatialParams>
48{
49private:
50 using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
52public:
54};
55}
56
61template<class TypeTag>
63{
65 using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
66 using Grid = typename GET_PROP_TYPE(TypeTag, Grid);
67 using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
68 using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
69 using CoordScalar = typename Grid::ctype;
70
71 enum
72 {
73 dim = Grid::dimension, dimWorld = Grid::dimensionworld
74 };
75 using Element = typename Grid::Traits::template Codim<0>::Entity;
76
77 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
78 using FieldMatrix = Dune::FieldMatrix<Scalar, dim, dim>;
79
80public:
81 using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw);
82 using MaterialLawParams = typename MaterialLaw::Params;
83
84 const FieldMatrix& intrinsicPermeabilityAtPos(const GlobalPosition& globalPos) const
85 {
86 if (isLensOne(globalPos))
87 return permLenses_;
88 else if (isLensTwo(globalPos))
89 return permLenses_;
90 else if (isLensThree(globalPos))
91 return permLenses_;
92 else
93 return permBackground_;
94 }
95
96 Scalar porosity(const Element& element) const
97 {
98#if PROBLEM == 0
99 return 0.2;
100#elif PROBLEM == 1
101 return 0.3;
102#else
103 return 0.4;
104#endif
105 }
106
107 // return the brooks-corey context depending on the position
108 const MaterialLawParams& materialLawParamsAtPos(const GlobalPosition& globalPos) const
109 {
110 if (isLensOne(globalPos))
111 return materialLawParamsLenses_;
112 else if (isLensTwo(globalPos))
113 return materialLawParamsLenses_;
114 else if (isLensThree(globalPos))
115 return materialLawParamsLenses_;
116 else
117 return materialLawParamsBackground_;
118 }
119
120 Test2PSpatialParams(const Problem& problem) :
121 ParentType(problem), permBackground_(0), permLenses_(0),
122 lensOneLowerLeft_(0), lensOneUpperRight_(0), lensTwoLowerLeft_(0), lensTwoUpperRight_(0), lensThreeLowerLeft_(0), lensThreeUpperRight_(0)
123 {
124#if PROBLEM == 0
125 // residual saturations
126 materialLawParamsBackground_.setSwr(0.2);
127 materialLawParamsBackground_.setSnr(0.2);
128
129 materialLawParamsLenses_.setSwr(0.2);
130 materialLawParamsLenses_.setSnr(0.2);
131
132 //parameters for Brooks-Corey law
133
134 // entry pressures function
135 materialLawParamsBackground_.setPe(0.);
136 materialLawParamsLenses_.setPe(0.);
137#elif PROBLEM == 1
138 // residual saturations
139 materialLawParamsBackground_.setSwr(0.);
140 materialLawParamsBackground_.setSnr(0.);
141
142 materialLawParamsLenses_.setSwr(0.);
143 materialLawParamsLenses_.setSnr(0.);
144
145 //parameters for Brooks-Corey law
146
147 // entry pressures function
148 materialLawParamsBackground_.setPe(5000.);
149 materialLawParamsLenses_.setPe(5000.);
150#else
151 // residual saturations
152 materialLawParamsBackground_.setSwr(0.);
153 materialLawParamsBackground_.setSnr(0.);
154
155 materialLawParamsLenses_.setSwr(0.);
156 materialLawParamsLenses_.setSnr(0.);
157
158 //parameters for Brooks-Corey law
159
160 // entry pressures
161 materialLawParamsBackground_.setPe(getParam<Scalar>("SpatialParams.BackgroundEntryPressure", 0.0));
162 materialLawParamsLenses_.setPe(getParam<Scalar>("SpatialParams.LenseEntryPressure", 0.0));
163#endif
164
165 // Brooks-Corey shape parameters
166#if PROBLEM == 2
167 materialLawParamsBackground_.setLambda(getParam<Scalar>("SpatialParams.BackgroundLambda", 3.0));
168 materialLawParamsLenses_.setLambda(getParam<Scalar>("SpatialParams.LenseLambda", 2.0));
169#else
170 materialLawParamsBackground_.setLambda(2.0);
171 materialLawParamsLenses_.setLambda(2.0);
172#endif
173
174#if PROBLEM == 0
175 permBackground_[0][0] = 1e-7;
176 permBackground_[1][1] = 1e-7;
177 permLenses_[0][0] = 1e-7;
178 permLenses_[1][1] = 1e-7;
179#elif PROBLEM == 1
180 permBackground_[0][0] = 1e-10;
181 permBackground_[1][1] = 1e-10;
182 permLenses_[0][0] = 1e-10;
183 permLenses_[1][1] = 1e-10;
184#else
185 permBackground_[0][0] = getParam<Scalar>("SpatialParams.BackgroundPermeabilityXX", 1e-10);
186 permBackground_[0][1] = getParam<Scalar>("SpatialParams.BackgroundPermeabilityXY", 0.0);
187 permBackground_[1][0] = getParam<Scalar>("SpatialParams.BackgroundPermeabilityYX", 0.0);
188 permBackground_[1][1] = getParam<Scalar>("SpatialParams.BackgroundPermeabilityYY", 1e-10);
189 permLenses_[0][0] = getParam<Scalar>("SpatialParams.LensPermeabilityXX", 1e-10);
190 permLenses_[0][1] = getParam<Scalar>("SpatialParams.LensPermeabilityXY", 0.0);
191 permLenses_[1][0] = getParam<Scalar>("SpatialParams.LensPermeabilityYX", 0.0);
192 permLenses_[1][1] = getParam<Scalar>("SpatialParams.LensPermeabilityYY", 1e-10);
193
194 lensOneLowerLeft_ = getParam<GlobalPosition>("SpatialParams.LensOneLowerLeft", GlobalPosition(0.0));
195 lensOneUpperRight_ = getParam<GlobalPosition>("SpatialParams.LensOneUpperRight", GlobalPosition(0.0));
196 lensTwoLowerLeft_ = getParam<GlobalPosition>("SpatialParams.LensTwoLowerLeft", GlobalPosition(0.0));
197 lensTwoUpperRight_ = getParam<GlobalPosition>("SpatialParams.LensTwoUpperRight", GlobalPosition(0.0));
198 lensThreeLowerLeft_ = getParam<GlobalPosition>("SpatialParams.LensThreeLowerLeft", GlobalPosition(0.0));
199 lensThreeUpperRight_ = getParam<GlobalPosition>("SpatialParams.LensThreeUpperRight", GlobalPosition(0.0));
200#endif
201 }
202
203private:
204
205 bool isLensOne(const GlobalPosition& globalPos) const
206 {
207 for (int i = 0; i < dim; i++)
208 {
209 if (globalPos[i] < lensOneLowerLeft_[i] - eps_ || globalPos[i] > lensOneUpperRight_[i] + eps_)
210 {
211 return false;
212 }
213 }
214 return true;
215 }
216 bool isLensTwo(const GlobalPosition& globalPos) const
217 {
218 for (int i = 0; i < dim; i++)
219 {
220 if (globalPos[i] < lensTwoLowerLeft_[i] - eps_ || globalPos[i] > lensTwoUpperRight_[i] + eps_)
221 {
222 return false;
223 }
224 }
225 return true;
226 }
227 bool isLensThree(const GlobalPosition& globalPos) const
228 {
229 for (int i = 0; i < dim; i++)
230 {
231 if (globalPos[i] < lensThreeLowerLeft_[i] - eps_ || globalPos[i] > lensThreeUpperRight_[i] + eps_)
232 {
233 return false;
234 }
235 }
236 return true;
237 }
238
239 MaterialLawParams materialLawParamsBackground_;
240 MaterialLawParams materialLawParamsLenses_;
241 FieldMatrix permBackground_;
242 FieldMatrix permLenses_;
243 GlobalPosition lensOneLowerLeft_;
244 GlobalPosition lensOneUpperRight_;
245 GlobalPosition lensTwoLowerLeft_;
246 GlobalPosition lensTwoUpperRight_;
247 GlobalPosition lensThreeLowerLeft_;
248 GlobalPosition lensThreeUpperRight_;
249
250 static constexpr Scalar eps_ = 1e-6;
251};
252
253} // end namespace
254#endif
#define GET_PROP_TYPE(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:283
#define NEW_TYPE_TAG(...)
Definition: propertysystemmacros.hh:130
Implementation of a regularized version of the Brooks-Corey capillary pressure / relative permeabilit...
The base class for spatial parameters of problems using the fv method.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Type tag Test2PSpatialParams
Definition: test_mpfa2pspatialparams.hh:40
SET_TYPE_PROP(FVPressureOneP, Velocity, FVVelocity1P< TypeTag >)
Set velocity reconstruction implementation standard cell centered finite volume schemes as default.
The type of the spatial parameters object.
Definition: common/properties.hh:221
This material law takes a material law defined for effective saturations and converts it to a materia...
Definition: 2p/efftoabslaw.hh:60
Implementation of the regularized Brooks-Corey capillary pressure / relative permeability <-> saturat...
Definition: regularizedbrookscorey.hh:62
Definition: sequentialfv.hh:34
The base class for spatial parameters of a multi-phase problem using the fv method.
Definition: sequentialfv.hh:43
Test problem for the sequential 2p models.
Definition: test_mpfa2pspatialparams.hh:63
typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw
Definition: test_mpfa2pspatialparams.hh:81
Scalar porosity(const Element &element) const
Definition: test_mpfa2pspatialparams.hh:96
Test2PSpatialParams(const Problem &problem)
Definition: test_mpfa2pspatialparams.hh:120
const MaterialLawParams & materialLawParamsAtPos(const GlobalPosition &globalPos) const
Definition: test_mpfa2pspatialparams.hh:108
typename MaterialLaw::Params MaterialLawParams
Definition: test_mpfa2pspatialparams.hh:82
const FieldMatrix & intrinsicPermeabilityAtPos(const GlobalPosition &globalPos) const
Definition: test_mpfa2pspatialparams.hh:84
This material law takes a material law defined for effective saturations and converts it to a materia...