/[MITgcm]/MITgcm/pkg/flt/flt_exchg.F
ViewVC logotype

Annotation of /MITgcm/pkg/flt/flt_exchg.F

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


Revision 1.2 - (hide annotations) (download)
Tue Sep 7 16:19:30 2004 UTC (19 years, 8 months ago) by edhill
Branch: MAIN
CVS Tags: checkpoint57m_post, checkpoint57g_pre, checkpoint57s_post, checkpoint58b_post, checkpoint57b_post, checkpoint57g_post, checkpoint56b_post, checkpoint57y_post, checkpoint57r_post, checkpoint57d_post, checkpoint57i_post, checkpoint59, checkpoint58, checkpoint55, checkpoint57, checkpoint56, checkpoint58f_post, checkpoint57n_post, checkpoint58d_post, checkpoint58a_post, checkpoint57z_post, checkpoint54f_post, checkpoint58y_post, checkpoint58t_post, checkpoint55i_post, checkpoint58m_post, checkpoint57l_post, checkpoint57t_post, checkpoint55c_post, checkpoint57v_post, checkpoint57f_post, checkpoint57a_post, checkpoint57h_pre, checkpoint58w_post, checkpoint57h_post, checkpoint57y_pre, checkpoint55g_post, checkpoint58o_post, checkpoint57c_post, checkpoint58p_post, checkpoint58q_post, checkpoint55d_post, checkpoint58e_post, checkpoint55d_pre, checkpoint57c_pre, checkpoint58r_post, checkpoint55j_post, checkpoint55h_post, checkpoint58n_post, checkpoint57e_post, checkpoint55b_post, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint55f_post, checkpoint59c, checkpoint59b, checkpoint59h, checkpoint57p_post, checkpint57u_post, checkpoint57q_post, eckpoint57e_pre, checkpoint58k_post, checkpoint58v_post, checkpoint56a_post, checkpoint58l_post, checkpoint57h_done, checkpoint57j_post, checkpoint57f_pre, checkpoint58g_post, checkpoint58x_post, checkpoint58h_post, checkpoint56c_post, checkpoint58j_post, checkpoint57a_pre, checkpoint55a_post, checkpoint57o_post, checkpoint57k_post, checkpoint57w_post, checkpoint58i_post, checkpoint57x_post, checkpoint58c_post, checkpoint58u_post, checkpoint58s_post, checkpoint55e_post
Changes since 1.1: +304 -254 lines
 o add Antti Westerlund's extensions to make flt work with 3D velocity
   fields

1 edhill 1.2 C /u/gcmpack/MITgcm/pkg/flt/flt_exchg.F,v 1.1 2001/09/13 17:43:55 adcroft Exp
2     C checkpoint52h_pre
3 adcroft 1.1
4     #include "FLT_CPPOPTIONS.h"
5    
6     subroutine flt_exchg (
7     I myCurrentIter,
8     I myCurrentTime,
9     I myThid
10     & )
11    
12     c ==================================================================
13     c SUBROUTINE flt_exchg
14     c ==================================================================
15     c
16 edhill 1.2 c o Exchange particles between tiles.
17     c
18     c started: Arne Biastoch
19     c
20     c changed: Antti Westerlund antti.westerlund@helsinki.fi 2004.06.10
21 adcroft 1.1 c
22     c ==================================================================
23     c SUBROUTINE flt_exchg
24     c ==================================================================
25    
26     c == global variables ==
27    
28     #include "SIZE.h"
29     #include "EEPARAMS.h"
30     #include "EESUPPORT.h"
31     #include "EXCH.h"
32     #include "FLT.h"
33     #include "GRID.h"
34     #include "PARAMS.h"
35    
36     c == routine arguments ==
37    
38     INTEGER myCurrentIter, myThid
39     _RL myCurrentTime
40     INTEGER bi, bj, ic
41     character*(max_len_mbuf) msgbuf
42    
43     c == local variables ==
44    
45     integer ip
46     integer icountE, icountW, icountN, icountS
47     _RL xx, yy
48     INTEGER imax, imax2, m, iG, jG
49     _RL xlo, xhi, ylo, yhi
50     parameter(imax=9)
51     parameter(imax2=imax*max_npart_exch)
52    
53     c buffer for sending/receiving variables (E/W are also used for S/N)
54     _RL fltbuf_sendE(imax2,nSx,nSy)
55     _RL fltbuf_sendW(imax2,nSx,nSy)
56     _RL fltbuf_recvE(imax2,nSx,nSy)
57     _RL fltbuf_recvW(imax2,nSx,nSy)
58    
59     _RL npart_dist
60     c == end of interface ==
61    
62 edhill 1.2 caw Check if there are eastern/western tiles
63     if(Nx .ne. sNx) then
64    
65 adcroft 1.1 C-- Choose floats that have to exchanged with eastern and western tiles
66     C and pack to arrays
67    
68    
69 edhill 1.2 DO bj=myByLo(myThid),myByHi(myThid)
70     DO bi=myBxLo(myThid),myBxHi(myThid)
71 adcroft 1.1
72     c initialize buffers
73    
74 edhill 1.2 do m=1,imax2
75     fltbuf_sendE(m,bi,bj) = 0.
76     fltbuf_sendW(m,bi,bj) = 0.
77     fltbuf_recvE(m,bi,bj) = 0.
78     fltbuf_recvW(m,bi,bj) = 0.
79     enddo
80    
81     icountE=0
82     icountW=0
83    
84     iG = myXGlobalLo + (bi-1)*sNx
85     xlo = xc(1, 1, bi,bj) - delX(iG)
86     xhi = xc(sNx,1,bi,bj) + delX(iG+sNx-1)
87 adcroft 1.1 c
88 edhill 1.2 do ip=1,npart_tile(bi,bj)
89 adcroft 1.1 c
90 edhill 1.2 if (xpart(ip,bi,bj) .ge. xhi) then
91     icountE=icountE+1
92     if (icountE .gt. max_npart_exch) stop
93     & ' max_npart_exch too low. stop in flt_exchg'
94    
95     ic=(icountE-1)*imax
96     fltbuf_sendE(ic+1,bi,bj) = npart(ip,bi,bj)
97     fltbuf_sendE(ic+2,bi,bj) = tstart(ip,bi,bj)
98     fltbuf_sendE(ic+3,bi,bj) = xpart(ip,bi,bj)
99     fltbuf_sendE(ic+4,bi,bj) = ypart(ip,bi,bj)
100     fltbuf_sendE(ic+5,bi,bj) = kpart(ip,bi,bj)
101     fltbuf_sendE(ic+6,bi,bj) = kfloat(ip,bi,bj)
102     fltbuf_sendE(ic+7,bi,bj) = iup(ip,bi,bj)
103     fltbuf_sendE(ic+8,bi,bj) = itop(ip,bi,bj)
104     fltbuf_sendE(ic+9,bi,bj) = tend(ip,bi,bj)
105    
106     npart(ip,bi,bj) = npart(npart_tile(bi,bj),bi,bj)
107     tstart(ip,bi,bj) = tstart(npart_tile(bi,bj),bi,bj)
108     xpart(ip,bi,bj) = xpart(npart_tile(bi,bj),bi,bj)
109     ypart(ip,bi,bj) = ypart(npart_tile(bi,bj),bi,bj)
110     kpart(ip,bi,bj) = kpart(npart_tile(bi,bj),bi,bj)
111     kfloat(ip,bi,bj) = kfloat(npart_tile(bi,bj),bi,bj)
112     iup(ip,bi,bj) = iup(npart_tile(bi,bj),bi,bj)
113     itop(ip,bi,bj) = itop(npart_tile(bi,bj),bi,bj)
114     tend(ip,bi,bj) = tend(npart_tile(bi,bj),bi,bj)
115    
116     npart_tile(bi,bj) = npart_tile(bi,bj) - 1
117    
118     endif
119    
120     if (xpart(ip,bi,bj) .le. xlo) then
121     icountW=icountW+1
122     if (icountW .gt. max_npart_exch) stop
123     & ' max_npart_exch too low. stop in flt_exchg'
124    
125     ic=(icountW-1)*imax
126     fltbuf_sendW(ic+1,bi,bj) = npart(ip,bi,bj)
127     fltbuf_sendW(ic+2,bi,bj) = tstart(ip,bi,bj)
128     fltbuf_sendW(ic+3,bi,bj) = xpart(ip,bi,bj)
129     fltbuf_sendW(ic+4,bi,bj) = ypart(ip,bi,bj)
130     fltbuf_sendW(ic+5,bi,bj) = kpart(ip,bi,bj)
131     fltbuf_sendW(ic+6,bi,bj) = kfloat(ip,bi,bj)
132     fltbuf_sendW(ic+7,bi,bj) = iup(ip,bi,bj)
133     fltbuf_sendW(ic+8,bi,bj) = itop(ip,bi,bj)
134     fltbuf_sendW(ic+9,bi,bj) = tend(ip,bi,bj)
135    
136     npart(ip,bi,bj) = npart(npart_tile(bi,bj),bi,bj)
137     tstart(ip,bi,bj) = tstart(npart_tile(bi,bj),bi,bj)
138     xpart(ip,bi,bj) = xpart(npart_tile(bi,bj),bi,bj)
139     ypart(ip,bi,bj) = ypart(npart_tile(bi,bj),bi,bj)
140     kpart(ip,bi,bj) = kpart(npart_tile(bi,bj),bi,bj)
141     kfloat(ip,bi,bj) = kfloat(npart_tile(bi,bj),bi,bj)
142     iup(ip,bi,bj) = iup(npart_tile(bi,bj),bi,bj)
143     itop(ip,bi,bj) = itop(npart_tile(bi,bj),bi,bj)
144     tend(ip,bi,bj) = tend(npart_tile(bi,bj),bi,bj)
145    
146     npart_tile(bi,bj) = npart_tile(bi,bj) - 1
147    
148     endif
149    
150     enddo
151     ENDDO
152     ENDDO
153 adcroft 1.1
154     C-- "Put" east and west edges.
155 edhill 1.2 CALL EXCH_RL_SEND_PUT_VEC_X( fltbuf_sendE, fltbuf_sendW,
156     I imax2, myThid )
157     C-- Receive east/west arrays
158     CALL EXCH_RL_RECV_GET_VEC_X( fltbuf_recvE, fltbuf_recvW,
159     I imax2, myThid )
160 adcroft 1.1
161     C-- Unpack arrays on new tiles
162    
163 edhill 1.2 DO bj=myByLo(myThid),myByHi(myThid)
164     DO bi=myBxLo(myThid),myBxHi(myThid)
165    
166     do ip=1,max_npart_exch
167 adcroft 1.1 c
168 edhill 1.2 ic=(ip-1)*imax
169     if (fltbuf_recvE(ic+1,bi,bj) .eq. 0.) goto 100
170     npart_tile(bi,bj) = npart_tile(bi,bj) + 1
171     if (npart_tile(bi,bj) .gt. max_npart_tile)
172     & stop ' max_npart_tile too low. stop in flt_exchg'
173    
174     npart(npart_tile(bi,bj),bi,bj) =
175     & fltbuf_recvE(ic+1,bi,bj)
176     tstart(npart_tile(bi,bj),bi,bj) =
177     & fltbuf_recvE(ic+2,bi,bj)
178     xpart(npart_tile(bi,bj),bi,bj) =
179     & fltbuf_recvE(ic+3,bi,bj)
180     ypart(npart_tile(bi,bj),bi,bj) =
181     & fltbuf_recvE(ic+4,bi,bj)
182     kpart(npart_tile(bi,bj),bi,bj) =
183     & fltbuf_recvE(ic+5,bi,bj)
184     kfloat(npart_tile(bi,bj),bi,bj) =
185     & fltbuf_recvE(ic+6,bi,bj)
186     iup(npart_tile(bi,bj),bi,bj) =
187     & fltbuf_recvE(ic+7,bi,bj)
188     itop(npart_tile(bi,bj),bi,bj) =
189     & fltbuf_recvE(ic+8,bi,bj)
190     tend(npart_tile(bi,bj),bi,bj) =
191     & fltbuf_recvE(ic+9,bi,bj)
192 adcroft 1.1
193 edhill 1.2 enddo
194     100 continue
195 adcroft 1.1
196 edhill 1.2 do ip=1,max_npart_exch
197 adcroft 1.1 c
198 edhill 1.2 ic=(ip-1)*imax
199     if (fltbuf_recvW(ic+1,bi,bj) .eq. 0.) goto 200
200     npart_tile(bi,bj) = npart_tile(bi,bj) + 1
201     if (npart_tile(bi,bj) .gt. max_npart_tile)
202     & stop ' max_npart_tile too low. stop in flt_exchg'
203    
204     npart(npart_tile(bi,bj),bi,bj) =
205     & fltbuf_recvW(ic+1,bi,bj)
206     tstart(npart_tile(bi,bj),bi,bj) =
207     & fltbuf_recvW(ic+2,bi,bj)
208     xpart(npart_tile(bi,bj),bi,bj) =
209     & fltbuf_recvW(ic+3,bi,bj)
210     ypart(npart_tile(bi,bj),bi,bj) =
211     & fltbuf_recvW(ic+4,bi,bj)
212     kpart(npart_tile(bi,bj),bi,bj) =
213     & fltbuf_recvW(ic+5,bi,bj)
214     kfloat(npart_tile(bi,bj),bi,bj) =
215     & fltbuf_recvW(ic+6,bi,bj)
216     iup(npart_tile(bi,bj),bi,bj) =
217     & fltbuf_recvW(ic+7,bi,bj)
218     itop(npart_tile(bi,bj),bi,bj) =
219     & fltbuf_recvW(ic+8,bi,bj)
220     itop(npart_tile(bi,bj),bi,bj) =
221     & fltbuf_recvW(ic+8,bi,bj)
222     tend(npart_tile(bi,bj),bi,bj) =
223     & fltbuf_recvW(ic+9,bi,bj)
224    
225     enddo
226     200 continue
227 adcroft 1.1
228 edhill 1.2 ENDDO
229     ENDDO
230 adcroft 1.1
231 edhill 1.2 caw end tile check
232     endif
233 adcroft 1.1
234 edhill 1.2 C-- Choose floats that have to exchanged with northern and southern tiles
235 adcroft 1.1 C and pack to arrays
236    
237 edhill 1.2 caw Check if there are northern/southern tiles
238     if(Ny .ne. sNy) then
239 adcroft 1.1
240 edhill 1.2 DO bj=myByLo(myThid),myByHi(myThid)
241     DO bi=myBxLo(myThid),myBxHi(myThid)
242 adcroft 1.1
243     c initialize buffers
244    
245 edhill 1.2 do m=1,imax2
246     fltbuf_sendE(m,bi,bj) = 0.
247     fltbuf_sendW(m,bi,bj) = 0.
248     fltbuf_recvE(m,bi,bj) = 0.
249     fltbuf_recvW(m,bi,bj) = 0.
250     enddo
251    
252     icountN=0
253     icountS=0
254    
255     jG = myYGlobalLo + (bj-1)*sNy
256     ylo = yc(1, 1, bi,bj) - delY(jG)
257     yhi = yc(1,sNy,bi,bj) + delY(jG+sNy-1)
258    
259     do ip=1,npart_tile(bi,bj)
260    
261     if (ypart(ip,bi,bj) .ge. yhi) then
262     icountN=icountN+1
263     if (icountN .gt. max_npart_exch) stop
264     & ' max_npart_exch too low. stop in flt_exchg'
265    
266     ic=(icountN-1)*imax
267     fltbuf_sendE(ic+1,bi,bj) = npart(ip,bi,bj)
268     fltbuf_sendE(ic+2,bi,bj) = tstart(ip,bi,bj)
269     fltbuf_sendE(ic+3,bi,bj) = xpart(ip,bi,bj)
270     fltbuf_sendE(ic+4,bi,bj) = ypart(ip,bi,bj)
271     fltbuf_sendE(ic+5,bi,bj) = kpart(ip,bi,bj)
272     fltbuf_sendE(ic+6,bi,bj) = kfloat(ip,bi,bj)
273     fltbuf_sendE(ic+7,bi,bj) = iup(ip,bi,bj)
274     fltbuf_sendE(ic+8,bi,bj) = itop(ip,bi,bj)
275     fltbuf_sendE(ic+9,bi,bj) = tend(ip,bi,bj)
276    
277     npart(ip,bi,bj) = npart(npart_tile(bi,bj),bi,bj)
278     tstart(ip,bi,bj) = tstart(npart_tile(bi,bj),bi,bj)
279     xpart(ip,bi,bj) = xpart(npart_tile(bi,bj),bi,bj)
280     ypart(ip,bi,bj) = ypart(npart_tile(bi,bj),bi,bj)
281     kpart(ip,bi,bj) = kpart(npart_tile(bi,bj),bi,bj)
282     kfloat(ip,bi,bj) = kfloat(npart_tile(bi,bj),bi,bj)
283     iup(ip,bi,bj) = iup(npart_tile(bi,bj),bi,bj)
284     itop(ip,bi,bj) = itop(npart_tile(bi,bj),bi,bj)
285     tend(ip,bi,bj) = tend(npart_tile(bi,bj),bi,bj)
286    
287     npart_tile(bi,bj) = npart_tile(bi,bj) - 1
288     endif
289    
290     if (ypart(ip,bi,bj) .le. ylo) then
291     icountS=icountS+1
292     if (icountS .gt. max_npart_exch) stop
293     & ' max_npart_exch too low. stop in flt_exchg'
294    
295     ic=(icountS-1)*imax
296     fltbuf_sendW(ic+1,bi,bj) = npart(ip,bi,bj)
297     fltbuf_sendW(ic+2,bi,bj) = tstart(ip,bi,bj)
298     fltbuf_sendW(ic+3,bi,bj) = xpart(ip,bi,bj)
299     fltbuf_sendW(ic+4,bi,bj) = ypart(ip,bi,bj)
300     fltbuf_sendW(ic+5,bi,bj) = kpart(ip,bi,bj)
301     fltbuf_sendW(ic+6,bi,bj) = kfloat(ip,bi,bj)
302     fltbuf_sendW(ic+7,bi,bj) = iup(ip,bi,bj)
303     fltbuf_sendW(ic+8,bi,bj) = itop(ip,bi,bj)
304     fltbuf_sendW(ic+9,bi,bj) = tend(ip,bi,bj)
305    
306     npart(ip,bi,bj) = npart(npart_tile(bi,bj),bi,bj)
307     tstart(ip,bi,bj) = tstart(npart_tile(bi,bj),bi,bj)
308     xpart(ip,bi,bj) = xpart(npart_tile(bi,bj),bi,bj)
309     ypart(ip,bi,bj) = ypart(npart_tile(bi,bj),bi,bj)
310     kpart(ip,bi,bj) = kpart(npart_tile(bi,bj),bi,bj)
311     kfloat(ip,bi,bj) = kfloat(npart_tile(bi,bj),bi,bj)
312     iup(ip,bi,bj) = iup(npart_tile(bi,bj),bi,bj)
313     itop(ip,bi,bj) = itop(npart_tile(bi,bj),bi,bj)
314     tend(ip,bi,bj) = tend(npart_tile(bi,bj),bi,bj)
315 adcroft 1.1
316 edhill 1.2 npart_tile(bi,bj) = npart_tile(bi,bj) - 1
317     endif
318 adcroft 1.1
319 edhill 1.2 enddo
320 adcroft 1.1
321 edhill 1.2 ENDDO
322     ENDDO
323 adcroft 1.1
324     C "Put" north and south arrays.
325 edhill 1.2 CALL EXCH_RL_SEND_PUT_VEC_Y( fltbuf_sendE, fltbuf_sendW,
326     I imax2, myThid )
327 adcroft 1.1
328     C Receive north and south arrays
329 edhill 1.2 CALL EXCH_RL_RECV_GET_VEC_Y( fltbuf_recvE, fltbuf_recvW,
330     I imax2, myThid )
331 adcroft 1.1
332     C-- Unpack arrays on new tiles
333    
334 edhill 1.2 DO bj=myByLo(myThid),myByHi(myThid)
335     DO bi=myBxLo(myThid),myBxHi(myThid)
336 adcroft 1.1
337 edhill 1.2 do ip=1,max_npart_exch
338 adcroft 1.1 c
339 edhill 1.2 ic=(ip-1)*imax
340     if (fltbuf_recvE(ic+1,bi,bj) .eq. 0.) goto 300
341     npart_tile(bi,bj) = npart_tile(bi,bj) + 1
342     if (npart_tile(bi,bj) .gt. max_npart_tile)
343     & stop ' max_npart_tile too low. stop in flt_exchg'
344    
345     npart(npart_tile(bi,bj),bi,bj) =
346     & fltbuf_recvE(ic+1,bi,bj)
347     tstart(npart_tile(bi,bj),bi,bj) =
348     & fltbuf_recvE(ic+2,bi,bj)
349     xpart(npart_tile(bi,bj),bi,bj) =
350     & fltbuf_recvE(ic+3,bi,bj)
351     ypart(npart_tile(bi,bj),bi,bj) =
352     & fltbuf_recvE(ic+4,bi,bj)
353     kpart(npart_tile(bi,bj),bi,bj) =
354     & fltbuf_recvE(ic+5,bi,bj)
355     kfloat(npart_tile(bi,bj),bi,bj) =
356     & fltbuf_recvE(ic+6,bi,bj)
357     iup(npart_tile(bi,bj),bi,bj) =
358     & fltbuf_recvE(ic+7,bi,bj)
359     itop(npart_tile(bi,bj),bi,bj) =
360     & fltbuf_recvE(ic+8,bi,bj)
361     tend(npart_tile(bi,bj),bi,bj) =
362     & fltbuf_recvE(ic+9,bi,bj)
363 adcroft 1.1
364 edhill 1.2 enddo
365     300 continue
366 adcroft 1.1
367 edhill 1.2 do ip=1,max_npart_exch
368 adcroft 1.1 c
369 edhill 1.2 ic=(ip-1)*imax
370     if (fltbuf_recvW(ic+1,bi,bj) .eq. 0.) goto 400
371     npart_tile(bi,bj) = npart_tile(bi,bj) + 1
372     if (npart_tile(bi,bj) .gt. max_npart_tile)
373     & stop ' max_npart_tile too low. stop in flt_exchg'
374    
375     npart(npart_tile(bi,bj),bi,bj) =
376     & fltbuf_recvW(ic+1,bi,bj)
377     tstart(npart_tile(bi,bj),bi,bj) =
378     & fltbuf_recvW(ic+2,bi,bj)
379     xpart(npart_tile(bi,bj),bi,bj) =
380     & fltbuf_recvW(ic+3,bi,bj)
381     ypart(npart_tile(bi,bj),bi,bj) =
382     & fltbuf_recvW(ic+4,bi,bj)
383     kpart(npart_tile(bi,bj),bi,bj) =
384     & fltbuf_recvW(ic+5,bi,bj)
385     kfloat(npart_tile(bi,bj),bi,bj) =
386     & fltbuf_recvW(ic+6,bi,bj)
387     iup(npart_tile(bi,bj),bi,bj) =
388     & fltbuf_recvW(ic+7,bi,bj)
389     itop(npart_tile(bi,bj),bi,bj) =
390     & fltbuf_recvW(ic+8,bi,bj)
391     tend(npart_tile(bi,bj),bi,bj) =
392     & fltbuf_recvW(ic+9,bi,bj)
393    
394     enddo
395     400 continue
396    
397     ENDDO
398     ENDDO
399 adcroft 1.1
400 edhill 1.2 caw end tile check
401     endif
402 adcroft 1.1
403     return
404     end

  ViewVC Help
Powered by ViewVC 1.1.22