forked from darwinproject/darwin3
-
Notifications
You must be signed in to change notification settings - Fork 1
/
mom_fluxform.F
986 lines (904 loc) · 32.8 KB
/
mom_fluxform.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
CBOI
C !TITLE: pkg/mom\_advdiff
C !AUTHORS: adcroft@mit.edu
C !INTRODUCTION: Flux-form Momentum Equations Package
C
C Package "mom\_fluxform" provides methods for calculating explicit terms
C in the momentum equation cast in flux-form:
C \begin{eqnarray*}
C G^u & = & -\frac{1}{\rho} \partial_x \phi_h
C -\nabla \cdot {\bf v} u
C -fv
C +\frac{1}{\rho} \nabla \cdot {\bf \tau}^x
C + \mbox{metrics}
C \\
C G^v & = & -\frac{1}{\rho} \partial_y \phi_h
C -\nabla \cdot {\bf v} v
C +fu
C +\frac{1}{\rho} \nabla \cdot {\bf \tau}^y
C + \mbox{metrics}
C \end{eqnarray*}
C where ${\bf v}=(u,v,w)$ and $\tau$, the stress tensor, includes surface
C stresses as well as internal viscous stresses.
CEOI
#include "MOM_FLUXFORM_OPTIONS.h"
#ifdef ALLOW_AUTODIFF
# include "AUTODIFF_OPTIONS.h"
#endif
#ifdef ALLOW_MOM_COMMON
# include "MOM_COMMON_OPTIONS.h"
#endif
CBOP
C !ROUTINE: MOM_FLUXFORM
C !INTERFACE: ==========================================================
SUBROUTINE MOM_FLUXFORM(
I bi,bj,k,iMin,iMax,jMin,jMax,
I kappaRU, kappaRV,
U fVerUkm, fVerVkm,
O fVerUkp, fVerVkp,
O guDiss, gvDiss,
I myTime, myIter, myThid )
C !DESCRIPTION:
C Calculates all the horizontal accelerations except for the implicit surface
C pressure gradient and implicit vertical viscosity.
C !USES: ===============================================================
C == Global variables ==
IMPLICIT NONE
#include "SIZE.h"
#include "EEPARAMS.h"
#include "PARAMS.h"
#include "GRID.h"
#include "DYNVARS.h"
#include "FFIELDS.h"
#include "SURFACE.h"
#ifdef ALLOW_MOM_COMMON
# include "MOM_VISC.h"
#endif
#ifdef ALLOW_AUTODIFF
# ifdef ALLOW_AUTODIFF_TAMC
# include "tamc.h"
# endif
# include "MOM_FLUXFORM.h"
#endif
C !INPUT PARAMETERS: ===================================================
C bi,bj :: current tile indices
C k :: current vertical level
C iMin,iMax,jMin,jMax :: loop ranges
C kappaRU :: vertical viscosity
C kappaRV :: vertical viscosity
C fVerUkm :: vertical advective flux of U, interface above (k-1/2)
C fVerVkm :: vertical advective flux of V, interface above (k-1/2)
C fVerUkp :: vertical advective flux of U, interface below (k+1/2)
C fVerVkp :: vertical advective flux of V, interface below (k+1/2)
C guDiss :: dissipation tendency (all explicit terms), u component
C gvDiss :: dissipation tendency (all explicit terms), v component
C myTime :: current time
C myIter :: current time-step number
C myThid :: my Thread Id number
INTEGER bi,bj,k
INTEGER iMin,iMax,jMin,jMax
_RL kappaRU(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr+1)
_RL kappaRV(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr+1)
_RL fVerUkm(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL fVerVkm(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL fVerUkp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL fVerVkp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL guDiss(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL gvDiss(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL myTime
INTEGER myIter
INTEGER myThid
C !OUTPUT PARAMETERS: ==================================================
C None - updates gU() and gV() in common blocks
C !LOCAL VARIABLES: ====================================================
C i,j :: loop indices
C vF :: viscous flux
C v4F :: bi-harmonic viscous flux
C cF :: Coriolis acceleration
C mT :: Metric terms
C fZon :: zonal fluxes
C fMer :: meridional fluxes
C fVrUp,fVrDw :: vertical viscous fluxes at interface k & k+1
INTEGER i,j
#ifdef ALLOW_AUTODIFF_TAMC
INTEGER imomkey
#endif
_RL vF(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL v4F(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL cF(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL mT(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL fZon(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL fMer(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL fVrUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL fVrDw(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
C afFacMom :: Tracer parameters for turning terms on and off.
C vfFacMom
C pfFacMom afFacMom - Advective terms
C cfFacMom vfFacMom - Eddy viscosity terms
C mtFacMom pfFacMom - Pressure terms
C cfFacMom - Coriolis terms
C foFacMom - Forcing
C mtFacMom - Metric term
C uDudxFac, AhDudxFac, etc ... individual term parameters for switching terms off
_RS hFacZ(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RS h0FacZ(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RS r_hFacZ(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RS xA(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RS yA(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL uFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL vFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL rTransU(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL rTransV(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL KE(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL cDrag(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL viscAh_D(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL viscAh_Z(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL viscA4_D(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL viscA4_Z(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL vort3(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL hDiv(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL strain(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL tension(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
_RL stretching(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
#ifdef ALLOW_LEITH_QG
_RL Nsquare(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
#endif
_RL uDudxFac
_RL AhDudxFac
_RL vDudyFac
_RL AhDudyFac
_RL rVelDudrFac
_RL ArDudrFac
_RL fuFac
_RL mtFacU
_RL mtNHFacU
_RL uDvdxFac
_RL AhDvdxFac
_RL vDvdyFac
_RL AhDvdyFac
_RL rVelDvdrFac
_RL ArDvdrFac
_RL fvFac
_RL mtFacV
_RL mtNHFacV
_RL sideMaskFac
LOGICAL bottomDragTerms
CEOP
#ifdef MOM_BOUNDARY_CONSERVE
COMMON / MOM_FLUXFORM_LOCAL / uBnd, vBnd
_RL uBnd(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
_RL vBnd(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
#endif /* MOM_BOUNDARY_CONSERVE */
#ifdef ALLOW_AUTODIFF_TAMC
imomkey = bi + (bj-1)*nSx + (ikey_dynamics-1)*nSx*nSy
imomkey = k + (imomkey-1)*Nr
#endif /* ALLOW_AUTODIFF_TAMC */
C Initialise intermediate terms
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
vF(i,j) = 0.
v4F(i,j) = 0.
cF(i,j) = 0.
mT(i,j) = 0.
fZon(i,j) = 0.
fMer(i,j) = 0.
fVrUp(i,j)= 0.
fVrDw(i,j)= 0.
rTransU(i,j)= 0.
rTransV(i,j)= 0.
c KE(i,j) = 0.
hDiv(i,j) = 0.
vort3(i,j) = 0.
strain(i,j) = 0.
tension(i,j)= 0.
stretching(i,j) = 0.
#ifdef ALLOW_LEITH_QG
Nsquare(i,j) = 0.
#endif
guDiss(i,j) = 0.
gvDiss(i,j) = 0.
ENDDO
ENDDO
C-- Term by term tracer parmeters
C o U momentum equation
uDudxFac = afFacMom*1.
AhDudxFac = vfFacMom*1.
vDudyFac = afFacMom*1.
AhDudyFac = vfFacMom*1.
rVelDudrFac = afFacMom*1.
ArDudrFac = vfFacMom*1.
mtFacU = mtFacMom*1.
mtNHFacU = 1.
fuFac = cfFacMom*1.
C o V momentum equation
uDvdxFac = afFacMom*1.
AhDvdxFac = vfFacMom*1.
vDvdyFac = afFacMom*1.
AhDvdyFac = vfFacMom*1.
rVelDvdrFac = afFacMom*1.
ArDvdrFac = vfFacMom*1.
mtFacV = mtFacMom*1.
mtNHFacV = 1.
fvFac = cfFacMom*1.
IF (implicitViscosity) THEN
ArDudrFac = 0.
ArDvdrFac = 0.
ENDIF
C note: using standard stencil (no mask) results in under-estimating
C vorticity at a no-slip boundary by a factor of 2 = sideDragFactor
IF ( no_slip_sides ) THEN
sideMaskFac = sideDragFactor
ELSE
sideMaskFac = 0. _d 0
ENDIF
IF ( selectImplicitDrag.EQ.0 .AND.
& ( no_slip_bottom
& .OR. selectBotDragQuadr.GE.0
& .OR. bottomDragLinear.NE.0. ) ) THEN
bottomDragTerms=.TRUE.
ELSE
bottomDragTerms=.FALSE.
ENDIF
C-- Calculate open water fraction at vorticity points
CALL MOM_CALC_HFACZ( bi,bj,k,hFacZ,r_hFacZ,myThid )
C---- Calculate common quantities used in both U and V equations
C Calculate tracer cell face open areas
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
xA(i,j) = _dyG(i,j,bi,bj)*deepFacC(k)
& *drF(k)*_hFacW(i,j,k,bi,bj)
yA(i,j) = _dxG(i,j,bi,bj)*deepFacC(k)
& *drF(k)*_hFacS(i,j,k,bi,bj)
h0FacZ(i,j) = hFacZ(i,j)
ENDDO
ENDDO
#ifdef NONLIN_FRSURF
IF ( momViscosity .AND. no_slip_sides
& .AND. nonlinFreeSurf.GT.0 ) THEN
DO j=2-OLy,sNy+OLy
DO i=2-OLx,sNx+OLx
h0FacZ(i,j) = MIN(
& MIN( h0FacW(i,j,k,bi,bj), h0FacW(i,j-1,k,bi,bj) ),
& MIN( h0FacS(i,j,k,bi,bj), h0FacS(i-1,j,k,bi,bj) ) )
ENDDO
ENDDO
ENDIF
#endif /* NONLIN_FRSURF */
C Make local copies of horizontal flow field
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
uFld(i,j) = uVel(i,j,k,bi,bj)
vFld(i,j) = vVel(i,j,k,bi,bj)
ENDDO
ENDDO
C Calculate velocity field "volume transports" through tracer cell faces.
C anelastic: transports are scaled by rhoFacC (~ mass transport)
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
uTrans(i,j) = uFld(i,j)*xA(i,j)*rhoFacC(k)
vTrans(i,j) = vFld(i,j)*yA(i,j)*rhoFacC(k)
ENDDO
ENDDO
CALL MOM_CALC_KE( bi,bj,k,2,uFld,vFld,KE,myThid )
IF ( useVariableVisc ) THEN
CALL MOM_CALC_HDIV( bi,bj,k,2,uFld,vFld,hDiv,myThid )
CALL MOM_CALC_RELVORT3( bi,bj,k,uFld,vFld,hFacZ,vort3,myThid )
CALL MOM_CALC_TENSION( bi,bj,k,uFld,vFld,tension,myThid )
CALL MOM_CALC_STRAIN( bi,bj,k,uFld,vFld,hFacZ,strain,myThid )
#ifdef ALLOW_LEITH_QG
IF ( viscC2LeithQG.NE.zeroRL ) THEN
CALL MOM_VISC_QGL_STRETCH(bi,bj,k,
O stretching, Nsquare,
I myTime, myIter, myThid)
CALL MOM_VISC_QGL_LIMIT(bi,bj,k,
O stretching,
I Nsquare, uFld,vFld,vort3,
I myTime, myIter, myThid )
ENDIF
#endif /* ALLOW_LEITH_QG */
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
IF ( hFacZ(i,j).EQ.0. ) THEN
vort3(i,j) = sideMaskFac*vort3(i,j)
strain(i,j) = sideMaskFac*strain(i,j)
ENDIF
ENDDO
ENDDO
#ifdef ALLOW_DIAGNOSTICS
IF ( useDiagnostics ) THEN
CALL DIAGNOSTICS_FILL(hDiv, 'momHDiv ',k,1,2,bi,bj,myThid)
CALL DIAGNOSTICS_FILL(vort3, 'momVort3',k,1,2,bi,bj,myThid)
CALL DIAGNOSTICS_FILL(tension,'Tension ',k,1,2,bi,bj,myThid)
CALL DIAGNOSTICS_FILL(strain, 'Strain ',k,1,2,bi,bj,myThid)
C stretching will be zero, unless using QG Leith
IF ( viscC2LeithQG.NE.zeroRL ) THEN
CALL DIAGNOSTICS_FILL(stretching,
I 'Stretch ',k,1,2,bi,bj,myThid)
ENDIF
ENDIF
#endif
ENDIF
C--- First call (k=1): compute vertical adv. flux fVerUkm & fVerVkm
IF (momAdvection.AND.k.EQ.1) THEN
#ifdef MOM_BOUNDARY_CONSERVE
CALL MOM_UV_BOUNDARY( bi, bj, k,
I uVel, vVel,
O uBnd(1-OLx,1-OLy,k,bi,bj),
O vBnd(1-OLx,1-OLy,k,bi,bj),
I myTime, myIter, myThid )
#endif /* MOM_BOUNDARY_CONSERVE */
C- Calculate vertical transports above U & V points (West & South face):
#ifdef ALLOW_AUTODIFF_TAMC
# ifdef NONLIN_FRSURF
# ifndef DISABLE_RSTAR_CODE
CADJ STORE dwtransc(:,:,bi,bj) =
CADJ & comlev1_bibj_k, key = imomkey, byte = isbyte
CADJ STORE dwtransu(:,:,bi,bj) =
CADJ & comlev1_bibj_k, key = imomkey, byte = isbyte
CADJ STORE dwtransv(:,:,bi,bj) =
CADJ & comlev1_bibj_k, key = imomkey, byte = isbyte
# endif
# endif /* NONLIN_FRSURF */
#endif /* ALLOW_AUTODIFF_TAMC */
CALL MOM_CALC_RTRANS( k, bi, bj,
O rTransU, rTransV,
I myTime, myIter, myThid )
C- Free surface correction term (flux at k=1)
CALL MOM_U_ADV_WU( bi,bj,k,uVel,wVel,rTransU,
O fVerUkm, myThid )
CALL MOM_V_ADV_WV( bi,bj,k,vVel,wVel,rTransV,
O fVerVkm, myThid )
C--- endif momAdvection & k=1
ENDIF
C--- Calculate vertical transports (at k+1) below U & V points :
IF (momAdvection) THEN
CALL MOM_CALC_RTRANS( k+1, bi, bj,
O rTransU, rTransV,
I myTime, myIter, myThid )
ENDIF
#ifdef MOM_BOUNDARY_CONSERVE
IF ( momAdvection .AND. k.LT.Nr ) THEN
CALL MOM_UV_BOUNDARY( bi, bj, k+1,
I uVel, vVel,
O uBnd(1-OLx,1-OLy,k+1,bi,bj),
O vBnd(1-OLx,1-OLy,k+1,bi,bj),
I myTime, myIter, myThid )
ENDIF
#endif /* MOM_BOUNDARY_CONSERVE */
IF (momViscosity) THEN
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
viscAh_D(i,j) = viscAhD
viscAh_Z(i,j) = viscAhZ
viscA4_D(i,j) = viscA4D
viscA4_Z(i,j) = viscA4Z
ENDDO
ENDDO
IF ( useVariableVisc ) THEN
CALL MOM_CALC_VISC( bi, bj, k,
O viscAh_Z, viscAh_D, viscA4_Z, viscA4_D,
I hDiv, vort3, tension, strain, stretching, KE, hFacZ,
I myThid )
ENDIF
ENDIF
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
C---- Zonal momentum equation starts here
IF (momAdvection) THEN
C--- Calculate mean fluxes (advection) between cells for zonal flow.
#ifdef MOM_BOUNDARY_CONSERVE
CALL MOM_U_ADV_UU( bi,bj,k,uTrans,uBnd(1-OLx,1-OLy,k,bi,bj),
O fZon,myThid )
CALL MOM_U_ADV_VU( bi,bj,k,vTrans,uBnd(1-OLx,1-OLy,k,bi,bj),
O fMer,myThid )
CALL MOM_U_ADV_WU(
I bi,bj,k+1,uBnd,wVel,rTransU,
O fVerUkp, myThid )
#else /* MOM_BOUNDARY_CONSERVE */
C-- Zonal flux (fZon is at east face of "u" cell)
C Mean flow component of zonal flux -> fZon
CALL MOM_U_ADV_UU( bi,bj,k,uTrans,uFld,fZon,myThid )
C-- Meridional flux (fMer is at south face of "u" cell)
C Mean flow component of meridional flux -> fMer
CALL MOM_U_ADV_VU( bi,bj,k,vTrans,uFld,fMer,myThid )
C-- Vertical flux (fVer is at upper face of "u" cell)
C Mean flow component of vertical flux (at k+1) -> fVer
CALL MOM_U_ADV_WU(
I bi,bj,k+1,uVel,wVel,rTransU,
O fVerUkp, myThid )
#endif /* MOM_BOUNDARY_CONSERVE */
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term
DO j=jMin,jMax
DO i=iMin,iMax
gU(i,j,k,bi,bj) =
#ifdef OLD_UV_GEOM
& -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)/
& ( 0.5 _d 0*(rA(i,j,bi,bj)+rA(i-1,j,bi,bj)) )
#else
& -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)
& *recip_rAw(i,j,bi,bj)*recip_deepFac2C(k)*recip_rhoFacC(k)
#endif
& *( ( fZon(i,j ) - fZon(i-1,j) )*uDudxFac
& +( fMer(i,j+1) - fMer(i, j) )*vDudyFac
& +( fVerUkp(i,j) - fVerUkm(i,j) )*rkSign*rVelDudrFac
& )
ENDDO
ENDDO
#ifdef ALLOW_DIAGNOSTICS
IF ( useDiagnostics ) THEN
CALL DIAGNOSTICS_FILL( fZon, 'ADVx_Um ',k,1,2,bi,bj,myThid)
CALL DIAGNOSTICS_FILL( fMer, 'ADVy_Um ',k,1,2,bi,bj,myThid)
CALL DIAGNOSTICS_FILL(fVerUkm,'ADVrE_Um',k,1,2,bi,bj,myThid)
ENDIF
#endif
#ifdef NONLIN_FRSURF
C-- account for 3.D divergence of the flow in rStar coordinate:
# ifndef DISABLE_RSTAR_CODE
IF ( select_rStar.GT.0 ) THEN
DO j=jMin,jMax
DO i=iMin,iMax
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)
& - (rStarExpW(i,j,bi,bj) - 1. _d 0)/deltaTFreeSurf
& *uVel(i,j,k,bi,bj)
ENDDO
ENDDO
ENDIF
IF ( select_rStar.LT.0 ) THEN
DO j=jMin,jMax
DO i=iMin,iMax
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)
& - rStarDhWDt(i,j,bi,bj)*uVel(i,j,k,bi,bj)
ENDDO
ENDDO
ENDIF
# endif /* DISABLE_RSTAR_CODE */
#endif /* NONLIN_FRSURF */
#ifdef ALLOW_ADDFLUID
IF ( selectAddFluid.GE.1 ) THEN
DO j=jMin,jMax
DO i=iMin,iMax
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)
& + uVel(i,j,k,bi,bj)*mass2rUnit*0.5 _d 0
& *( addMass(i-1,j,k,bi,bj) + addMass(i,j,k,bi,bj) )
& *_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)*recip_rhoFacC(k)
& * recip_rAw(i,j,bi,bj)*recip_deepFac2C(k)
ENDDO
ENDDO
ENDIF
#endif /* ALLOW_ADDFLUID */
ELSE
C- if momAdvection / else
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
gU(i,j,k,bi,bj) = 0. _d 0
ENDDO
ENDDO
C- endif momAdvection.
ENDIF
IF (momViscosity) THEN
C--- Calculate eddy fluxes (dissipation) between cells for zonal flow.
C Bi-harmonic term del^2 U -> v4F
IF ( useBiharmonicVisc )
& CALL MOM_U_DEL2U( bi, bj, k, uFld, hFacZ, h0FacZ,
O v4f, myThid )
C Laplacian and bi-harmonic terms, Zonal Fluxes -> fZon
CALL MOM_U_XVISCFLUX( bi,bj,k,uFld,v4F,fZon,
I viscAh_D,viscA4_D,myThid )
C Laplacian and bi-harmonic termis, Merid Fluxes -> fMer
CALL MOM_U_YVISCFLUX( bi,bj,k,uFld,v4F,hFacZ,fMer,
I viscAh_Z,viscA4_Z,myThid )
C Eddy component of vertical flux (interior component only) -> fVrUp & fVrDw
IF (.NOT.implicitViscosity) THEN
CALL MOM_U_RVISCFLUX( bi,bj, k, uVel,kappaRU,fVrUp,myThid )
CALL MOM_U_RVISCFLUX( bi,bj,k+1,uVel,kappaRU,fVrDw,myThid )
ENDIF
C-- Tendency is minus divergence of the fluxes
C anelastic: hor.visc.fluxes are not scaled by rhoFac (by vert.visc.flx is)
DO j=jMin,jMax
DO i=iMin,iMax
guDiss(i,j) =
#ifdef OLD_UV_GEOM
& -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)/
& ( 0.5 _d 0*(rA(i,j,bi,bj)+rA(i-1,j,bi,bj)) )
#else
& -_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)
& *recip_rAw(i,j,bi,bj)*recip_deepFac2C(k)
#endif
& *( ( fZon(i,j ) - fZon(i-1,j) )*AhDudxFac
& +( fMer(i,j+1) - fMer(i, j) )*AhDudyFac
& +( fVrDw(i,j) - fVrUp(i,j) )*rkSign*ArDudrFac
& *recip_rhoFacC(k)
& )
ENDDO
ENDDO
#ifdef ALLOW_DIAGNOSTICS
IF ( useDiagnostics ) THEN
CALL DIAGNOSTICS_FILL(fZon, 'VISCx_Um',k,1,2,bi,bj,myThid)
CALL DIAGNOSTICS_FILL(fMer, 'VISCy_Um',k,1,2,bi,bj,myThid)
IF (.NOT.implicitViscosity)
& CALL DIAGNOSTICS_FILL(fVrUp,'VISrE_Um',k,1,2,bi,bj,myThid)
ENDIF
#endif
C-- No-slip and drag BCs appear as body forces in cell abutting topography
IF (no_slip_sides) THEN
C- No-slip BCs impose a drag at walls...
CALL MOM_U_SIDEDRAG( bi, bj, k,
I uFld, v4f, h0FacZ,
I viscAh_Z, viscA4_Z,
I useHarmonicVisc, useBiharmonicVisc, useVariableVisc,
O vF,
I myThid )
DO j=jMin,jMax
DO i=iMin,iMax
guDiss(i,j) = guDiss(i,j) + vF(i,j)
ENDDO
ENDDO
ENDIF
C- No-slip BCs impose a drag at bottom
IF ( bottomDragTerms ) THEN
#ifdef ALLOW_AUTODIFF_TAMC
CADJ STORE KE(:,:) = comlev1_bibj_k, key = imomkey, byte = isbyte
#endif
CALL MOM_U_BOTDRAG_COEFF( bi, bj, k, .TRUE.,
I uFld, vFld, kappaRU, KE,
O cDrag,
I myIter, myThid )
DO j=jMin,jMax
DO i=iMin,iMax
guDiss(i,j) = guDiss(i,j)
& - cDrag(i,j)*uFld(i,j)
& *_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)
ENDDO
ENDDO
IF ( useDiagnostics ) THEN
DO j=jMin,jMax
DO i=iMin,iMax
botDragU(i,j,bi,bj) = botDragU(i,j,bi,bj)
& - cDrag(i,j)*uFld(i,j)*rUnit2mass
ENDDO
ENDDO
ENDIF
ENDIF
#ifdef ALLOW_SHELFICE
IF ( useShelfIce .AND. selectImplicitDrag.EQ.0 ) THEN
#ifdef ALLOW_AUTODIFF_TAMC
CADJ STORE KE(:,:) = comlev1_bibj_k, key = imomkey, byte = isbyte
#endif
CALL SHELFICE_U_DRAG_COEFF( bi, bj, k, .TRUE.,
I uFld, vFld, kappaRU, KE,
O cDrag,
I myIter, myThid )
DO j=jMin,jMax
DO i=iMin,iMax
guDiss(i,j) = guDiss(i,j)
& - cDrag(i,j)*uFld(i,j)
& *_recip_hFacW(i,j,k,bi,bj)*recip_drF(k)
ENDDO
ENDDO
ENDIF
#endif /* ALLOW_SHELFICE */
C- endif momViscosity
ENDIF
C-- Forcing term (moved to timestep.F)
c IF (momForcing)
c & CALL EXTERNAL_FORCING_U(
c I iMin,iMax,jMin,jMax,bi,bj,k,
c I myTime,myThid)
C-- Metric terms for curvilinear grid systems
IF (useNHMTerms) THEN
C o Non-Hydrostatic (spherical) metric terms
CALL MOM_U_METRIC_NH( bi,bj,k,uFld,wVel,mT,myThid )
DO j=jMin,jMax
DO i=iMin,iMax
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mtNHFacU*mT(i,j)
ENDDO
ENDDO
ENDIF
IF ( usingSphericalPolarGrid .AND. metricTerms ) THEN
C o Spherical polar grid metric terms
CALL MOM_U_METRIC_SPHERE( bi,bj,k,uFld,vFld,mT,myThid )
DO j=jMin,jMax
DO i=iMin,iMax
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mtFacU*mT(i,j)
ENDDO
ENDDO
ENDIF
IF ( usingCylindricalGrid .AND. metricTerms ) THEN
C o Cylindrical grid metric terms
CALL MOM_U_METRIC_CYLINDER( bi,bj,k,uFld,vFld,mT,myThid )
DO j=jMin,jMax
DO i=iMin,iMax
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+mtFacU*mT(i,j)
ENDDO
ENDDO
ENDIF
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
C---- Meridional momentum equation starts here
IF (momAdvection) THEN
#ifdef MOM_BOUNDARY_CONSERVE
CALL MOM_V_ADV_UV( bi,bj,k,uTrans,vBnd(1-OLx,1-OLy,k,bi,bj),
O fZon,myThid )
CALL MOM_V_ADV_VV( bi,bj,k,vTrans,vBnd(1-OLx,1-OLy,k,bi,bj),
O fMer,myThid )
CALL MOM_V_ADV_WV( bi,bj,k+1,vBnd,wVel,rTransV,
O fVerVkp, myThid )
#else /* MOM_BOUNDARY_CONSERVE */
C--- Calculate mean fluxes (advection) between cells for meridional flow.
C Mean flow component of zonal flux -> fZon
CALL MOM_V_ADV_UV( bi,bj,k,uTrans,vFld,fZon,myThid )
C-- Meridional flux (fMer is at north face of "v" cell)
C Mean flow component of meridional flux -> fMer
CALL MOM_V_ADV_VV( bi,bj,k,vTrans,vFld,fMer,myThid )
C-- Vertical flux (fVer is at upper face of "v" cell)
C Mean flow component of vertical flux (at k+1) -> fVerV
CALL MOM_V_ADV_WV( bi,bj,k+1,vVel,wVel,rTransV,
O fVerVkp, myThid )
#endif /* MOM_BOUNDARY_CONSERVE */
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term
DO j=jMin,jMax
DO i=iMin,iMax
gV(i,j,k,bi,bj) =
#ifdef OLD_UV_GEOM
& -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)/
& ( 0.5 _d 0*(_rA(i,j,bi,bj)+_rA(i,j-1,bi,bj)) )
#else
& -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)
& *recip_rAs(i,j,bi,bj)*recip_deepFac2C(k)*recip_rhoFacC(k)
#endif
& *( ( fZon(i+1,j) - fZon(i,j ) )*uDvdxFac
& +( fMer(i, j) - fMer(i,j-1) )*vDvdyFac
& +( fVerVkp(i,j) - fVerVkm(i,j) )*rkSign*rVelDvdrFac
& )
ENDDO
ENDDO
#ifdef ALLOW_DIAGNOSTICS
IF ( useDiagnostics ) THEN
CALL DIAGNOSTICS_FILL( fZon, 'ADVx_Vm ',k,1,2,bi,bj,myThid)
CALL DIAGNOSTICS_FILL( fMer, 'ADVy_Vm ',k,1,2,bi,bj,myThid)
CALL DIAGNOSTICS_FILL(fVerVkm,'ADVrE_Vm',k,1,2,bi,bj,myThid)
ENDIF
#endif
#ifdef NONLIN_FRSURF
C-- account for 3.D divergence of the flow in rStar coordinate:
# ifndef DISABLE_RSTAR_CODE
IF ( select_rStar.GT.0 ) THEN
DO j=jMin,jMax
DO i=iMin,iMax
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)
& - (rStarExpS(i,j,bi,bj) - 1. _d 0)/deltaTFreeSurf
& *vVel(i,j,k,bi,bj)
ENDDO
ENDDO
ENDIF
IF ( select_rStar.LT.0 ) THEN
DO j=jMin,jMax
DO i=iMin,iMax
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)
& - rStarDhSDt(i,j,bi,bj)*vVel(i,j,k,bi,bj)
ENDDO
ENDDO
ENDIF
# endif /* DISABLE_RSTAR_CODE */
#endif /* NONLIN_FRSURF */
#ifdef ALLOW_ADDFLUID
IF ( selectAddFluid.GE.1 ) THEN
DO j=jMin,jMax
DO i=iMin,iMax
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)
& + vVel(i,j,k,bi,bj)*mass2rUnit*0.5 _d 0
& *( addMass(i,j-1,k,bi,bj) + addMass(i,j,k,bi,bj) )
& *_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)*recip_rhoFacC(k)
& * recip_rAs(i,j,bi,bj)*recip_deepFac2C(k)
ENDDO
ENDDO
ENDIF
#endif /* ALLOW_ADDFLUID */
ELSE
C- if momAdvection / else
DO j=1-OLy,sNy+OLy
DO i=1-OLx,sNx+OLx
gV(i,j,k,bi,bj) = 0. _d 0
ENDDO
ENDDO
C- endif momAdvection.
ENDIF
IF (momViscosity) THEN
C--- Calculate eddy fluxes (dissipation) between cells for meridional flow.
C Bi-harmonic term del^2 V -> v4F
IF ( useBiharmonicVisc )
& CALL MOM_V_DEL2V( bi, bj, k, vFld, hFacZ, h0FacZ,
O v4f, myThid )
C Laplacian and bi-harmonic terms, Zonal Fluxes -> fZon
CALL MOM_V_XVISCFLUX( bi,bj,k,vFld,v4f,hFacZ,fZon,
I viscAh_Z,viscA4_Z,myThid )
C Laplacian and bi-harmonic termis, Merid Fluxes -> fMer
CALL MOM_V_YVISCFLUX( bi,bj,k,vFld,v4f,fMer,
I viscAh_D,viscA4_D,myThid )
C Eddy component of vertical flux (interior component only) -> fVrUp & fVrDw
IF (.NOT.implicitViscosity) THEN
CALL MOM_V_RVISCFLUX( bi,bj, k, vVel,KappaRV,fVrUp,myThid )
CALL MOM_V_RVISCFLUX( bi,bj,k+1,vVel,KappaRV,fVrDw,myThid )
ENDIF
C-- Tendency is minus divergence of the fluxes + coriolis + pressure term
C anelastic: hor.visc.fluxes are not scaled by rhoFac (by vert.visc.flx is)
DO j=jMin,jMax
DO i=iMin,iMax
gvDiss(i,j) =
#ifdef OLD_UV_GEOM
& -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)/
& ( 0.5 _d 0*(_rA(i,j,bi,bj)+_rA(i,j-1,bi,bj)) )
#else
& -_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)
& *recip_rAs(i,j,bi,bj)*recip_deepFac2C(k)
#endif
& *( ( fZon(i+1,j) - fZon(i,j ) )*AhDvdxFac
& +( fMer(i, j) - fMer(i,j-1) )*AhDvdyFac
& +( fVrDw(i,j) - fVrUp(i,j) )*rkSign*ArDvdrFac
& *recip_rhoFacC(k)
& )
ENDDO
ENDDO
#ifdef ALLOW_DIAGNOSTICS
IF ( useDiagnostics ) THEN
CALL DIAGNOSTICS_FILL(fZon, 'VISCx_Vm',k,1,2,bi,bj,myThid)
CALL DIAGNOSTICS_FILL(fMer, 'VISCy_Vm',k,1,2,bi,bj,myThid)
IF (.NOT.implicitViscosity)
& CALL DIAGNOSTICS_FILL(fVrUp,'VISrE_Vm',k,1,2,bi,bj,myThid)
ENDIF
#endif
C-- No-slip and drag BCs appear as body forces in cell abutting topography
IF (no_slip_sides) THEN
C- No-slip BCs impose a drag at walls...
CALL MOM_V_SIDEDRAG( bi, bj, k,
I vFld, v4f, h0FacZ,
I viscAh_Z, viscA4_Z,
I useHarmonicVisc, useBiharmonicVisc, useVariableVisc,
O vF,
I myThid )
DO j=jMin,jMax
DO i=iMin,iMax
gvDiss(i,j) = gvDiss(i,j) + vF(i,j)
ENDDO
ENDDO
ENDIF
C- No-slip BCs impose a drag at bottom
IF ( bottomDragTerms ) THEN
#ifdef ALLOW_AUTODIFF_TAMC
CADJ STORE KE(:,:) = comlev1_bibj_k, key = imomkey, byte = isbyte
#endif
CALL MOM_V_BOTDRAG_COEFF( bi, bj, k, .TRUE.,
I uFld, vFld, kappaRV, KE,
O cDrag,
I myIter, myThid )
DO j=jMin,jMax
DO i=iMin,iMax
gvDiss(i,j) = gvDiss(i,j)
& - cDrag(i,j)*vFld(i,j)
& *_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)
ENDDO
ENDDO
IF ( useDiagnostics ) THEN
DO j=jMin,jMax
DO i=iMin,iMax
botDragV(i,j,bi,bj) = botDragV(i,j,bi,bj)
& - cDrag(i,j)*vFld(i,j)*rUnit2mass
ENDDO
ENDDO
ENDIF
ENDIF
#ifdef ALLOW_SHELFICE
IF ( useShelfIce .AND. selectImplicitDrag.EQ.0 ) THEN
#ifdef ALLOW_AUTODIFF_TAMC
CADJ STORE KE(:,:) = comlev1_bibj_k, key = imomkey, byte = isbyte
#endif
CALL SHELFICE_V_DRAG_COEFF( bi, bj, k, .TRUE.,
I uFld, vFld, kappaRV, KE,
O cDrag,
I myIter, myThid )
DO j=jMin,jMax
DO i=iMin,iMax
gvDiss(i,j) = gvDiss(i,j)
& - cDrag(i,j)*vFld(i,j)
& *_recip_hFacS(i,j,k,bi,bj)*recip_drF(k)
ENDDO
ENDDO
ENDIF
#endif /* ALLOW_SHELFICE */
C- endif momViscosity
ENDIF
C-- Forcing term (moved to timestep.F)
c IF (momForcing)
c & CALL EXTERNAL_FORCING_V(
c I iMin,iMax,jMin,jMax,bi,bj,k,
c I myTime,myThid)
C-- Metric terms for curvilinear grid systems
IF (useNHMTerms) THEN
C o Non-Hydrostatic (spherical) metric terms
CALL MOM_V_METRIC_NH( bi,bj,k,vFld,wVel,mT,myThid )
DO j=jMin,jMax
DO i=iMin,iMax
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mtNHFacV*mT(i,j)
ENDDO
ENDDO
ENDIF
IF ( usingSphericalPolarGrid .AND. metricTerms ) THEN
C o Spherical polar grid metric terms
CALL MOM_V_METRIC_SPHERE( bi,bj,k,uFld,mT,myThid )
DO j=jMin,jMax
DO i=iMin,iMax
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mtFacV*mT(i,j)
ENDDO
ENDDO
ENDIF
IF ( usingCylindricalGrid .AND. metricTerms ) THEN
C o Cylindrical grid metric terms
CALL MOM_V_METRIC_CYLINDER( bi,bj,k,uFld,vFld,mT,myThid )
DO j=jMin,jMax
DO i=iMin,iMax
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+mtFacV*mT(i,j)
ENDDO
ENDDO
ENDIF
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
C-- Coriolis term (call to CD_CODE_SCHEME has been moved to timestep.F)
IF (.NOT.useCDscheme) THEN
CALL MOM_U_CORIOLIS( bi,bj,k,vFld,cf,myThid )
DO j=jMin,jMax
DO i=iMin,iMax
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+fuFac*cf(i,j)
ENDDO
ENDDO
#ifdef ALLOW_DIAGNOSTICS
IF ( useDiagnostics )
& CALL DIAGNOSTICS_FILL(cf,'Um_Cori ',k,1,2,bi,bj,myThid)
#endif
CALL MOM_V_CORIOLIS( bi,bj,k,uFld,cf,myThid )
DO j=jMin,jMax
DO i=iMin,iMax
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+fvFac*cf(i,j)
ENDDO
ENDDO
#ifdef ALLOW_DIAGNOSTICS
IF ( useDiagnostics )
& CALL DIAGNOSTICS_FILL(cf,'Vm_Cori ',k,1,2,bi,bj,myThid)
#endif
ENDIF
C-- 3.D Coriolis term (horizontal momentum, Eastward component: -fprime*w)
IF ( use3dCoriolis ) THEN
CALL MOM_U_CORIOLIS_NH( bi,bj,k,wVel,cf,myThid )
DO j=jMin,jMax
DO i=iMin,iMax
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)+fuFac*cf(i,j)
ENDDO
ENDDO
IF ( usingCurvilinearGrid ) THEN
C- presently, non zero angleSinC array only supported with Curvilinear-Grid
CALL MOM_V_CORIOLIS_NH( bi,bj,k,wVel,cf,myThid )
DO j=jMin,jMax
DO i=iMin,iMax
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)+fvFac*cf(i,j)
ENDDO
ENDDO
ENDIF
ENDIF
C-- Set du/dt & dv/dt on boundaries to zero
DO j=jMin,jMax
DO i=iMin,iMax
gU(i,j,k,bi,bj) = gU(i,j,k,bi,bj)*_maskW(i,j,k,bi,bj)
guDiss(i,j) = guDiss(i,j) *_maskW(i,j,k,bi,bj)
gV(i,j,k,bi,bj) = gV(i,j,k,bi,bj)*_maskS(i,j,k,bi,bj)
gvDiss(i,j) = gvDiss(i,j) *_maskS(i,j,k,bi,bj)
ENDDO
ENDDO
#ifdef ALLOW_DIAGNOSTICS
IF ( useDiagnostics ) THEN
CALL DIAGNOSTICS_FILL(KE, 'momKE ',k,1,2,bi,bj,myThid)
CALL DIAGNOSTICS_FILL(gU(1-OLx,1-OLy,k,bi,bj),
& 'Um_Advec',k,1,2,bi,bj,myThid)
CALL DIAGNOSTICS_FILL(gV(1-OLx,1-OLy,k,bi,bj),
& 'Vm_Advec',k,1,2,bi,bj,myThid)
ENDIF
#endif /* ALLOW_DIAGNOSTICS */
RETURN
END