-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod_cb_arrays.F+98
executable file
·1460 lines (1434 loc) · 57.8 KB
/
mod_cb_arrays.F+98
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
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
module mod_cb_arrays
use mod_dimensions
implicit none
public ! everything is public
c
c wrapper for common_blocks.h
c
#if defined(RELO)
real, save, allocatable, dimension(:,:,:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm,2) ::
#endif
& u,v, ! velocity components
& dp,dpo, ! layer thickness on p-grid
& dpu,dpv, ! layer thickness on u-grid and v-grid
& temp, ! temperature
& saln, ! salinity
& th3d, ! potential density
& thstar, ! virtual potential density
& montg ! montgomery potential
#if defined(RELO)
real, save, allocatable, dimension(:,:,:,:,:) ::
#else
real, save,
& dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm,2,mxtrcr) ::
#endif
& tracer ! inert tracers
#if defined(RELO)
real, save, allocatable, dimension(:,:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm+1) ::
#endif
& p,pu,pv ! interface pressure
#if defined(RELO)
real, save, allocatable, dimension(:,:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm) ::
#endif
& theta, ! isopycnal layer target densties - thbase
& diaflx ! time integral of diapyc.flux
#if defined(RELO)
real, save, allocatable, dimension(:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) ::
#endif
& corio, ! coriolis parameter
& potvor, ! potential vorticity
& srfhgt, ! sea surface height, g*ssh(m)
& steric, ! steric sea surface height, g*sssh(m)
& sshgmn, ! mean sea surface height, g*mssh(m)
& thmean, ! mean depth averaged density
& montg1, ! layer 1 montgomery potential
& skap ! thermobaric scale factor between reference states
#if defined(RELO)
real, save, allocatable, dimension(:,:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,2) ::
#endif
& psikk, ! montg.pot. in bottom layer
& thkk ! virtual potential density in bottom layer
c
#if defined(RELO)
integer, save, allocatable, dimension(:,:) ::
#else
integer, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) ::
#endif
& kapi ! thermobaric reference state index (1 or 3)
c
#if defined(RELO)
real, save, allocatable, dimension(:,:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm) ::
#endif
& uflx,vflx, ! mass fluxes
& uflxav,vflxav, ! average fluxes
& dpav ! average fluxes
#if defined(RELO)
real, save, allocatable, dimension(:,:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,3) ::
#endif
& ubavg,vbavg, ! barotropic velocity
& pbavg ! barotropic pressure
#if defined(RELO)
real, save, allocatable, dimension(:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) ::
#endif
& defor1,defor2, ! deformation components
& ubrhs, vbrhs, ! rhs of barotropic u,v eqns.
& utotm, vtotm, ! total (barotrop.+baroclin.)..
& utotn, vtotn, ! ..velocities at 2 time levels
& uflux, vflux, ! horizontal mass fluxes
& uflux1,vflux1, ! more mass fluxes
& uflux2,vflux2, ! more mass fluxes
& uflux3,vflux3 ! more mass fluxes
c
#if defined(RELO)
real, save, allocatable, dimension(:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) ::
#endif
& util1,util2, ! arrays for temporary storage
& util3,util4, ! arrays for temporary storage
& util5,util6, ! arrays for temporary storage
& plon, plat, ! lon,lat at p pts
& ulon, ulat, ! lon,lat at u pts
& vlon, vlat, ! lon,lat at v pts
& scux, scuy, ! mesh size at u pts in x,y dir.
& scvx, scvy, ! mesh size at v pts in x,y dir.
& scpx, scpy, ! mesh size at p pts in x,y dir.
& scqx, scqy, ! mesh size at q pts in x,y dir.
& scu2, scv2, ! grid box area at u,v pts
& scp2, scq2, ! grid box area at p,q pts
& scp2i,scq2i, ! inverses of scp2,scq2
& scuxi,scvyi, ! inverses of scux,scvy
& aspux,aspuy, ! u-grid aspect ratios for diffusion
& aspvx,aspvy, ! v-grid aspect ratios for diffusion
& veldf2u, ! u-grid laplacian diffusion coefficient
& veldf2v, ! v-grid laplacian diffusion coefficient
& veldf4u, ! u-grid biharmonic diffusion coefficient
& veldf4v, ! v-grid biharmonic diffusion coefficient
& thkdf4u, ! u-grid biharmonic diffusion coefficient
& thkdf4v, ! v-grid biharmonic diffusion coefficient
& cbp, ! p-grid quadratic bottom friction coefficient
& cbarp, ! p-grid rms flow speed for linear bottom friction
& pgfx, pgfy, ! horiz. presssure gradient
& gradx,grady, ! horiz. presssure gradient
& depthu,depthv, ! bottom pres. at u,v points
& pvtrop, ! pot.vort. of barotropic flow
& depths, ! water depth
& drag, ! bottom drag
& salfac, ! spatialy varying "scalar" SAL factor
& topiso, ! shallowest depth for isopycnal layers (pressure units)
& diws, ! spacially varying background/internal wave diffusivity
& diwm, ! spacially varying background/internal wave viscosity
& diwbot, ! background/internal wave diffusivity at the bottom
& diwqh0, ! background/internal wave diffusivity vertical scale
& sssrmx, ! maximum SSS difference for relaxation (psu)
& tidepg_mn, ! tidal pressure gradient forcing, time mean
& displd_mn, ! dissipation from linear drag, time mean
& dispqd_mn ! dissipation from quadratic drag, time mean
#if defined(RELO)
real, save, allocatable, dimension(:,:,:,:) ::
#else
real, save, dimension(1:2,1:2,1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) ::
#endif
& drgten ! tidal bottom drag tensor
c
#if defined(RELO)
real, save, allocatable, dimension(:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) ::
#endif
& uja, ujb, ! velocities at lateral ..
& via, vib, ! .. neighbor points
& pbot, ! bottom pressure at t=0
& sgain, ! salin.changes from diapyc.mix.
& surtx, ! surface net x-stress on p-grid
& surty, ! surface net y-stress on p-grid
& surflx, ! surface net thermal energy flux
& sswflx, ! surface swv thermal energy flux
& mixflx, ! mixed layer thermal energy flux
& sstflx, ! surface thermal flux from sst relax
& sssflx, ! surface salinity flux from sss relax
& rivflx, ! surface salinity flux from rivers
& salflx, ! surface salinity flux
& buoflx, ! mixed layer buoyancy flux
& bhtflx, ! mixed layer buoyancy flux from heat
& wndocn, ! magnitude of 10m wind minus ocean current
& ustar, ! friction velocity
& ustarb, ! bottom friction velocity
& turgen, ! turb.kin.energ. generation
& thkice, ! grid-cell avg. ice thknss (m)
& covice, ! ice coverage (rel.units)
& temice, ! ice surface temperature
& flxice, ! heat flux under ice
& fswice, ! swv flux under ice
& sflice, ! salt flux under ice
& si_c, ! ice concentration on p-grid from coupler
& si_h, ! ice thickness on p-grid from coupler
& si_t, ! ice temperature on p-grid from coupler
& si_u, ! ice u-velocity on p-grid from coupler
& si_v, ! ice v-velocity on p-grid from coupler
& si_tx, ! x-stress under ice on p-grid from coupler
& si_ty ! y-stesss under ice on p-grid from coupler
c
#if defined(RELO)
integer, save, allocatable, dimension(:,:) ::
#else
integer, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) ::
#endif
& klist, ! k-index
& jerlov ! jerlov water type 1-5, 0 for kpar, -1 for chl
c
#if defined(RELO)
real, save, allocatable, dimension(:,:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,2) ::
#endif
& dpmixl, ! mixed layer depth
& t1sav, ! upper sublayer temperature
& s1sav, ! upper sublayer salinity
& tmlb, ! temp in lyr. containing mlb.
& smlb ! saln in lyr. containing mlb
#if defined(RELO)
real, save, allocatable, dimension(:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) ::
#endif
& hekman, ! ekman layer thickness
& hmonob, ! monin-obukhov length
& dpbl, ! turbulent boundary layer depth
& dpbbl, ! bottom turbulent boundary layer depth
& dpmold, ! mixed layer depth at old time step
& tmix, ! mixed layer temperature
& smix, ! mixed layer salinity
& thmix, ! mixed layer potential density
& umix, vmix ! mixed layer velocity
#if defined(RELO)
real, save, allocatable, dimension(:) ::
#else
real, save, dimension(kdm) ::
#endif
& dp0k, ! minimum deep z-layer separation
& ds0k ! minimum shallow z-layer separation
real, save ::
& dpns, ! depth to start terrain following
& dsns ! depth to stop terrain following
c
#if defined(RELO)
integer, save, allocatable, dimension(:,:,:) ::
#else
integer, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,2) ::
#endif
& nmlb ! layer containing mlb.
c
c --- s w i t c h e s (if set to .true., then...)
c --- btrlfr leapfrog barotropic time step
c --- btrmas barotropic is mass conserving
c --- diagno output model fields and diagnostic messages
c --- thermo use thermodynamic forcing (flxflg>0)
c --- windf use wind stress forcing (wndflg>0)
c --- pcipf use evap-precip surface salinity flux
c --- epmass treat evap-precip as a mass exchange
c --- mslprf use msl presssure forcing
c --- priver use river precip bogas
c --- rivera annual-only river precip bogas
c --- kparan annual-only kpar or chl
c --- relax activate lateral boundary T/S/p climatological nudging
c --- srelax activate surface salinity climatological nudging
c --- (sssflg==1 or -1)
c --- trelax activate surface temperature climatological nudging
c --- (sstflg==1)
c --- trcrlx activate lateral boundary tracer climatological nudging
c --- relaxf input T/S/p relaxation fields
c --- relaxs input surface relaxation fields only
c --- relaxt input tracer relaxation fields
c --- locsig use locally-referenced potential density for stability
c --- vsigma use spacially varying target densities
c --- hybrid use hybrid vertical coordinates
c --- isopyc use isopycnic vertical coordinates (MICOM mode)
c --- icegln use energy loan ice model (iceflg==1)
c --- hybraf HYBGEN: apply Robert-Asselin filter during hybgen
c --- isopcm HYBGEN: use PCM to remap isopycnal layers
c --- mxlkta KT: activate original mixed layer model (mlflag==2)
c --- mxlktb KT: activate alternative mixed layer model (mlflag==3)
c --- mxlkrt KT: activate MICOM or HYCOM Kraus-Turner (mlflag==2,3)
c --- pensol KT: activate penetrating solar radiation
c --- mxlkpp KPP: activate mixed layer model (mlflag==1)
c --- bblkpp KPP: activate bottom boundary layer
c --- shinst KPP: activate shear instability mixing
c --- dbdiff KPP: activate double diffusion mixing
c --- nonloc KPP: activate nonlocal b. layer mixing
c --- botdiw KPROF: activate bot.enhan.int.wav mixing
c --- difout KPROF: output visc/diff coeffs in archive
c --- mxlmy MY2.5: activate mixed layer model (mlflag==5)
c --- mxlpwp PWP: activate mixed layer model (mlflag==4)
c --- mxlgiss GISS: activate mixed layer model (mlflag==6)
c --- stroff add a net wind stress offset
c --- flxoff add a net heat flux offset
c --- flxsmo activate smoothing of surface fluxes
c --- trcrin initialize tracer from restart file
c --- trcout advect tracer and save results in history/restart file
c --- dsur1p single point only surface diagnostics
c --- arcend always write a 3-d archive at the end of the run
c
logical, save ::
& btrlfr,btrmas,diagno,thermo,windf,mslprf,
& pcipf,epmass,priver,rivera,kparan,
& relax,srelax,trelax,trcrlx,relaxf,relaxs,relaxt,
& locsig,vsigma,hybrid,isopyc,icegln,hybraf,isopcm,
& mxlkta,mxlktb,mxlkrt,pensol,
& mxlkpp,bblkpp,shinst,dbdiff,nonloc,
& botdiw,difout,
& mxlmy,mxlpwp,mxlgiss,
& stroff,flxoff,flxsmo,trcrin,trcout,
& dsur1p,arcend
c
c --- t e x t
c --- ctitle four lines describing the simulation
c
character*80, save, dimension(4) :: ctitle
c
c --- atmospheric forcing fields, natm is 2 or 4
#if defined(RELO)
real, save, allocatable, dimension(:,:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,natm) ::
#endif
& taux, ! wind stress in x direction
& tauy, ! wind stress in y direction
& wndspd, ! wind speed
& ustara, ! ustar (tke source)
& mslprs, ! mean sea level pressure (anomaly)
& airtmp, ! air temperature
& vapmix, ! atmosph. vapor mixing ratio
& precip, ! precipitation
& radflx, ! net solar radiation
& swflx, ! net shortwave radiation
& surtmp, ! surface temp. used to calculate input lw radiation
& seatmp ! best available SST from observations
c
c --- monthly atmospheric forcing fields
#if defined(RELO)
real, save, allocatable, dimension(:,:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,4) ::
#endif
& akpar, ! photosynthetically available radiation coefficent
! or chlorophyll-a (jerlov=-1)
& rivers ! river inflow bogused to surface precipitation
#if defined(RELO)
real, save, allocatable, dimension(:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) ::
#endif
& oftaux, ! wind stress offset in x direction
& oftauy, ! wind stress offset in y direction
& offlux ! net heat flux offset
#if defined(RELO)
real, save, allocatable, dimension(:,:) ::
#else
real, save, dimension(0:24,-91:91) ::
#endif
& diurnl ! hourly vs latitude shortwave scale factor table
c
c --- surface and sidewall and nestwall boundary fields
c --- (kkwall and kknest are either kdm or, if inactive, 1).
#if defined(RELO)
real, save, allocatable, dimension(:,:,:,:) ::
#else
real, save,
& dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kkwall,4) ::
#endif
& pwall, ! pressure b.c. at sidewalls
& swall, ! salinity b.c. at sidewalls
& twall ! temp. b.c. at sidewalls
#if defined(RELO)
real, save, allocatable, dimension(:,:,:,:,:) ::
#else
real, save,
& dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kkwall,4,
& mxtrcr) ::
#endif
& trwall ! tracer b.c. at sidewalls
#if defined(RELO)
real, save, allocatable, dimension(:,:,:,:) ::
#else
real, save,
& dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kknest,2) ::
#endif
& pnest, ! pressure b.c. at nestwalls
& snest, ! salinity b.c. at nestwalls
& tnest, ! temp. b.c. at nestwalls
& unest, ! u-vel. b.c. at nestwalls
& vnest ! v-vel. b.c. at nestwalls
#if defined(RELO)
real, save, allocatable, dimension(:,:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,2) ::
#endif
& ubnest, ! barotropic u-velocity at nestwalls
& vbnest, ! barotropic v-velocity at nestwalls
& ubpnst, ! barotropic u-velocity at nestwalls on p-grid
& vbpnst, ! barotropic v-velocity at nestwalls on p-grid
& pbnest ! barotropic pressure at nestwalls
#if defined(RELO)
real, save, allocatable, dimension(:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) ::
#endif
& rmu, ! weights for s.w.b.c. relax
& rmunp, ! weights for p.n.w.b.c. relax
& rmunv, ! weights for v.n.w.b.c. relax
& rmutra ! weights for tracr.b.c. relax (maximum of all tracers)
#if defined(RELO)
real, save, allocatable, dimension(:,:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,mxtrcr) ::
#endif
& rmutr ! weights for tracr.b.c. relax
#if defined(RELO)
integer, save, allocatable, dimension(:,:) ::
#else
integer, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) ::
#endif
& maskbc ! mask for nested barotropic boundary condition
c
c --- pwp variables
real, save ::
& rigc ! PWP: critical gradient richardson number
&,ribc ! PWP: critical bulk richardson number
c
c --- m-y 2.5 variables
#if defined(RELO)
real, save, allocatable, dimension(:,:,:,:) ::
#else
real, save,
& dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,0:kkmy25+1,2) ::
#endif
& q2 ! tke
&,q2l ! tke * turbulent length scale
#if defined(RELO)
real, save, allocatable, dimension(:,:,:) ::
#else
real, save,
& dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,0:kkmy25+1) ::
#endif
& difqmy ! tke diffusivity
&,vctymy ! viscosity on mellor-yamada vertical grid
&,diftmy ! temperature diffusivity on mellor-yamada vertical grid
real, save ::
& ghc ! constant for calculating tke production
&,sef ! constant for calculating tke production
&,smll ! constant for calculating tke
&,const1 ! coefficient for estimating surface and bottom bc's
&,coef4 ! coefficient for calculating viscosity/diffusivity
&,coef5 ! coefficient for calculating viscosity/diffusivity
&,a1my ! coefficient for calculating viscosity/diffusivity
&,b1my ! coefficient for calculating viscosity/diffusivity
&,a2my ! coefficient for calculating viscosity/diffusivity
&,b2my ! coefficient for calculating viscosity/diffusivity
&,c1my ! coefficient for calculating viscosity/diffusivity
&,e1my ! coefficient for calculating viscosity/diffusivity
&,e2my ! coefficient for calculating viscosity/diffusivity
&,e3my ! coefficient for calculating viscosity/diffusivity
c
c --- kpp variables
#if defined(RELO)
real, save, allocatable, dimension(:,:,:) ::
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm+1) ::
#endif
& zgrid ! grid levels in meters
&,vcty ! vert. viscosity coefficient
&,difs ! vert. scalar diffusivity
&,dift ! vert. temperature diffusivity
&,ghats ! nonlocal transport
real, save ::
& vonk ! von karman constant
&,zmin,zmax ! zehat limits for table
&,umin,umax ! ustar limits for table
&,epsilon ! vertical coordinate scale factor
&,cmonob ! KPP: scale factor for Monin-Obukov length
&,cekman ! KPP: scale factor for Ekman depth
&,qrinfy ! KPP: 1/max grad.rich.no. for shear instability
&,difm0 ! KPP: max viscosity due to shear instability
&,difs0 ! KPP: max diffusivity due to shear instability
&,difmiw ! KPP/MY: background/internal wave viscosity (m^2/s)
&,difsiw ! KPP/MY: background/internal wave diffusivity (m^2/s)
&,dsfmax ! KPP: salt fingering diffusivity factor (m^2/s)
&,rrho0 ! KPP: salt fingering rp=(alpha*delT)/(beta*delS)
&,ricr ! KPP: critical bulk richardson number
&,cs ! KPP: value for nonlocal flux term
&,cstar ! KPP: value for nonlocal flux term
&,cv ! KPP: buoyancy frequency ratio (0.0 to use a fn. of N)
&,c11 ! KPP: value for turb velocity scale
&,deltaz ! delta zehat in table
&,deltau ! delta ustar in table
&,vtc ! constant for estimating background shear in rib calc.
&,cg ! constant for estimating nonlocal flux term of diff. eq.
&,dp0enh ! dist. for tapering diff. enhancement at interface nbl-1
integer, save ::
& niter ! KPP: iterations for semi-implicit soln. (2 recomended)
&,hblflg ! KPP: b.layer interpolation flag (0=con.1=lin.,2=quad.)
c
c --- nasa giss variables
c
integer, save ::
& nextrtbl0,ifexpabstable,nextrtbl1,
& nextrtbl,nposapprox,mt0,mt,ntbl,
& mt_ra_r,n_theta_r_oct,nbig
c
real, save ::
& deltheta_r,pidbl,rri
c
integer, save ::
& irimax(-762:762)
&,nb
c
#if defined(RELO)
real, save, allocatable, dimension(:,:) ::
#else
real, save, dimension(-762:762,-nlgiss:nlgiss) ::
#endif
& slq2b
&,smb
&,shb
&,ssb
c
real, save ::
& ribtbl(-762:762)
&,ridb( -762:762)
&,dri
&,back_ra_r(-39:117)
&,sisamax( -39:117)
&,ra_rmax( -39:117)
&,c_y_r0( -39:117)
&,sm_r1( -39:117)
&,sh_r1( -39:117)
&,ss_r1( -39:117)
&,slq2_r1( -39:117)
&,b1,visc_cbu_limit,diff_cbt_limit
&,theta_rcrp,theta_rcrn
c
integer, save ::
& ifback,ifsali,ifepson2,ifrafgmax,
& ifsalback,ifchengcon,ifunreal,idefmld,
& ifpolartablewrite,ifbg_theta_interp
c
real, save ::
& back_ph_0,adjust_gargett,back_k_0,back_del_0,back_s2,
& ri0,ebase,epson2_ref,
& eps_bot0,scale_bot, !for bottom-enhanced
& eplatidepmin,wave_30, !and latitude dependent mixing
& deltemld,delrhmld,
& back_sm2,v_back0,t_back0,
& s_back0,ri_internal,backfrac,backfact,ako,tpvot0,sgmt,
& tptot0,tpcot0,ttot0,tcot0,tctot0,tpvot,tptot,tpcot,
& ttot,tcot,tctot,back_l_0
c
real*8, save :: area,avgbot,watcum,empcum,wndrep
c
real, save ::
& time,delt1,dlt,
& w0, w1, w2, w3, ! wind interp. scale factors
& wk0,wk1,wk2,wk3, ! kpar interp. scale factors
& wr0,wr1,wr2,wr3, ! river interp. scale factors
& wc0,wc1,wc2,wc3, ! clim. interp. scale factors
& wn0,wn1, ! nest interp. scale factors
& wb0,wb1 ! baro. interp. scale factors
c
integer, save ::
& nstep,nstep1,nstep2,lstep,
& l0, l1, l2, l3, ! wind indexes
& lk0,lk1,lk2,lk3, ! kpar indexes
& lr0,lr1,lr2,lr3, ! river indexes
& lc0,lc1,lc2,lc3, ! clim. indexes
& ln0,ln1, ! nest indexes
& lb0,lb1 ! baro. indexes
c
c --- 'sigma ' = isopyncnal layer target densities (sigma units)
c --- 'thbase' = reference density (sigma units)
c --- 'saln0' = initial salinity value
c --- 'baclin' = baroclinic time step
c --- 'batrop' = barotropic time step
c ---'qhybrlx' = HYBGEN: relaxation coefficient (inverse baroclinic time steps)
c --- 'hybiso' = HYBGEN: Use PCM if layer is within hybiso of target density
c --- 'visco2' = deformation-dependent Laplacian viscosity factor
c --- 'visco4' = deformation-dependent biharmonic viscosity factor
c --- 'facdf4' = speed-dependent biharmonic viscosity factor
c --- 'veldf2' = diffusion velocity (m/s) for Laplacian momentum dissipation
c --- 'veldf4' = diffusion velocity (m/s) for biharmonic momentum dissipation
c --- 'temdf2' = diffusion velocity (m/s) for Laplacian temp/saln diffusion
c --- 'temdfc' = temp diffusion conservation (0.0 all density, 1.0 all temp)
c --- 'thkdf2' = diffusion velocity (m/s) for Laplacian thickness diffusion
c --- 'thkdf4' = diffusion velocity (m/s) for biharmonic thickness diffusion
c --- 'vertmx' = diffusion velocity (m/s) for mom.mixing across mix.layr.base
c --- 'tofset' = temperature anti-drift offset (degC/century)
c --- 'sofset' = salnity anti-drift offset (psu/century)
c --- 'diapyc' = KT: diapycnal diffusivity x buoyancy freq. (m**2/s**2)
c --- 'dtrate' = KT: maximum permitted m.l. detrainment rate (m/day)
c --- 'slip' = +1 for free-slip, -1 for non-slip boundary conditions
c --- 'cb' = coefficient of quadratic bottom friction
c --- 'cbar' = rms flow speed (m/s) for linear bottom friction law
c --- 'drglim' = limiter for explicit friction (1.0 no limiter, 0.0 implicit)
c --- 'drgscl' = scale factor for tidal drag (0.0 for no tidal drag)
c --- 'thkdrg' = thickness of bottom boundary layer for tidal drag (m)
c --- 'dsurfq' = number of days between model diagnostics at the surface
c --- 'diagfq' = number of days between model diagnostics
c --- 'proffq' = number of days between model diagnostics at some locations
c --- 'tilefq' = number of days between model diagnostics on some tiles
c --- 'meanfq' = number of days between model diagnostics (time averaged)
c --- 'rstrfq' = number of days between model restart output
c --- 'bnstfq' = number of days between baro. nesting archive input
c --- 'nestfq' = number of days between 3-d nesting archive input
c --- 'ra2fac' = weight for Robert-Asselin time filter
c --- 'wbaro' = weight for time smoothing of barotropic u,v,p field
c --- 'thkmls' = reference mixed-layer thickness for SSS relaxation (m)
c --- 'thkmlt' = reference mixed-layer thickness for SST relaxation (m)
c --- 'thkriv' = nominal thickness of river inflow (m)
c --- 'thkcdw' = thickness for near-surface currents in ice-ocean stress
c --- 'thkfrz' = maximum thickness of near surface freezing zone (m)
c --- 'tfrz_0' = ENLN: ice melting point (degC) at S=0psu
c --- 'tfrz_s' = ENLN: gradient of ice melting point (degC/psu)
c --- 'ticegr' = ENLN: vertical temperature gradient inside ice (deg/m)
c --- (0.0 to get ice surface temp. from atmos. surtmp)
c --- 'hicemn' = ENLN: minimum ice thickness (m)
c --- 'hicemx' = ENLN: maximum ice thickness (m)
c --- 'thkmin' = KT/PWP: minimum mixed-layer thickness (m)
c --- 'bldmin' = KPP: minimum surface boundary layer thickness (m)
c --- 'bldmax' = KPP: maximum surface boundary layer thickness (m)
c --- 'thkbot' = thickness of bottom boundary layer (m)
c --- 'sigjmp' = minimum density jump across interfaces (theta units)
c --- 'tmljmp' = equivalent temperature jump across the mixed layer (degC)
c --- 'prsbas' = msl pressure is input field + prsbas (Pa)
c --- 'salmin' = minimum salinity allowed in an isopycnic layer (psu)
c --- 'dp00' = deep z-level spacing minimum thickness (m)
c --- 'dp00x' = deep z-level spacing maximum thickness (m)
c --- 'dp00f' = deep z-level spacing stretching factor (1.0=const.z)
c --- 'ds00' = shallow z-level spacing minimum thickness (m)
c --- 'ds00x' = shallow z-level spacing maximum thickness (m)
c --- 'ds00f' = shallow z-level spacing stretching factor (1.0=const.z)
c --- 'dp00i' = deep iso-pycnal spacing minimum thickness (m)
c --- 'isotop' = shallowest depth for isopycnal layers (m), <0 from file
c --- 'nhybrd' = number of hybrid levels (0=all isopycnal)
c --- 'nsigma' = number of sigma levels (nhybrd-nsigma z-levels)
c --- 'hybmap' = HYBGEN: remapper flag (0=PCM,1=PLM,2=PPM,-ve:isoPCM)
c --- 'hybflg' = HYBGEN: generator flag (0=T&S,1=th&S,2=th&T)
c --- 'advflg' = thermal advection flag (0=T&S,1=th&S,2=th&T)
c --- 'advtyp' = scalar advection type (0=PCM,1=MPDATA,2=FCT2,4=FCT4)
c --- 'momtyp' = momentum advection type (2=2nd order, 4=4th order)
c --- 'kapref' = thermobaric reference state (-1=input,0=none,1,2,3=constant)
c --- 'kapnum' = number of thermobaric reference states (1 or 2)
c --- 'tsofrq' = number of time steps between anti-drift offset calcs
c --- 'mixfrq' = KT: number of time steps between diapycnal mixing calcs
c --- 'icefrq' = relax to tfrz with e-folding time of icefrq time steps
c --- 'icpfrq' = number of time steps between sea-ice updates
c --- 'ntracr' = number of tracers (<=mxtrcr)
c --- 'trcflg' = tracer type flag (one per tracer)
c --- 'clmflg' = climatology frequency flag (6=bimonthly,12=monthly)
c --- 'dypflg' = KT: diapycnal mixing flag (0=none,1=KPP,2=explicit)
c --- 'iniflg' = initial state flag (0=level,1=zonal,2=climatology)
c --- 'lbflag' = lateral baro. bndy flag (0=none;nest:2=B-K,4=Flather,6=clamped)
c --- (port: 1=Browning-Kreiss,3=Flather)
c --- 'mapflg' = map flag (0=mercator,2=uniform,3=beta-plane,4=input)
c --- 'yrflag' = days in year flag (0=360,1=366,2=366Jan1,3=actual)
c --- 'sshflg' = diagnostic SSH flag (0=SSH,1=SSH&stericSSH)
c --- 'iversn' = hycom version number x10
c --- 'iexpt' = experiment number x10
c --- 'jerlv0' = initial jerlov water type (1 to 5; 0 for kpar, -1 for chl)
c --- 'iceflg' = sea ice model flag (0=none,1=energy loan,2=coupled/esmf)
c --- 'ishelf' = ice shelf flag (0=none,1=ice shelf over ocean)
c --- 'wndflg' = wind str. input flag (0=none,1=on u/v grid,2,3=on p grid)
c --- 'ustflg' = ustar forcing flag (3=input,1=wndspd,2=stress)
c --- 'flxflg' = thermal forcing flag (0=none,3=net-flux,1,2,4=sst-based)
c --- 'empflg' = E-P forcing flag (0=none,3=net_E-P, 1,2,4=sst-based_E)
c --- 'dswflg' = diurnal shortwv flag (0=none,1=daily to diurnal correction)
c --- 'albflg' = ocean albedo flag (0=none,1=.06,2=L&Y)
c --- 'sssflg' = SSS relaxation flag (0=none,1=clim,-1=clim+rmx)
c --- 'lwflag' = longwave corr. flag (0=none,1=clim,2=atmos), sst-based
c --- 'sstflg' = SST relaxation flag (0=none,1=clim,2=atmos,3=obs)
c --- 'icmflg' = ice mask flag (0=none,1=clim,2=atmos,3=obs)
c --- 'difsmo' = KPROF: number of layers with horiz smooth diff coeffs
c
#if defined(RELO)
real, save, allocatable, dimension(:) ::
#else
real, save, dimension(kdm) ::
#endif
& sigma,
& salmin
c
real, save ::
& thbase,saln0,baclin,batrop,
& qhybrlx,hybiso,
& visco2,visco4,veldf2,veldf4,facdf4,
& temdf2,temdfc,thkdf2,thkdf4,vertmx,diapyc,
& tofset,sofset,dtrate,slip,cb,cbar,
& drglim,drgscl,thkdrg,
& dsurfq,diagfq,proffq,tilefq,meanfq,
& rstrfq,bnstfq,nestfq,
& ra2fac,wbaro,
& thkmls,thkmlt,thkriv,thkmin,bldmin,bldmax,thkbot,
& thkcdw,thkfrz,tfrz_0,tfrz_s,ticegr,hicemn,hicemx,
& dp00,dp00f,dp00x,ds00,ds00f,ds00x,dp00i,isotop,
& sigjmp,tmljmp,prsbas
c
integer, save ::
& tsofrq,mixfrq,icefrq,icpfrq,nhybrd,nsigma,
& hybmap,hybflg,advflg,advtyp,momtyp,
& kapref,kapnum,
& ntracr,trcflg(mxtrcr),
& clmflg,dypflg,iniflg,lbflag,mapflg,yrflag,sshflg,
& iversn,iexpt,jerlv0,
& iceflg,ishelf,icmflg,wndflg,ustflg,
& flxflg,empflg,dswflg,albflg,lwflag,sstflg,sssflg,
& difsmo,disp_count
c
real, parameter ::
& g = 9.806, !gravitational acceleration (m/s**2)
& thref = 1.0d-3, !reference value of specific volume (m**3/kg)
& onem = g/thref, !one meter in pressure units (Pa)
& tenm = onem*10.0,
& tencm = onem* 0.1,
& onecm = onem* 0.01,
& onemm = onem* 0.001,
& spcifh = 3990.0, !specific heat of sea water (j/kg/deg)
& epsil = 1.0d-11, !small nonzero to prevent division by zero
& hugel = 2.0**100, !large number used to indicate land points
& pi = 3.14159265358979323846d0,
& radian = pi/180.0,
& qonem = 1.0/onem,
& qthref = 1.0/thref
c
c --- grid point where detailed diagnostics are desired:
integer, save :: itest,jtest,ittest,jttest
c
c --- filenames.
character*80, save ::
& flnmdep,flnmgrd,flnmshlf,
& flnmrsi,flnmrso, flnmflx,
& flnmarc,flnmovr,flnmfor,flnmforw,flnminp,
& flnmarcm,
& flnmarcs,
& flnmarct
c
c --- CCSM3 variables (should be in CCSM3 modules)
logical, save :: dosstbud,doovtn,chk_ovtn,dodump,dohist,dorestart
c
integer, save :: istrt_mo,icurrent_mo,istrt_yr,icurrent_yr
c
c --- diurnal cycle factor for short wave heat flux
integer, save :: nsteps_per_day,nsteps_today
c
contains
subroutine cb_allocate
c
c --- Allocate saved arrays
c
call set_r_init
c
#if defined(RELO)
call gindex_allocate !from mod_dimensions
c
allocate(
& u(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm,2),
& v(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm,2),
& dp(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm,2),
& dpo(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm,2),
& dpu(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm,2),
& dpv(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm,2),
& temp(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm,2),
& saln(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm,2),
& th3d(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm,2),
& thstar(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm,2),
& montg(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm,2) )
call mem_stat_add( 11*(idm+2*nbdy)*(jdm+2*nbdy)*kdm*2 )
#endif
u = r_init
v = r_init
dp = r_init
dpo = r_init
dpu = r_init
dpv = r_init
temp = r_init
saln = r_init
th3d = r_init
thstar = r_init
montg = r_init
c
if (ntracr.gt.0) then
#if defined(RELO)
allocate(
& tracer(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm,2,ntracr) )
call mem_stat_add( (idm+2*nbdy)*(jdm+2*nbdy)*kdm*2*ntracr )
#endif
tracer = r_init
endif
c
#if defined(RELO)
allocate(
& p(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm+1),
& pu(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm+1),
& pv(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm+1) )
call mem_stat_add( 3*(idm+2*nbdy)*(jdm+2*nbdy)*(kdm+1) )
#endif
p = r_init
pu = r_init
pv = r_init
c
#if defined(RELO)
allocate(
& theta(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm),
& diaflx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm) )
call mem_stat_add( 2*(idm+2*nbdy)*(jdm+2*nbdy)*kdm )
#endif
theta = r_init
diaflx = r_init
c
#if defined(RELO)
allocate(
& corio(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& potvor(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& srfhgt(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& steric(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& sshgmn(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& thmean(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& montg1(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& skap(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) )
call mem_stat_add( 8*(idm+2*nbdy)*(jdm+2*nbdy) )
#endif
corio = r_init
potvor = r_init
srfhgt = r_init
steric = r_init
sshgmn = r_init
thmean = r_init
montg1 = r_init
skap = r_init
c
#if defined(RELO)
allocate(
& psikk(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,2),
& thkk(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,2) )
call mem_stat_add( 2*(idm+2*nbdy)*(jdm+2*nbdy)*2 )
#endif
psikk = r_init
thkk = r_init
c
#if defined(RELO)
allocate(
& kapi(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) )
call mem_stat_add( (idm+2*nbdy)*(jdm+2*nbdy)/2 ) !real=2*int
#endif
kapi = -99
c
#if defined(RELO)
allocate(
& uflx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm),
& vflx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm),
& uflxav(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm),
& vflxav(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm),
& dpav(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm) )
call mem_stat_add( 5*(idm+2*nbdy)*(jdm+2*nbdy)*kdm )
#endif
uflx = r_init
vflx = r_init
uflxav = r_init
vflxav = r_init
dpav = r_init
c
#if defined(RELO)
allocate(
& ubavg(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,3),
& vbavg(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,3),
& pbavg(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,3) )
call mem_stat_add( 3*(idm+2*nbdy)*(jdm+2*nbdy)*3 )
#endif
ubavg = r_init
vbavg = r_init
pbavg = r_init
c
#if defined(RELO)
allocate(
& defor1(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& defor2(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& ubrhs(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& vbrhs(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& utotm(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& vtotm(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& utotn(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& vtotn(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) ,
& uflux(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& vflux(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& uflux1(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& vflux1(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& uflux2(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& vflux2(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& uflux3(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& vflux3(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) )
call mem_stat_add( 16*(idm+2*nbdy)*(jdm+2*nbdy) )
#endif
defor1 = r_init
defor2 = r_init
ubrhs = r_init
vbrhs = r_init
utotm = r_init
vtotm = r_init
utotn = r_init
vtotn = r_init
uflux = r_init
vflux = r_init
uflux1 = r_init
vflux1 = r_init
uflux2 = r_init
vflux2 = r_init
uflux3 = r_init
vflux3 = r_init
c
#if defined(RELO)
allocate(
& util1(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& util2(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& util3(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& util4(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& util5(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& util6(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& plon(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& plat(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& ulon(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& ulat(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& vlon(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& vlat(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& scux(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& scuy(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& scvx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& scvy(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& scpx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& scpy(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& scqx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& scqy(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& scu2(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& scv2(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& scp2(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& scq2(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& scp2i(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& scq2i(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& scuxi(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& scvyi(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& aspux(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& aspuy(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& aspvx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& aspvy(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& veldf2u(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& veldf2v(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& veldf4u(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& veldf4v(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& thkdf4u(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& thkdf4v(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& cbp(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& cbarp(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& pgfx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& pgfy(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& gradx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& grady(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& depthu(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& depthv(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& pvtrop(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& depths(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& drag(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& salfac(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& topiso(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& diws(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& diwm(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& diwbot(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& diwqh0(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& sssrmx(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& tidepg_mn(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& displd_mn(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy),
& dispqd_mn(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) )
call mem_stat_add( 59*(idm+2*nbdy)*(jdm+2*nbdy) )
#endif
util1 = r_init
util2 = r_init
util3 = r_init
util4 = r_init
util5 = r_init
util6 = r_init
plon = r_init
plat = r_init
ulon = r_init
ulat = r_init
vlon = r_init