/[MITgcm]/MITgcm/pkg/generic_advdiff/gad_som_prep_cs_corner.F
ViewVC logotype

Contents of /MITgcm/pkg/generic_advdiff/gad_som_prep_cs_corner.F

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


Revision 1.2 - (show annotations) (download)
Fri May 9 21:43:16 2008 UTC (15 years, 11 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, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint64, checkpoint65, checkpoint60, checkpoint61, 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, checkpoint59r, 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, checkpoint61f, checkpoint61g, checkpoint61d, checkpoint61e, checkpoint61b, checkpoint61c, checkpoint61a, checkpoint61n, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint61z, checkpoint61x, checkpoint61y, HEAD
Changes since 1.1: +1 -4 lines
change option: GAD_ALLOW_SOM_ADVECT to GAD_ALLOW_TS_SOM_ADV which only
applies to files where Temperature & salinity 2nd Order moments are used

1 C $Header: /u/gcmpack/MITgcm/pkg/generic_advdiff/gad_som_prep_cs_corner.F,v 1.1 2008/02/12 20:32:34 jmc Exp $
2 C $Name: $
3
4 #include "GAD_OPTIONS.h"
5
6 CBOP
7 C !ROUTINE: GAD_SOM_PREP_CS_CORNER
8 C !INTERFACE:
9 SUBROUTINE GAD_SOM_PREP_CS_CORNER(
10 U smVol, smTr0, smTr, smCorners,
11 I prep4dirX, overlapOnly, interiorOnly,
12 I N_edge, S_edge, E_edge, W_edge,
13 I iPass, k, myNz, bi, bj, myThid )
14
15
16 C !DESCRIPTION: \bv
17 C *==========================================================*
18 C | SUBROUTINE GAD_SOM_PREP_CS_CORNER
19 C | o Prepare for Horizontal SOM Advection :
20 C | when using Cubed-Sphere Grid, fill corner-halo regions
21 C | of all Tracer-moments with proper values
22 C *==========================================================*
23 C \ev
24 C !USES:
25 IMPLICIT NONE
26
27 C === Global variables ===
28 #include "SIZE.h"
29 #include "EEPARAMS.h"
30 #include "GAD.h"
31
32 C !INPUT/OUTPUT PARAMETERS:
33 C === Routine arguments ===
34 C smVol :: grid-cell volume
35 C smTr0 :: tracer Zero Order moment
36 C smTr :: tracer 1rst & 2nd Order moments
37 C smCorners :: Temporary storage of Corner-halo-regions values
38 C ( 3rd dim = Number of corners = 4 : SW, SE, NE, NW )
39 C prep4dirX :: True = prepare for X direction advection
40 C otherwise, prepare for Y direction advection.
41 C overlapOnly :: only update the edges of myTile, but not the interior
42 C interiorOnly :: only update the interior of myTile, but not the edges
43 C [N,S,E,W]_edge :: true if N,S,E,W edge of myTile is an Edge of the cube
44 C iPass :: current passage index in SOM_ADVECT
45 C k :: current level index
46 C myNz :: 3rd dimension of array to exchange
47 C bi,bj :: current tile indices
48 C myThid :: my Thread Id number
49 INTEGER myNz
50 _RL smVol(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNz)
51 _RL smTr0(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNz)
52 _RL smTr (1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNz,nSx,nSy,nSOM)
53 _RL smCorners(OLx,OLy,4,-1:nSOM)
54 LOGICAL prep4dirX, overlapOnly, interiorOnly
55 LOGICAL N_edge, S_edge, E_edge, W_edge
56 INTEGER iPass, k, bi, bj
57 INTEGER myThid
58 CEOP
59
60 C !LOCAL VARIABLES:
61 C === Local variables ===
62 INTEGER i,j, jPass, n
63 LOGICAL southWestCorner
64 LOGICAL southEastCorner
65 LOGICAL northEastCorner
66 LOGICAL northWestCorner
67
68 southWestCorner = S_edge .AND. W_edge
69 southEastCorner = S_edge .AND. E_edge
70 northEastCorner = N_edge .AND. E_edge
71 northWestCorner = N_edge .AND. W_edge
72
73 IF ( overlapOnly ) THEN
74 C-- to avoid repeating 2 times the full sequence of FILL_CS_CORNER calls,
75 C add a loop on jPass (from iPass to 2) to reproduce the following logic:
76 C 1 ) overlapOnly & iPass = 1 (face 3 & 6)
77 C - fill corners for the other direction
78 C - then store the corner values
79 C 2 ) IF overlapOnly :: fill corners for the current direction
80 C ELSEIF .NOT.interiorOnly :: get the corner values back from storage
81 C ENDIF
82 DO jPass = iPass,2
83
84 IF ( ( jPass.EQ.2 .AND. prep4dirX ) .OR.
85 & ( jPass.EQ.1 .AND. .NOT.prep4dirX ) ) THEN
86 C-- Fill corners to prepare for calculations in X
87 CALL GAD_SOM_FILL_CS_CORNER( .TRUE.,
88 U smVol(1-OLx,1-OLy,k),
89 U smTr0(1-OLx,1-OLy,k),
90 U smTr(1-OLx,1-OLy,k,bi,bj,1),
91 U smTr(1-OLx,1-OLy,k,bi,bj,2),
92 U smTr(1-OLx,1-OLy,k,bi,bj,3),
93 U smTr(1-OLx,1-OLy,k,bi,bj,4),
94 U smTr(1-OLx,1-OLy,k,bi,bj,5),
95 U smTr(1-OLx,1-OLy,k,bi,bj,6),
96 U smTr(1-OLx,1-OLy,k,bi,bj,7),
97 U smTr(1-OLx,1-OLy,k,bi,bj,8),
98 U smTr(1-OLx,1-OLy,k,bi,bj,9),
99 I bi, bj, myThid )
100 C-- End of filling for X dir
101 c ENDIF
102
103 ELSE
104 C Note: the 2 IF tests are equivalent to just 1 if/else test;
105 C use this later option and leave the former commented.
106
107 c IF ( ( jPass.EQ.1 .AND. prep4dirX ) .OR.
108 c & ( jPass.EQ.2 .AND. .NOT.prep4dirX ) ) THEN
109 C-- Fill corners to prepare for calculations in Y
110 CALL GAD_SOM_FILL_CS_CORNER( .FALSE.,
111 U smVol(1-OLx,1-OLy,k),
112 U smTr0(1-OLx,1-OLy,k),
113 U smTr(1-OLx,1-OLy,k,bi,bj,1),
114 U smTr(1-OLx,1-OLy,k,bi,bj,2),
115 U smTr(1-OLx,1-OLy,k,bi,bj,3),
116 U smTr(1-OLx,1-OLy,k,bi,bj,4),
117 U smTr(1-OLx,1-OLy,k,bi,bj,5),
118 U smTr(1-OLx,1-OLy,k,bi,bj,6),
119 U smTr(1-OLx,1-OLy,k,bi,bj,7),
120 U smTr(1-OLx,1-OLy,k,bi,bj,8),
121 U smTr(1-OLx,1-OLy,k,bi,bj,9),
122 I bi, bj, myThid )
123 C-- End of filling for Y dir
124 ENDIF
125
126 IF ( jPass.EQ.1 ) THEN
127 C-- Store corner values (to be used on the next iPass)
128 IF ( southWestCorner ) THEN
129 DO j=1,OLy
130 DO i=1,OLx
131 smCorners(i,j,1,-1) = smVol(i-OLx,j-OLy,k)
132 smCorners(i,j,1, 0) = smTr0(i-OLx,j-OLy,k)
133 DO n=1,nSOM
134 smCorners(i,j,1,n) = smTr (i-OLx,j-OLy,k,bi,bj,n)
135 ENDDO
136 ENDDO
137 ENDDO
138 ENDIF
139 IF ( southEastCorner ) THEN
140 DO j=1,OLy
141 DO i=1,OLx
142 smCorners(i,j,2,-1) = smVol(sNx+i,j-OLy,k)
143 smCorners(i,j,2, 0) = smTr0(sNx+i,j-OLy,k)
144 DO n=1,nSOM
145 smCorners(i,j,2,n) = smTr (sNx+i,j-OLy,k,bi,bj,n)
146 ENDDO
147 ENDDO
148 ENDDO
149 ENDIF
150 IF ( northEastCorner ) THEN
151 DO j=1,OLy
152 DO i=1,OLx
153 smCorners(i,j,3,-1) = smVol(sNx+i,sNy+j,k)
154 smCorners(i,j,3, 0) = smTr0(sNx+i,sNy+j,k)
155 DO n=1,nSOM
156 smCorners(i,j,3,n) = smTr (sNx+i,sNy+j,k,bi,bj,n)
157 ENDDO
158 ENDDO
159 ENDDO
160 ENDIF
161 IF ( northWestCorner ) THEN
162 DO j=1,OLy
163 DO i=1,OLx
164 smCorners(i,j,4,-1) = smVol(i-OLx,sNy+j,k)
165 smCorners(i,j,4, 0) = smTr0(i-OLx,sNy+j,k)
166 DO n=1,nSOM
167 smCorners(i,j,4,n) = smTr (i-OLx,sNy+j,k,bi,bj,n)
168 ENDDO
169 ENDDO
170 ENDDO
171 ENDIF
172 C-- End storing block
173 ENDIF
174
175 C-- End of loop on jPass
176 ENDDO
177
178 ELSEIF ( .NOT.interiorOnly ) THEN
179
180 C-- Get back corner values from storage
181 IF ( southWestCorner ) THEN
182 DO j=1,OLy
183 DO i=1,OLx
184 smVol(i-OLx,j-OLy,k ) = smCorners(i,j,1,-1)
185 smTr0(i-OLx,j-OLy,k ) = smCorners(i,j,1, 0)
186 DO n=1,nSOM
187 smTr(i-OLx,j-OLy,k,bi,bj,n) = smCorners(i,j,1, n)
188 ENDDO
189 ENDDO
190 ENDDO
191 ENDIF
192 IF ( southEastCorner ) THEN
193 DO j=1,OLy
194 DO i=1,OLx
195 smVol(sNx+i,j-OLy,k ) = smCorners(i,j,2,-1)
196 smTr0(sNx+i,j-OLy,k ) = smCorners(i,j,2, 0)
197 DO n=1,nSOM
198 smTr(sNx+i,j-OLy,k,bi,bj,n) = smCorners(i,j,2, n)
199 ENDDO
200 ENDDO
201 ENDDO
202 ENDIF
203 IF ( northEastCorner ) THEN
204 DO j=1,OLy
205 DO i=1,OLx
206 smVol(sNx+i,sNy+j,k ) = smCorners(i,j,3,-1)
207 smTr0(sNx+i,sNy+j,k ) = smCorners(i,j,3, 0)
208 DO n=1,nSOM
209 smTr(sNx+i,sNy+j,k,bi,bj,n) = smCorners(i,j,3, n)
210 ENDDO
211 ENDDO
212 ENDDO
213 ENDIF
214 IF ( northWestCorner ) THEN
215 DO j=1,OLy
216 DO i=1,OLx
217 smVol(i-OLx,sNy+j,k ) = smCorners(i,j,4,-1)
218 smTr0(i-OLx,sNy+j,k ) = smCorners(i,j,4, 0)
219 DO n=1,nSOM
220 smTr(i-OLx,sNy+j,k,bi,bj,n) = smCorners(i,j,4, n)
221 ENDDO
222 ENDDO
223 ENDDO
224 ENDIF
225 C-- End getting back corner values from storage
226
227 C--- End if/else - overlapOnly - block
228 ENDIF
229
230 RETURN
231 END

  ViewVC Help
Powered by ViewVC 1.1.22