MODFLOW 6  version 6.7.0.dev0
USGS Modular Hydrologic Model
smoothingmodule Module Reference

Functions/Subroutines

subroutine sscurve (x, range, dydx, y)
 @ brief SCurve More...
 
subroutine scubiclinear (x, range, dydx, y)
 @ brief sCubicLinear More...
 
subroutine scubic (x, range, dydx, y)
 @ brief sCubic More...
 
subroutine slinear (x, range, dydx, y)
 @ brief sLinear More...
 
subroutine squadratic (x, range, dydx, y)
 @ brief sQuadratic More...
 
subroutine schsmooth (d, smooth, dwdh)
 @ brief sChSmooth More...
 
real(dp) function slinearsaturation (top, bot, x)
 @ brief sLinearSaturation More...
 
real(dp) function scubicsaturation (top, bot, x, eps)
 @ brief sCubicSaturation More...
 
real(dp) function squadraticsaturation (top, bot, x, eps)
 @ brief sQuadraticSaturation More...
 
real(dp) function svangenuchtensaturation (top, bot, x, alpha, beta, sr)
 @ brief sQuadraticSaturation More...
 
real(dp) function squadraticsaturationderivative (top, bot, x, eps)
 @ brief Derivative of the quadratic saturation function More...
 
real(dp) function sqsaturation (top, bot, x, c1, c2)
 @ brief sQSaturation More...
 
real(dp) function sqsaturationderivative (top, bot, x, c1, c2)
 @ brief sQSaturationDerivative More...
 
real(dp) function sslope (x, xi, yi, sm, sp, ta)
 @ brief sSlope More...
 
real(dp) function sslopederivative (x, xi, sm, sp, ta)
 @ brief sSlopeDerivative More...
 
real(dp) function squadratic0sp (x, xi, tomega)
 @ brief sQuadratic0sp More...
 
real(dp) function squadratic0spderivative (x, xi, tomega)
 @ brief sQuadratic0spDerivative More...
 
real(dp) function squadraticslope (x, xi, yi, sm, sp, tomega)
 @ brief sQuadraticSlope More...
 
real(dp) function squadraticslopederivative (x, xi, sm, sp, tomega)
 @ brief sQuadraticSlopeDerivative More...
 

Function/Subroutine Documentation

◆ schsmooth()

subroutine smoothingmodule::schsmooth ( real(dp), intent(in)  d,
real(dp), intent(inout)  smooth,
real(dp), intent(inout)  dwdh 
)

Function to smooth channel variables during channel drying

Definition at line 162 of file SmoothingFunctions.f90.

163  real(DP), intent(in) :: d
164  real(DP), intent(inout) :: smooth
165  real(DP), intent(inout) :: dwdh
166  !
167  ! -- local variables
168  real(DP) :: s
169  real(DP) :: diff
170  real(DP) :: aa
171  real(DP) :: ad
172  real(DP) :: b
173  real(DP) :: x
174  real(DP) :: y
175  ! -- code
176  !
177  smooth = dzero
178  s = dem5
179  x = d
180  diff = x - s
181  if (diff > dzero) then
182  smooth = done
183  dwdh = dzero
184  else
185  aa = -done / (s**dtwo)
186  ad = -dtwo / (s**dtwo)
187  b = dtwo / s
188  y = aa * x**dtwo + b * x
189  dwdh = (ad * x + b)
190  if (x <= dzero) then
191  y = dzero
192  dwdh = dzero
193  else if (diff > -dem14) then
194  y = done
195  dwdh = dzero
196  end if
197  smooth = y
198  end if
Here is the caller graph for this function:

◆ scubic()

subroutine smoothingmodule::scubic ( real(dp), intent(inout)  x,
real(dp), intent(inout)  range,
real(dp), intent(inout)  dydx,
real(dp), intent(inout)  y 
)

Nonlinear smoothing function returns value between 0-1; cubic function

Definition at line 75 of file SmoothingFunctions.f90.

76  real(DP), intent(inout) :: x
77  real(DP), intent(inout) :: range
78  real(DP), intent(inout) :: dydx
79  real(DP), intent(inout) :: y
80  !--local variables
81  real(DP) :: s, aa, bb
82  real(DP) :: cof1, cof2, cof3
83  ! -- code
84  !
85  dydx = dzero
86  y = dzero
87  if (range < dprec) range = dprec
88  if (x < dprec) x = dprec
89  s = range
90  aa = -dsix / (s**dthree)
91  bb = -dsix / (s**dtwo)
92  cof1 = x**dtwo
93  cof2 = -(dtwo * x) / (s**dthree)
94  cof3 = dthree / (s**dtwo)
95  y = cof1 * (cof2 + cof3)
96  dydx = (aa * x**dtwo - bb * x)
97  if (x <= dzero) then
98  y = dzero
99  dydx = dzero
100  else if ((x - s) > -dprec) then
101  y = done
102  dydx = dzero
103  end if
Here is the caller graph for this function:

◆ scubiclinear()

subroutine smoothingmodule::scubiclinear ( real(dp), intent(in)  x,
real(dp), intent(in)  range,
real(dp), intent(inout)  dydx,
real(dp), intent(inout)  y 
)

Computes the s curve where dy/dx = 0 at x=0; and dy/dx = 1 at x=1. Smooths from zero to a slope of 1.

Definition at line 45 of file SmoothingFunctions.f90.

46  real(DP), intent(in) :: x
47  real(DP), intent(in) :: range
48  real(DP), intent(inout) :: dydx
49  real(DP), intent(inout) :: y
50  !--local variables
51  real(DP) :: s
52  real(DP) :: xs
53  ! -- code
54  !
55  s = range
56  if (s < dprec) s = dprec
57  xs = x / s
58  if (xs < dzero) xs = dzero
59  if (xs <= dzero) then
60  y = dzero
61  dydx = dzero
62  elseif (xs < done) then
63  y = -done * xs**dthree + dtwo * xs**dtwo
64  dydx = -dthree * xs**dtwo + dfour * xs
65  else
66  y = done
67  dydx = dzero
68  end if
Here is the caller graph for this function:

◆ scubicsaturation()

real(dp) function smoothingmodule::scubicsaturation ( real(dp), intent(in)  top,
real(dp), intent(in)  bot,
real(dp), intent(in)  x,
real(dp), intent(in), optional  eps 
)

Nonlinear cubic saturation function returns value between 0-1

Definition at line 230 of file SmoothingFunctions.f90.

231  ! -- return
232  real(DP) :: y
233  ! -- dummy variables
234  real(DP), intent(in) :: top
235  real(DP), intent(in) :: bot
236  real(DP), intent(in) :: x
237  real(DP), intent(in), optional :: eps
238  ! -- local
239  real(DP) :: teps
240  real(DP) :: w
241  real(DP) :: b
242  real(DP) :: s
243  real(DP) :: cof1
244  real(DP) :: cof2
245  ! -- code
246  !
247  if (present(eps)) then
248  teps = eps
249  else
250  teps = dem2
251  end if
252  w = x - bot
253  b = top - bot
254  s = teps * b
255  cof1 = done / (s**dtwo)
256  cof2 = dtwo / s
257  if (w < dzero) then
258  y = dzero
259  else if (w < s) then
260  y = -cof1 * (w**dthree) + cof2 * (w**dtwo)
261  else if (w < (b - s)) then
262  y = w / b
263  else if (w < b) then
264  y = done + cof1 * ((b - w)**dthree) - cof2 * ((b - w)**dtwo)
265  else
266  y = done
267  end if
268 
Here is the caller graph for this function:

◆ slinear()

subroutine smoothingmodule::slinear ( real(dp), intent(inout)  x,
real(dp), intent(inout)  range,
real(dp), intent(inout)  dydx,
real(dp), intent(inout)  y 
)

Linear smoothing function returns value between 0-1

Definition at line 110 of file SmoothingFunctions.f90.

111  real(DP), intent(inout) :: x
112  real(DP), intent(inout) :: range
113  real(DP), intent(inout) :: dydx
114  real(DP), intent(inout) :: y
115  !--local variables
116  real(DP) :: s
117  ! -- code
118  !
119  dydx = dzero
120  y = dzero
121  if (range < dprec) range = dprec
122  if (x < dprec) x = dprec
123  s = range
124  y = done - (s - x) / s
125  dydx = done / s
126  if (y > done) then
127  y = done
128  dydx = dzero
129  end if
Here is the caller graph for this function:

◆ slinearsaturation()

real(dp) function smoothingmodule::slinearsaturation ( real(dp), intent(in)  top,
real(dp), intent(in)  bot,
real(dp), intent(in)  x 
)

Linear saturation function returns value between 0-1

Definition at line 205 of file SmoothingFunctions.f90.

206  ! -- return
207  real(DP) :: y
208  ! -- dummy variables
209  real(DP), intent(in) :: top
210  real(DP), intent(in) :: bot
211  real(DP), intent(in) :: x
212  ! -- local
213  real(DP) :: b
214  ! -- code
215  !
216  b = top - bot
217  if (x < bot) then
218  y = dzero
219  else if (x > top) then
220  y = done
221  else
222  y = (x - bot) / b
223  end if

◆ sqsaturation()

real(dp) function smoothingmodule::sqsaturation ( real(dp), intent(in)  top,
real(dp), intent(in)  bot,
real(dp), intent(in)  x,
real(dp), intent(in), optional  c1,
real(dp), intent(in), optional  c2 
)

Nonlinear smoothing function returns value between 0-1

Definition at line 412 of file SmoothingFunctions.f90.

413  ! -- return
414  real(DP) :: y
415  ! -- dummy variables
416  real(DP), intent(in) :: top
417  real(DP), intent(in) :: bot
418  real(DP), intent(in) :: x
419  real(DP), intent(in), optional :: c1
420  real(DP), intent(in), optional :: c2
421  ! -- local
422  real(DP) :: w
423  real(DP) :: b
424  real(DP) :: s
425  real(DP) :: cof1
426  real(DP) :: cof2
427  ! -- code
428  !
429  ! -- process optional variables
430  if (present(c1)) then
431  cof1 = c1
432  else
433  cof1 = -dtwo
434  end if
435  if (present(c2)) then
436  cof2 = c2
437  else
438  cof2 = dthree
439  end if
440  !
441  ! -- calculate head difference from bottom (w),
442  ! calculate range (b), and
443  ! calculate normalized head difference from bottom (s)
444  w = x - bot
445  b = top - bot
446  s = w / b
447  !
448  ! -- divide cof1 and cof2 by range to the power 3 and 2, respectively
449  cof1 = cof1 / b**dthree
450  cof2 = cof2 / b**dtwo
451  !
452  ! -- calculate fraction
453  if (s < dzero) then
454  y = dzero
455  else if (s < done) then
456  y = cof1 * w**dthree + cof2 * w**dtwo
457  else
458  y = done
459  end if
Here is the caller graph for this function:

◆ sqsaturationderivative()

real(dp) function smoothingmodule::sqsaturationderivative ( real(dp), intent(in)  top,
real(dp), intent(in)  bot,
real(dp), intent(in)  x,
real(dp), intent(in), optional  c1,
real(dp), intent(in), optional  c2 
)

Nonlinear smoothing function returns value between 0-1

Definition at line 466 of file SmoothingFunctions.f90.

467  ! -- return
468  real(DP) :: y
469  ! -- dummy variables
470  real(DP), intent(in) :: top
471  real(DP), intent(in) :: bot
472  real(DP), intent(in) :: x
473  real(DP), intent(in), optional :: c1
474  real(DP), intent(in), optional :: c2
475  ! -- local
476  real(DP) :: w
477  real(DP) :: b
478  real(DP) :: s
479  real(DP) :: cof1
480  real(DP) :: cof2
481  ! -- code
482  !
483  !
484  ! -- process optional variables
485  if (present(c1)) then
486  cof1 = c1
487  else
488  cof1 = -dtwo
489  end if
490  if (present(c2)) then
491  cof2 = c2
492  else
493  cof2 = dthree
494  end if
495  !
496  ! -- calculate head difference from bottom (w),
497  ! calculate range (b), and
498  ! calculate normalized head difference from bottom (s)
499  w = x - bot
500  b = top - bot
501  s = w / b
502  !
503  ! -- multiply cof1 and cof2 by 3 and 2, respectively, and then
504  ! divide by range to the power 3 and 2, respectively
505  cof1 = cof1 * dthree / b**dthree
506  cof2 = cof2 * dtwo / b**dtwo
507  !
508  ! -- calculate derivative of fraction with respect to x
509  if (s < dzero) then
510  y = dzero
511  else if (s < done) then
512  y = cof1 * w**dtwo + cof2 * w
513  else
514  y = dzero
515  end if
Here is the caller graph for this function:

◆ squadratic()

subroutine smoothingmodule::squadratic ( real(dp), intent(inout)  x,
real(dp), intent(inout)  range,
real(dp), intent(inout)  dydx,
real(dp), intent(inout)  y 
)

Nonlinear quadratic smoothing function returns value between 0-1

Definition at line 136 of file SmoothingFunctions.f90.

137  real(DP), intent(inout) :: x
138  real(DP), intent(inout) :: range
139  real(DP), intent(inout) :: dydx
140  real(DP), intent(inout) :: y
141  !--local variables
142  real(DP) :: s
143  ! -- code
144  !
145  dydx = dzero
146  y = dzero
147  if (range < dprec) range = dprec
148  if (x < dprec) x = dprec
149  s = range
150  y = (x**dtwo) / (s**dtwo)
151  dydx = dtwo * x / (s**dtwo)
152  if (y > done) then
153  y = done
154  dydx = dzero
155  end if
Here is the caller graph for this function:

◆ squadratic0sp()

real(dp) function smoothingmodule::squadratic0sp ( real(dp), intent(in)  x,
real(dp), intent(in)  xi,
real(dp), intent(in), optional  tomega 
)

Nonlinear smoothing function returns a smoothed value of y that uses a quadratic to smooth x over range of xi - epsilon to xi + epsilon. Simplification of sQuadraticSlope with sm = 0, sp = 1, and yi = 0. From Panday et al. (2013) - eq. 35 - https://dx.doi.org/10.5066/F7R20ZFJ

Definition at line 612 of file SmoothingFunctions.f90.

613  ! -- return
614  real(DP) :: y
615  ! -- dummy variables
616  real(DP), intent(in) :: x
617  real(DP), intent(in) :: xi
618  real(DP), optional, intent(in) :: tomega
619  ! -- local
620  real(DP) :: omega
621  real(DP) :: epsilon
622  real(DP) :: dx
623  !
624  ! -- set smoothing interval
625  if (present(tomega)) then
626  omega = tomega
627  else
628  omega = dem6
629  end if
630  !
631  ! -- set smoothing interval
632  epsilon = dhalf * omega
633  !
634  ! -- calculate distance from xi
635  dx = x - xi
636  !
637  ! -- evaluate smoothing function
638  if (dx < -epsilon) then
639  y = xi
640  else if (dx < epsilon) then
641  y = (dx**dtwo / (dfour * epsilon)) + dhalf * dx + (epsilon / dfour) + xi
642  else
643  y = x
644  end if
Here is the caller graph for this function:

◆ squadratic0spderivative()

real(dp) function smoothingmodule::squadratic0spderivative ( real(dp), intent(in)  x,
real(dp), intent(in)  xi,
real(dp), intent(in), optional  tomega 
)

Derivative of nonlinear smoothing function returns a smoothed value of y that uses a quadratic to smooth x over range of xi - epsilon to xi + epsilon. Simplification of sQuadraticSlope with sm = 0, sp = 1, and yi = 0. From Panday et al. (2013) - eq. 35 - https://dx.doi.org/10.5066/F7R20ZFJ

Definition at line 654 of file SmoothingFunctions.f90.

655  ! -- return
656  real(DP) :: y
657  ! -- dummy variables
658  real(DP), intent(in) :: x
659  real(DP), intent(in) :: xi
660  real(DP), optional, intent(in) :: tomega
661  ! -- local
662  real(DP) :: omega
663  real(DP) :: epsilon
664  real(DP) :: dx
665  !
666  ! -- set smoothing interval
667  if (present(tomega)) then
668  omega = tomega
669  else
670  omega = dem6
671  end if
672  !
673  ! -- set smoothing interval
674  epsilon = dhalf * omega
675  !
676  ! -- calculate distance from xi
677  dx = x - xi
678  !
679  ! -- evaluate smoothing function
680  if (dx < -epsilon) then
681  y = 0
682  else if (dx < epsilon) then
683  y = (dx / omega) + dhalf
684  else
685  y = 1
686  end if
Here is the caller graph for this function:

◆ squadraticsaturation()

real(dp) function smoothingmodule::squadraticsaturation ( real(dp), intent(in)  top,
real(dp), intent(in)  bot,
real(dp), intent(in)  x,
real(dp), intent(in), optional  eps 
)

Nonlinear quadratic saturation function returns value between 0-1

Definition at line 275 of file SmoothingFunctions.f90.

276  ! -- return
277  real(DP) :: y
278  ! -- dummy variables
279  real(DP), intent(in) :: top
280  real(DP), intent(in) :: bot
281  real(DP), intent(in) :: x
282  real(DP), optional, intent(in) :: eps
283  ! -- local
284  real(DP) :: teps
285  real(DP) :: b
286  real(DP) :: br
287  real(DP) :: bri
288  real(DP) :: av
289  ! -- code
290  !
291  if (present(eps)) then
292  teps = eps
293  else
294  teps = dem6
295  end if
296  b = top - bot
297  if (b > dzero) then
298  if (x < bot) then
299  br = dzero
300  else if (x > top) then
301  br = done
302  else
303  br = (x - bot) / b
304  end if
305  av = done / (done - teps)
306  bri = done - br
307  if (br < teps) then
308  y = av * dhalf * (br * br) / teps
309  elseif (br < (done - teps)) then
310  y = av * br + dhalf * (done - av)
311  elseif (br < done) then
312  y = done - ((av * dhalf * (bri * bri)) / teps)
313  else
314  y = done
315  end if
316  else
317  if (x < bot) then
318  y = dzero
319  else
320  y = done
321  end if
322  end if
323 
Here is the caller graph for this function:

◆ squadraticsaturationderivative()

real(dp) function smoothingmodule::squadraticsaturationderivative ( real(dp), intent(in)  top,
real(dp), intent(in)  bot,
real(dp), intent(in)  x,
real(dp), intent(in), optional  eps 
)

Derivative of nonlinear smoothing function returns value between 0-1;

Definition at line 364 of file SmoothingFunctions.f90.

365  ! -- return
366  real(DP) :: y
367  ! -- dummy variables
368  real(DP), intent(in) :: top
369  real(DP), intent(in) :: bot
370  real(DP), intent(in) :: x
371  real(DP), optional, intent(in) :: eps
372  ! -- local
373  real(DP) :: teps
374  real(DP) :: b
375  real(DP) :: br
376  real(DP) :: bri
377  real(DP) :: av
378  ! -- code
379  !
380  if (present(eps)) then
381  teps = eps
382  else
383  teps = dem6
384  end if
385  b = top - bot
386  if (x < bot) then
387  br = dzero
388  else if (x > top) then
389  br = done
390  else
391  br = (x - bot) / b
392  end if
393  av = done / (done - teps)
394  bri = done - br
395  if (br < teps) then
396  y = av * br / teps
397  elseif (br < (done - teps)) then
398  y = av
399  elseif (br < done) then
400  y = av * bri / teps
401  else
402  y = dzero
403  end if
404  y = y / b
405 
Here is the caller graph for this function:

◆ squadraticslope()

real(dp) function smoothingmodule::squadraticslope ( real(dp), intent(in)  x,
real(dp), intent(in)  xi,
real(dp), intent(in)  yi,
real(dp), intent(in)  sm,
real(dp), intent(in)  sp,
real(dp), intent(in), optional  tomega 
)

Quadratic smoothing function returns a smoothed value of y that has the value yi at xi and yi + (sm * dx) for x-values less than xi and yi + (sp * dx) for x-values greater than xi, where dx = x - xi.

Definition at line 695 of file SmoothingFunctions.f90.

696  ! -- return
697  real(DP) :: y
698  ! -- dummy variables
699  real(DP), intent(in) :: x
700  real(DP), intent(in) :: xi
701  real(DP), intent(in) :: yi
702  real(DP), intent(in) :: sm
703  real(DP), intent(in) :: sp
704  real(DP), optional, intent(in) :: tomega
705  ! -- local
706  real(DP) :: omega
707  real(DP) :: epsilon
708  real(DP) :: dx
709  real(DP) :: c
710  !
711  ! -- set smoothing interval
712  if (present(tomega)) then
713  omega = tomega
714  else
715  omega = dem6
716  end if
717  !
718  ! -- set smoothing interval
719  epsilon = dhalf * omega
720  !
721  ! -- calculate distance from xi
722  dx = x - xi
723  !
724  ! -- evaluate smoothing function
725  if (dx < -epsilon) then
726  y = sm * dx
727  else if (dx < epsilon) then
728  c = dx / epsilon
729  y = dhalf * epsilon * (dhalf * (sp - sm) * (done + c**dtwo) + (sm + sp) * c)
730  else
731  y = sp * dx
732  end if
733  !
734  ! -- add value at xi
735  y = y + yi

◆ squadraticslopederivative()

real(dp) function smoothingmodule::squadraticslopederivative ( real(dp), intent(in)  x,
real(dp), intent(in)  xi,
real(dp), intent(in)  sm,
real(dp), intent(in)  sp,
real(dp), intent(in), optional  tomega 
)

Derivative of quadratic smoothing function returns a smoothed value of y that has the value yi at xi and yi + (sm * dx) for x-values less than xi and yi + (sp * dx) for x-values greater than xi, where dx = x - xi.

Definition at line 744 of file SmoothingFunctions.f90.

745  ! -- return
746  real(DP) :: y
747  ! -- dummy variables
748  real(DP), intent(in) :: x
749  real(DP), intent(in) :: xi
750  real(DP), intent(in) :: sm
751  real(DP), intent(in) :: sp
752  real(DP), optional, intent(in) :: tomega
753  ! -- local
754  real(DP) :: omega
755  real(DP) :: epsilon
756  real(DP) :: dx
757  real(DP) :: c
758  !
759  ! -- set smoothing interval
760  if (present(tomega)) then
761  omega = tomega
762  else
763  omega = dem6
764  end if
765  !
766  ! -- set smoothing interval
767  epsilon = dhalf * omega
768  !
769  ! -- calculate distance from xi
770  dx = x - xi
771  !
772  ! -- evaluate smoothing function
773  if (dx < -epsilon) then
774  y = sm
775  else if (dx < epsilon) then
776  c = dx / epsilon
777  y = dhalf * ((sp - sm) * c + (sm + sp))
778  else
779  y = sp
780  end if

◆ sscurve()

subroutine smoothingmodule::sscurve ( real(dp), intent(in)  x,
real(dp), intent(in)  range,
real(dp), intent(inout)  dydx,
real(dp), intent(inout)  y 
)

Computes the S curve for smooth derivatives between x=0 and x=1 from mfusg smooth subroutine in gwf2wel7u1.f

Definition at line 14 of file SmoothingFunctions.f90.

15  real(DP), intent(in) :: x
16  real(DP), intent(in) :: range
17  real(DP), intent(inout) :: dydx
18  real(DP), intent(inout) :: y
19  !--local variables
20  real(DP) :: s
21  real(DP) :: xs
22  ! -- code
23  !
24  s = range
25  if (s < dprec) s = dprec
26  xs = x / s
27  if (xs < dzero) xs = dzero
28  if (xs <= dzero) then
29  y = dzero
30  dydx = dzero
31  elseif (xs < done) then
32  y = -dtwo * xs**dthree + dthree * xs**dtwo
33  dydx = -dsix * xs**dtwo + dsix * xs
34  else
35  y = done
36  dydx = dzero
37  end if
Here is the caller graph for this function:

◆ sslope()

real(dp) function smoothingmodule::sslope ( real(dp), intent(in)  x,
real(dp), intent(in)  xi,
real(dp), intent(in)  yi,
real(dp), intent(in)  sm,
real(dp), intent(in)  sp,
real(dp), intent(in), optional  ta 
)

Nonlinear smoothing function returns a smoothed value of y that has the value yi at xi and yi + (sm * dx) for x-values less than xi and yi + (sp * dx) for x-values greater than xi, where dx = x - xi.

Definition at line 524 of file SmoothingFunctions.f90.

525  ! -- return
526  real(DP) :: y
527  ! -- dummy variables
528  real(DP), intent(in) :: x
529  real(DP), intent(in) :: xi
530  real(DP), intent(in) :: yi
531  real(DP), intent(in) :: sm
532  real(DP), intent(in) :: sp
533  real(DP), optional, intent(in) :: ta
534  ! -- local
535  real(DP) :: a
536  real(DP) :: b
537  real(DP) :: dx
538  real(DP) :: xm
539  real(DP) :: xp
540  real(DP) :: ym
541  real(DP) :: yp
542  !
543  ! -- set smoothing variable a
544  if (present(ta)) then
545  a = ta
546  else
547  a = dem8
548  end if
549  !
550  ! -- calculate b from smoothing variable a
551  b = a / (sqrt(dtwo) - done)
552  !
553  ! -- calculate contributions to y
554  dx = x - xi
555  xm = dhalf * (x + xi - sqrt(dx + b**dtwo - a**dtwo))
556  xp = dhalf * (x + xi + sqrt(dx + b**dtwo - a**dtwo))
557  ym = sm * (xm - xi)
558  yp = sp * (xi - xp)
559  !
560  ! -- calculate y from ym and yp contributions
561  y = yi + ym + yp

◆ sslopederivative()

real(dp) function smoothingmodule::sslopederivative ( real(dp), intent(in)  x,
real(dp), intent(in)  xi,
real(dp), intent(in)  sm,
real(dp), intent(in)  sp,
real(dp), intent(in), optional  ta 
)

Derivative of nonlinear smoothing function that has the value yi at xi and yi + (sm * dx) for x-values less than xi and yi + (sp * dx) for x-values greater than xi, where dx = x - xi.

Definition at line 570 of file SmoothingFunctions.f90.

571  ! -- return
572  real(DP) :: y
573  ! -- dummy variables
574  real(DP), intent(in) :: x
575  real(DP), intent(in) :: xi
576  real(DP), intent(in) :: sm
577  real(DP), intent(in) :: sp
578  real(DP), optional, intent(in) :: ta
579  ! -- local
580  real(DP) :: a
581  real(DP) :: b
582  real(DP) :: dx
583  real(DP) :: mu
584  real(DP) :: rho
585  !
586  ! -- set smoothing variable a
587  if (present(ta)) then
588  a = ta
589  else
590  a = dem8
591  end if
592  !
593  ! -- calculate b from smoothing variable a
594  b = a / (sqrt(dtwo) - done)
595  !
596  ! -- calculate contributions to derivative
597  dx = x - xi
598  mu = sqrt(dx**dtwo + b**dtwo - a**dtwo)
599  rho = dx / mu
600  !
601  ! -- calculate derivative from individual contributions
602  y = dhalf * (sm + sp) - dhalf * rho * (sm - sp)

◆ svangenuchtensaturation()

real(dp) function smoothingmodule::svangenuchtensaturation ( real(dp), intent(in)  top,
real(dp), intent(in)  bot,
real(dp), intent(in)  x,
real(dp), intent(in)  alpha,
real(dp), intent(in)  beta,
real(dp), intent(in)  sr 
)

van Genuchten saturation function returns value between 0-1

Definition at line 330 of file SmoothingFunctions.f90.

331  ! -- return
332  real(DP) :: y
333  ! -- dummy variables
334  real(DP), intent(in) :: top
335  real(DP), intent(in) :: bot
336  real(DP), intent(in) :: x
337  real(DP), intent(in) :: alpha
338  real(DP), intent(in) :: beta
339  real(DP), intent(in) :: sr
340  ! -- local
341  real(DP) :: b
342  real(DP) :: pc
343  real(DP) :: gamma
344  real(DP) :: seff
345  ! -- code
346  !
347  b = top - bot
348  pc = (dhalf * b) - x
349  if (pc <= dzero) then
350  y = dzero
351  else
352  gamma = done - (done / beta)
353  seff = (done + (alpha * pc)**beta)**gamma
354  seff = done / seff
355  y = seff * (done - sr) + sr
356  end if
357