/[MITgcm]/MITgcm/pkg/exch2/exch2_z_xy_rx.template
ViewVC logotype

Contents of /MITgcm/pkg/exch2/exch2_z_xy_rx.template

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Sun Jul 24 01:35:06 2005 UTC (18 years, 11 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint57t_post, checkpoint58l_post, checkpoint57o_post, checkpoint57y_post, checkpoint57r_post, checkpoint58c_post, checkpoint58g_post, checkpoint57x_post, checkpoint58k_post, checkpoint57m_post, checkpoint58, checkpoint58e_post, checkpoint57v_post, checkpoint58n_post, checkpoint58h_post, checkpoint58f_post, checkpoint57s_post, checkpoint58b_post, checkpoint58m_post, checkpoint57n_post, checkpoint58j_post, checkpoint58d_post, checkpoint57w_post, checkpoint57p_post, checkpint57u_post, checkpoint58a_post, checkpoint58i_post, checkpoint57q_post, checkpoint57y_pre, checkpoint57z_post
Changes since 1.1: +39 -16 lines
filling of face-corner halo regions is now optional (ifdef W2_FILL_NULL_REGIONS)
 and using a filling value (non necessary zero, for testing purpose).
Default is #undef W2_FILL_NULL_REGIONS

1 C $Header: /u/gcmpack/MITgcm/pkg/exch2/exch2_z_xy_rx.template,v 1.1 2004/09/22 15:23:00 jmc Exp $
2 C $Name: $
3
4 #include "CPP_EEOPTIONS.h"
5 #include "W2_OPTIONS.h"
6
7 CBOP
8
9 C !ROUTINE: EXCH_Z_XY_RX
10
11 C !INTERFACE:
12 SUBROUTINE EXCH2_Z_XY_RX(
13 U phi,
14 I myThid )
15 IMPLICIT NONE
16 C !DESCRIPTION:
17 C *==========================================================*
18 C | SUBROUTINE EXCH_Z_XY_RX
19 C | o Handle exchanges for _RX two-dim zeta-point array.
20 C *==========================================================*
21 C | Invoke appropriate exchange for a zeta-point array
22 C | for either global grid, or cube sphere grid.
23 C *==========================================================*
24
25 C !USES:
26 C === Global data ===
27 #include "SIZE.h"
28 #include "EEPARAMS.h"
29 #include "EESUPPORT.h"
30 #include "W2_EXCH2_TOPOLOGY.h"
31 #include "W2_EXCH2_PARAMS.h"
32
33 C !INPUT/OUTPUT PARAMETERS:
34 C === Routine arguments ===
35 C phi :: Array with overlap regions are to be exchanged
36 C myThid :: My thread id.
37 _RX phi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
38 INTEGER myThid
39
40 C !LOCAL VARIABLES:
41 C == Local variables ==
42 C OL[wens] :: Overlap extents in west, east, north, south.
43 C exchWidth[XY] :: Extent of regions that will be exchanged.
44 C mFace :: face number
45 C phiNW,phiSE :: temporary array to hold corner value (CS grid)
46 INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY, myNz
47 INTEGER bi, bj, myTile, i, j
48 INTEGER mFace
49 _RX phiNW(nSx,nSy)
50 _RX phiSE(nSx,nSy)
51 CEOP
52
53
54 OLw = OLx
55 OLe = OLx
56 OLn = OLy
57 OLs = OLy
58 exchWidthX = OLx
59 exchWidthY = OLy
60 myNz = 1
61 C ** NOTE ** The exchange routine we use here does not
62 C require the preceeding and following barriers.
63 C However, the slow, simple exchange interface
64 C that is calling it here is meant to ensure
65 C that threads are synchronised before exchanges
66 C begine.
67
68 IF (useCubedSphereExchange) THEN
69
70 C- save 2 corners value (in case we find 1 "missing corner")
71 DO bj=myByLo(myThid),myByHi(myThid)
72 DO bi=myBxLo(myThid),myBxHi(myThid)
73 phiNW(bi,bj) = phi(1,sNy+1,bi,bj)
74 phiSE(bi,bj) = phi(sNx+1,1,bi,bj)
75 ENDDO
76 ENDDO
77
78 CALL EXCH2_RX1_CUBE( phi, 'T ',
79 I OLw, OLe, OLs, OLn, myNz,
80 I exchWidthX, exchWidthY,
81 I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
82 CALL EXCH2_RX1_CUBE( phi, 'T ',
83 I OLw, OLe, OLs, OLn, myNz,
84 I exchWidthX, exchWidthY,
85 I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
86
87 DO bj=myByLo(myThid),myByHi(myThid)
88 DO bi=myBxLo(myThid),myBxHi(myThid)
89 myTile = W2_myTileList(bi)
90 mFace = exch2_myFace(myTile)
91
92 C--- Face 2,4,6:
93 IF ( MOD(mFace,2).EQ.0 ) THEN
94
95 C-- East edge : shift j <- j-1
96 IF ( exch2_isEedge(myTile) .EQ. 1 ) THEN
97 DO j=sNy+OLy,2-Oly,-1
98 DO i=sNx+1,sNx+OLx
99 phi(i,j,bi,bj)=phi(i,j-1,bi,bj)
100 ENDDO
101 ENDDO
102 C- North-East corner
103 IF ( exch2_isNedge(myTile) .EQ. 1 ) THEN
104 DO j=sNy+2,sNy+OLy
105 i=sNx-sNy+j
106 phi(sNx+1,j,bi,bj)=phi(i,sNy+1,bi,bj)
107 ENDDO
108 #ifdef W2_FILL_NULL_REGIONS
109 DO j=sNy+2,sNy+OLy
110 DO i=sNx+2,sNx+OLx
111 phi(i,j,bi,bj)=e2FillValue_RX
112 ENDDO
113 ENDDO
114 #endif
115 ENDIF
116 ENDIF
117 C-- South edge : shift i <- i-1
118 IF ( exch2_isSedge(myTile) .EQ. 1 ) THEN
119 DO j=1-OLy,0
120 DO i=sNx+OLx,2-Olx,-1
121 phi(i,j,bi,bj)=phi(i-1,j,bi,bj)
122 ENDDO
123 ENDDO
124 C- South-East corner
125 IF ( exch2_isEedge(myTile) .EQ. 1 ) THEN
126 phi(sNx+1,1,bi,bj)=phiSE(bi,bj)
127 DO i=sNx+2,sNx+OLx
128 j=sNx+2-i
129 phi(i,1,bi,bj)=phi(sNx+1,j,bi,bj)
130 ENDDO
131 #ifdef W2_FILL_NULL_REGIONS
132 DO j=1-OLy,0
133 DO i=sNx+2,sNx+OLx
134 phi(i,j,bi,bj)=e2FillValue_RX
135 ENDDO
136 ENDDO
137 #endif
138 ENDIF
139 C- South-West corner
140 IF ( exch2_isWedge(myTile) .EQ. 1 ) THEN
141 DO j=1-OLy,0
142 phi(1,j,bi,bj)=phi(j,1,bi,bj)
143 #ifdef W2_FILL_NULL_REGIONS
144 DO i=1-OLx,0
145 phi(i,j,bi,bj)=e2FillValue_RX
146 ENDDO
147 #endif
148 ENDDO
149 ENDIF
150 ENDIF
151 C-- North-west corner
152 IF ( exch2_isWedge(myTile) .EQ. 1 .AND.
153 & exch2_isNedge(myTile) .EQ. 1 ) THEN
154 DO i=2-OLx,0
155 j=sNy+2-i
156 phi(i,sNy+1,bi,bj)=phi(1,j,bi,bj)
157 ENDDO
158 #ifdef W2_FILL_NULL_REGIONS
159 DO j=sNy+2,sNy+OLy
160 DO i=1-OLx,0
161 phi(i,j,bi,bj)=e2FillValue_RX
162 ENDDO
163 ENDDO
164 phi(1-Olx,sNy+1,bi,bj)=e2FillValue_RX
165 #endif
166 ENDIF
167
168 ELSE
169 C--- Face 1,3,5:
170
171 C-- North edge : shift i <- i-1
172 IF ( exch2_isNedge(myTile) .EQ. 1 ) THEN
173 DO j=sNy+1,sNy+Oly
174 DO i=sNx+OLx,2-Olx,-1
175 phi(i,j,bi,bj)=phi(i-1,j,bi,bj)
176 ENDDO
177 ENDDO
178 C- North-East corner
179 IF ( exch2_isEedge(myTile) .EQ. 1 ) THEN
180 DO i=sNx+2,sNx+OLx
181 j=sNy-sNx+i
182 phi(i,sNy+1,bi,bj)=phi(sNx+1,j,bi,bj)
183 ENDDO
184 #ifdef W2_FILL_NULL_REGIONS
185 DO j=sNy+2,sNy+OLy
186 DO i=sNx+2,sNx+OLx
187 phi(i,j,bi,bj)=e2FillValue_RX
188 ENDDO
189 ENDDO
190 #endif
191 ENDIF
192 ENDIF
193 C-- West edge : shift j <- j-1
194 IF ( exch2_isWedge(myTile) .EQ. 1 ) THEN
195 DO j=sNy+OLy,2-Oly,-1
196 DO i=1-Olx,0
197 phi(i,j,bi,bj)=phi(i,j-1,bi,bj)
198 ENDDO
199 ENDDO
200 C- North-west corner
201 IF ( exch2_isNedge(myTile) .EQ. 1 ) THEN
202 phi(1,sNy+1,bi,bj)=phiNW(bi,bj)
203 DO j=sNy+2,sNy+OLy
204 i=sNy+2-j
205 phi(1,j,bi,bj)=phi(i,sNy+1,bi,bj)
206 ENDDO
207 #ifdef W2_FILL_NULL_REGIONS
208 DO j=sNy+2,sNy+OLy
209 DO i=1-OLx,0
210 phi(i,j,bi,bj)=e2FillValue_RX
211 ENDDO
212 ENDDO
213 #endif
214 ENDIF
215 C- South-West corner
216 IF ( exch2_isSedge(myTile) .EQ. 1 ) THEN
217 DO i=1-OLx,0
218 phi(i,1,bi,bj)=phi(1,i,bi,bj)
219 ENDDO
220 #ifdef W2_FILL_NULL_REGIONS
221 DO j=1-OLy,0
222 DO i=1-OLx,0
223 phi(i,j,bi,bj)=e2FillValue_RX
224 ENDDO
225 ENDDO
226 #endif
227 ENDIF
228 ENDIF
229 C- South-East corner
230 IF ( exch2_isEedge(myTile) .EQ. 1 .AND.
231 & exch2_isSedge(myTile) .EQ. 1 ) THEN
232 DO j=2-OLy,0
233 i=sNx+2-j
234 phi(sNx+1,j,bi,bj)=phi(i,1,bi,bj)
235 ENDDO
236 #ifdef W2_FILL_NULL_REGIONS
237 DO j=1-OLy,0
238 DO i=sNx+2,sNx+OLx
239 phi(i,j,bi,bj)=e2FillValue_RX
240 ENDDO
241 ENDDO
242 phi(sNx+1,1-Oly,bi,bj)=e2FillValue_RX
243 #endif
244 ENDIF
245
246 C--- end odd / even face number
247 ENDIF
248
249 ENDDO
250 ENDDO
251
252 ELSE
253
254 CALL EXCH_RX( phi,
255 I OLw, OLe, OLs, OLn, myNz,
256 I exchWidthX, exchWidthY,
257 I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
258
259 ENDIF
260
261 RETURN
262 END
263
264 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
265
266 CEH3 ;;; Local Variables: ***
267 CEH3 ;;; mode:fortran ***
268 CEH3 ;;; End: ***

  ViewVC Help
Powered by ViewVC 1.1.22