1 |
C $Header: /u/gcmpack/models/MITgcmUV/eesupp/src/exch_cycle_ebl.F,v 1.1 1998/09/29 18:53:44 cnh Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
SUBROUTINE EXCH_CYCLE_EBL( myThid ) |
5 |
C /==========================================================\ |
6 |
C | SUBROUTINE EXCH_CYCLE_EBL | |
7 |
C | o Cycle exchange buffer level. | |
8 |
C |==========================================================| |
9 |
C | Step the "exchange buffer level" to next value. | |
10 |
C | The buffer level is used to prevent consecutive messages | |
11 |
C | overwriting one another. Because we know that every tile | |
12 |
C | will participate in an exchange we can be sure that every| |
13 |
C | tile will cycle through the buffers with the same | |
14 |
C | sequence. Also we know that a tile cannot start a new | |
15 |
C | exchange before it has completed its end of the previous | |
16 |
C | exchange. Thus by cycling through three buffer levels we | |
17 |
C | can be sure that the buffer we write to will be free. | |
18 |
C | That is by the time we are participating in the third | |
19 |
C | exchange transaction we know that both ends of the first | |
20 |
C | transaction must have completed. | |
21 |
C | Note -- | |
22 |
C | 1. We allow more than three levels below although this | |
23 |
C | is not necessary. | |
24 |
C \==========================================================/ |
25 |
IMPLICIT NONE |
26 |
C == Global data == |
27 |
#include "SIZE.h" |
28 |
#include "EEPARAMS.h" |
29 |
#include "EESUPPORT.h" |
30 |
#include "EXCH.h" |
31 |
|
32 |
C == Routine arguments == |
33 |
C myThid - Thread number of this instance of the routine |
34 |
INTEGER myThid |
35 |
|
36 |
C == Local variables == |
37 |
C bi, bj - Loop counters |
38 |
INTEGER bi, bj |
39 |
|
40 |
DO bj=myByLo(myThid),myByHi(myThid) |
41 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
42 |
C-- Use next level exchange buffer in cycle. |
43 |
exchangeBufLevel(1,bi,bj) = exchangeBufLevel(1,bi,bj)+1 |
44 |
IF ( exchangeBufLevel(1,bi,bj) .GT. NUMBER_OF_BUFFER_LEVELS ) |
45 |
& exchangeBufLevel(1,bi,bj) = 1 |
46 |
ENDDO |
47 |
ENDDO |
48 |
|
49 |
RETURN |
50 |
END |