36 |
INTEGER i, j, bi, bj, Gi, Gj, k |
INTEGER i, j, bi, bj, Gi, Gj, k |
37 |
_RL vface, phi |
_RL vface, phi |
38 |
_RL stencil (-1:1) |
_RL stencil (-1:1) |
39 |
LOGICAL H0_valid ! there are valid cells to calculate a |
LOGICAL H0_valid(1-Olx:sNx+Olx,1-Oly:sNy+Oly,nSx,nSy) |
40 |
|
! there are valid cells to calculate a |
41 |
! slope-limited 2nd order flux |
! slope-limited 2nd order flux |
42 |
_RL SLOPE_LIMITER |
_RL SLOPE_LIMITER |
43 |
external SLOPE_LIMITER |
external SLOPE_LIMITER |
44 |
|
|
45 |
DO bj=myByLo(myThid),myByHi(myThid) |
DO bj=myByLo(myThid),myByHi(myThid) |
46 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
DO bi=myBxLo(myThid),myBxHi(myThid) |
47 |
|
DO j=1-oly,sNy+oly |
48 |
|
DO i=1-olx,sNx+olx |
49 |
|
H0_valid(i,j,bi,bj)=.false. |
50 |
|
ENDDO |
51 |
|
ENDDO |
52 |
|
ENDDO |
53 |
|
ENDDO |
54 |
|
|
55 |
|
DO bj=myByLo(myThid),myByHi(myThid) |
56 |
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
57 |
DO j=1-1,sNy+2 |
DO j=1-1,sNy+2 |
58 |
Gj = (myYGlobalLo-1)+(bj-1)*sNy+j |
Gj = (myYGlobalLo-1)+(bj-1)*sNy+j |
59 |
DO i=1-2,sNx+2 |
DO i=1-2,sNx+2 |
78 |
stencil (k) = h(i,j+k-1,bi,bj) |
stencil (k) = h(i,j+k-1,bi,bj) |
79 |
ENDDO |
ENDDO |
80 |
IF ((STREAMICE_hmask(i,j,bi,bj).eq.1.0) .and. |
IF ((STREAMICE_hmask(i,j,bi,bj).eq.1.0) .and. |
81 |
& (STREAMICE_hmask(i,j-2,bi,bj).eq.1.0)) H0_valid=.true. |
& (STREAMICE_hmask(i,j-2,bi,bj).eq.1.0)) |
82 |
|
& H0_valid(i,j,bi,bj)=.true. |
83 |
|
|
84 |
IF ((Gj.eq.1).and.(STREAMICE_hmask(i,j-1,bi,bj).eq.3.0)) |
IF ((Gj.eq.1).and.(STREAMICE_hmask(i,j-1,bi,bj).eq.3.0)) |
85 |
& THEN ! we are at western bdry and there is a thick. bdry cond |
& THEN ! we are at western bdry and there is a thick. bdry cond |
86 |
hflux_y (i,j,bi,bj) = h(i,j-1,bi,bj) * vface |
hflux_y (i,j,bi,bj) = h(i,j-1,bi,bj) * vface |
87 |
ELSEIF (H0_valid) THEN |
ELSEIF (H0_valid(i,j,bi,bj)) THEN |
88 |
phi = SLOPE_LIMITER ( |
phi = SLOPE_LIMITER ( |
89 |
& stencil(0)-stencil(-1), |
& stencil(0)-stencil(-1), |
90 |
& stencil(1)-stencil(0)) |
& stencil(1)-stencil(0)) |
98 |
stencil (k) = h(i,j-k,bi,bj) |
stencil (k) = h(i,j-k,bi,bj) |
99 |
ENDDO |
ENDDO |
100 |
IF ((STREAMICE_hmask(i,j-1,bi,bj).eq.1.0) .and. |
IF ((STREAMICE_hmask(i,j-1,bi,bj).eq.1.0) .and. |
101 |
& (STREAMICE_hmask(i,j+1,bi,bj).eq.1.0)) H0_valid=.true. |
& (STREAMICE_hmask(i,j+1,bi,bj).eq.1.0)) |
102 |
|
& H0_valid(i,j,bi,bj)=.true. |
103 |
|
|
104 |
IF ((Gj.eq.Ny).and.(STREAMICE_hmask(i,j+1,bi,bj).eq.3.0)) |
IF ((Gj.eq.Ny).and.(STREAMICE_hmask(i,j+1,bi,bj).eq.3.0)) |
105 |
& THEN ! we are at western bdry and there is a thick. bdry cond |
& THEN ! we are at western bdry and there is a thick. bdry cond |
106 |
hflux_y (i,j,bi,bj) = h(i,j+1,bi,bj) * vface |
hflux_y (i,j,bi,bj) = h(i,j+1,bi,bj) * vface |
107 |
ELSEIF (H0_valid) THEN |
ELSEIF (H0_valid(i,j,bi,bj)) THEN |
108 |
phi = SLOPE_LIMITER ( |
phi = SLOPE_LIMITER ( |
109 |
& stencil(0)-stencil(-1), |
& stencil(0)-stencil(-1), |
110 |
& stencil(1)-stencil(0)) |
& stencil(1)-stencil(0)) |