45 |
_RL localTij(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL localTij(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
46 |
_RL localTijk(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
_RL localTijk(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
47 |
_RL kp1Msk |
_RL kp1Msk |
48 |
|
LOGICAL calc_fluxes_X,calc_fluxes_Y |
49 |
|
INTEGER nipass,ipass |
50 |
|
|
51 |
C-- Set up work arrays with valid (i.e. not NaN) values |
C-- Set up work arrays with valid (i.e. not NaN) values |
52 |
C These inital values do not alter the numerical results. They |
C These inital values do not alter the numerical results. They |
86 |
ENDDO |
ENDDO |
87 |
ENDDO |
ENDDO |
88 |
|
|
89 |
|
IF (useCubedSphereExchange) THEN |
90 |
|
nipass=3 |
91 |
|
ELSE |
92 |
|
nipass=1 |
93 |
|
ENDIF |
94 |
|
nipass=1 |
95 |
|
|
96 |
|
C-- Multiple passes for different directions on different tiles |
97 |
|
DO ipass=1,nipass |
98 |
|
|
99 |
|
IF (nipass.EQ.3) THEN |
100 |
|
calc_fluxes_X=.FALSE. |
101 |
|
calc_fluxes_Y=.FALSE. |
102 |
|
IF (ipass.EQ.1 .AND. (bi.EQ.1 .OR. bi.EQ.2) ) THEN |
103 |
|
calc_fluxes_X=.TRUE. |
104 |
|
ELSEIF (ipass.EQ.1 .AND. (bi.EQ.4 .OR. bi.EQ.5) ) THEN |
105 |
|
calc_fluxes_Y=.TRUE. |
106 |
|
ELSEIF (ipass.EQ.2 .AND. (bi.EQ.1 .OR. bi.EQ.6) ) THEN |
107 |
|
calc_fluxes_Y=.TRUE. |
108 |
|
ELSEIF (ipass.EQ.2 .AND. (bi.EQ.3 .OR. bi.EQ.4) ) THEN |
109 |
|
calc_fluxes_X=.TRUE. |
110 |
|
ELSEIF (ipass.EQ.3 .AND. (bi.EQ.2 .OR. bi.EQ.3) ) THEN |
111 |
|
calc_fluxes_Y=.TRUE. |
112 |
|
ELSEIF (ipass.EQ.3 .AND. (bi.EQ.5 .OR. bi.EQ.6) ) THEN |
113 |
|
calc_fluxes_X=.TRUE. |
114 |
|
ENDIF |
115 |
|
ELSE |
116 |
|
calc_fluxes_X=.TRUE. |
117 |
|
calc_fluxes_Y=.TRUE. |
118 |
|
ENDIF |
119 |
|
|
120 |
|
C-- X direction |
121 |
|
IF (calc_fluxes_X) THEN |
122 |
|
|
123 |
|
C-- Internal exchange for calculations in X |
124 |
|
IF (useCubedSphereExchange) THEN |
125 |
|
DO j=1,Oly |
126 |
|
DO i=1,Olx |
127 |
|
localTij( 1-i , 1-j )=localTij( 1-j , i ) |
128 |
|
localTij( 1-i ,sNy+j)=localTij( 1-j , sNy+1-i ) |
129 |
|
localTij(sNx+i, 1-j )=localTij(sNx+j, i ) |
130 |
|
localTij(sNx+i,sNy+j)=localTij(sNx+j, sNy+1-i ) |
131 |
|
ENDDO |
132 |
|
ENDDO |
133 |
|
ENDIF |
134 |
|
|
135 |
C- Advective flux in X |
C- Advective flux in X |
136 |
DO j=1-Oly,sNy+Oly |
DO j=1-Oly,sNy+Oly |
137 |
DO i=1-Olx,sNx+Olx |
DO i=1-Olx,sNx+Olx |
172 |
END IF |
END IF |
173 |
#endif /* ALLOW_OBCS */ |
#endif /* ALLOW_OBCS */ |
174 |
|
|
175 |
|
C-- End of X direction |
176 |
|
ENDIF |
177 |
|
|
178 |
|
C-- Y direction |
179 |
|
IF (calc_fluxes_Y) THEN |
180 |
|
|
181 |
|
C-- Internal exchange for calculations in Y |
182 |
|
IF (useCubedSphereExchange) THEN |
183 |
|
DO j=1,Oly |
184 |
|
DO i=1,Olx |
185 |
|
localTij( 1-i , 1-j )=localTij( j , 1-i ) |
186 |
|
localTij( 1-i ,sNy+j)=localTij( j ,sNy+i) |
187 |
|
localTij(sNx+i, 1-j )=localTij(sNx+1-j, 1-i ) |
188 |
|
localTij(sNx+i,sNy+j)=localTij(sNx+1-j,sNy+i) |
189 |
|
ENDDO |
190 |
|
ENDDO |
191 |
|
ENDIF |
192 |
|
|
193 |
C- Advective flux in Y |
C- Advective flux in Y |
194 |
DO j=1-Oly,sNy+Oly |
DO j=1-Oly,sNy+Oly |
195 |
DO i=1-Olx,sNx+Olx |
DO i=1-Olx,sNx+Olx |
218 |
& ) |
& ) |
219 |
ENDDO |
ENDDO |
220 |
ENDDO |
ENDDO |
221 |
|
|
222 |
#ifdef ALLOW_OBCS |
#ifdef ALLOW_OBCS |
223 |
C-- Apply open boundary conditions |
C-- Apply open boundary conditions |
224 |
IF (useOBCS) THEN |
IF (useOBCS) THEN |
229 |
END IF |
END IF |
230 |
END IF |
END IF |
231 |
#endif /* ALLOW_OBCS */ |
#endif /* ALLOW_OBCS */ |
232 |
DO j=1-Oly,sNy+Oly-1 |
|
233 |
|
C-- End of Y direction |
234 |
|
ENDIF |
235 |
|
|
236 |
|
DO j=1-Oly,sNy+Oly |
237 |
DO i=1-Olx,sNx+Olx |
DO i=1-Olx,sNx+Olx |
238 |
localTijk(i,j,k)=localTij(i,j) |
localTijk(i,j,k)=localTij(i,j) |
239 |
ENDDO |
ENDDO |
240 |
ENDDO |
ENDDO |
241 |
|
|
242 |
|
C-- End of ipass loop |
243 |
|
ENDDO |
244 |
|
|
245 |
C-- End of K loop for horizontal fluxes |
C-- End of K loop for horizontal fluxes |
246 |
ENDDO |
ENDDO |