/[MITgcm]/MITgcm/eesupp/src/fill_cs_corner_ag_rl.F
ViewVC logotype

Contents of /MITgcm/eesupp/src/fill_cs_corner_ag_rl.F

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


Revision 1.3 - (show annotations) (download)
Sun Jun 28 01:02:17 2009 UTC (15 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, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint64, checkpoint65, checkpoint62, checkpoint63, 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, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61s, checkpoint61z, checkpoint61x, checkpoint61y, HEAD
Changes since 1.2: +2 -2 lines
add bj in exch2 arrays and S/R

1 C $Header: /u/gcmpack/MITgcm/eesupp/src/fill_cs_corner_ag_rl.F,v 1.2 2009/05/12 19:53:03 jmc Exp $
2 C $Name: $
3
4 #include "PACKAGES_CONFIG.h"
5 #include "CPP_EEOPTIONS.h"
6
7 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
8 CBOP
9 C !ROUTINE: FILL_CS_CORNER_AG_RL
10
11 C !INTERFACE:
12 SUBROUTINE FILL_CS_CORNER_AG_RL(
13 I fill4dirX, withSigns,
14 U uFld, vFld,
15 I bi,bj, myThid)
16
17 C !DESCRIPTION:
18 C *==========================================================*
19 C | SUBROUTINE FILL_CS_CORNER_AG_RL
20 C | o Fill the corner-halo region of CS-grid,
21 C | for a 2 components vector field on A-grid (center of grid cell)
22 C *==========================================================*
23 C | o the corner halo region is filled with valid values
24 C | in order to compute (later on) gradient in X or Y
25 C | direction, on a wide stencil.
26 C *==========================================================*
27
28 C !USES:
29 IMPLICIT NONE
30
31 C == Global variables ==
32 #include "SIZE.h"
33 #include "EEPARAMS.h"
34 #ifdef ALLOW_EXCH2
35 #include "W2_EXCH2_SIZE.h"
36 #include "W2_EXCH2_TOPOLOGY.h"
37 #endif /* ALLOW_EXCH2 */
38
39 C !INPUT/OUTPUT PARAMETERS:
40 C == Routine arguments ==
41 C
42 C fill4dirX :: True = prepare for X direction calculations
43 C otherwise, prepare for Y direction
44 C withSigns :: True = account for sign of vector component
45 C uFld :: u-component of vector field array with empty corners to fill
46 C vFld :: v-component of vector field array with empty corners to fill
47 C bi,bj :: tile indices
48 C myThid :: thread number
49 LOGICAL fill4dirX
50 LOGICAL withSigns
51 _RL uFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
52 _RL vFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
53 INTEGER bi,bj
54 INTEGER myThid
55
56 C !LOCAL VARIABLES:
57 C == Local variables ==
58 C i,j :: loop indices
59 C myTile :: tile number
60 INTEGER i,j
61 LOGICAL southWestCorner
62 LOGICAL southEastCorner
63 LOGICAL northWestCorner
64 LOGICAL northEastCorner
65 _RL negOne
66 #ifdef ALLOW_EXCH2
67 INTEGER myTile
68 #endif
69 CEOP
70
71 negOne = 1.
72 IF (withSigns) negOne = -1.
73
74 IF (useCubedSphereExchange) THEN
75
76 #ifdef ALLOW_EXCH2
77 myTile = W2_myTileList(bi,bj)
78 southWestCorner = exch2_isWedge(myTile).EQ.1
79 & .AND. exch2_isSedge(myTile).EQ.1
80 southEastCorner = exch2_isEedge(myTile).EQ.1
81 & .AND. exch2_isSedge(myTile).EQ.1
82 northEastCorner = exch2_isEedge(myTile).EQ.1
83 & .AND. exch2_isNedge(myTile).EQ.1
84 northWestCorner = exch2_isWedge(myTile).EQ.1
85 & .AND. exch2_isNedge(myTile).EQ.1
86 #else
87 southWestCorner = .TRUE.
88 southEastCorner = .TRUE.
89 northWestCorner = .TRUE.
90 northEastCorner = .TRUE.
91 #endif
92
93 IF ( fill4dirX ) THEN
94 C-- Internal exchange for calculations in X
95
96 C- For cube face corners we need to duplicate the
97 C- i-1 and i+1 values into the null space as follows:
98 C
99 C
100 C o NW corner: copy T( 0,sNy ) into T( 0,sNy+1) e.g.
101 C |
102 C x T(0,sNy+1) |
103 C /\ |
104 C --||------------|-----------
105 C || |
106 C x T(0,sNy) | x T(1,sNy)
107 C |
108 C
109 C o SW corner: copy T(0,1) into T(0,0) e.g.
110 C |
111 C x T(0,1) | x T(1,1)
112 C || |
113 C --||------------|-----------
114 C \/ |
115 C x T(0,0) |
116 C |
117 C
118 C o NE corner: copy T(sNx+1,sNy ) into T(sNx+1,sNy+1) e.g.
119 C |
120 C | x T(sNx+1,sNy+1)
121 C | /\
122 C ----------------|--||-------
123 C | ||
124 C x T(sNx,sNy) | x T(sNx+1,sNy )
125 C |
126 C o SE corner: copy T(sNx+1,1 ) into T(sNx+1,0 ) e.g.
127 C |
128 C x T(sNx,1) | x T(sNx+1, 1)
129 C | ||
130 C ----------------|--||-------
131 C | \/
132 C | x T(sNx+1, 0)
133 IF ( southWestCorner ) THEN
134 DO j=1,OLy
135 DO i=1,OLx
136 uFld( 1-i , 1-j ) = vFld( 1-j , i )*negOne
137 vFld( 1-i , 1-j ) = uFld( 1-j , i )
138 ENDDO
139 ENDDO
140 ENDIF
141 IF ( southEastCorner ) THEN
142 DO j=1,OLy
143 DO i=1,OLx
144 uFld(sNx+i, 1-j ) = vFld(sNx+j, i )
145 vFld(sNx+i, 1-j ) = uFld(sNx+j, i )*negOne
146 ENDDO
147 ENDDO
148 ENDIF
149 IF ( northWestCorner ) THEN
150 DO j=1,OLy
151 DO i=1,OLx
152 uFld( 1-i ,sNy+j) = vFld( 1-j , sNy+1-i )
153 vFld( 1-i ,sNy+j) = uFld( 1-j , sNy+1-i )*negOne
154 ENDDO
155 ENDDO
156 ENDIF
157 IF ( northEastCorner ) THEN
158 DO j=1,OLy
159 DO i=1,OLx
160 uFld(sNx+i,sNy+j) = vFld(sNx+j, sNy+1-i )*negOne
161 vFld(sNx+i,sNy+j) = uFld(sNx+j, sNy+1-i )
162 ENDDO
163 ENDDO
164 ENDIF
165
166 C-- End of X direction ; start Y direction case.
167
168 ELSE
169 C-- Internal exchange for calculations in Y
170
171 C- For cube face corners we need to duplicate the
172 C- j-1 and j+1 values into the null space as follows:
173 C
174 C o SW corner: copy T(0,1) into T(0,0) e.g.
175 C |
176 C | x T(1,1)
177 C |
178 C ----------------|-----------
179 C |
180 C x T(0,0)<====== x T(1,0)
181 C |
182 C
183 C o NW corner: copy T( 0,sNy ) into T( 0,sNy+1) e.g.
184 C |
185 C x T(0,sNy+1)<=== x T(1,sNy+1)
186 C |
187 C ----------------|-----------
188 C |
189 C | x T(1,sNy)
190 C |
191 C
192 C o NE corner: copy T(sNx+1,sNy ) into T(sNx+1,sNy+1) e.g.
193 C |
194 C x T(sNx,sNy+1)=====>x T(sNx+1,sNy+1)
195 C |
196 C ----------------|-----------
197 C |
198 C x T(sNx,sNy) |
199 C |
200 C o SE corner: copy T(sNx+1,1 ) into T(sNx+1,0 ) e.g.
201 C |
202 C x T(sNx,1) |
203 C |
204 C ----------------|-----------
205 C |
206 C x T(sNx,0) =====>x T(sNx+1, 0)
207 IF ( southWestCorner ) THEN
208 DO j=1,Oly
209 DO i=1,Olx
210 uFld( 1-i , 1-j ) = vFld( j , 1-i )
211 vFld( 1-i , 1-j ) = uFld( j , 1-i )*negOne
212 ENDDO
213 ENDDO
214 ENDIF
215 IF ( southEastCorner ) THEN
216 DO j=1,Oly
217 DO i=1,Olx
218 uFld(sNx+i, 1-j ) = vFld(sNx+1-j, 1-i )*negOne
219 vFld(sNx+i, 1-j ) = uFld(sNx+1-j, 1-i )
220 ENDDO
221 ENDDO
222 ENDIF
223 IF ( northWestCorner ) THEN
224 DO j=1,Oly
225 DO i=1,Olx
226 uFld( 1-i ,sNy+j) = vFld( j ,sNy+i)*negOne
227 vFld( 1-i ,sNy+j) = uFld( j ,sNy+i)
228 ENDDO
229 ENDDO
230 ENDIF
231 IF ( northEastCorner ) THEN
232 DO j=1,Oly
233 DO i=1,Olx
234 uFld(sNx+i,sNy+j) = vFld(sNx+1-j,sNy+i)
235 vFld(sNx+i,sNy+j) = uFld(sNx+1-j,sNy+i)*negOne
236 ENDDO
237 ENDDO
238 ENDIF
239
240 C- End of Y direction case.
241 ENDIF
242
243 C-- End useCubedSphereExchange
244 ENDIF
245
246 RETURN
247 END

  ViewVC Help
Powered by ViewVC 1.1.22