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

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

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


Revision 1.6 - (show annotations) (download)
Sun Jun 28 00:57:51 2009 UTC (14 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61s, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.5: +4 -20 lines
-always call exch2_*_cube, not exch-1 anymore, if useCubedSphereExchange=F
-add bj in exch2 arrays and S/R.

1 C $Header: /u/gcmpack/MITgcm/pkg/exch2/exch2_uv_agrid_3d_rx.template,v 1.5 2009/05/12 19:44:58 jmc Exp $
2 C $Name: $
3
4 #include "CPP_EEOPTIONS.h"
5 #include "W2_OPTIONS.h"
6
7 CBOP
8 C !ROUTINE: EXCH2_UV_AGRID_3D_RX
9
10 C !INTERFACE:
11 SUBROUTINE EXCH2_UV_AGRID_3D_RX(
12 U uPhi, vPhi,
13 I withSigns, myNz, myThid )
14
15 C !DESCRIPTION:
16 C*=====================================================================*
17 C Purpose: SUBROUTINE EXCH2_UV_AGRID_3D_RX
18 C handle exchanges for a 3D vector field on an A-grid.
19 C
20 C Input:
21 C uPhi(lon,lat,levs,bi,bj) :: first component of vector
22 C vPhi(lon,lat,levs,bi,bj) :: second component of vector
23 C withSigns (logical) :: true to use sign of components
24 C myNz :: 3rd dimension of input arrays uPhi,vPhi
25 C myThid :: my Thread Id number
26 C
27 C Output: uPhi and vPhi are updated (halo regions filled)
28 C
29 C Calls: exch_RX (exch2_RX1_cube) - for each component
30 C
31 C*=====================================================================*
32
33 C !USES:
34 IMPLICIT NONE
35
36 #include "SIZE.h"
37 #include "EEPARAMS.h"
38 #include "W2_EXCH2_SIZE.h"
39 #include "W2_EXCH2_TOPOLOGY.h"
40
41 C !INPUT/OUTPUT PARAMETERS:
42 C == Argument list variables ==
43 INTEGER myNz
44 _RX uPhi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNz,nSx,nSy)
45 _RX vPhi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNz,nSx,nSy)
46 LOGICAL withSigns
47 INTEGER myThid
48
49 C !LOCAL VARIABLES:
50 C == Local variables ==
51 C i,j,k,bi,bj :: loop indices.
52 C OL[wens] :: Overlap extents in west, east, north, south.
53 C exchWidth[XY] :: Extent of regions that will be exchanged.
54 C uLoc,vLoc :: copies of the vector components with haloes filled.
55
56 INTEGER i,j,k,bi,bj
57 INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY
58 _RX uLoc(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
59 _RX vLoc(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
60 _RX negOne
61 INTEGER myTile, myFace
62 CEOP
63
64 OLw = OLx
65 OLe = OLx
66 OLn = OLy
67 OLs = OLy
68 exchWidthX = OLx
69 exchWidthY = OLy
70 negOne = 1.
71 IF (withSigns) negOne = -1.
72
73 C-- First call the exchanges for the two components
74
75 CALL EXCH2_RX1_CUBE( uPhi, 'T ',
76 I OLw, OLe, OLs, OLn, myNz,
77 I exchWidthX, exchWidthY,
78 I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
79 CALL EXCH2_RX1_CUBE( uPhi, 'T ',
80 I OLw, OLe, OLs, OLn, myNz,
81 I exchWidthX, exchWidthY,
82 I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
83
84 CALL EXCH2_RX1_CUBE( vPhi, 'T ',
85 I OLw, OLe, OLs, OLn, myNz,
86 I exchWidthX, exchWidthY,
87 I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
88 CALL EXCH2_RX1_CUBE( vPhi, 'T ',
89 I OLw, OLe, OLs, OLn, myNz,
90 I exchWidthX, exchWidthY,
91 I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
92
93 C- note: can substitute the low-level S/R calls above with:
94 c CALL EXCH2_3D_RX( uPhi, myNz, myThid )
95 c CALL EXCH2_3D_RX( vPhi, myNz, myThid )
96
97 IF ( useCubedSphereExchange ) THEN
98
99 C-- Then we may need to switch u and v components
100 C and/or the signs depending on which cube face we are located.
101
102 C-- Loops on tile indices:
103 DO bj = myByLo(myThid), myByHi(myThid)
104 DO bi = myBxLo(myThid), myBxHi(myThid)
105
106 C- Now choose what to do at each edge of the halo based on which face
107 C (we assume that bj is always=1)
108 myTile = W2_myTileList(bi,bj)
109 myFace = exch2_myFace(myTile)
110
111 C-- Loops on level index:
112 DO k = 1,myNz
113
114 C- First we copy the component info into local dummy arrays
115 DO j = 1-OLy,sNy+OLy
116 DO i = 1-OLx,sNx+OLx
117 uLoc(i,j) = uPhi(i,j,k,bi,bj)
118 vLoc(i,j) = vPhi(i,j,k,bi,bj)
119 ENDDO
120 ENDDO
121
122 C- odd faces share disposition of all sections of the halo
123 IF ( MOD(myFace,2).EQ.1 ) THEN
124 C- North:
125 IF (exch2_isNedge(myTile).EQ.1) THEN
126 DO j = 1,exchWidthY
127 DO i = 1-OLx,sNx+OLx
128 uPhi(i,sNy+j,k,bi,bj) = vLoc(i,sNy+j)*negOne
129 vPhi(i,sNy+j,k,bi,bj) = uLoc(i,sNy+j)
130 ENDDO
131 ENDDO
132 ENDIF
133 C- South: (nothing to change)
134 c IF (exch2_isSedge(myTile).EQ.1) THEN
135 c DO j = 1,exchWidthY
136 c DO i = 1-OLx,sNx+OLx
137 c uPhi(i,1-j,k,bi,bj) = uLoc(i,1-j)
138 c vPhi(i,1-j,k,bi,bj) = vLoc(i,1-j)
139 c ENDDO
140 c ENDDO
141 c ENDIF
142 C- East: (nothing to change)
143 c IF (exch2_isEedge(myTile).EQ.1) THEN
144 c DO j = 1-OLy,sNy+OLy
145 c DO i = 1,exchWidthX
146 c uPhi(sNx+i,j,k,bi,bj) = uLoc(sNx+i,j)
147 c vPhi(sNx+i,j,k,bi,bj) = vLoc(sNx+i,j)
148 c ENDDO
149 c ENDDO
150 c ENDIF
151 C- West:
152 IF (exch2_isWedge(myTile).EQ.1) THEN
153 DO j = 1-OLy,sNy+OLy
154 DO i = 1,exchWidthX
155 uPhi(1-i,j,k,bi,bj) = vLoc(1-i,j)
156 vPhi(1-i,j,k,bi,bj) = uLoc(1-i,j)*negOne
157 ENDDO
158 ENDDO
159 ENDIF
160
161 ELSE
162 C- Now the even faces (share disposition of all sections of the halo)
163
164 C- East:
165 IF (exch2_isEedge(myTile).EQ.1) THEN
166 DO j = 1-OLy,sNy+OLy
167 DO i = 1,exchWidthX
168 uPhi(sNx+i,j,k,bi,bj) = vLoc(sNx+i,j)
169 vPhi(sNx+i,j,k,bi,bj) = uLoc(sNx+i,j)*negOne
170 ENDDO
171 ENDDO
172 ENDIF
173 C- West: (nothing to change)
174 c IF (exch2_isWedge(myTile).EQ.1) THEN
175 c DO j = 1-OLy,sNy+OLy
176 c DO i = 1,exchWidthX
177 c uPhi(1-i,j,k,bi,bj) = uLoc(1-i,j)
178 c vPhi(1-i,j,k,bi,bj) = vLoc(1-i,j)
179 c ENDDO
180 c ENDDO
181 c ENDIF
182 C- North: (nothing to change)
183 c IF (exch2_isNedge(myTile).EQ.1) THEN
184 c DO j = 1,exchWidthY
185 c DO i = 1-OLx,sNx+OLx
186 c uPhi(i,sNy+j,k,bi,bj) = uLoc(i,sNy+j)
187 c vPhi(i,sNy+j,k,bi,bj) = vLoc(i,sNy+j)
188 c ENDDO
189 c ENDDO
190 c ENDIF
191 C- South:
192 IF (exch2_isSedge(myTile).EQ.1) THEN
193 DO j = 1,exchWidthY
194 DO i = 1-OLx,sNx+OLx
195 uPhi(i,1-j,k,bi,bj) = vLoc(i,1-j)*negOne
196 vPhi(i,1-j,k,bi,bj) = uLoc(i,1-j)
197 ENDDO
198 ENDDO
199 ENDIF
200
201 C end odd / even faces
202 ENDIF
203
204 C-- end of Loops on tile and level indices (k,bi,bj).
205 ENDDO
206 ENDDO
207 ENDDO
208
209 C--- using or not using CubedSphereExchange: end
210 ENDIF
211
212 RETURN
213 END
214
215 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
216
217 CEH3 ;;; Local Variables: ***
218 CEH3 ;;; mode:fortran ***
219 CEH3 ;;; End: ***

  ViewVC Help
Powered by ViewVC 1.1.22