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