/[MITgcm]/MITgcm/pkg/streamice/streamice_driving_stress_fd.F
ViewVC logotype

Contents of /MITgcm/pkg/streamice/streamice_driving_stress_fd.F

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


Revision 1.3 - (show annotations) (download)
Tue Jul 25 11:30:01 2017 UTC (6 years, 9 months ago) by mlosch
Branch: MAIN
CVS Tags: checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, HEAD
Changes since 1.2: +3 -3 lines
- remove blank between _EXCH_XY_RL and "()", which my Apple Xcode
  preprocessor /usr/bin/cpp cannot interpret; 3 instances in total in
  streamice_driving_stress_fd.F and streamice_advect_2dtracer.F
This is my preprocessor:
bkli04m001::build> /usr/bin/cpp -v
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -E -disable-free -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu penryn -target-linker-version 278.4 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.1.0 -I /usr/include -fdebug-compilation-dir /Users/mlosch/head/verification/halfpipe_streamice/build -ferror-limit 19 -fmessage-length 144 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.12.0 -fencode-extended-block-signature -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -traditional-cpp -o - -x c -
clang -cc1 version 8.1.0 (clang-802.0.42) default target x86_64-apple-darwin16.6.0
ignoring duplicate directory "/usr/include"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.1.0/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.

1 C $Header: /u/gcmpack/MITgcm/pkg/streamice/streamice_driving_stress_fd.F,v 1.2 2016/10/24 14:14:19 dgoldberg Exp $
2 C $Name: $
3
4 #include "STREAMICE_OPTIONS.h"
5
6 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
7
8 CBOP
9 SUBROUTINE STREAMICE_DRIVING_STRESS_FD( myThid )
10 ! O taudx,
11 ! O taudy )
12
13 C /============================================================\
14 C | SUBROUTINE |
15 C | o |
16 C |============================================================|
17 C | |
18 C \============================================================/
19 IMPLICIT NONE
20
21 C === Global variables ===
22 #include "SIZE.h"
23 #include "EEPARAMS.h"
24 #include "PARAMS.h"
25 #include "GRID.h"
26 #include "STREAMICE.h"
27 #include "STREAMICE_CG.h"
28
29 C !INPUT/OUTPUT ARGUMENTS
30 INTEGER myThid
31 ! _RL taudx (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
32 ! _RL taudx (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
33
34 #ifdef ALLOW_STREAMICE
35
36
37 C LOCAL VARIABLES
38 INTEGER i, j, bi, bj, k, l,
39 & Gi, Gj
40 LOGICAL at_west_bdry, at_east_bdry,
41 & at_north_bdry, at_south_bdry
42 _RL dsdx
43 & (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
44 _RL dsdy
45 & (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
46 _RL face_factor, grd_below_sl, i_rhow
47
48
49 i_rhow = 1./streamice_density_ocean_avg
50
51 DO bj = myByLo(myThid), myByHi(myThid)
52 DO bi = myBxLo(myThid), myBxHi(myThid)
53 DO j=1-OLy+1,sNy+OLy-1
54 DO i=1-OLx+1,sNx+OLx-1
55 taudx_SI(i,j,bi,bj) = 0. _d 0
56 taudy_SI(i,j,bi,bj) = 0. _d 0
57 ENDDO
58 ENDDO
59 ENDDO
60 ENDDO
61
62 DO bj = myByLo(myThid), myByHi(myThid)
63 DO bi = myBxLo(myThid), myBxHi(myThid)
64 DO j=1,sNy
65 DO i=1,sNx
66
67 IF (streamice_hmask(i,j,bi,bj) .eq. 1) THEN
68
69 ! ds/dx ------------------------------------------------
70
71 IF (streamice_hmask(i-1,j,bi,bj) .eq. 1) THEN
72
73 dsdx(i,j,bi,bj) = recip_dxC(i,j,bi,bj) *
74 & (surf_el_streamice(i,j,bi,bj) -
75 & surf_el_streamice(i-1,j,bi,bj))
76
77 ELSEIF (streamice_hmask(i-1,j,bi,bj).eq.0.or.
78 & streamice_hmask(i-1,j,bi,bj).eq.2) THEN
79
80 IF (streamice_hmask(i+1,j,bi,bj).eq.1) THEN
81 dsdx(i,j,bi,bj) = recip_dxC(i+1,j,bi,bj) *
82 & (surf_el_streamice(i+1,j,bi,bj) -
83 & surf_el_streamice(i,j,bi,bj))
84 ELSE
85 dsdx(i,j,bi,bj) = 0.0
86 ENDIF
87
88 ELSE ! streamice_hmask(i-1,j,bi,bj).eq. -1
89 dsdx(i,j,bi,bj) = 0.0
90 ENDIF
91
92 ! ds/dy ------------------------------------------------
93
94 IF (streamice_hmask(i,j-1,bi,bj) .eq. 1) THEN
95
96 dsdy(i,j,bi,bj) = recip_dyC(i,j,bi,bj) *
97 & (surf_el_streamice(i,j,bi,bj) -
98 & surf_el_streamice(i,j-1,bi,bj))
99
100 ELSEIF (streamice_hmask(i,j-1,bi,bj).eq.0.or.
101 & streamice_hmask(i,j-1,bi,bj).eq.2) THEN
102
103 IF (streamice_hmask(i,j+1,bi,bj).eq.1) THEN
104 dsdy(i,j,bi,bj) = recip_dyC(i,j+1,bi,bj) *
105 & (surf_el_streamice(i,j+1,bi,bj) -
106 & surf_el_streamice(i,j,bi,bj))
107 ELSE
108 dsdy(i,j,bi,bj) = 0.0
109 ENDIF
110
111 ELSE ! streamice_hmask(i-1,j,bi,bj).eq. -1
112 dsdx(i,j,bi,bj) = 0.0
113 ENDIF
114
115 ! end ------------------------------------------------
116
117 ELSEIF(streamice_hmask(i,j,bi,bj).eq.0.or.
118 & streamice_hmask(i,j,bi,bj).eq.2) THEN
119
120 ! ds/dx ------------------------------------------------
121
122 IF(streamice_hmask(i-1,j,bi,bj).eq.1.and.
123 & streamice_hmask(i-2,j,bi,bj).eq.1) THEN
124
125 dsdx(i,j,bi,bj) = recip_dxC(i-1,j,bi,bj) *
126 & (surf_el_streamice(i-1,j,bi,bj) -
127 & surf_el_streamice(i-2,j,bi,bj))
128
129 ELSE
130 dsdx(i,j,bi,bj) = 0.0
131
132 ENDIF
133
134 ! ds/dy ------------------------------------------------
135
136 IF(streamice_hmask(i,j-1,bi,bj).eq.1.and.
137 & streamice_hmask(i,j-2,bi,bj).eq.1) THEN
138
139 dsdy(i,j,bi,bj) = recip_dyC(i,j-1,bi,bj) *
140 & (surf_el_streamice(i,j-1,bi,bj) -
141 & surf_el_streamice(i,j-2,bi,bj))
142
143 ELSE
144 dsdy(i,j,bi,bj) = 0.0
145
146 ENDIF
147
148 ! end ------------------------------------------------
149
150 ENDIF
151 ENDDO
152 ENDDO
153 ENDDO
154 ENDDO
155
156 _EXCH_XY_RL(dsdy, mythid)
157 _EXCH_XY_RL(dsdx, mythid)
158
159 DO bj = myByLo(myThid), myByHi(myThid)
160 DO bi = myBxLo(myThid), myBxHi(myThid)
161
162 DO i=1,sNx
163 DO j=1,sNy
164
165 ! Gi = (myXGlobalLo-1)+(bi-1)*sNx+i
166 ! Gj = (myYGlobalLo-1)+(bj-1)*sNy+j
167
168 IF (streamice_hmask(i,j,bi,bj).eq.1.0) THEN
169
170 IF (streamice_umask(i,j,bi,bj).eq.1.0) THEN
171
172 taudx_si(i,j,bi,bj) = taudx_si(i,j,bi,bj) +
173 & gravity * streamice_density *
174 & H_streamice (i,j,bi,bj) * dsdx (i,j,bi,bj) *
175 & (0.5 * dyG(i,j,bi,bj) + 0.25 * dyF(i,j,bi,bj)) *
176 & 0.5 * dxG(i,j,bi,bj)
177
178 taudx_si(i,j,bi,bj) = taudx_si(i,j,bi,bj) +
179 & gravity * streamice_density *
180 & H_streamice (i,j,bi,bj) * dsdx (i+1,j,bi,bj) *
181 & 0.25 * dyF(i,j,bi,bj) *
182 & 0.5 * dxG(i,j,bi,bj)
183
184 ENDIF
185
186 IF (streamice_umask(i+1,j,bi,bj).eq.1.0) THEN
187
188 taudx_si(i+1,j,bi,bj) = taudx_si(i+1,j,bi,bj) +
189 & gravity * streamice_density *
190 & H_streamice (i,j,bi,bj) * dsdx (i+1,j,bi,bj) *
191 & (0.5 * dyG(i+1,j,bi,bj) + 0.25 * dyF(i,j,bi,bj)) *
192 & 0.5 * dxG(i,j,bi,bj)
193
194 taudx_si(i+1,j,bi,bj) = taudx_si(i+1,j,bi,bj) +
195 & gravity * streamice_density *
196 & H_streamice (i,j,bi,bj) * dsdx (i,j,bi,bj) *
197 & 0.25 * dyF(i,j,bi,bj) *
198 & 0.5 * dxG(i,j,bi,bj)
199
200 ENDIF
201
202 IF (streamice_umask(i,j+1,bi,bj).eq.1.0) THEN
203
204 taudx_si(i,j+1,bi,bj) = taudx_si(i,j+1,bi,bj) +
205 & gravity * streamice_density *
206 & H_streamice (i,j,bi,bj) * dsdx (i,j,bi,bj) *
207 & (0.5 * dyG(i,j,bi,bj) + 0.25 * dyF(i,j,bi,bj)) *
208 & 0.5 * dxG(i,j+1,bi,bj)
209
210 taudx_si(i,j+1,bi,bj) = taudx_si(i,j+1,bi,bj) +
211 & gravity * streamice_density *
212 & H_streamice (i,j,bi,bj) * dsdx (i+1,j,bi,bj) *
213 & 0.25 * dyF(i,j,bi,bj) *
214 & 0.5 * dxG(i,j+1,bi,bj)
215
216 ENDIF
217
218 IF (streamice_umask(i+1,j+1,bi,bj).eq.1.0) THEN
219
220 taudx_si(i+1,j+1,bi,bj) = taudx_si(i+1,j+1,bi,bj) +
221 & gravity * streamice_density *
222 & H_streamice (i,j,bi,bj) * dsdx (i+1,j,bi,bj) *
223 & (0.5 * dyG(i+1,j,bi,bj) + 0.25 * dyF(i,j,bi,bj)) *
224 & 0.5 * dxG(i,j+1,bi,bj)
225
226 taudx_si(i+1,j+1,bi,bj) = taudx_si(i+1,j+1,bi,bj) +
227 & gravity * streamice_density *
228 & H_streamice (i,j,bi,bj) * dsdx (i,j,bi,bj) *
229 & 0.25 * dyF(i,j,bi,bj) *
230 & 0.5 * dxG(i,j+1,bi,bj)
231
232 ENDIF
233
234 #ifdef USE_ALT_RLOW
235 IF (R_low_si(i,j,bi,bj) .lt. 0. _d 0) then
236 #else
237 IF (R_low(i,j,bi,bj) .lt. 0. _d 0) then
238 #endif
239 grd_below_sl = 1. _d 0
240 else
241 grd_below_sl = 0. _d 0
242 endif
243
244
245 ! check face to right
246 IF (streamice_hmask(i+1,j,bi,bj).eq.0.or.
247 & streamice_hmask(i+1,j,bi,bj).eq.2.or.
248 & streamice_ufacemask(i+1,j,bi,bj).eq.2) THEN
249
250 IF (float_frac_streamice(i,j,bi,bj) .eq. 1.0) THEN
251
252 face_factor =
253 & 0.25 * dyG(i+1,j,bi,bj) *
254 & gravity *
255 & streamice_density * H_streamice(i,j,bi,bj)**2-
256 #ifdef USE_ALT_RLOW
257 & streamice_density_ocean_avg * grd_below_sl *
258 & R_low_si(i,j,bi,bj)**2
259 #else
260 & streamice_density_ocean_avg * grd_below_sl *
261 & R_low(i,j,bi,bj)**2
262 #endif
263
264 ELSE
265
266 face_factor =
267 & 0.25 * dyG(i+1,j,bi,bj) *
268 & streamice_density * gravity *
269 & (1-streamice_density*i_rhow) *
270 & H_streamice(i,j,bi,bj)**2
271
272 ENDIF
273
274 taudx_si(i+1,j,bi,bj) = taudx_si(i+1,j,bi,bj)
275 & - face_factor
276
277 taudx_si(i+1,j+1,bi,bj) = taudx_si(i+1,j+1,bi,bj)
278 & - face_factor
279
280 ENDIF
281
282 ! check face to left
283 IF (streamice_hmask(i-1,j,bi,bj).eq.0.or.
284 & streamice_hmask(i-1,j,bi,bj).eq.2.or.
285 & streamice_ufacemask(i,j,bi,bj).eq.2) THEN
286
287 IF (float_frac_streamice(i,j,bi,bj) .eq. 1.0) THEN
288
289 face_factor =
290 & 0.25 * dyG(i,j,bi,bj) *
291 & gravity *
292 & streamice_density * H_streamice(i,j,bi,bj)**2-
293 #ifdef USE_ALT_RLOW
294 & streamice_density_ocean_avg * grd_below_sl *
295 & R_low_si(i,j,bi,bj)**2
296 #else
297 & streamice_density_ocean_avg * grd_below_sl *
298 & R_low(i,j,bi,bj)**2
299 #endif
300
301 ELSE
302
303 face_factor =
304 & 0.25 * dyG(i,j,bi,bj) *
305 & streamice_density * gravity *
306 & (1-streamice_density*i_rhow) *
307 & H_streamice(i,j,bi,bj)**2
308
309 ENDIF
310
311 taudx_si(i,j,bi,bj) = taudx_si(i,j,bi,bj)
312 & + face_factor
313
314 taudx_si(i,j+1,bi,bj) = taudx_si(i,j+1,bi,bj)
315 & + face_factor
316
317 ENDIF
318
319 ! Y FORCES
320
321 IF (streamice_vmask(i,j,bi,bj).eq.1.0) THEN
322
323 taudy_si(i,j,bi,bj) = taudy_si(i,j,bi,bj) +
324 & gravity * streamice_density *
325 & H_streamice (i,j,bi,bj) * dsdy (i,j,bi,bj) *
326 & (0.5 * dxG(i,j,bi,bj) + 0.25 * dxF(i,j,bi,bj)) *
327 & 0.5 * dyG(i,j,bi,bj)
328
329 taudy_si(i,j,bi,bj) = taudy_si(i,j,bi,bj) +
330 & gravity * streamice_density *
331 & H_streamice (i,j,bi,bj) * dsdy (i,j+1,bi,bj) *
332 & 0.25 * dxF(i,j,bi,bj) *
333 & 0.5 * dyG(i,j,bi,bj)
334
335 ENDIF
336
337 IF (streamice_vmask(i,j+1,bi,bj).eq.1.0) THEN
338
339 taudy_si(i,j+1,bi,bj) = taudy_si(i,j+1,bi,bj) +
340 & gravity * streamice_density *
341 & H_streamice (i,j,bi,bj) * dsdy (i,j+1,bi,bj) *
342 & (0.5 * dxG(i,j+1,bi,bj) + 0.25 * dxF(i,j,bi,bj)) *
343 & 0.5 * dyG(i,j,bi,bj)
344
345 taudy_si(i,j+1,bi,bj) = taudy_si(i,j+1,bi,bj) +
346 & gravity * streamice_density *
347 & H_streamice (i,j,bi,bj) * dsdy (i,j,bi,bj) *
348 & 0.25 * dxF(i,j,bi,bj) *
349 & 0.5 * dyG(i,j,bi,bj)
350
351 ENDIF
352
353 IF (streamice_vmask(i+1,j,bi,bj).eq.1.0) THEN
354
355 taudy_si(i+1,j,bi,bj) = taudy_si(i+1,j,bi,bj) +
356 & gravity * streamice_density *
357 & H_streamice (i,j,bi,bj) * dsdy (i,j,bi,bj) *
358 & (0.5 * dxG(i,j,bi,bj) + 0.25 * dxF(i,j,bi,bj)) *
359 & 0.5 * dyG(i+1,j,bi,bj)
360
361 taudy_si(i+1,j,bi,bj) = taudy_si(i+1,j,bi,bj) +
362 & gravity * streamice_density *
363 & H_streamice (i,j,bi,bj) * dsdy (i,j+1,bi,bj) *
364 & 0.25 * dxF(i,j,bi,bj) *
365 & 0.5 * dyG(i+1,j,bi,bj)
366
367 ENDIF
368
369 IF (streamice_umask(i+1,j+1,bi,bj).eq.1.0) THEN
370
371 taudy_si(i+1,j+1,bi,bj) = taudy_si(i+1,j+1,bi,bj) +
372 & gravity * streamice_density *
373 & H_streamice (i,j,bi,bj) * dsdy (i,j+1,bi,bj) *
374 & (0.5 * dxG(i,j+1,bi,bj) + 0.25 * dxF(i,j,bi,bj)) *
375 & 0.5 * dyG(i,j+1,bi,bj)
376
377 taudy_si(i+1,j+1,bi,bj) = taudy_si(i+1,j+1,bi,bj) +
378 & gravity * streamice_density *
379 & H_streamice (i,j,bi,bj) * dsdy (i,j,bi,bj) *
380 & 0.25 * dxF(i,j,bi,bj) *
381 & 0.5 * dyG(i,j+1,bi,bj)
382
383 ENDIF
384
385 #ifdef USE_ALT_RLOW
386 IF (R_low_si(i,j,bi,bj) .lt. 0. _d 0) then
387 #else
388 IF (R_low(i,j,bi,bj) .lt. 0. _d 0) then
389 #endif
390 grd_below_sl = 1. _d 0
391 else
392 grd_below_sl = 0. _d 0
393 endif
394
395
396 ! check face to right
397 IF (streamice_hmask(i,j+1,bi,bj).eq.0.or.
398 & streamice_hmask(i,j+1,bi,bj).eq.2.or.
399 & streamice_vfacemask(i,j+1,bi,bj).eq.2) THEN
400
401 IF (float_frac_streamice(i,j,bi,bj) .eq. 1.0) THEN
402
403 face_factor =
404 & 0.25 * dxG(i,j+1,bi,bj) *
405 & gravity *
406 & streamice_density * H_streamice(i,j,bi,bj)**2-
407 #ifdef USE_ALT_RLOW
408 & streamice_density_ocean_avg * grd_below_sl *
409 & R_low_si(i,j,bi,bj)**2
410 #else
411 & streamice_density_ocean_avg * grd_below_sl *
412 & R_low(i,j,bi,bj)**2
413 #endif
414
415 ELSE
416
417 face_factor =
418 & 0.25 * dxG(i,j+1,bi,bj) *
419 & streamice_density * gravity *
420 & (1-streamice_density*i_rhow) *
421 & H_streamice(i,j,bi,bj)**2
422
423 ENDIF
424
425 taudy_si(i,j+1,bi,bj) = taudy_si(i,j+1,bi,bj)
426 & - face_factor
427
428 taudy_si(i+1,j+1,bi,bj) = taudy_si(i+1,j+1,bi,bj)
429 & - face_factor
430
431 ENDIF
432
433 ! check face to left
434 IF (streamice_hmask(i,j-1,bi,bj).eq.0.or.
435 & streamice_hmask(i,j-1,bi,bj).eq.2.or.
436 & streamice_vfacemask(i,j,bi,bj).eq.2) THEN
437
438 IF (float_frac_streamice(i,j,bi,bj) .eq. 1.0) THEN
439
440 face_factor =
441 & 0.25 * dxG(i,j,bi,bj) *
442 & gravity *
443 & streamice_density * H_streamice(i,j,bi,bj)**2-
444 #ifdef USE_ALT_RLOW
445 & streamice_density_ocean_avg * grd_below_sl *
446 & R_low_si(i,j,bi,bj)**2
447 #else
448 & streamice_density_ocean_avg * grd_below_sl *
449 & R_low(i,j,bi,bj)**2
450 #endif
451
452 ELSE
453
454 face_factor =
455 & 0.25 * dxG(i,j,bi,bj) *
456 & streamice_density * gravity *
457 & (1-streamice_density*i_rhow) *
458 & H_streamice(i,j,bi,bj)**2
459
460 ENDIF
461
462 taudy_si(i,j,bi,bj) = taudy_SI(i,j,bi,bj)
463 & + face_factor
464
465 taudy_si(i+1,j,bi,bj) = taudy_si(i+1,j,bi,bj)
466 & + face_factor
467
468 ENDIF
469
470
471 ENDIF
472
473 ENDDO
474 ENDDO
475 ENDDO
476 ENDDO
477
478 DO bj = myByLo(myThid), myByHi(myThid)
479 DO bi = myBxLo(myThid), myBxHi(myThid)
480 DO j=1-OLy+1,sNy+OLy-1
481 DO i=1-OLx+1,sNx+OLx-1
482 taudx_SI(i,j,bi,bj) = -1.*taudx_SI(i,j,bi,bj)
483 taudy_SI(i,j,bi,bj) = -1.*taudy_SI(i,j,bi,bj)
484 ENDDO
485 ENDDO
486 ENDDO
487 ENDDO
488 ! call write_fld_xy_rl ('driving_taux','',taudx_si,0,mythid)
489
490 #endif
491 RETURN
492 END
493
494

  ViewVC Help
Powered by ViewVC 1.1.22