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

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

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


Revision 1.4 - (show annotations) (download)
Sun Jun 28 00:57:51 2009 UTC (14 years, 11 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.3: +5 -16 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_sm_3d_rx.template,v 1.3 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_SM_3D_RX
9
10 C !INTERFACE:
11 SUBROUTINE EXCH2_SM_3D_RX(
12 U phi,
13 I withSigns, myNz, myThid )
14
15 C !DESCRIPTION:
16 C*=====================================================================*
17 C Purpose: SUBROUTINE EXCH2_SM_3D_RX
18 C handle exchanges for Second Moment (Sxy) 3D field
19 C (for quantity which Sign depend on X & Y orientation), at Mass point
20 C
21 C Input:
22 C phi(lon,lat,levs,bi,bj) :: array with overlap regions are to be exchanged
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: phi is updated (halo regions filled)
28 C
29 C Calls: exch_RX (exch2_RX1_cube)
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 phi(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNz,nSx,nSy)
45 LOGICAL withSigns
46 INTEGER myThid
47
48 C !LOCAL VARIABLES:
49 C == Local variables ==
50 C i,j,k,bi,bj :: loop indices.
51 C OL[wens] :: Overlap extents in west, east, north, south.
52 C exchWidth[XY] :: Extent of regions that will be exchanged.
53
54 INTEGER i,j,k,bi,bj
55 INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY
56 _RX negOne
57 INTEGER myTile, myFace
58 CEOP
59
60 OLw = OLx
61 OLe = OLx
62 OLn = OLy
63 OLs = OLy
64 exchWidthX = OLx
65 exchWidthY = OLy
66 negOne = 1.
67 IF (withSigns) negOne = -1.
68
69 C-- First call the exchanges
70
71 CALL EXCH2_RX1_CUBE( phi, 'T ',
72 I OLw, OLe, OLs, OLn, myNz,
73 I exchWidthX, exchWidthY,
74 I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
75 CALL EXCH2_RX1_CUBE( phi, 'T ',
76 I OLw, OLe, OLs, OLn, myNz,
77 I exchWidthX, exchWidthY,
78 I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
79
80 C- note: can substitute the low-level S/R call above with:
81 c CALL EXCH2_3D_RX( phi, myNz, myThid )
82
83 IF ( useCubedSphereExchange ) THEN
84 C--- using CubedSphereExchange:
85
86 C-- Then we may need to switch u and v components
87 C and/or the signs depending on which cube face we are located.
88
89 C-- Loops on tile indices:
90 DO bj = myByLo(myThid), myByHi(myThid)
91 DO bi = myBxLo(myThid), myBxHi(myThid)
92
93 C-- Then we may need to switch the signs depending on which cube face
94 C we are located (we assume that bj is always=1).
95 C Choose what to do at each edge of the halo based on which face
96 myTile = W2_myTileList(bi,bj)
97 myFace = exch2_myFace(myTile)
98
99 C-- Loops on level index:
100 DO k = 1,myNz
101
102 C- odd (or even) faces share disposition of all sections of the halo
103 IF ( MOD(myFace,2).EQ.1 ) THEN
104 C-- Face 1,3,5:
105
106 C- North:
107 IF (exch2_isNedge(myTile).EQ.1) THEN
108 DO j = 1,exchWidthY
109 DO i = 1-OLx,sNx+OLx
110 phi(i,sNy+j,k,bi,bj) = phi(i,sNy+j,k,bi,bj)*negOne
111 ENDDO
112 ENDDO
113 ENDIF
114 C- South: (nothing to change)
115 c IF (exch2_isSedge(myTile).EQ.1) THEN
116 c DO j = 1,exchWidthY
117 c DO i = 1-OLx,sNx+OLx
118 c phi(i,1-j,k,bi,bj) = phi(i,1-j,k,bi,bj)
119 c ENDDO
120 c ENDDO
121 c ENDIF
122 C- East: (nothing to change)
123 c IF (exch2_isEedge(myTile).EQ.1) THEN
124 c DO j = 1-OLy,sNy+OLy
125 c DO i = 1,exchWidthX
126 c phi(sNx+i,j,k,bi,bj) = phi(sNx+i,j,k,bi,bj)
127 c ENDDO
128 c ENDDO
129 c ENDIF
130 C- West:
131 IF (exch2_isWedge(myTile).EQ.1) THEN
132 DO j = 1-OLy,sNy+OLy
133 DO i = 1,exchWidthX
134 phi(1-i,j,k,bi,bj) = phi(1-i,j,k,bi,bj)*negOne
135 ENDDO
136 ENDDO
137 ENDIF
138
139 ELSE
140 C-- Face 2,4,6:
141
142 C- East:
143 IF (exch2_isEedge(myTile).EQ.1) THEN
144 DO j = 1-OLy,sNy+OLy
145 DO i = 1,exchWidthX
146 phi(sNx+i,j,k,bi,bj) = phi(sNx+i,j,k,bi,bj)*negOne
147 ENDDO
148 ENDDO
149 ENDIF
150 C- West: (nothing to change)
151 c IF (exch2_isWedge(myTile).EQ.1) THEN
152 c DO j = 1-OLy,sNy+OLy
153 c DO i = 1,exchWidthX
154 c phi(1-i,j,k,bi,bj) = phi(1-i,j,k,bi,bj)
155 c ENDDO
156 c ENDDO
157 c ENDIF
158 C- North: (nothing to change)
159 c IF (exch2_isNedge(myTile).EQ.1) THEN
160 c DO j = 1,exchWidthY
161 c DO i = 1-OLx,sNx+OLx
162 c phi(i,sNy+j,k,bi,bj) = phi(i,sNy+j,k,bi,bj)
163 c ENDDO
164 c ENDDO
165 c ENDIF
166 C- South:
167 IF (exch2_isSedge(myTile).EQ.1) THEN
168 DO j = 1,exchWidthY
169 DO i = 1-OLx,sNx+OLx
170 phi(i,1-j,k,bi,bj) = phi(i,1-j,k,bi,bj)*negOne
171 ENDDO
172 ENDDO
173 ENDIF
174
175 C-- End odd / even faces
176 ENDIF
177
178 C-- end of Loops on tile and level indices (k,bi,bj).
179 ENDDO
180 ENDDO
181 ENDDO
182
183 C--- using or not using CubedSphereExchange: end
184 ENDIF
185
186 RETURN
187 END
188
189 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
190
191 CEH3 ;;; Local Variables: ***
192 CEH3 ;;; mode:fortran ***
193 CEH3 ;;; End: ***

  ViewVC Help
Powered by ViewVC 1.1.22