1 |
dgoldberg |
1.1 |
C $Header: /u/gcmpack/MITgcm_contrib/verification_other/shelfice_remeshing/code/ini_masks_etc_JJ.F,v 1.7 2016/04/18 14:18:57 dgoldberg Exp $ |
2 |
|
|
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "PACKAGES_CONFIG.h" |
5 |
|
|
#include "CPP_OPTIONS.h" |
6 |
|
|
#include "SHELFICE_OPTIONS.h" |
7 |
|
|
|
8 |
|
|
CBOP |
9 |
|
|
C !ROUTINE: INI_MASKS_ETC |
10 |
|
|
C !INTERFACE: |
11 |
|
|
SUBROUTINE INI_MASKS_REMESH( myThid ) |
12 |
|
|
C !DESCRIPTION: \bv |
13 |
|
|
C *==========================================================* |
14 |
|
|
C | SUBROUTINE INI_MASKS_ETC |
15 |
|
|
C | o Initialise masks and topography factors |
16 |
|
|
C *==========================================================* |
17 |
|
|
C | These arrays are used throughout the code and describe |
18 |
|
|
C | the topography of the domain through masks (0s and 1s) |
19 |
|
|
C | and fractional height factors (0<hFac<1). The latter |
20 |
|
|
C | distinguish between the lopped-cell and full-step |
21 |
|
|
C | topographic representations. |
22 |
|
|
C *==========================================================* |
23 |
|
|
C \ev |
24 |
|
|
|
25 |
|
|
C !USES: |
26 |
|
|
IMPLICIT NONE |
27 |
|
|
C === Global variables === |
28 |
|
|
#include "SIZE.h" |
29 |
|
|
#include "EEPARAMS.h" |
30 |
|
|
#include "PARAMS.h" |
31 |
|
|
#include "GRID.h" |
32 |
|
|
#include "DYNVARS.h" |
33 |
|
|
#ifdef NONLIN_FRSURF |
34 |
|
|
# include "SURFACE.h" |
35 |
|
|
#endif /* NONLIN_FRSURF */ |
36 |
|
|
|
37 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
38 |
|
|
C == Routine arguments == |
39 |
|
|
C myThid :: Number of this instance of INI_MASKS_ETC |
40 |
|
|
INTEGER myThid |
41 |
|
|
|
42 |
|
|
#ifdef ALLOW_SHELFICE |
43 |
|
|
#ifdef ALLOW_SHELFICE_REMESHING |
44 |
|
|
|
45 |
|
|
C !LOCAL VARIABLES: |
46 |
|
|
C == Local variables == |
47 |
|
|
C bi,bj :: tile indices |
48 |
|
|
C i,j,k :: Loop counters |
49 |
|
|
C tmpfld :: Temporary array used to compute & write Total Depth |
50 |
|
|
_RS tmpfld(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
51 |
|
|
|
52 |
|
|
_RS rsurftmp(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
53 |
|
|
|
54 |
|
|
INTEGER bi, bj |
55 |
|
|
INTEGER i, j, k, ks |
56 |
|
|
_RL hFacCtmp |
57 |
|
|
_RL hFacMnSz |
58 |
|
|
_RS hhm, hhp |
59 |
|
|
CEOP |
60 |
|
|
|
61 |
|
|
|
62 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
63 |
|
|
|
64 |
|
|
IF ( selectSigmaCoord.EQ.0 ) THEN |
65 |
|
|
C--- r-coordinate with partial-cell or full cell mask |
66 |
|
|
|
67 |
|
|
C-- Calculate lopping factor hFacC : over-estimate the part inside of the domain |
68 |
|
|
C taking into account the lower_R Boundary (Bathymetrie / Top of Atmos) |
69 |
|
|
DO bj=myByLo(myThid), myByHi(myThid) |
70 |
|
|
DO bi=myBxLo(myThid), myBxHi(myThid) |
71 |
|
|
DO k=1, Nr |
72 |
|
|
hFacMnSz=max( hFacMin, min(hFacMinDr*recip_drF(k),1. _d 0) ) |
73 |
|
|
DO j=1-OLy,sNy+OLy |
74 |
|
|
DO i=1-OLx,sNx+OLx |
75 |
|
|
C o Non-dimensional distance between grid bound. and domain lower_R bound. |
76 |
|
|
hFacCtmp = (rF(k)-R_low(i,j,bi,bj))*recip_drF(k) |
77 |
|
|
C o Select between, closed, open or partial (0,1,0-1) |
78 |
|
|
hFacCtmp=min( max( hFacCtmp, 0. _d 0) , 1. _d 0) |
79 |
|
|
C o Impose minimum fraction and/or size (dimensional) |
80 |
|
|
IF (hFacCtmp.LT.hFacMnSz) THEN |
81 |
|
|
IF (hFacCtmp.LT.hFacMnSz*0.5) THEN |
82 |
|
|
hFacC(i,j,k,bi,bj)=0. |
83 |
|
|
ELSE |
84 |
|
|
hFacC(i,j,k,bi,bj)=hFacMnSz |
85 |
|
|
ENDIF |
86 |
|
|
ELSE |
87 |
|
|
hFacC(i,j,k,bi,bj)=hFacCtmp |
88 |
|
|
ENDIF |
89 |
|
|
ENDDO |
90 |
|
|
ENDDO |
91 |
|
|
ENDDO |
92 |
|
|
|
93 |
|
|
C- Re-calculate lower-R Boundary position, taking into account hFacC |
94 |
|
|
DO j=1-OLy,sNy+OLy |
95 |
|
|
DO i=1-OLx,sNx+OLx |
96 |
|
|
R_low(i,j,bi,bj) = rF(1) |
97 |
|
|
ENDDO |
98 |
|
|
ENDDO |
99 |
|
|
DO k=Nr,1,-1 |
100 |
|
|
DO j=1-OLy,sNy+OLy |
101 |
|
|
DO i=1-OLx,sNx+OLx |
102 |
|
|
R_low(i,j,bi,bj) = R_low(i,j,bi,bj) |
103 |
|
|
& - drF(k)*hFacC(i,j,k,bi,bj) |
104 |
|
|
ENDDO |
105 |
|
|
ENDDO |
106 |
|
|
ENDDO |
107 |
|
|
C- end bi,bj loops. |
108 |
|
|
ENDDO |
109 |
|
|
ENDDO |
110 |
|
|
|
111 |
|
|
C-- Calculate lopping factor hFacC : Remove part outside of the domain |
112 |
|
|
C taking into account the Reference (=at rest) Surface Position Ro_surf |
113 |
|
|
DO bj=myByLo(myThid), myByHi(myThid) |
114 |
|
|
DO bi=myBxLo(myThid), myBxHi(myThid) |
115 |
|
|
DO k=1, Nr |
116 |
|
|
hFacMnSz=max( hFacMin, min(hFacMinDr*recip_drF(k),1. _d 0) ) |
117 |
|
|
DO j=1-OLy,sNy+OLy |
118 |
|
|
DO i=1-OLx,sNx+OLx |
119 |
|
|
C JJ HACK |
120 |
|
|
Ro_surf(i,j,bi,bj)=0.0 |
121 |
|
|
C o Non-dimensional distance between grid boundary and model surface |
122 |
|
|
hFacCtmp = (rF(k)-Ro_surf(i,j,bi,bj))*recip_drF(k) |
123 |
|
|
C o Reduce the previous fraction : substract the outside part. |
124 |
|
|
hFacCtmp = hFacC(i,j,k,bi,bj) - max( hFacCtmp, 0. _d 0) |
125 |
|
|
C o set to zero if empty Column : |
126 |
|
|
hFacCtmp = max( hFacCtmp, 0. _d 0) |
127 |
|
|
C o Impose minimum fraction and/or size (dimensional) |
128 |
|
|
IF (hFacCtmp.LT.hFacMnSz) THEN |
129 |
|
|
IF (hFacCtmp.LT.hFacMnSz*0.5) THEN |
130 |
|
|
hFacC(i,j,k,bi,bj)=0. |
131 |
|
|
ELSE |
132 |
|
|
hFacC(i,j,k,bi,bj)=hFacMnSz |
133 |
|
|
ENDIF |
134 |
|
|
ELSE |
135 |
|
|
hFacC(i,j,k,bi,bj)=hFacCtmp |
136 |
|
|
ENDIF |
137 |
|
|
ENDDO |
138 |
|
|
ENDDO |
139 |
|
|
ENDDO |
140 |
|
|
ENDDO |
141 |
|
|
ENDDO |
142 |
|
|
|
143 |
|
|
#ifdef ALLOW_SHELFICE |
144 |
|
|
|
145 |
|
|
IF ( useShelfIce ) THEN |
146 |
|
|
C-- Modify lopping factor hFacC : Remove part outside of the domain |
147 |
|
|
C taking into account the Reference (=at rest) Surface Position Ro_shelfIce |
148 |
|
|
CALL SHELFICE_UPDATE_MASKS_REMESH( |
149 |
|
|
I rF, recip_drF, drF, kLowc, |
150 |
|
|
U hFacC, |
151 |
|
|
I myThid ) |
152 |
|
|
ENDIF |
153 |
|
|
#endif /* ALLOW_SHELFICE */ |
154 |
|
|
|
155 |
|
|
|
156 |
|
|
|
157 |
|
|
C- Re-calculate Reference surface position, taking into account hFacC |
158 |
|
|
C initialize Total column fluid thickness and surface k index |
159 |
|
|
C Note: if no fluid (continent) ==> kSurf = Nr+1 |
160 |
|
|
DO bj=myByLo(myThid), myByHi(myThid) |
161 |
|
|
DO bi=myBxLo(myThid), myBxHi(myThid) |
162 |
|
|
DO j=1-OLy,sNy+OLy |
163 |
|
|
DO i=1-OLx,sNx+OLx |
164 |
|
|
tmpfld(i,j,bi,bj) = 0. |
165 |
|
|
kSurfC(i,j,bi,bj) = Nr+1 |
166 |
|
|
c maskH(i,j,bi,bj) = 0. |
167 |
|
|
Ro_surf(i,j,bi,bj) = R_low(i,j,bi,bj) |
168 |
|
|
DO k=Nr,1,-1 |
169 |
|
|
Ro_surf(i,j,bi,bj) = Ro_surf(i,j,bi,bj) |
170 |
|
|
& + drF(k)*hFacC(i,j,k,bi,bj) |
171 |
|
|
IF (hFacC(i,j,k,bi,bj).NE.0.) THEN |
172 |
|
|
kSurfC(i,j,bi,bj) = k |
173 |
|
|
c maskH(i,j,bi,bj) = 1. |
174 |
|
|
tmpfld(i,j,bi,bj) = tmpfld(i,j,bi,bj) + 1. |
175 |
|
|
ENDIF |
176 |
|
|
ENDDO |
177 |
|
|
kLowC(i,j,bi,bj) = 0 |
178 |
|
|
DO k= 1, Nr |
179 |
|
|
IF (hFacC(i,j,k,bi,bj).NE.0) THEN |
180 |
|
|
kLowC(i,j,bi,bj) = k |
181 |
|
|
ENDIF |
182 |
|
|
ENDDO |
183 |
|
|
maskInC(i,j,bi,bj)= 0. |
184 |
|
|
IF ( kSurfC(i,j,bi,bj).LE.Nr ) maskInC(i,j,bi,bj)= 1. |
185 |
|
|
ENDDO |
186 |
|
|
ENDDO |
187 |
|
|
C- end bi,bj loops. |
188 |
|
|
ENDDO |
189 |
|
|
ENDDO |
190 |
|
|
|
191 |
|
|
|
192 |
|
|
IF ( printDomain ) THEN |
193 |
|
|
c CALL PLOT_FIELD_XYRS( tmpfld, |
194 |
|
|
c & 'Model Depths K Index' , -1, myThid ) |
195 |
|
|
CALL PLOT_FIELD_XYRS(R_low, |
196 |
|
|
& 'Model R_low (ini_masks_etc)', -1, myThid ) |
197 |
|
|
CALL PLOT_FIELD_XYRS(Ro_surf, |
198 |
|
|
& 'Model Ro_surf (ini_masks_etc)', -1, myThid ) |
199 |
|
|
ENDIF |
200 |
|
|
|
201 |
|
|
C-- Calculate quantities derived from XY depth map |
202 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
203 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
204 |
|
|
DO j=1-OLy,sNy+OLy |
205 |
|
|
DO i=1-OLx,sNx+OLx |
206 |
|
|
C Total fluid column thickness (r_unit) : |
207 |
|
|
c Rcolumn(i,j,bi,bj)= Ro_surf(i,j,bi,bj) - R_low(i,j,bi,bj) |
208 |
|
|
tmpfld(i,j,bi,bj) = Ro_surf(i,j,bi,bj) - R_low(i,j,bi,bj) |
209 |
|
|
C Inverse of fluid column thickness (1/r_unit) |
210 |
|
|
IF ( tmpfld(i,j,bi,bj) .LE. 0. ) THEN |
211 |
|
|
recip_Rcol(i,j,bi,bj) = 0. |
212 |
|
|
ELSE |
213 |
|
|
recip_Rcol(i,j,bi,bj) = 1. _d 0 / tmpfld(i,j,bi,bj) |
214 |
|
|
ENDIF |
215 |
|
|
ENDDO |
216 |
|
|
ENDDO |
217 |
|
|
ENDDO |
218 |
|
|
ENDDO |
219 |
|
|
|
220 |
|
|
C-- hFacW and hFacS (at U and V points) |
221 |
|
|
DO bj=myByLo(myThid), myByHi(myThid) |
222 |
|
|
DO bi=myBxLo(myThid), myBxHi(myThid) |
223 |
|
|
DO k=1, Nr |
224 |
|
|
DO j=1-OLy,sNy+OLy |
225 |
|
|
hFacW(1-OLx,j,k,bi,bj)= 0. |
226 |
|
|
DO i=2-OLx,sNx+OLx |
227 |
|
|
hFacW(i,j,k,bi,bj)= |
228 |
|
|
& MIN(hFacC(i,j,k,bi,bj),hFacC(i-1,j,k,bi,bj)) |
229 |
|
|
ENDDO |
230 |
|
|
ENDDO |
231 |
|
|
DO i=1-OLx,sNx+OLx |
232 |
|
|
hFacS(i,1-OLy,k,bi,bj)= 0. |
233 |
|
|
ENDDO |
234 |
|
|
DO j=2-OLy,sNy+oly |
235 |
|
|
DO i=1-OLx,sNx+OLx |
236 |
|
|
hFacS(i,j,k,bi,bj)= |
237 |
|
|
& MIN(hFacC(i,j,k,bi,bj),hFacC(i,j-1,k,bi,bj)) |
238 |
|
|
ENDDO |
239 |
|
|
ENDDO |
240 |
|
|
ENDDO |
241 |
|
|
C rLow & reference rSurf at Western & Southern edges (U and V points) |
242 |
|
|
i = 1-OLx |
243 |
|
|
DO j=1-OLy,sNy+OLy |
244 |
|
|
rLowW (i,j,bi,bj) = 0. |
245 |
|
|
rSurfW(i,j,bi,bj) = 0. |
246 |
|
|
ENDDO |
247 |
|
|
j = 1-OLy |
248 |
|
|
DO i=1-OLx,sNx+OLx |
249 |
|
|
rLowS (i,j,bi,bj) = 0. |
250 |
|
|
rSurfS(i,j,bi,bj) = 0. |
251 |
|
|
ENDDO |
252 |
|
|
DO j=1-OLy,sNy+OLy |
253 |
|
|
DO i=2-OLx,sNx+OLx |
254 |
|
|
rLowW(i,j,bi,bj) = |
255 |
|
|
& MAX( R_low(i-1,j,bi,bj), R_low(i,j,bi,bj) ) |
256 |
|
|
rSurfW(i,j,bi,bj) = |
257 |
|
|
& MIN( Ro_surf(i-1,j,bi,bj), Ro_surf(i,j,bi,bj) ) |
258 |
|
|
rSurfW(i,j,bi,bj) = |
259 |
|
|
& MAX( rSurfW(i,j,bi,bj), rLowW(i,j,bi,bj) ) |
260 |
|
|
ENDDO |
261 |
|
|
ENDDO |
262 |
|
|
DO j=2-OLy,sNy+OLy |
263 |
|
|
DO i=1-OLx,sNx+OLx |
264 |
|
|
rLowS(i,j,bi,bj) = |
265 |
|
|
& MAX( R_low(i,j-1,bi,bj), R_low(i,j,bi,bj) ) |
266 |
|
|
rSurfS(i,j,bi,bj) = |
267 |
|
|
& MIN( Ro_surf(i,j-1,bi,bj), Ro_surf(i,j,bi,bj) ) |
268 |
|
|
rSurfS(i,j,bi,bj) = |
269 |
|
|
& MAX( rSurfS(i,j,bi,bj), rLowS(i,j,bi,bj) ) |
270 |
|
|
ENDDO |
271 |
|
|
ENDDO |
272 |
|
|
C- end bi,bj loops. |
273 |
|
|
ENDDO |
274 |
|
|
ENDDO |
275 |
|
|
CALL EXCH_UV_XYZ_RS(hFacW,hFacS,.FALSE.,myThid) |
276 |
|
|
CALL EXCH_UV_XY_RS( rSurfW, rSurfS, .FALSE., myThid ) |
277 |
|
|
CALL EXCH_UV_XY_RS( rLowW, rLowS, .FALSE., myThid ) |
278 |
|
|
|
279 |
|
|
C-- Addtional closing of Western and Southern grid-cell edges: for example, |
280 |
|
|
C a) might add some "thin walls" in specific location |
281 |
|
|
C-- b) close non-periodic N & S boundaries of lat-lon grid at the N/S poles. |
282 |
|
|
CALL ADD_WALLS2MASKS( myThid ) |
283 |
|
|
|
284 |
|
|
C-- Calculate surface k index for interface W & S (U & V points) |
285 |
|
|
DO bj=myByLo(myThid), myByHi(myThid) |
286 |
|
|
DO bi=myBxLo(myThid), myBxHi(myThid) |
287 |
|
|
DO j=1-OLy,sNy+OLy |
288 |
|
|
DO i=1-OLx,sNx+OLx |
289 |
|
|
kSurfW(i,j,bi,bj) = Nr+1 |
290 |
|
|
kSurfS(i,j,bi,bj) = Nr+1 |
291 |
|
|
DO k=Nr,1,-1 |
292 |
|
|
IF (hFacW(i,j,k,bi,bj).NE.0.) kSurfW(i,j,bi,bj) = k |
293 |
|
|
IF (hFacS(i,j,k,bi,bj).NE.0.) kSurfS(i,j,bi,bj) = k |
294 |
|
|
ENDDO |
295 |
|
|
maskInW(i,j,bi,bj)= 0. |
296 |
|
|
IF ( kSurfW(i,j,bi,bj).LE.Nr ) maskInW(i,j,bi,bj)= 1. |
297 |
|
|
maskInS(i,j,bi,bj)= 0. |
298 |
|
|
IF ( kSurfS(i,j,bi,bj).LE.Nr ) maskInS(i,j,bi,bj)= 1. |
299 |
|
|
ENDDO |
300 |
|
|
ENDDO |
301 |
|
|
ENDDO |
302 |
|
|
ENDDO |
303 |
|
|
|
304 |
|
|
ELSE |
305 |
|
|
#ifndef DISABLE_SIGMA_CODE |
306 |
|
|
C--- Sigma and Hybrid-Sigma set-up: |
307 |
|
|
CALL INI_SIGMA_HFAC( myThid ) |
308 |
|
|
#endif /* DISABLE_SIGMA_CODE */ |
309 |
|
|
ENDIF |
310 |
|
|
|
311 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
312 |
|
|
|
313 |
|
|
C-- Write to disk: Total Column Thickness & hFac(C,W,S): |
314 |
|
|
C This I/O is now done in write_grid.F |
315 |
|
|
c CALL WRITE_FLD_XY_RS( 'Depth',' ',tmpfld,0,myThid) |
316 |
|
|
c CALL WRITE_FLD_XYZ_RS( 'hFacC',' ',hFacC,0,myThid) |
317 |
|
|
c CALL WRITE_FLD_XYZ_RS( 'hFacW',' ',hFacW,0,myThid) |
318 |
|
|
c CALL WRITE_FLD_XYZ_RS( 'hFacS',' ',hFacS,0,myThid) |
319 |
|
|
|
320 |
|
|
IF ( printDomain ) THEN |
321 |
|
|
CALL PLOT_FIELD_XYZRS( hFacC, 'hFacC' , Nr, 0, myThid ) |
322 |
|
|
CALL PLOT_FIELD_XYZRS( hFacW, 'hFacW' , Nr, 0, myThid ) |
323 |
|
|
CALL PLOT_FIELD_XYZRS( hFacS, 'hFacS' , Nr, 0, myThid ) |
324 |
|
|
ENDIF |
325 |
|
|
|
326 |
|
|
C-- Masks and reciprocals of hFac[CWS] |
327 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
328 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
329 |
|
|
DO k=1,Nr |
330 |
|
|
DO j=1-OLy,sNy+OLy |
331 |
|
|
DO i=1-OLx,sNx+OLx |
332 |
|
|
IF (hFacC(i,j,k,bi,bj) .NE. 0. ) THEN |
333 |
|
|
recip_hFacC(i,j,k,bi,bj) = 1. _d 0 / hFacC(i,j,k,bi,bj) |
334 |
|
|
maskC(i,j,k,bi,bj) = 1. |
335 |
|
|
ELSE |
336 |
|
|
recip_hFacC(i,j,k,bi,bj) = 0. |
337 |
|
|
maskC(i,j,k,bi,bj) = 0. |
338 |
|
|
ENDIF |
339 |
|
|
IF (hFacW(i,j,k,bi,bj) .NE. 0. ) THEN |
340 |
|
|
recip_hFacW(i,j,k,bi,bj) = 1. _d 0 / hFacW(i,j,k,bi,bj) |
341 |
|
|
maskW(i,j,k,bi,bj) = 1. |
342 |
|
|
ELSE |
343 |
|
|
recip_hFacW(i,j,k,bi,bj) = 0. |
344 |
|
|
maskW(i,j,k,bi,bj) = 0. |
345 |
|
|
ENDIF |
346 |
|
|
IF (hFacS(i,j,k,bi,bj) .NE. 0. ) THEN |
347 |
|
|
recip_hFacS(i,j,k,bi,bj) = 1. _d 0 / hFacS(i,j,k,bi,bj) |
348 |
|
|
maskS(i,j,k,bi,bj) = 1. |
349 |
|
|
ELSE |
350 |
|
|
recip_hFacS(i,j,k,bi,bj) = 0. |
351 |
|
|
maskS(i,j,k,bi,bj) = 0. |
352 |
|
|
ENDIF |
353 |
|
|
ENDDO |
354 |
|
|
ENDDO |
355 |
|
|
ENDDO |
356 |
|
|
#ifdef NONLIN_FRSURF |
357 |
|
|
C-- Save initial geometrical hFac factor into h0Fac (fixed in time): |
358 |
|
|
C Note: In case 1 pkg modifies hFac (from packages_init_fixed, called |
359 |
|
|
C later in sequence of calls) this pkg would need also to update h0Fac. |
360 |
|
|
DO k=1,Nr |
361 |
|
|
DO j=1-OLy,sNy+OLy |
362 |
|
|
DO i=1-OLx,sNx+OLx |
363 |
|
|
h0FacC(i,j,k,bi,bj) = _hFacC(i,j,k,bi,bj) |
364 |
|
|
h0FacW(i,j,k,bi,bj) = _hFacW(i,j,k,bi,bj) |
365 |
|
|
h0FacS(i,j,k,bi,bj) = _hFacS(i,j,k,bi,bj) |
366 |
|
|
ENDDO |
367 |
|
|
ENDDO |
368 |
|
|
ENDDO |
369 |
|
|
#endif /* NONLIN_FRSURF */ |
370 |
|
|
C- end bi,bj loops. |
371 |
|
|
ENDDO |
372 |
|
|
ENDDO |
373 |
|
|
|
374 |
|
|
|
375 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
376 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
377 |
|
|
DO k=1,Nr |
378 |
|
|
DO j=1-OLy,sNy+OLy |
379 |
|
|
DO i=1-OLx,sNx+OLx |
380 |
|
|
uVel(i,j,k,bi,bj)=uVel(i,j,k,bi,bj)*maskW(i,j,k,bi,bj) |
381 |
|
|
vVel(i,j,k,bi,bj)=vVel(i,j,k,bi,bj)*maskS(i,j,k,bi,bj) |
382 |
|
|
wVel(i,j,k,bi,bj)=0.0 |
383 |
|
|
salt(i,j,k,bi,bj)=salt(i,j,k,bi,bj)*maskC(i,j,k,bi,bj) |
384 |
|
|
theta(i,j,k,bi,bj)=theta(i,j,k,bi,bj)*maskC(i,j,k,bi,bj) |
385 |
|
|
|
386 |
|
|
ENDDO |
387 |
|
|
ENDDO |
388 |
|
|
ENDDO |
389 |
|
|
ENDDO |
390 |
|
|
ENDDO |
391 |
|
|
|
392 |
|
|
|
393 |
|
|
|
394 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
395 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
396 |
|
|
DO j=1,sNy |
397 |
|
|
DO i=1,sNx+1 |
398 |
|
|
ks = kSurfW(i,j,bi,bj) |
399 |
|
|
IF (ks.LE.Nr) THEN |
400 |
|
|
c- allows hFacW to be larger than surrounding hFacC=1 @ edge of a step with |
401 |
|
|
C different kSurfC on either side (topo in p-coords, ice-shelf in z-coords) |
402 |
|
|
hhm = Ro_surf(i-1,j,bi,bj)+etaN(i-1,j,bi,bj) |
403 |
|
|
|
404 |
|
|
hhp = Ro_surf(i,j,bi,bj)+etaN(i,j,bi,bj) |
405 |
|
|
|
406 |
|
|
C- make sure hFacW is not larger than the 2 surrounding hFacC |
407 |
|
|
c hhm = rF(ks) |
408 |
|
|
c IF(ks.EQ.kSurfC(i-1,j,bi,bj)) hhm = rSurftmp(i-1,j) |
409 |
|
|
c hhp = rF(ks) |
410 |
|
|
c IF(ks.EQ.kSurfC(i,j,bi,bj)) hhp = rSurftmp(i,j) |
411 |
|
|
hFac_surfW(i,j,bi,bj) = h0FacW(i,j,ks,bi,bj) |
412 |
|
|
& + ( MIN(hhm,hhp) |
413 |
|
|
& - MIN( Ro_surf(i-1,j,bi,bj), Ro_surf(i,j,bi,bj) ) |
414 |
|
|
& )*recip_drF(ks)*maskW(i,j,ks,bi,bj) |
415 |
|
|
ENDIF |
416 |
|
|
ENDDO |
417 |
|
|
ENDDO |
418 |
|
|
|
419 |
|
|
DO j=1,sNy+1 |
420 |
|
|
DO i=1,sNx |
421 |
|
|
ks = kSurfS(i,j,bi,bj) |
422 |
|
|
IF (ks.LE.Nr) THEN |
423 |
|
|
C- allows hFacS to be larger than surrounding hFacC=1 @ edge of a step with |
424 |
|
|
C different kSurfC on either side (topo in p-coords, ice-shelf in z-coords) |
425 |
|
|
hhm = Ro_surf(i,j-1,bi,bj)+etaN(i,j-1,bi,bj) |
426 |
|
|
|
427 |
|
|
hhp = Ro_surf(i,j,bi,bj)+etaN(i,j,bi,bj) |
428 |
|
|
|
429 |
|
|
C- make sure hFacS is not larger than the 2 surrounding hFacC |
430 |
|
|
c hhm = rF(ks) |
431 |
|
|
c IF(ks.EQ.kSurfC(i,j-1,bi,bj)) hhm = rSurftmp(i,j-1) |
432 |
|
|
c hhp = rF(ks) |
433 |
|
|
c IF(ks.EQ.kSurfC(i,j,bi,bj)) hhp = rSurftmp(i,j) |
434 |
|
|
hFac_surfS(i,j,bi,bj) = h0FacS(i,j,ks,bi,bj) |
435 |
|
|
& + ( MIN(hhm,hhp) |
436 |
|
|
& - MIN( Ro_surf(i,j-1,bi,bj), Ro_surf(i,j,bi,bj) ) |
437 |
|
|
& )*recip_drF(ks)*maskS(i,j,ks,bi,bj) |
438 |
|
|
ENDIF |
439 |
|
|
ENDDO |
440 |
|
|
ENDDO |
441 |
|
|
ENDDO |
442 |
|
|
ENDDO |
443 |
|
|
|
444 |
|
|
|
445 |
|
|
c #if |
446 |
|
|
C-- Calculate "recip_hFacU" = reciprocal hfac distance/volume for W cells |
447 |
|
|
C NOTE: not used ; computed locally in CALC_GW |
448 |
|
|
c #endif |
449 |
|
|
|
450 |
|
|
#endif |
451 |
|
|
#endif |
452 |
|
|
|
453 |
|
|
RETURN |
454 |
|
|
END |