Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:44:06 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
5ca83cd8f7 Dani*0001 #include "CPP_OPTIONS.h"
                0002 
                0003       _RL FUNCTION ETA_GL_STREAMICE (X, M1, M2, Y0, W)
                0004 
                0005 !      This function smooths out slope discontinuities in a 1D function
                0006 !      y(x) is assumed piecewise linear with a slope discontinuity at 0
                0007 !      the results is smoothed only on -w/2 < x < w/2
                0008 
                0009 !     X: input variable
                0010 !     M1: slope of y where x<0
                0011 !     M2: slope of y where x>0
                0012 !     Y0: value of y at 0
                0013 !     W: width of smoothing
                0014 
                0015        _RL X, M1, M2, Y0, W
                0016        _RL TMP1, PI
                0017 
08ccc3afe7 Dani*0018        IF (X.le.-0.5*W) THEN
5ca83cd8f7 Dani*0019          ETA_GL_STREAMICE = Y0 + M1 * X
08ccc3afe7 Dani*0020        ELSEIF(X.gt.0.5*W) THEN
5ca83cd8f7 Dani*0021          ETA_GL_STREAMICE = Y0 + M2 * X
                0022        ELSE
                0023          PI = 3.14159265358979323844D0
                0024          TMP1 = W/PI * COS(PI*X/W)
                0025          ETA_GL_STREAMICE = Y0 + 
08ccc3afe7 Dani*0026      &     M1/2 * (X-0.5*W+TMP1) + 
                0027      &     M2/2 * (X+0.5*W-TMP1)
5ca83cd8f7 Dani*0028        ENDIF
                0029 
                0030        RETURN
                0031        END