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

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

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


Revision 1.3 - (hide annotations) (download)
Tue May 12 19:44:58 2009 UTC (15 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: checkpoint61o, checkpoint61r, checkpoint61p, checkpoint61q
Changes since 1.2: +2 -2 lines
new header files "W2_EXCH2_SIZE.h" (taken out of W2_EXCH2_TOPOLOGY.h)
             and "W2_EXCH2_BUFFER.h" (taken out of W2_EXCH2_PARAMS.h)

1 jmc 1.3 C $Header: /u/gcmpack/MITgcm/pkg/exch2/exch2_sm_3d_rx.template,v 1.2 2007/08/17 18:17:45 jmc Exp $
2 jmc 1.1 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 jmc 1.2 c#include "EESUPPORT.h"
39 jmc 1.3 #include "W2_EXCH2_SIZE.h"
40 jmc 1.1 #include "W2_EXCH2_TOPOLOGY.h"
41    
42     C !INPUT/OUTPUT PARAMETERS:
43     C == Argument list variables ==
44     INTEGER myNz
45     _RX phi(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    
55     INTEGER i,j,k,bi,bj
56     INTEGER OLw, OLe, OLn, OLs, exchWidthX, exchWidthY
57     _RX negOne
58     INTEGER myTile, myFace
59     CEOP
60    
61     OLw = OLx
62     OLe = OLx
63     OLn = OLy
64     OLs = OLy
65     exchWidthX = OLx
66     exchWidthY = OLy
67     negOne = 1.
68     IF (withSigns) negOne = -1.
69    
70     IF ( useCubedSphereExchange ) THEN
71     C--- using CubedSphereExchange:
72    
73     C-- First call the exchanges
74    
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     CALL EXCH2_RX1_CUBE( phi, 'T ',
80     I OLw, OLe, OLs, OLn, myNz,
81     I exchWidthX, exchWidthY,
82     I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
83    
84     C- note: can substitute the low-level S/R call above with:
85     c CALL EXCH2_3D_RX( phi, myNz, myThid )
86    
87     C-- Then we may need to switch u and v components
88     C and/or the signs depending on which cube face we are located.
89    
90     C-- Loops on tile indices:
91     DO bj = myByLo(myThid), myByHi(myThid)
92     DO bi = myBxLo(myThid), myBxHi(myThid)
93    
94     C-- Then we may need to switch the signs depending on which cube face
95     C we are located (we assume that bj is always=1).
96     C Choose what to do at each edge of the halo based on which face
97     myTile = W2_myTileList(bi)
98     myFace = exch2_myFace(myTile)
99    
100     C-- Loops on level index:
101     DO k = 1,myNz
102    
103     C- odd (or even) faces share disposition of all sections of the halo
104     IF ( MOD(myFace,2).EQ.1 ) THEN
105     C-- Face 1,3,5:
106    
107     C- North:
108     IF (exch2_isNedge(myTile).EQ.1) THEN
109     DO j = 1,exchWidthY
110     DO i = 1-OLx,sNx+OLx
111     phi(i,sNy+j,k,bi,bj) = phi(i,sNy+j,k,bi,bj)*negOne
112     ENDDO
113     ENDDO
114     ENDIF
115     C- South: (nothing to change)
116     c IF (exch2_isSedge(myTile).EQ.1) THEN
117     c DO j = 1,exchWidthY
118     c DO i = 1-OLx,sNx+OLx
119     c phi(i,1-j,k,bi,bj) = phi(i,1-j,k,bi,bj)
120     c ENDDO
121     c ENDDO
122     c ENDIF
123     C- East: (nothing to change)
124     c IF (exch2_isEedge(myTile).EQ.1) THEN
125     c DO j = 1-OLy,sNy+OLy
126     c DO i = 1,exchWidthX
127     c phi(sNx+i,j,k,bi,bj) = phi(sNx+i,j,k,bi,bj)
128     c ENDDO
129     c ENDDO
130     c ENDIF
131     C- West:
132     IF (exch2_isWedge(myTile).EQ.1) THEN
133     DO j = 1-OLy,sNy+OLy
134     DO i = 1,exchWidthX
135     phi(1-i,j,k,bi,bj) = phi(1-i,j,k,bi,bj)*negOne
136     ENDDO
137     ENDDO
138     ENDIF
139    
140     ELSE
141     C-- Face 2,4,6:
142    
143     C- East:
144     IF (exch2_isEedge(myTile).EQ.1) THEN
145     DO j = 1-OLy,sNy+OLy
146     DO i = 1,exchWidthX
147     phi(sNx+i,j,k,bi,bj) = phi(sNx+i,j,k,bi,bj)*negOne
148     ENDDO
149     ENDDO
150     ENDIF
151     C- West: (nothing to change)
152     c IF (exch2_isWedge(myTile).EQ.1) THEN
153     c DO j = 1-OLy,sNy+OLy
154     c DO i = 1,exchWidthX
155     c phi(1-i,j,k,bi,bj) = phi(1-i,j,k,bi,bj)
156     c ENDDO
157     c ENDDO
158     c ENDIF
159     C- North: (nothing to change)
160     c IF (exch2_isNedge(myTile).EQ.1) THEN
161     c DO j = 1,exchWidthY
162     c DO i = 1-OLx,sNx+OLx
163     c phi(i,sNy+j,k,bi,bj) = phi(i,sNy+j,k,bi,bj)
164     c ENDDO
165     c ENDDO
166     c ENDIF
167     C- South:
168     IF (exch2_isSedge(myTile).EQ.1) THEN
169     DO j = 1,exchWidthY
170     DO i = 1-OLx,sNx+OLx
171     phi(i,1-j,k,bi,bj) = phi(i,1-j,k,bi,bj)*negOne
172     ENDDO
173     ENDDO
174     ENDIF
175    
176     C-- End odd / even faces
177     ENDIF
178    
179     C-- end of Loops on tile and level indices (k,bi,bj).
180     ENDDO
181     ENDDO
182     ENDDO
183    
184     ELSE
185     C--- not using CubedSphereExchange:
186    
187     #ifndef AUTODIFF_EXCH2
188     CALL EXCH_RX( phi,
189     I OLw, OLe, OLs, OLn, myNz,
190     I exchWidthX, exchWidthY,
191     I FORWARD_SIMULATION, EXCH_UPDATE_CORNERS, myThid )
192     #endif
193    
194     C--- using or not using CubedSphereExchange: end
195     ENDIF
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