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

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

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


Revision 1.6 - (show annotations) (download)
Mon May 14 13:15:05 2012 UTC (12 years ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63n, checkpoint63o, checkpoint64, checkpoint65, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, HEAD
Changes since 1.5: +44 -34 lines
add new CPP option (DISCONNECTED_TILES) to disconnect tiles (no exchange
 between tiles, just fill-in edges assuming locally periodic subdomain) and
 add corresponding exchange subroutines (EXCH0);

1 C $Header: /u/gcmpack/MITgcm/eesupp/src/exch_uv_agrid_3d_rx.template,v 1.5 2010/05/19 01:53:46 jmc Exp $
2 C $Name: $
3
4 #include "PACKAGES_CONFIG.h"
5 #include "CPP_EEOPTIONS.h"
6
7 CBOP
8 C !ROUTINE: EXCH_UV_AGRID_3D_RX
9
10 C !INTERFACE:
11 SUBROUTINE EXCH_UV_AGRID_3D_RX(
12 U uPhi, vPhi,
13 I withSigns, myNz, myThid )
14
15 C !DESCRIPTION:
16 C*=====================================================================*
17 C Purpose: SUBROUTINE EXCH_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 signs 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 (either exch_rx_cube or exch_rx) - twice, once
30 C for the first-component, once for second.
31 C
32 C NOTES: 1) If using CubedSphereExchange, only works on ONE PROCESSOR!
33 C*=====================================================================*
34
35 C !USES:
36 IMPLICIT NONE
37
38 #include "SIZE.h"
39 #include "EEPARAMS.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 #ifndef ALLOW_EXCH2
51 C == Local variables ==
52 C i,j,k,bi,bj :: are DO indices.
53 C OL[wens] :: Overlap extents in west, east, north, south.
54 C exchWidth[XY] :: Extent of regions that will be exchanged.
55 C dummy[12] :: copies of the vector components with haloes filled.
56
57 INTEGER i,j,k,bi,bj
58 INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY
59 _RX dummy1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
60 _RX dummy2(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
61 _RX negOne
62 #endif
63 CEOP
64
65 #ifdef ALLOW_EXCH2
66 CALL EXCH2_UV_AGRID_3D_RX(
67 U uPhi, vPhi,
68 I withSigns, myNz, myThid )
69 #else /* ALLOW_EXCH2 */
70
71 OLw = OLx
72 OLe = OLx
73 OLn = OLy
74 OLs = OLy
75 exchWidthX = OLx
76 exchWidthY = OLy
77 negOne = 1.
78 IF (withSigns) negOne = -1.
79
80 IF (useCubedSphereExchange) THEN
81 C--- using CubedSphereExchange:
82
83 C First call the exchanges for the two components
84
85 CALL EXCH1_RX_CUBE( uPhi, .FALSE.,
86 I OLw, OLe, OLs, OLn, myNz,
87 I exchWidthX, exchWidthY,
88 I EXCH_UPDATE_CORNERS, myThid )
89 CALL EXCH1_RX_CUBE( vPhi, .FALSE.,
90 I OLw, OLe, OLs, OLn, myNz,
91 I exchWidthX, exchWidthY,
92 I EXCH_UPDATE_CORNERS, myThid )
93
94 C Then if we are on the sphere we may need to switch u and v components
95 C and/or the signs depending on which cube face we are located.
96
97 C-- Loops on tile and level indices:
98 DO bj = myByLo(myThid), myByHi(myThid)
99 DO bi = myBxLo(myThid), myBxHi(myThid)
100 DO k = 1,myNz
101
102 C First we need to copy the component info into dummy arrays
103 DO j = 1-OLy,sNy+OLy
104 DO i = 1-OLx,sNx+OLx
105 dummy1(i,j) = uPhi(i,j,k,bi,bj)
106 dummy2(i,j) = vPhi(i,j,k,bi,bj)
107 ENDDO
108 ENDDO
109
110 C Now choose what to do at each edge of the halo based on which face
111 C (we assume that bj is always=1)
112
113 C odd faces share disposition of all sections of the halo
114 IF ( MOD(bi,2).EQ.1 ) THEN
115 DO j = 1,sNy
116 DO i = 1,exchWidthX
117 C east (nothing to change)
118 c uPhi(sNx+i,j,k,bi,bj) = dummy1(sNx+i,j)
119 c vPhi(sNx+i,j,k,bi,bj) = dummy2(sNx+i,j)
120 C west
121 uPhi(1-i,j,k,bi,bj) = dummy2(1-i,j)
122 vPhi(1-i,j,k,bi,bj) = dummy1(1-i,j)*negOne
123 ENDDO
124 ENDDO
125 DO j = 1,exchWidthY
126 DO i = 1,sNx
127 C north
128 uPhi(i,sNy+j,k,bi,bj) = dummy2(i,sNy+j)*negOne
129 vPhi(i,sNy+j,k,bi,bj) = dummy1(i,sNy+j)
130 C south (nothing to change)
131 c uPhi(i,1-j,k,bi,bj) = dummy1(i,1-j)
132 c vPhi(i,1-j,k,bi,bj) = dummy2(i,1-j)
133 ENDDO
134 ENDDO
135
136 ELSE
137 C now the even faces (share disposition of all sections of the halo)
138
139 DO j = 1,sNy
140 DO i = 1,exchWidthX
141 C east
142 uPhi(sNx+i,j,k,bi,bj) = dummy2(sNx+i,j)
143 vPhi(sNx+i,j,k,bi,bj) = dummy1(sNx+i,j)*negOne
144 C west (nothing to change)
145 c uPhi(1-i,j,k,bi,bj) = dummy1(1-i,j)
146 c vPhi(1-i,j,k,bi,bj) = dummy2(1-i,j)
147 ENDDO
148 ENDDO
149 DO j = 1,exchWidthY
150 DO i = 1,sNx
151 C north (nothing to change)
152 c uPhi(i,sNy+j,k,bi,bj) = dummy1(i,sNy+j)
153 c vPhi(i,sNy+j,k,bi,bj) = dummy2(i,sNy+j)
154 C south
155 uPhi(i,1-j,k,bi,bj) = dummy2(i,1-j)*negOne
156 vPhi(i,1-j,k,bi,bj) = dummy1(i,1-j)
157
158 ENDDO
159 ENDDO
160
161 C end odd / even faces
162 ENDIF
163
164 C-- end of Loops on tile and level indices (k,bi,bj).
165 ENDDO
166 ENDDO
167 ENDDO
168
169 ELSE
170 C--- not using CubedSphereExchange:
171
172 #ifdef DISCONNECTED_TILES
173 CALL EXCH0_RX( uPhi,
174 I OLw, OLe, OLs, OLn, myNz,
175 I exchWidthX, exchWidthY,
176 I EXCH_UPDATE_CORNERS, myThid )
177 CALL EXCH0_RX( vPhi,
178 I OLw, OLe, OLs, OLn, myNz,
179 I exchWidthX, exchWidthY,
180 I EXCH_UPDATE_CORNERS, myThid )
181 #else /* DISCONNECTED_TILES */
182 CALL EXCH1_RX( uPhi,
183 I OLw, OLe, OLs, OLn, myNz,
184 I exchWidthX, exchWidthY,
185 I EXCH_UPDATE_CORNERS, myThid )
186 CALL EXCH1_RX( vPhi,
187 I OLw, OLe, OLs, OLn, myNz,
188 I exchWidthX, exchWidthY,
189 I EXCH_UPDATE_CORNERS, myThid )
190 #endif /* DISCONNECTED_TILES */
191
192 C--- using or not using CubedSphereExchange: end
193 ENDIF
194
195 #endif /* ALLOW_EXCH2 */
196
197 RETURN
198 END
199
200 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
201
202 CEH3 ;;; Local Variables: ***
203 CEH3 ;;; mode:fortran ***
204 CEH3 ;;; End: ***

  ViewVC Help
Powered by ViewVC 1.1.22