/[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.7 - (show annotations) (download)
Fri Jul 27 18:55:18 2012 UTC (11 years, 10 months 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, checkpoint63q, checkpoint63r, checkpoint63s, 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.6: +4 -4 lines
faster when withSigns=F (just normal EXCH)

1 C $Header: /u/gcmpack/MITgcm/pkg/exch2/exch2_sm_3d_rx.template,v 1.6 2012/03/26 19:43:10 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, .FALSE., 'T ',
72 I OLw, OLe, OLs, OLn, myNz,
73 I exchWidthX, exchWidthY,
74 I EXCH_IGNORE_CORNERS, myThid )
75 CALL EXCH2_RX1_CUBE( phi, .FALSE., 'T ',
76 I OLw, OLe, OLs, OLn, myNz,
77 I exchWidthX, exchWidthY,
78 I 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 .AND. withSigns ) THEN
84 C--- using CubedSphereExchange with Signs:
85
86 C-- Then we may need to switch the signs depending on which cube face
87 C 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 Choose what to do at each edge of the halo based on which face we are
94 myTile = W2_myTileList(bi,bj)
95 myFace = exch2_myFace(myTile)
96
97 C-- Loops on level index:
98 DO k = 1,myNz
99
100 C- odd (or even) faces share disposition of all sections of the halo
101 IF ( MOD(myFace,2).EQ.1 ) THEN
102 C-- Face 1,3,5:
103
104 C- North:
105 IF (exch2_isNedge(myTile).EQ.1) THEN
106 DO j = 1,exchWidthY
107 DO i = 1-OLx,sNx+OLx
108 phi(i,sNy+j,k,bi,bj) = phi(i,sNy+j,k,bi,bj)*negOne
109 ENDDO
110 ENDDO
111 ENDIF
112 C- South: (nothing to change)
113 c IF (exch2_isSedge(myTile).EQ.1) THEN
114 c DO j = 1,exchWidthY
115 c DO i = 1-OLx,sNx+OLx
116 c phi(i,1-j,k,bi,bj) = phi(i,1-j,k,bi,bj)
117 c ENDDO
118 c ENDDO
119 c ENDIF
120 C- East: (nothing to change)
121 c IF (exch2_isEedge(myTile).EQ.1) THEN
122 c DO j = 1-OLy,sNy+OLy
123 c DO i = 1,exchWidthX
124 c phi(sNx+i,j,k,bi,bj) = phi(sNx+i,j,k,bi,bj)
125 c ENDDO
126 c ENDDO
127 c ENDIF
128 C- West:
129 IF (exch2_isWedge(myTile).EQ.1) THEN
130 DO j = 1-OLy,sNy+OLy
131 DO i = 1,exchWidthX
132 phi(1-i,j,k,bi,bj) = phi(1-i,j,k,bi,bj)*negOne
133 ENDDO
134 ENDDO
135 ENDIF
136
137 ELSE
138 C-- Face 2,4,6:
139
140 C- East:
141 IF (exch2_isEedge(myTile).EQ.1) THEN
142 DO j = 1-OLy,sNy+OLy
143 DO i = 1,exchWidthX
144 phi(sNx+i,j,k,bi,bj) = phi(sNx+i,j,k,bi,bj)*negOne
145 ENDDO
146 ENDDO
147 ENDIF
148 C- West: (nothing to change)
149 c IF (exch2_isWedge(myTile).EQ.1) THEN
150 c DO j = 1-OLy,sNy+OLy
151 c DO i = 1,exchWidthX
152 c phi(1-i,j,k,bi,bj) = phi(1-i,j,k,bi,bj)
153 c ENDDO
154 c ENDDO
155 c ENDIF
156 C- North: (nothing to change)
157 c IF (exch2_isNedge(myTile).EQ.1) THEN
158 c DO j = 1,exchWidthY
159 c DO i = 1-OLx,sNx+OLx
160 c phi(i,sNy+j,k,bi,bj) = phi(i,sNy+j,k,bi,bj)
161 c ENDDO
162 c ENDDO
163 c ENDIF
164 C- South:
165 IF (exch2_isSedge(myTile).EQ.1) THEN
166 DO j = 1,exchWidthY
167 DO i = 1-OLx,sNx+OLx
168 phi(i,1-j,k,bi,bj) = phi(i,1-j,k,bi,bj)*negOne
169 ENDDO
170 ENDDO
171 ENDIF
172
173 C-- End odd / even faces
174 ENDIF
175
176 C-- end of Loops on tile and level indices (k,bi,bj).
177 ENDDO
178 ENDDO
179 ENDDO
180
181 C--- using or not using CubedSphereExchange with Signs: end
182 ENDIF
183
184 RETURN
185 END
186
187 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
188
189 CEH3 ;;; Local Variables: ***
190 CEH3 ;;; mode:fortran ***
191 CEH3 ;;; End: ***

  ViewVC Help
Powered by ViewVC 1.1.22