1 |
dgoldberg |
1.1 |
#include "CPP_OPTIONS.h" |
2 |
|
|
|
3 |
|
|
_RL FUNCTION ETA_GL_STREAMICE (X, M1, M2, Y0, W) |
4 |
|
|
|
5 |
|
|
! This function smooths out slope discontinuities in a 1D function |
6 |
|
|
! y(x) is assumed piecewise linear with a slope discontinuity at 0 |
7 |
|
|
! the results is smoothed only on -w/2 < x < w/2 |
8 |
|
|
|
9 |
|
|
! X: input variable |
10 |
|
|
! M1: slope of y where x<0 |
11 |
|
|
! M2: slope of y where x>0 |
12 |
|
|
! Y0: value of y at 0 |
13 |
|
|
! W: width of smoothing |
14 |
|
|
|
15 |
|
|
_RL X, M1, M2, Y0, W |
16 |
|
|
_RL TMP1, PI |
17 |
|
|
|
18 |
|
|
IF (X<-1.0*W/2.0) THEN |
19 |
|
|
ETA_GL_STREAMICE = Y0 + M1 * X |
20 |
|
|
ELSEIF(X>W/2.0) THEN |
21 |
|
|
ETA_GL_STREAMICE = Y0 + M2 * X |
22 |
|
|
ELSE |
23 |
|
|
PI = 3.14159265358979323844D0 |
24 |
|
|
TMP1 = W/PI * COS(PI*X/W) |
25 |
|
|
ETA_GL_STREAMICE = Y0 + |
26 |
|
|
& M1/2 * (X-W/2+TMP1) + |
27 |
|
|
& M2/2 * (X+W/2-TMP1) |
28 |
|
|
ENDIF |
29 |
|
|
|
30 |
|
|
RETURN |
31 |
|
|
END |