3.3.0
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
regularizedparkervangen3p.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 REGULARIZED_PARKERVANGEN_3P_HH
26#define REGULARIZED_PARKERVANGEN_3P_HH
27
28#warning "This header is deprecated. Removal after 3.3. Use new material laws."
29
30#include <algorithm>
31
32#include "parkervangen3p.hh"
34
36
37namespace Dumux {
38
64template <class ScalarT, class ParamsT = RegularizedParkerVanGen3PParams<ScalarT> >
66{
68
69public:
70 using Params = ParamsT;
71 using Scalar = typename Params::Scalar;
72
86 static Scalar pc(const Params &params, Scalar sw)
87 {
88 return ParkerVanGen3P::pc(params, sw);
89 }
90
97 static Scalar pcgw(const Params &params, Scalar swe)
98 {
99 //if specified, a constant value is used for regularization
100 using std::clamp;
101 if (params.constRegularization())
102 swe = clamp(swe, 0.0, 1.0);
103
104 // retrieve the low and the high threshold saturations for the
105 // unregularized capillary pressure curve from the parameters
106 const Scalar swThLow = params.pcLowS();
107 const Scalar swThHigh = params.pcHighS();
108
109 // make sure that the capillary pressure observes a derivative
110 // != 0 for 'illegal' saturations. This is favourable for the
111 // newton solver (if the derivative is calculated numerically)
112 // in order to get the saturation moving to the right
113 // direction if it temporarily is in an 'illegal' range.
114 if (swe < swThLow)
115 {
116 const Scalar mLow = ParkerVanGen3P::dpcgw_dswe(params, swThLow);
117 return ParkerVanGen3P::pcgw(params, swThLow) + mLow*(swe - swThLow);
118 }
119 else if (swe > swThHigh)
120 {
121 Scalar yTh = ParkerVanGen3P::pcgw(params, swThHigh);
122 Scalar m1 = (0.0 - yTh)/(1.0 - swThHigh)*2;
123
124 if (swe < 1.0) {
125 // use spline between threshold swe and 1.0
126 Scalar mTh = ParkerVanGen3P::dpcgw_dswe(params, swThHigh);
127 Spline<Scalar> sp(swThHigh, 1.0, // x0, x1
128 yTh, 0, // y0, y1
129 mTh, m1); // m0, m1
130 return sp.eval(swe);
131 }
132 else {
133 // straight line for swe > 1.0
134 return m1*(swe - 1.0) + 0.0;
135 }
136 }
137
138 // if the effective saturation is in an 'reasonable'
139 // range, we use the real van genuchten law...
140 return ParkerVanGen3P::pcgw(params, swe);
141 }
142
148 static Scalar pcnw(const Params &params, Scalar swe)
149 {
150 //if specified, a constant value is used for regularization
151 if(params.constRegularization())
152 {
153 if(swe < 0.0)
154 swe = 0.0;
155 if(swe > 1.0)
156 swe = 1.0;
157 }
158
159 // retrieve the low and the high threshold saturations for the
160 // unregularized capillary pressure curve from the parameters
161 const Scalar swThLow = params.pcLowS();
162 const Scalar swThHigh = params.pcHighS();
163
164 // make sure that the capillary pressure observes a derivative
165 // != 0 for 'illegal' saturations. This is favourable for the
166 // newton solver (if the derivative is calculated numerically)
167 // in order to get the saturation moving to the right
168 // direction if it temporarily is in an 'illegal' range.
169 if (swe < swThLow)
170 {
171 const Scalar mLow = ParkerVanGen3P::dpcnw_dswe(params, swThLow);
172 return ParkerVanGen3P::pcnw(params, swThLow) + mLow*(swe - swThLow);
173 }
174 else if (swe > swThHigh)
175 {
176 Scalar yTh = ParkerVanGen3P::pcnw(params, swThHigh);
177 Scalar m1 = (0.0 - yTh)/(1.0 - swThHigh)*2;
178
179 if (swe < 1.0) {
180 // use spline between threshold swe and 1.0
181 Scalar mTh = ParkerVanGen3P::dpcnw_dswe(params, swThHigh);
182 Spline<Scalar> sp(swThHigh, 1.0, // x0, x1
183 yTh, 0, // y0, y1
184 mTh, m1); // m0, m1
185 return sp.eval(swe);
186 }
187 else {
188 // straight line for swe > 1.0
189 return m1*(swe - 1.0) + 0.0;
190 }
191 }
192
193 // if the effective saturation is in an 'reasonable'
194 // range, we use the real van genuchten law...
195 return ParkerVanGen3P::pcnw(params, swe);
196 }
197
203 static Scalar pcgn(const Params &params, Scalar ste)
204 {
205 //if specified, a constant value is used for regularization
206 if(params.constRegularization())
207 {
208 if(ste < 0.0)
209 ste = 0.0;
210 if(ste > 1.0)
211 ste = 1.0;
212 }
213
214 // retrieve the low and the high threshold saturations for the
215 // unregularized capillary pressure curve from the parameters
216 const Scalar swThLow = params.pcLowS();
217 const Scalar swThHigh = params.pcHighS();
218
219 // make sure that the capillary pressure observes a derivative
220 // != 0 for 'illegal' saturations. This is favourable for the
221 // newton solver (if the derivative is calculated numerically)
222 // in order to get the saturation moving to the right
223 // direction if it temporarily is in an 'illegal' range.
224 if (ste < swThLow)
225 {
226 const Scalar mLow = ParkerVanGen3P::dpcgn_dste(params, swThLow);
227 return ParkerVanGen3P::pcgn(params, swThLow) + mLow*(ste - swThLow);
228 }
229 else if (ste > swThHigh)
230 {
231 Scalar yTh = ParkerVanGen3P::pcgn(params, swThHigh);
232 Scalar m1 = (0.0 - yTh)/(1.0 - swThHigh)*2;
233
234 if (ste < 1.0) {
235 // use spline between threshold swe and 1.0
236 Scalar mTh = ParkerVanGen3P::dpcgn_dste(params, swThHigh);
237 Spline<Scalar> sp(swThHigh, 1.0, // x0, x1
238 yTh, 0, // y0, y1
239 mTh, m1); // m0, m1
240 return sp.eval(ste);
241 }
242 else {
243 // straight line for swe > 1.0
244 return m1*(ste - 1.0) + 0.0;
245 }
246 }
247
248 // if the effective saturation is in an 'reasonable'
249 // range, we use the real van genuchten law...
250 return ParkerVanGen3P::pcgn(params, ste);
251 }
252
258 static Scalar pcAlpha(const Params &params, Scalar sne)
259 {
260 return ParkerVanGen3P::pcAlpha(params, sne);
261 }
262
269 static Scalar sw(const Params &params, Scalar pc)
270 {
271 return ParkerVanGen3P::sw(params, pc);
272 }
273
280 static Scalar dpc_dswe(const Params &params, Scalar swe)
281 {
282 return ParkerVanGen3P::dpc_dswe(params, swe);
283 }
284
291 static Scalar dswe_dpc(const Params &params, Scalar pc)
292 {
293 return ParkerVanGen3P::dswe_dpc(params, pc);
294 }
295
308 static Scalar krw(const Params &params, const Scalar swe)
309 {
310 //use regularization
311 if(swe > 1.0) return 1.0;
312 if(swe < 0.0) return 0.0;
313
314 //or use actual material law
315 return ParkerVanGen3P::krw(params, swe);
316 }
317
334 static Scalar krn(const Params &params, Scalar swe, Scalar sn, Scalar ste)
335 {
336 using std::clamp;
337 swe = clamp(swe, 0.0, 1.0);
338 ste = clamp(ste, 0.0, 1.0);
339
340 if(ste - swe <= 0.0)
341 return 0.0;
342
343 //or use actual material law
344 return ParkerVanGen3P::krn(params, swe, sn, ste);
345 }
346
347
360 static Scalar krg(const Params &params, const Scalar ste)
361 {
362 //return 0 if there is no gas
363 if(ste > 1.0)
364 return 0.0;
365
366 // use linear regularization for very high gas saturations
367 // to avoid a kink in the curve and to maintain a slope for
368 // the Newton solver
369 const Scalar threshold = 1e-3;
370 if(ste <= threshold)
371 {
372 const Scalar mSwr = ParkerVanGen3P::dkrg_dste(params, threshold);
373 const Scalar ySwr = ParkerVanGen3P::krg(params, threshold);
374 return ySwr + mSwr*(ste - threshold);
375 }
376
377 // For very low gas saturations:
378 // We use a scaling factor that decreases the gas phase permeability quite fast at very low gas phase
379 // saturations, thus making that phase virtually immobile.
380 // This prevents numerical issues related to the degeneration of the gas phase mass balance for the 3p3c model
381 // at very low gas phase saturations.
382
383 //get the absolute gas phase saturation
384 const Scalar st = ste*(1 - params.swr()) + params.swr();
385 const Scalar sg = 1.0 - st;
386 using std::max;
387 const Scalar scalFact = (sg > 0.1) ? 1.0 : max(0.0,
388 (sg - params.sgr())/(0.1 - params.sgr()));
389
390 //or use actual material law
391 return scalFact * ParkerVanGen3P::krg(params, ste);
392 }
393
402 static Scalar kr(const Params &params, const int phaseIdx, const Scalar swe, const Scalar sn, const Scalar ste)
403 {
404 switch (phaseIdx)
405 {
406 case 0:
407 return krw(params, swe);
408 case 1:
409 return krn(params, swe, sn, ste);
410 case 2:
411 return krg(params, ste);
412 }
413 DUNE_THROW(Dune::InvalidStateException,
414 "Invalid phase index ");
415 }
416
422 {
424 }
425
426};
427} // end namespace Dumux
428
429#endif
Provides 3rd order polynomial splines.
Implementation of van Genuchten's capillary pressure-saturation relation for three phases.
Parameters that are necessary for the regularization of the Parker - Van Genuchten capillary pressure...
Definition: adapt.hh:29
A 3rd order polynomial spline.
Definition: spline.hh:55
Scalar eval(Scalar x, bool extrapolate=false) const
Evaluate the spline at a given position.
Definition: splinecommon_.hh:141
Implementation of van Genuchten's capillary pressure <-> saturation relation. This class bundles the ...
Definition: parkervangen3p.hh:46
static Scalar pc(const Params &params, const Scalar sw)
The capillary pressure-saturation curve.
Definition: parkervangen3p.hh:57
static Scalar krg(const Params &params, const Scalar ste)
The relative permeability for the nonwetting phase of the medium implied by van Genuchten's parameter...
Definition: parkervangen3p.hh:266
static Scalar pcAlpha(const Params &params, Scalar sne)
This function ensures a continuous transition from 2 to 3 phases and vice versa.
Definition: parkervangen3p.hh:100
static Scalar sw(const Params &params, const Scalar pc)
The saturation-capillary pressure curve.
Definition: parkervangen3p.hh:126
static Scalar dpcgn_dste(const Params &params, const Scalar seRegu)
Returns the partial derivative of the capillary pressure to the effective saturation.
Definition: parkervangen3p.hh:176
static Scalar krn(const Params &params, const Scalar swe, const Scalar sn, const Scalar ste)
The relative permeability for the nonwetting phase after the Model of Parker et al....
Definition: parkervangen3p.hh:232
static Scalar dswe_dpc(const Params &params, const Scalar pc)
Returns the partial derivative of the effective saturation to the capillary pressure.
Definition: parkervangen3p.hh:190
static Scalar bulkDensTimesAdsorpCoeff(const Params &params)
the basis for calculating adsorbed NAPL in storage term
Definition: parkervangen3p.hh:324
static Scalar krw(const Params &params, const Scalar swe)
The relative permeability for the wetting phase of the medium implied by van Genuchten's parameteriza...
Definition: parkervangen3p.hh:207
static Scalar dpc_dswe(const Params &params, const Scalar swe)
Returns the partial derivative of the capillary pressure to the effective saturation.
Definition: parkervangen3p.hh:137
static Scalar dpcnw_dswe(const Params &params, const Scalar seRegu)
Returns the partial derivative of the capillary pressure to the effective saturation.
Definition: parkervangen3p.hh:162
static Scalar pcgn(const Params &params, const Scalar ste)
The capillary pressure-saturation curve for the gas and nonwetting phase.
Definition: parkervangen3p.hh:89
static Scalar pcgw(const Params &params, const Scalar swe)
The capillary pressure-saturation curve for the gas and wetting phase.
Definition: parkervangen3p.hh:67
static Scalar pcnw(const Params &params, const Scalar swe)
The capillary pressure-saturation curve for the non-wettigng and wetting phase.
Definition: parkervangen3p.hh:78
static Scalar dpcgw_dswe(const Params &params, const Scalar seRegu)
Returns the partial derivative of the capillary pressure to the effective saturation.
Definition: parkervangen3p.hh:148
static Scalar dkrg_dste(const Params &params, Scalar ste)
The derivative of the relative permeability for the gas phase in regard to the total liquid saturatio...
Definition: parkervangen3p.hh:285
Implementation of the regularized van Genuchten's capillary pressure <-> saturation relation....
Definition: regularizedparkervangen3p.hh:66
typename Params::Scalar Scalar
Definition: regularizedparkervangen3p.hh:71
static Scalar krg(const Params &params, const Scalar ste)
The relative permeability for the nonwetting phase of the medium implied by van Genuchten's parameter...
Definition: regularizedparkervangen3p.hh:360
static Scalar pcAlpha(const Params &params, Scalar sne)
This function ensures a continuous transition from 2 to 3 phases and vice versa.
Definition: regularizedparkervangen3p.hh:258
static Scalar pcgw(const Params &params, Scalar swe)
The capillary pressure-saturation curve for the gas and wetting phase.
Definition: regularizedparkervangen3p.hh:97
static Scalar kr(const Params &params, const int phaseIdx, const Scalar swe, const Scalar sn, const Scalar ste)
The relative permeability for a phase.
Definition: regularizedparkervangen3p.hh:402
static Scalar dpc_dswe(const Params &params, Scalar swe)
Returns the partial derivative of the capillary pressure to the effective saturation.
Definition: regularizedparkervangen3p.hh:280
static Scalar krw(const Params &params, const Scalar swe)
The relative permeability for the wetting phase of the medium implied by van Genuchten's parameteriza...
Definition: regularizedparkervangen3p.hh:308
static Scalar krn(const Params &params, Scalar swe, Scalar sn, Scalar ste)
The relative permeability for the nonwetting phase after the Model of Parker et al....
Definition: regularizedparkervangen3p.hh:334
ParamsT Params
Definition: regularizedparkervangen3p.hh:70
static Scalar pcgn(const Params &params, Scalar ste)
The capillary pressure-saturation curve for the gas and nonwetting phase.
Definition: regularizedparkervangen3p.hh:203
static Scalar sw(const Params &params, Scalar pc)
The saturation-capillary pressure curve.
Definition: regularizedparkervangen3p.hh:269
static Scalar bulkDensTimesAdsorpCoeff(const Params &params)
the basis for calculating adsorbed NAPL in storage term
Definition: regularizedparkervangen3p.hh:421
static Scalar pcnw(const Params &params, Scalar swe)
The capillary pressure-saturation curve for the non-wettigng and wetting phase.
Definition: regularizedparkervangen3p.hh:148
static Scalar pc(const Params &params, Scalar sw)
A regularized Parker- van Genuchten capillary pressure-saturation curve.
Definition: regularizedparkervangen3p.hh:86
static Scalar dswe_dpc(const Params &params, Scalar pc)
Returns the partial derivative of the effective saturation to the capillary pressure.
Definition: regularizedparkervangen3p.hh:291