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

Annotation of /MITgcm/eesupp/src/exch_rx.template

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


Revision 1.4 - (hide annotations) (download)
Tue Apr 30 22:48:20 2002 UTC (22 years ago) by jmc
Branch: MAIN
CVS Tags: checkpoint46n_post, checkpoint51k_post, checkpoint47e_post, checkpoint57m_post, checkpoint52l_pre, hrcube4, hrcube5, checkpoint46l_post, checkpoint57g_pre, checkpoint46g_pre, checkpoint47c_post, checkpoint50c_post, checkpoint57s_post, checkpoint57b_post, checkpoint46f_post, checkpoint52d_pre, checkpoint57g_post, checkpoint48e_post, checkpoint56b_post, checkpoint50g_post, checkpoint46b_post, checkpoint52j_pre, checkpoint51o_pre, checkpoint54d_post, checkpoint48c_post, checkpoint54e_post, checkpoint51l_post, checkpoint48i_post, checkpoint57r_post, checkpoint46l_pre, checkpoint57d_post, checkpoint57i_post, checkpoint50d_pre, checkpoint52k_post, checkpoint55, checkpoint54, checkpoint57, checkpoint56, checkpoint51, checkpoint53, checkpoint52, checkpoint50d_post, checkpoint52f_post, checkpoint57n_post, checkpoint50b_pre, checkpoint54f_post, checkpoint51f_post, checkpoint48b_post, checkpoint51d_post, checkpoint48c_pre, checkpoint55a_post, checkpoint51t_post, checkpoint51n_post, checkpoint55i_post, checkpoint57l_post, checkpoint52i_pre, checkpoint57h_post, hrcube_2, hrcube_3, checkpoint51s_post, checkpoint57t_post, checkpoint55c_post, checkpoint48d_pre, checkpoint51j_post, checkpoint47i_post, checkpoint52e_pre, checkpoint57v_post, checkpoint57f_post, checkpoint52e_post, checkpoint51n_pre, checkpoint47d_post, checkpoint53d_post, checkpoint46d_pre, checkpoint57a_post, checkpoint48d_post, checkpoint57h_pre, checkpoint48f_post, checkpoint45d_post, checkpoint52b_pre, checkpoint54b_post, checkpoint46j_pre, checkpoint51l_pre, checkpoint52m_post, checkpoint47d_pre, checkpoint55g_post, checkpoint48h_post, checkpoint51q_post, checkpoint51b_pre, checkpoint46a_post, checkpoint47g_post, checkpoint52b_post, checkpoint52c_post, checkpoint46j_post, checkpoint51h_pre, checkpoint46k_post, checkpoint46b_pre, checkpoint52h_pre, checkpoint45a_post, checkpoint57c_post, checkpoint50f_post, checkpoint50a_post, checkpoint50f_pre, hrcube_1, checkpoint51m_post, checkpoint55d_post, checkpoint47a_post, checkpoint53c_post, checkpoint55d_pre, checkpoint57c_pre, checkpoint55j_post, branchpoint-genmake2, checkpoint54a_post, checkpoint46e_pre, checkpoint55h_post, checkpoint51r_post, checkpoint45b_post, checkpoint51i_post, checkpoint57e_post, checkpoint55b_post, checkpoint51b_post, checkpoint46c_pre, checkpoint53a_post, checkpoint47b_post, checkpoint55f_post, checkpoint46h_pre, checkpoint52d_post, checkpoint53g_post, checkpoint46m_post, checkpoint57p_post, checkpint57u_post, checkpoint46a_pre, checkpoint50c_pre, checkpoint45c_post, checkpoint57q_post, eckpoint57e_pre, checkpoint46g_post, checkpoint51c_post, checkpoint52a_pre, checkpoint46i_post, checkpoint50h_post, checkpoint52i_post, checkpoint50e_pre, checkpoint50i_post, checkpoint51i_pre, checkpoint48a_post, checkpoint56a_post, checkpoint53f_post, checkpoint47j_post, checkpoint54a_pre, checkpoint53b_pre, branch-exfmods-tag, checkpoint57h_done, checkpoint52j_post, checkpoint47f_post, checkpoint50e_post, checkpoint57j_post, checkpoint57f_pre, checkpoint46c_post, branch-netcdf, checkpoint52l_post, checkpoint52n_post, checkpoint46e_post, checkpoint56c_post, checkpoint51e_post, checkpoint57a_pre, checkpoint46, checkpoint47, checkpoint48, checkpoint49, checkpoint57o_post, checkpoint46h_post, checkpoint51o_post, checkpoint50, checkpoint57k_post, checkpoint51f_pre, checkpoint53b_post, checkpoint47h_post, checkpoint52a_post, checkpoint57w_post, checkpoint51g_post, ecco_c52_e35, checkpoint46d_post, checkpoint50b_post, checkpoint52f_pre, checkpoint53d_pre, checkpoint55e_post, checkpoint54c_post, checkpoint51a_post, checkpoint51p_post, checkpoint48g_post, checkpoint51u_post
Branch point for: branch-exfmods-curt, branch-genmake2, branch-nonh, tg2-branch, netcdf-sm0, checkpoint51n_branch
Changes since 1.3: +20 -4 lines
specific exchange if Ny=1 (like Nx=1): allows to deal with X-slice domain

1 jmc 1.4 C $Header: /u/gcmpack/MITgcm/eesupp/src/exch_rx.template,v 1.3 2001/09/21 03:55:50 cnh Exp $
2 cnh 1.3 C $Name: $
3 adcroft 1.2
4     #include "CPP_EEOPTIONS.h"
5    
6 cnh 1.3 CBOP
7    
8     C !ROUTINE: EXCH_RX
9    
10     C !INTERFACE:
11 adcroft 1.2 SUBROUTINE EXCH_RX(
12     U array,
13     I myOLw, myOLe, myOLs, myOLn, myNz,
14     I exchWidthX, exchWidthY,
15     I simulationMode, cornerMode, myThid )
16     IMPLICIT NONE
17    
18 cnh 1.3 C !DESCRIPTION:
19     C *==========================================================*
20     C | SUBROUTINE EXCH_RX
21     C | o Control edge exchanges for RX array.
22     C *==========================================================*
23     C |
24     C | Controlling routine for exchange of XY edges of an array
25     C | distributed in X and Y. The routine interfaces to
26     C | communication routines that can use messages passing
27     C | exchanges, put type exchanges or get type exchanges.
28     C | This allows anything from MPI to raw memory channel to
29     C | memmap segments to be used as a inter-process and/or
30     C | inter-thread communiation and synchronisation
31     C | mechanism.
32     C | Notes --
33     C | 1. Some low-level mechanisms such as raw memory-channel
34     C | or SGI/CRAY shmem put do not have direct Fortran bindings
35     C | and are invoked through C stub routines.
36     C | 2. Although this routine is fairly general but it does
37     C | require nSx and nSy are the same for all innvocations.
38     C | There are many common data structures ( myByLo,
39     C | westCommunicationMode, mpiIdW etc... ) tied in with
40     C | (nSx,nSy). To support arbitray nSx and nSy would require
41     C | general forms of these.
42     C | 3. RX arrays are used to generate code for both _RL and
43     C | _RS forms.
44     C *==========================================================*
45    
46     C !USES:
47 adcroft 1.2 C == Global data ==
48     #include "SIZE.h"
49     #include "EEPARAMS.h"
50     #include "EESUPPORT.h"
51     #include "EXCH.h"
52    
53 cnh 1.3 C !INPUT/OUTPUT PARAMETERS:
54 adcroft 1.2 C == Routine arguments ==
55 cnh 1.3 C array :: Array with edges to exchange.
56     C myOLw :: West, East, North and South overlap region sizes.
57 adcroft 1.2 C myOLe
58     C myOLn
59     C myOLs
60 cnh 1.3 C exchWidthX :: Width of data region exchanged in X.
61     C exchWidthY :: Width of data region exchanged in Y.
62     C Note --
63     C 1. In theory one could have a send width and
64     C a receive width for each face of each tile. The only
65     C restriction woul be that the send width of one
66     C face should equal the receive width of the sent to
67     C tile face. Dont know if this would be useful. I
68     C have left it out for now as it requires additional
69     C bookeeping.
70     C simulationMode :: Forward or reverse mode exchange ( provides
71     C support for adjoint integration of code. )
72     C cornerMode :: Flag indicating whether corner updates are
73     C needed.
74     C myThid :: Thread number of this instance of S/R EXCH...
75 adcroft 1.2 INTEGER myOLw
76     INTEGER myOLe
77     INTEGER myOLs
78     INTEGER myOLn
79     INTEGER myNz
80     INTEGER exchWidthX
81     INTEGER exchWidthY
82     INTEGER simulationMode
83     INTEGER cornerMode
84     INTEGER myThid
85     _RX array(1-myOLw:sNx+myOLe,
86     & 1-myOLs:sNy+myOLn,
87     & myNZ, nSx, nSy)
88    
89 cnh 1.3 C !LOCAL VARIABLES:
90 adcroft 1.2 C == Local variables ==
91 cnh 1.3 C theSimulationMode :: Holds working copy of simulation mode
92     C theCornerMode :: Holds working copy of corner mode
93     C I,J,K,bi,bj :: Loop counters
94 adcroft 1.2 INTEGER theSimulationMode
95     INTEGER theCornerMode
96     INTEGER I,J,K,bi,bj
97 cnh 1.3 CEOP
98 adcroft 1.2
99     theSimulationMode = simulationMode
100     theCornerMode = cornerMode
101    
102     C-- Error checks
103     IF ( exchWidthX .GT. myOLw )
104     & STOP ' S/R EXCH_RX: exchWidthX .GT. myOLw'
105     IF ( exchWidthX .GT. myOLe )
106     & STOP ' S/R EXCH_RX: exchWidthX .GT. myOLe'
107     IF ( exchWidthY .GT. myOLs )
108     & STOP ' S/R EXCH_RX: exchWidthY .GT. myOLs'
109     IF ( exchWidthY .GT. myOLn )
110     & STOP ' S/R EXCH_RX: exchWidthY .GT. myOLn'
111     IF ( myOLw .GT. MAX_OLX_EXCH )
112     & STOP ' S/R EXCH_RX: myOLw .GT. MAX_OLX_EXCH'
113     IF ( myOLe .GT. MAX_OLX_EXCH )
114     & STOP ' S/R EXCH_RX: myOLe .GT. MAX_OLX_EXCH'
115     IF ( myOLn .GT. MAX_OLX_EXCH )
116     & STOP ' S/R EXCH_RX: myOLn .GT. MAX_OLY_EXCH'
117     IF ( myOLs .GT. MAX_OLY_EXCH )
118     & STOP ' S/R EXCH_RX: myOLs .GT. MAX_OLY_EXCH'
119     IF ( myNZ .GT. MAX_NR_EXCH )
120     & STOP ' S/R EXCH_RX: myNZ .GT. MAX_NR_EXCH '
121     IF ( theSimulationMode .NE. FORWARD_SIMULATION
122     & .AND. theSimulationMode .NE. REVERSE_SIMULATION
123     & ) STOP ' S/R EXCH_RX: Unrecognised simulationMode '
124     IF ( theCornerMode .NE. EXCH_IGNORE_CORNERS
125     & .AND. theCornerMode .NE. EXCH_UPDATE_CORNERS
126     & ) STOP ' S/R EXCH_RX: Unrecognised cornerMode '
127    
128     C-- Cycle edge buffer level
129     CALL EXCH_CYCLE_EBL( myThid )
130    
131     IF ( theSimulationMode .EQ. FORWARD_SIMULATION ) THEN
132     C-- "Put" east and west edges.
133     CALL EXCH_RX_SEND_PUT_X( array,
134     I myOLw, myOLe, myOLs, myOLn, myNz,
135     I exchWidthX, exchWidthY,
136     I theSimulationMode, theCornerMode, myThid )
137     C-- If corners are important then sync and update east and west edges
138     C-- before doing north and south exchanges.
139     IF ( theCornerMode .EQ. EXCH_UPDATE_CORNERS ) THEN
140     CALL EXCH_RX_RECV_GET_X( array,
141     I myOLw, myOLe, myOLs, myOLn, myNz,
142     I exchWidthX, exchWidthY,
143     I theSimulationMode, theCornerMode, myThid )
144     ENDIF
145     C "Put" north and south edges.
146     CALL EXCH_RX_SEND_PUT_Y( array,
147     I myOLw, myOLe, myOLs, myOLn, myNz,
148     I exchWidthX, exchWidthY,
149     I theSimulationMode, theCornerMode, myThid )
150     C-- Sync and update north, south (and east, west if corner updating
151     C-- not active).
152     IF ( theCornerMode .NE. EXCH_UPDATE_CORNERS ) THEN
153     CALL EXCH_RX_RECV_GET_X( array,
154     I myOLw, myOLe, myOLs, myOLn, myNz,
155     I exchWidthX, exchWidthY,
156     I theSimulationMode, theCornerMode, myThid )
157     ENDIF
158     CALL EXCH_RX_RECV_GET_Y( array,
159     I myOLw, myOLe, myOLs, myOLn, myNz,
160     I exchWidthX, exchWidthY,
161     I theSimulationMode, theCornerMode, myThid )
162     ENDIF
163    
164     IF ( theSimulationMode .EQ. REVERSE_SIMULATION ) THEN
165     C "Put" north and south edges.
166     CALL EXCH_RX_SEND_PUT_Y( array,
167     I myOLw, myOLe, myOLs, myOLn, myNz,
168     I exchWidthX, exchWidthY,
169     I theSimulationMode, theCornerMode, myThid )
170     C-- If corners are important then sync and update east and west edges
171     C-- before doing north and south exchanges.
172     IF ( theCornerMode .EQ. EXCH_UPDATE_CORNERS ) THEN
173     CALL EXCH_RX_RECV_GET_Y( array,
174     I myOLw, myOLe, myOLs, myOLn, myNz,
175     I exchWidthX, exchWidthY,
176     I theSimulationMode, theCornerMode, myThid )
177     ENDIF
178     C-- "Put" east and west edges.
179     CALL EXCH_RX_SEND_PUT_X( array,
180     I myOLw, myOLe, myOLs, myOLn, myNz,
181     I exchWidthX, exchWidthY,
182     I theSimulationMode, theCornerMode, myThid )
183     C-- Sync and update east, west (and north, south if corner updating
184     C-- not active).
185     IF ( theCornerMode .NE. EXCH_UPDATE_CORNERS ) THEN
186     CALL EXCH_RX_RECV_GET_Y( array,
187     I myOLw, myOLe, myOLs, myOLn, myNz,
188     I exchWidthX, exchWidthY,
189     I theSimulationMode, theCornerMode, myThid )
190     ENDIF
191     CALL EXCH_RX_RECV_GET_X( array,
192     I myOLw, myOLe, myOLs, myOLn, myNz,
193     I exchWidthX, exchWidthY,
194     I theSimulationMode, theCornerMode, myThid )
195     ENDIF
196 jmc 1.4 C Special case for zonal average model i.e. case where Nx == 1
197 adcroft 1.2 C In this case a forward mode exchange simply sets array to
198     C the i=1 value for all i.
199 jmc 1.4 IF ( Nx .EQ. 1 ) THEN
200 adcroft 1.2 DO bj=myByLo(myThid),myByHi(myThid)
201     DO bi=myBxLo(myThid),myBxHi(myThid)
202     DO K = 1,myNz
203     DO J = 1-myOLs,sNy+myOLn
204     DO I = 1-myOLw,sNx+myOLe
205 jmc 1.4 array(I,J,K,bi,bj) = array(1,J,K,bi,bj)
206     ENDDO
207     ENDDO
208     ENDDO
209     ENDDO
210     ENDDO
211     ENDIF
212     C Special case for X-slice domain i.e. case where Ny == 1
213     C In this case a forward mode exchange simply sets array to
214     C the j=1 value for all j.
215     IF ( Ny .EQ. 1 ) THEN
216     DO bj=myByLo(myThid),myByHi(myThid)
217     DO bi=myBxLo(myThid),myBxHi(myThid)
218     DO K = 1,myNz
219     DO J = 1-myOLs,sNy+myOLn
220     DO I = 1-myOLw,sNx+myOLe
221     array(I,J,K,bi,bj) = array(I,1,K,bi,bj)
222 adcroft 1.2 ENDDO
223     ENDDO
224     ENDDO
225     ENDDO
226     ENDDO
227     ENDIF
228    
229     RETURN
230     END

  ViewVC Help
Powered by ViewVC 1.1.22