/[MITgcm]/MITgcm/eesupp/src/exch_uv_rx_cube.template
ViewVC logotype

Contents of /MITgcm/eesupp/src/exch_uv_rx_cube.template

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


Revision 1.3 - (show annotations) (download)
Fri Sep 21 03:55:50 2001 UTC (22 years, 7 months ago) by cnh
Branch: MAIN
CVS Tags: checkpoint46n_post, checkpoint51k_post, checkpoint47e_post, checkpoint52l_pre, checkpoint44e_post, hrcube4, hrcube5, checkpoint46l_post, checkpoint46g_pre, checkpoint47c_post, release1_p13_pre, checkpoint50c_post, checkpoint46f_post, checkpoint52d_pre, checkpoint48e_post, checkpoint50g_post, checkpoint46b_post, checkpoint52j_pre, checkpoint43a-release1mods, checkpoint51o_pre, checkpoint44g_post, checkpoint54d_post, checkpoint48c_post, checkpoint54e_post, ecco_c50_e32, ecco_c50_e33, ecco_c50_e30, ecco_c50_e31, release1_p13, checkpoint51l_post, checkpoint48i_post, checkpoint46l_pre, checkpoint50d_pre, checkpoint52k_post, chkpt44d_post, checkpoint55, checkpoint54, checkpoint51, checkpoint53, checkpoint52, release1_p8, release1_p9, checkpoint50d_post, release1_p1, release1_p2, release1_p3, release1_p4, release1_p5, release1_p6, release1_p7, checkpoint52f_post, checkpoint50b_pre, checkpoint44e_pre, checkpoint54f_post, checkpoint51f_post, release1_b1, ecco_c51_e34d, ecco_c51_e34e, ecco_c51_e34f, ecco_c51_e34g, ecco_c51_e34a, ecco_c51_e34b, ecco_c51_e34c, checkpoint48b_post, checkpoint43, checkpoint51d_post, checkpoint48c_pre, checkpoint55a_post, checkpoint51t_post, checkpoint51n_post, release1_chkpt44d_post, checkpoint52i_pre, hrcube_2, hrcube_3, checkpoint51s_post, checkpoint48d_pre, checkpoint51j_post, checkpoint47i_post, checkpoint52e_pre, release1_p11, checkpoint52e_post, checkpoint51n_pre, checkpoint47d_post, icebear5, icebear4, icebear3, icebear2, checkpoint53d_post, checkpoint46d_pre, checkpoint48d_post, release1-branch_tutorials, checkpoint48f_post, checkpoint45d_post, checkpoint52b_pre, checkpoint54b_post, checkpoint46j_pre, ecco_c50_e28, checkpoint51l_pre, checkpoint52m_post, checkpoint47d_pre, chkpt44a_post, checkpoint44h_pre, checkpoint48h_post, checkpoint51q_post, ecco_c50_e29, checkpoint51b_pre, checkpoint46a_post, checkpoint47g_post, checkpoint52b_post, checkpoint52c_post, checkpoint46j_post, checkpoint51h_pre, checkpoint46k_post, checkpoint46b_pre, chkpt44c_pre, checkpoint52h_pre, checkpoint45a_post, checkpoint50f_post, checkpoint50a_post, checkpoint50f_pre, hrcube_1, checkpoint51m_post, ecco_c44_e19, ecco_c44_e18, ecco_c44_e17, ecco_c44_e16, release1_p12, release1_p10, release1_p16, release1_p17, release1_p14, release1_p15, checkpoint47a_post, ecco_c50_e33a, checkpoint53c_post, branchpoint-genmake2, checkpoint54a_post, checkpoint46e_pre, checkpoint51r_post, checkpoint45b_post, checkpoint51i_post, release1-branch-end, release1_final_v1, checkpoint51b_post, release1_p12_pre, checkpoint46c_pre, checkpoint53a_post, checkpoint44f_post, checkpoint47b_post, checkpoint44b_post, ecco_c51_e34, checkpoint46h_pre, checkpoint52d_post, checkpoint53g_post, checkpoint46m_post, checkpoint46a_pre, checkpoint50c_pre, checkpoint45c_post, ecco_ice2, ecco_ice1, checkpoint44h_post, checkpoint46g_post, checkpoint51c_post, checkpoint52a_pre, checkpoint46i_post, checkpoint50h_post, checkpoint52i_post, checkpoint50e_pre, checkpoint50i_post, ecco_c44_e25, checkpoint51i_pre, checkpoint48a_post, checkpoint53f_post, checkpoint47j_post, checkpoint54a_pre, checkpoint53b_pre, branch-exfmods-tag, checkpoint52j_post, checkpoint47f_post, checkpoint50e_post, chkpt44a_pre, ecco_c44_e22, ecco_c44_e23, ecco_c44_e20, ecco_c44_e21, ecco_c44_e26, ecco_c44_e27, ecco_c44_e24, checkpoint46c_post, ecco-branch-mod1, ecco-branch-mod2, ecco-branch-mod3, ecco-branch-mod4, ecco-branch-mod5, branch-netcdf, checkpoint52l_post, checkpoint52n_post, checkpoint46e_post, release1_beta1, checkpoint51e_post, checkpoint44b_pre, checkpoint42, checkpoint41, checkpoint46, checkpoint47, checkpoint44, checkpoint45, checkpoint48, checkpoint49, checkpoint46h_post, checkpoint51o_post, checkpoint50, checkpoint51f_pre, chkpt44c_post, checkpoint53b_post, checkpoint47h_post, checkpoint52a_post, checkpoint44f_pre, checkpoint51g_post, ecco_c52_e35, checkpoint46d_post, checkpoint50b_post, release1-branch_branchpoint, checkpoint52f_pre, checkpoint53d_pre, checkpoint54c_post, checkpoint51a_post, checkpoint51p_post, checkpoint48g_post, checkpoint51u_post
Branch point for: c24_e25_ice, branch-exfmods-curt, release1_coupled, release1_final, release1-branch, branch-genmake2, release1, branch-nonh, tg2-branch, ecco-branch, release1_50yr, netcdf-sm0, icebear, checkpoint51n_branch
Changes since 1.2: +59 -43 lines
Starting to bring comments up to date and format comments
for document extraction of "prototypes".

1 C $Header: /u/gcmpack/models/MITgcmUV/eesupp/src/exch_uv_rx_cube.template,v 1.2 2001/05/29 14:01:36 adcroft Exp $
2 C $Name: $
3
4 #include "CPP_EEOPTIONS.h"
5
6 CBOP
7 C !ROUTINE: EXCH_UV_RX_CUBE
8
9 C !INTERFACE:
10 SUBROUTINE EXCH_UV_RX_CUBE(
11 U Uarray,Varray, withSigns,
12 I myOLw, myOLe, myOLn, myOLs, myNz,
13 I exchWidthX, exchWidthY,
14 I simulationMode, cornerMode, myThid )
15 IMPLICIT NONE
16
17 C !DESCRIPTION:
18 C *==========================================================*
19 C | SUBROUTINE EXCH_UV_RX_CUBE
20 C | o Control edge exchanges for RX array for CS config.
21 C *==========================================================*
22 C |
23 C | Controlling routine for exchange of XY edges of an array
24 C | distributed in X and Y. The routine interfaces to
25 C | communication routines that can use messages passing
26 C | exchanges, put type exchanges or get type exchanges.
27 C | This allows anything from MPI to raw memory channel to
28 C | memmap segments to be used as a inter-process and/or
29 C | inter-thread communiation and synchronisation
30 C | mechanism.
31 C | Notes --
32 C | 1. Some low-level mechanisms such as raw memory-channel
33 C | or SGI/CRAY shmem put do not have direct Fortran bindings
34 C | and are invoked through C stub routines.
35 C | 2. Although this routine is fairly general but it does
36 C | require nSx and nSy are the same for all innvocations.
37 C | There are many common data structures ( myByLo,
38 C | westCommunicationMode, mpiIdW etc... ) tied in with
39 C | (nSx,nSy). To support arbitray nSx and nSy would require
40 C | general forms of these.
41 C | 3. Exchanges on the cube of vector quantities need to be
42 C | paired to allow rotations and sign reversal to be applied
43 C | consistently between vector components as they rotate.
44 C |
45 C *==========================================================*
46
47 C !USES:
48 C == Global data ==
49 #include "SIZE.h"
50 #include "EEPARAMS.h"
51 #include "EESUPPORT.h"
52 #include "EXCH.h"
53
54 C !INPUT/OUTPUT PARAMETERS:
55 C == Routine arguments ==
56 C Uarray :: (u-type) Array with edges to exchange.
57 C Varray :: (v-type) Array with edges to exchange.
58 C withSigns :: Uarray,Varray are vector components.
59 C myOLw :: West, East, North and South overlap region sizes.
60 C myOLe
61 C myOLn
62 C myOLs
63 C exchWidthX :: Width of data region exchanged in X.
64 C exchWidthY :: Width of data region exchanged in Y.
65 C Note --
66 C 1. In theory one could have a send width and
67 C a receive width for each face of each tile. The only
68 C restriction woul be that the send width of one
69 C face should equal the receive width of the sent to
70 C tile face. Dont know if this would be useful. I
71 C have left it out for now as it requires additional
72 C bookeeping.
73 C simulationMode :: Forward or reverse mode exchange ( provides
74 C support for adjoint integration of code. )
75 C cornerMode :: Flag indicating whether corner updates are
76 C needed.
77 C myThid :: Thread number of this instance of S/R EXCH...
78 LOGICAL withSigns
79 INTEGER myOLw
80 INTEGER myOLe
81 INTEGER myOLs
82 INTEGER myOLn
83 INTEGER myNz
84 INTEGER exchWidthX
85 INTEGER exchWidthY
86 INTEGER simulationMode
87 INTEGER cornerMode
88 INTEGER myThid
89 _RX Uarray(1-myOLw:sNx+myOLe,
90 & 1-myOLs:sNy+myOLn,
91 & myNZ, nSx, nSy)
92 _RX Varray(1-myOLw:sNx+myOLe,
93 & 1-myOLs:sNy+myOLn,
94 & myNZ, nSx, nSy)
95
96 C !LOCAL VARIABLES:
97 C == Local variables ==
98 C theSimulationMode :: Holds working copy of simulation mode
99 C theCornerMode :: Holds working copy of corner mode
100 C I,J,K :: Loop counters and index variables
101 C bl,bt,bn,bs,be,bw
102 C negOne,Utmp,Vtmp :: Temps used in swapping and rotating
103 C vectors.
104 INTEGER theSimulationMode
105 INTEGER theCornerMode
106 INTEGER I,J,K,repeat
107 INTEGER bl,bt,bn,bs,be,bw
108 _RL negOne,Utmp,Vtmp
109 C == Statement function ==
110 C tilemod :: Permutes indices to return neighboring tile index on
111 C six face cube.
112 INTEGER tilemod
113 tilemod(I)=1+mod(I-1+6,6)
114 CEOP
115
116 theSimulationMode = simulationMode
117 theCornerMode = cornerMode
118
119 negOne = 1.
120 IF (withSigns) negOne = -1.
121
122 C For now tile<->tile exchanges are sequentialised through
123 C thread 1. This is a temporary feature for preliminary testing until
124 C general tile decomposistion is in place (CNH April 11, 2001)
125 CALL BAR2( myThid )
126 IF ( myThid .EQ. 1 ) THEN
127
128 DO repeat=1,2
129
130 DO bl = 1, 5, 2
131
132 bt = bl
133 bn=tilemod(bt+2)
134 bs=tilemod(bt-1)
135 be=tilemod(bt+1)
136 bw=tilemod(bt-2)
137
138 DO K = 1,myNz
139
140 C Tile Odd:Odd+2 [get] [North<-West]
141 DO J = 1,sNy+1
142 DO I = 1,exchWidthX
143 Uarray(J,sNy+I,K,bt,1) = negOne*Varray(I,sNy+2-J,K,bn,1)
144 ENDDO
145 ENDDO
146 DO J = 1,sNy
147 DO I = 1,exchWidthX
148 Varray(J,sNy+I,K,bt,1) = Uarray(I,sNy+1-J,K,bn,1)
149 ENDDO
150 ENDDO
151 C Tile Odd:Odd-1 [get] [South<-North]
152 DO J = 1,sNy+1
153 DO I = 1,exchWidthX
154 Uarray(J,1-I,K,bt,1) = Uarray(J,sNy+1-I,K,bs,1)
155 ENDDO
156 ENDDO
157 DO J = 1,sNy
158 DO I = 1,exchWidthX
159 Varray(J,1-I,K,bt,1) = Varray(J,sNy+1-I,K,bs,1)
160 ENDDO
161 ENDDO
162 C Tile Odd:Odd+1 [get] [East<-West]
163 DO J = 1,sNy
164 DO I = 1,exchWidthX
165 Uarray(sNx+I,J,K,bt,1) = Uarray(I,J,K,be,1)
166 ENDDO
167 ENDDO
168 DO J = 1,sNy+1
169 DO I = 1,exchWidthX
170 Varray(sNx+I,J,K,bt,1) = Varray(I,J,K,be,1)
171 ENDDO
172 ENDDO
173 C Tile Odd:Odd-2 [get] [West<-North]
174 DO J = 1,sNy
175 DO I = 1,exchWidthX
176 Uarray(1-I,J,K,bt,1) = Varray(sNx+1-J,sNy+1-I,K,bw,1)
177 ENDDO
178 ENDDO
179 DO J = 1,sNy+1
180 DO I = 1,exchWidthX
181 Varray(1-I,J,K,bt,1) = negOne*Uarray(sNx+2-J,sNy+1-I,K,bw,1)
182 ENDDO
183 ENDDO
184
185 ENDDO
186
187 bt = bl+1
188 bn=tilemod(bt+1)
189 bs=tilemod(bt-2)
190 be=tilemod(bt+2)
191 bw=tilemod(bt-1)
192
193 DO K = 1,myNz
194
195 C Tile Even:Even+1 [get] [North<-South]
196 DO J = 1,sNy+1
197 DO I = 1,exchWidthX
198 Uarray(J,sNy+I,K,bt,1) = Uarray(J,I,K,bn,1)
199 ENDDO
200 ENDDO
201 DO J = 1,sNy
202 DO I = 1,exchWidthX
203 Varray(J,sNy+I,K,bt,1) = Varray(J,I,K,bn,1)
204 ENDDO
205 ENDDO
206 C Tile Even:Even-2 [get] [South<-East]
207 DO J = 1,sNy+1
208 DO I = 1,exchWidthX
209 Uarray(J,1-I,K,bt,1) = negOne*Varray(sNx+1-I,sNy+2-J,K,bs,1)
210 ENDDO
211 ENDDO
212 DO J = 1,sNy
213 DO I = 1,exchWidthX
214 Varray(J,1-I,K,bt,1) = Uarray(sNx+1-I,sNy+1-J,K,bs,1)
215 ENDDO
216 ENDDO
217 C Tile Even:Even+2 [get] [East<-South]
218 DO J = 1,sNy
219 DO I = 1,exchWidthX
220 Uarray(sNx+I,J,K,bt,1) = Varray(sNx+1-J,I,K,be,1)
221 ENDDO
222 ENDDO
223 DO J = 1,sNy+1
224 DO I = 1,exchWidthX
225 Varray(sNx+I,J,K,bt,1) = negOne*Uarray(sNx+2-J,I,K,be,1)
226 ENDDO
227 ENDDO
228 C Tile Even:Even-1 [get] [West<-East]
229 DO J = 1,sNy
230 DO I = 1,exchWidthX
231 Uarray(1-I,J,K,bt,1) = Uarray(sNx+1-I,J,K,bw,1)
232 ENDDO
233 ENDDO
234 DO J = 1,sNy+1
235 DO I = 1,exchWidthX
236 Varray(1-I,J,K,bt,1) = Varray(sNx+1-I,J,K,bw,1)
237 ENDDO
238 ENDDO
239
240 ENDDO
241
242 ENDDO
243
244 C Fix degeneracy at corners
245 IF (.FALSE.) THEN
246 c IF (withSigns) THEN
247 DO bt = 1, 6
248 DO K = 1,myNz
249 C Top left
250 Utmp=0.5*(Uarray(1,sNy,K,bt,1)+Uarray(0,sNy,K,bt,1))
251 Vtmp=0.5*(Varray(0,sNy+1,K,bt,1)+Varray(0,sNy,K,bt,1))
252 Varray(0,sNx+1,K,bt,1)=(Vtmp-Utmp)*0.70710678
253 Utmp=0.5*(Uarray(1,sNy+1,K,bt,1)+Uarray(2,sNy+1,K,bt,1))
254 Vtmp=0.5*(Varray(1,sNy+1,K,bt,1)+Varray(1,sNy+2,K,bt,1))
255 Uarray(1,sNy+1,K,bt,1)=(Utmp-Vtmp)*0.70710678
256 C Bottom right
257 Utmp=0.5*(Uarray(sNx+1,1,K,bt,1)+Uarray(sNx+2,1,K,bt,1))
258 Vtmp=0.5*(Varray(sNx+1,1,K,bt,1)+Varray(sNx+1,2,K,bt,1))
259 Varray(sNx+1,1,K,bt,1)=(Vtmp-Utmp)*0.70710678
260 Utmp=0.5*(Uarray(sNx+1,0,K,bt,1)+Uarray(sNx,0,K,bt,1))
261 Vtmp=0.5*(Varray(sNx,1,K,bt,1)+Varray(sNx,0,K,bt,1))
262 Uarray(sNx+1,0,K,bt,1)=(Utmp-Vtmp)*0.70710678
263 C Bottom left
264 Utmp=0.5*(Uarray(1,1,K,bt,1)+Uarray(0,1,K,bt,1))
265 Vtmp=0.5*(Varray(0,1,K,bt,1)+Varray(0,2,K,bt,1))
266 Varray(0,1,K,bt,1)=(Vtmp+Utmp)*0.70710678
267 Utmp=0.5*(Uarray(1,0,K,bt,1)+Uarray(2,0,K,bt,1))
268 Vtmp=0.5*(Varray(1,1,K,bt,1)+Varray(1,0,K,bt,1))
269 Uarray(1,0,K,bt,1)=(Utmp+Vtmp)*0.70710678
270 C Top right
271 Utmp=0.5*(Uarray(sNx+1,sNy,K,bt,1)+Uarray(sNx+2,sNy,K,bt,1))
272 Vtmp=0.5*(Varray(sNx+1,sNy+1,K,bt,1)+Varray(sNx+1,sNy,K,bt,1))
273 Varray(sNx+1,sNy+1,K,bt,1)=(Vtmp+Utmp)*0.70710678
274 Utmp=0.5*(Uarray(sNx+1,sNy+1,K,bt,1)+Uarray(sNx,sNy+1,K,bt,1))
275 Vtmp=0.5*(Varray(sNx,sNy+1,K,bt,1)+Varray(sNx,sNy+2,K,bt,1))
276 Uarray(sNx+1,sNy+1,K,bt,1)=(Utmp+Vtmp)*0.70710678
277 ENDDO
278 ENDDO
279 ENDIF
280
281 ENDDO
282
283 ENDIF
284 CALL BAR2(myThid)
285
286 RETURN
287 END

  ViewVC Help
Powered by ViewVC 1.1.22