forked from HYCOM/HYCOM-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod_cb_arrays.F90
1876 lines (1815 loc) · 74.7 KB
/
mod_cb_arrays.F90
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
#if defined (USE_NUOPC_CESMBETA) || (ESPC_COUPLE)
#define USE_NUOPC_GENERIC 1
#endif
!
! wrapper for common_blocks.h
!
#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) :: &
#endif
otemp, & ! temperature, time level t-1
osaln, & ! salinity, time level t-1
oth3d, & ! potential density, time level t-1
oq2, & ! tke time level t-1
oq2l ! tke*turbulent length scale, time level t-1
#if defined(RELO)
real, save, allocatable, dimension(:,:,:,:) :: &
#else
real, save, &
dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,kdm,mxtrcr) :: &
#endif
otracer ! inert tracers, time level t-1
#if defined(RELO)
real, save, allocatable, dimension(:,:) :: &
#else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) :: &
#endif
dpmold ! mixed layer depth at old time step
#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
montg_c, & ! Montgomery Potential correction (m)
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
!
#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)
!
#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, dimension (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,2) :: &
#endif
oneta, & ! 1+eta
onetao, & ! 1+eta, original for Robert-Asselin filter
onetamas ! either 1+eta or 1, based on btrmas
#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
onetacnt ! 1+eta(t+1) after cnuity
!
#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
qlon, qlat, & ! lon,lat at q pts
ulon, ulat, & ! lon,lat at u pts
vlon, vlat, & ! lon,lat at v pts
pang, & ! angle between xwards and ewards
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
!
#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 salt flux from sss relax
rivflx, & ! surface water flux from rivers
salflx, & ! surface salt flux
wtrflx, & ! surface water 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
wflice, & ! water flux under ice
wflfrz, & ! water flux under ice from freeze/melt (diagnostic, icloan)
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
!
#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
!
#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
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
!
#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.
!
#if defined(RELO)
real, save, allocatable, dimension(:,:) :: &
#else
real, save, dimension (2*max_nsteps_batrop+1,2) :: &
#endif
coeflx ! used to diagnose the barotropic mass flux
!
! --- s w i t c h e s (if set to .true., then...)
! --- btrlfr leapfrog barotropic time step
! --- btrmas barotropic is mass conserving
! --- diagno output model fields and diagnostic messages
! --- thermo use thermodynamic forcing (flxflg>0)
! --- windf use wind stress forcing (wndflg>0)
! --- pcipf use evap-precip surface salinity flux
! --- epmass treat evap-precip as a mass exchange
! --- mslprf use msl presssure forcing
! --- priver use river precip bogas
! --- rivera annual-only river precip bogas
! --- kparan annual-only kpar or chl
! --- relax activate lateral boundary T/S/p climatological nudging
! --- srelax activate surface salinity climatological nudging
! --- (sssflg==1 or -1)
! --- trelax activate surface temperature climatological nudging
! --- (sstflg==1)
! --- trcrlx activate lateral boundary tracer climatological nudging
! --- relaxf input T/S/p relaxation fields
! --- relaxs input surface relaxation fields only
! --- relaxt input tracer relaxation fields
! --- locsig use locally-referenced potential density for stability
! --- vsigma use spacially varying target densities
! --- hybrid use hybrid vertical coordinates
! --- isopyc use isopycnic vertical coordinates (MICOM mode)
! --- icegln use energy loan ice model (iceflg==1)
! --- hybraf HYBGEN: apply Robert-Asselin filter during hybgen
! --- isopcm HYBGEN: use PCM to remap isopycnal layers
! --- mxl_no NO: deactivate mixed layer model (mlflag==0)
! --- mxlkta KT: activate original mixed layer model (mlflag==2)
! --- mxlktb KT: activate alternative mixed layer model (mlflag==3)
! --- mxlkrt KT: activate MICOM or HYCOM Kraus-Turner (mlflag==2,3)
! --- pensol KT: activate penetrating solar radiation
! --- mxlkpp KPP: activate mixed layer model (mlflag==1)
! --- bblkpp KPP: activate bottom boundary layer
! --- shinst KPP: activate shear instability mixing
! --- dbdiff KPP: activate double diffusion mixing
! --- nonloc KPP: activate nonlocal b. layer mixing
! --- botdiw KPROF: activate bot.enhan.int.wav mixing
! --- difout KPROF: output visc/diff coeffs in archive
! --- mxlmy MY2.5: activate mixed layer model (mlflag==5)
! --- mxlpwp PWP: activate mixed layer model (mlflag==4)
! --- mxlgiss GISS: activate mixed layer model (mlflag==6)
! --- stroff add a net wind stress offset
! --- flxoff add a net heat flux offset
! --- flxsmo activate smoothing of surface fluxes
! --- trcrin initialize tracer from restart file
! --- trcout advect tracer and save results in history/restart file
! --- dsur1p single point only surface diagnostics
! --- arcend always write a 3-d archive at the end of the run
!
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, &
mxl_no,mxlkta,mxlktb,mxlkrt,pensol, &
mxlkpp,bblkpp,shinst,dbdiff,nonloc, &
botdiw,difout, &
mxlmy,mxlpwp,mxlgiss, &
stroff,flxoff,flxsmo,trcrin,trcout, &
dsur1p,arcend
!
! --- t e x t
! --- ctitle four lines describing the simulation
!
character*80, save, dimension(4) :: ctitle
!
! --- 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
stoc_t, & ! stochastic temperature anomaly forcing
stoc_s, & ! stochastic salinty anomaly forcing
stoc_u, & ! stochastic u-velocity anomaly forcing
stoc_v ! stochastic v-velocity anomaly forcing
!
! --- 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
!
! --- surface and sidewall and nestwall boundary fields
! --- (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)
rmus ! weights for sss relax !!Alex
#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
!
! --- pwp variables
real, save :: &
rigc & ! PWP: critical gradient richardson number
,ribc ! PWP: critical bulk richardson number
!
! --- 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
!
! --- 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.)
!
! --- nasa giss variables
!
integer, save :: &
nextrtbl0,ifexpabstable,nextrtbl1, &
nextrtbl,nposapprox,mt0,mt,ntbl, &
mt_ra_r,n_theta_r_oct,nbig
!
real, save :: &
deltheta_r,pidbl,rri
!
integer, save :: &
irimax(-762:762) &
,nb
!
#if defined(RELO)
real, save, allocatable, dimension(:,:) :: &
#else
real, save, dimension(-762:762,-nlgiss:nlgiss) :: &
#endif
slq2b &
,smb &
,shb &
,ssb
!
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
!
integer, save :: &
ifback,ifsali,ifepson2,ifrafgmax, &
ifsalback,ifchengcon,ifunreal,idefmld, &
ifpolartablewrite,ifbg_theta_interp
!
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
!
real*8, save :: area,avgbot,watcum,empcum,wndrep
!
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
!
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
!
! --- 'sigma ' = isopyncnal layer target densities (sigma units)
! --- 'thbase' = reference density (sigma units)
! --- 'saln0' = initial salinity value
! --- 'baclin' = baroclinic time step
! --- 'batrop' = barotropic time step
! ---'qhybrlx' = HYBGEN: relaxation coefficient (inverse baroclinic time steps)
! --- 'hybiso' = HYBGEN: Use PCM if layer is within hybiso of target density
! --- 'visco2' = deformation-dependent Laplacian viscosity factor
! --- 'visco4' = deformation-dependent biharmonic viscosity factor
! --- 'facdf4' = speed-dependent biharmonic viscosity factor
! --- 'veldf2' = diffusion velocity (m/s) for Laplacian momentum dissipation
! --- 'veldf4' = diffusion velocity (m/s) for biharmonic momentum dissipation
! --- 'temdf2' = diffusion velocity (m/s) for Laplacian temp/saln diffusion
! --- 'temdfc' = temp diffusion conservation (0.0 all density, 1.0 all temp)
! --- 'thkdf2' = diffusion velocity (m/s) for Laplacian thickness diffusion
! --- 'thkdf4' = diffusion velocity (m/s) for biharmonic thickness diffusion
! --- 'vertmx' = diffusion velocity (m/s) for mom.mixing across mix.layr.base
! --- 'tofset' = temperature anti-drift offset (degC/century)
! --- 'sofset' = salnity anti-drift offset (psu/century)
! --- 'diapyc' = KT: diapycnal diffusivity x buoyancy freq. (m**2/s**2)
! --- 'dtrate' = KT: maximum permitted m.l. detrainment rate (m/day)
! --- 'slip' = +1 for free-slip, -1 for non-slip boundary conditions
! --- 'cb' = coefficient of quadratic bottom friction
! --- 'cbar' = rms flow speed (m/s) for linear bottom friction law
! --- 'drglim' = limiter for explicit friction (1.0 no limiter, 0.0 implicit)
! --- 'drgscl' = scale factor for tidal drag (0.0 for no tidal drag)
! --- 'thkdrg' = thickness of bottom boundary layer for tidal drag (m)
! --- 'dsurfq' = number of days between model diagnostics at the surface
! --- 'diagfq' = number of days between model diagnostics
! --- 'proffq' = number of days between model diagnostics at some locations
! --- 'tilefq' = number of days between model diagnostics on some tiles
! --- 'meanfq' = number of days between model diagnostics (time averaged)
! --- 'rstrfq' = number of days between model restart output
! --- 'bnstfq' = number of days between baro. nesting archive input
! --- 'nestfq' = number of days between 3-d nesting archive input
! --- 'stfflg' = stochastic anomaly forcing flag (0=no, 1=TS, 2=TSV)
! --- 'stfrdt' = stochastic T anomaly forcing e-folding depth (m)
! --- 'stfrds' = stochastic S anomaly forcing e-folding depth (m)
! --- 'stfrdv' = stochastic V anomaly forcing e-folding depth (m)
! --- 'ra2fac' = weight for Robert-Asselin time filter
! --- 'wbaro' = weight for time smoothing of barotropic u,v,p field
! --- 'sefold' = e-folding time for SSS relaxation (days)
! --- 'thkmls' = reference mixed-layer thickness for SSS relaxation (m)
! --- 'thkmlt' = reference mixed-layer thickness for SST relaxation (m)
! --- 'thkriv' = nominal thickness of river inflow (m)
! --- 'thkcdw' = thickness for near-surface currents in ice-ocean stress
! --- 'thkfrz' = maximum thickness of near surface freezing zone (m)
! --- 'tfrz_0' = ENLN: ice melting point (degC) at S=0psu
! --- 'tfrz_s' = ENLN: gradient of ice melting point (degC/psu)
! --- 'ticegr' = ENLN: vertical temperature gradient inside ice (deg/m)
! --- (0.0 to get ice surface temp. from atmos. surtmp)
! --- 'hicemn' = ENLN: minimum ice thickness (m)
! --- 'hicemx' = ENLN: maximum ice thickness (m)
! --- 'thkmin' = KT/PWP: minimum mixed-layer thickness (m)
! --- 'bldmin' = KPP: minimum surface boundary layer thickness (m)
! --- 'bldmax' = KPP: maximum surface boundary layer thickness (m)
! --- 'thkbot' = thickness of bottom boundary layer (m)
! --- 'sigjmp' = minimum density jump across interfaces (theta units)
! --- 'tmljmp' = equivalent temperature jump across the mixed layer (degC)
! --- 'prsbas' = msl pressure is input field + prsbas (Pa)
! --- 'salmin' = minimum salinity allowed in an isopycnic layer (psu)
! --- 'dp00' = deep z-level spacing minimum thickness (m)
! --- 'dp00x' = deep z-level spacing maximum thickness (m)
! --- 'dp00f' = deep z-level spacing stretching factor (1.0=const.z)
! --- 'ds00' = shallow z-level spacing minimum thickness (m)
! --- 'ds00x' = shallow z-level spacing maximum thickness (m)
! --- 'ds00f' = shallow z-level spacing stretching factor (1.0=const.z)
! --- 'dp00i' = deep iso-pycnal spacing minimum thickness (m)
! --- 'isotop' = shallowest depth for isopycnal layers (m), <0 from file
! --- 'nhybrd' = number of hybrid levels (0=all isopycnal)
! --- 'nsigma' = number of sigma levels (nhybrd-nsigma z-levels)
! --- 'hybmap' = HYBGEN: remapper flag (0=PCM,1=PLM,2=PPM,-ve:isoPCM)
! --- 'hybflg' = HYBGEN: generator flag (0=T&S,1=th&S,2=th&T)
! --- 'advflg' = thermal advection flag (0=T&S,1=th&S,2=th&T)
! --- 'advtyp' = scalar advection type (0=PCM,1=MPDATA,2=FCT2,4=FCT4)
! --- 'momtyp' = momentum advection type (2=2nd order, 4=4th order)
! --- 'kapref' = thermobaric reference state (-1=input,0=none,1,2,3=constant)
! --- 'kapnum' = number of thermobaric reference states (1 or 2)
! --- 'tsofrq' = number of time steps between anti-drift offset calcs
! --- 'mixfrq' = KT: number of time steps between diapycnal mixing calcs
! --- 'icefrq' = relax to tfrz with e-folding time of icefrq time steps
! --- 'icpfrq' = number of time steps between sea-ice updates
! --- 'ntracr' = number of tracers (<=mxtrcr)
! --- 'trcflg' = tracer type flag (one per tracer)
! --- 'clmflg' = climatology frequency flag (6=bimonthly,12=monthly)
! --- 'dypflg' = KT: diapycnal mixing flag (0=none,1=KPP,2=explicit)
! --- 'iniflg' = initial state flag (0=level,1=zonal,2=climatology)
! --- 'lbflag' = lateral baro. bndy flag (0=none;nest:2=B-K,4=Flather,6=clamped)
! --- (port: 1=Browning-Kreiss,3=Flather)
! --- 'mapflg' = map flag (0=mercator,2=uniform,3=beta-plane,4=input)
! --- 'yrflag' = days in year flag (0=360,1=366,2=366Jan1,3=actual)
! --- 'sshflg' = diagnostic SSH flag (0=SSH,1=SSH&stericSSH)
! --- 'iversn' = hycom version number x10
! --- 'iexpt' = experiment number x10
! --- 'jerlv0' = initial jerlov water type (1 to 5; 0 for kpar, -1 for chl)
! --- 'iceflg' = sea ice model flag (0=none,1=energy loan,2=coupled/esmf)
! --- 'ishelf' = ice shelf flag (0=none,1=ice shelf over ocean)
! --- 'wndflg' = wind str. input flag (0=none,1=on u/v grid,2,3=on p grid)
! --- 'ustflg' = ustar forcing flag (3=input,1=wndspd,2=stress)
! --- 'flxflg' = thermal forcing flag (0=none,3=net-flux,1,2,4=sst-based)
! --- 'empflg' = E-P forcing flag (0=none,3=net_E-P, 1,2,4=sst-based_E)
! --- 'empbal' = E-P balance flag (0=none,1=offset,2=scale)
! --- 'dswflg' = diurnal shortwv flag (0=none,1=daily to diurnal correction)
! --- 'albflg' = ocean albedo flag (0=none,1=.06,2=L&Y)
! --- 'sssflg' = SSS relaxation flag (0=none,1=clim,-1=clim+rmx)
! --- 'sssbal' = SSS rlx balance flag (0=none,1=offset,2=scale)
! --- 'lwflag' = longwave corr. flag (0=none,1=clim,2=atmos), sst-based
! --- 'sstflg' = SST relaxation flag (0=none,1=clim,2=atmos,3=obs)
! --- 'icmflg' = ice mask flag (0=none,1=clim,2=atmos,3=obs)
! --- 'difsmo' = KPROF: number of layers with horiz smooth diff coeffs
!
#if defined(RELO)
real, save, allocatable, dimension(:) :: &
#else
real, save, dimension(kdm) :: &
#endif
sigma, &
salmin
!
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, &
stfrdt,stfrds,stfrdv,ra2fac,wbaro, &
sefold, &
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,emptgt
!
integer, save :: &
tsofrq,mixfrq,icefrq,icpfrq,nhybrd,nsigma, &
hybmap,hybflg,advflg,advtyp,momtyp,stfflg, &
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, &
empbal,sssbal, &
difsmo,disp_count
!
real, parameter :: &
g = 9.806, & !gravitational acceleration (m/s**2)
rhoref = 1000.0, & !reference value of potential density (kg/m**3)
svref = 1.0/rhoref, & !reference value of specific volume (m**3/kg)
onem = g/svref, & !one meter in pressure units (Pa)
!(/svref instead of *rhoref for compatibility with older version)
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
!
! --- grid point where detailed diagnostics are desired:
integer, save :: itest,jtest,ittest,jttest
!
! --- filenames.
character*80, save :: &
flnmdep,flnmgrd,flnmshlf, &
flnmrsi,flnmrso, flnmflx, &
flnmarc,flnmovr,flnmfor,flnmforw,flnminp, &
flnmarcm, &
flnmarcs, &
flnmarct
!
! --- CCSM3 variables (should be in CCSM3 modules)
logical, save :: dosstbud,doovtn,chk_ovtn,dodump,dohist,dorestart
!
integer, save :: istrt_mo,icurrent_mo,istrt_yr,icurrent_yr
!
! --- diurnal cycle factor for short wave heat flux
integer, save :: nsteps_per_day,nsteps_today
#if ! defined (ESPC_COUPLE)
! --- needed for restart if coupled
# if defined(RELO)
real, save, allocatable, dimension(:,:) :: &
# else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) :: &
# endif
dhde,dhdn, & ! sea-surface height slope for CICE
umxl,vmxl, & ! surface u and v for CICE
tml,sml ! surface T and S for CICE
#endif
#if defined (USE_NUOPC_GENERIC)
! --- import from atm
logical cpl_taux, cpl_tauy, cpl_wndspd, cpl_ustara, &
cpl_airtmp, cpl_vapmix, cpl_precip, cpl_surtmp, cpl_seatmp
! --- import from ice
logical cpl_sic, cpl_sitx, cpl_sity, cpl_siqs, cpl_sifh, &
cpl_sifs, cpl_sifw, cpl_sit, cpl_sih, cpl_siu, &
cpl_siv
!
# if defined(RELO)
real, target, allocatable,dimension (:,:) :: &
sic_import, & !Sea Ice Concentration
sitx_import, & !Sea Ice X-Stress
sity_import, & !Sea Ice Y-Stress
siqs_import, & !Solar Heat Flux thru Ice to Ocean
sifh_import, & !Ice Freezing/Melting Heat Flux
sifs_import, & !Ice Freezing/Melting Salt Flux
sifw_import, & !Ice Net Water Flux
sit_import, & !Sea Ice Temperature
sih_import, & !Sea Ice Thickness
siu_import, & !Sea Ice X-Velocity
siv_import !Sea Ice Y-Velocity
# else
real, target, dimension (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) :: &
sic_import, & !Sea Ice Concentration
sitx_import, & !Sea Ice X-Stress
sity_import, & !Sea Ice Y-Stress
siqs_import, & !Solar Heat Flux thru Ice to Ocean
sifh_import, & !Ice Freezing/Melting Heat Flux
sifs_import, & !Ice Freezing/Melting Salt Flux
sifw_import, & !Ice Net Water Flux
sit_import, & !Sea Ice Temperature
sih_import, & !Sea Ice Thickness
siu_import, & !Sea Ice X-Velocity
siv_import !Sea Ice Y-Velocity
# endif
#endif /* USE_NUOPC_GENERIC */
#if defined (USE_NUOPC_CESMBETA)
! --- Average array for export
# if defined(RELO)
real, save, allocatable, dimension(:,:) :: &
# else
real, save, dimension(1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) :: &
# endif
sshm, & ! sea-surface height averaged over 1 coupling sequence
um,vm, & ! surface u and v
ubm,vbm, & ! surface ubaro and vbaro
tavgm,savgm, & ! surface T and S
frzh ! Freezing potential flux (W/m2)
!
! --- NUOPC glue code structures
! --- tripolar grid
logical ltripolar
! --- import from coupler
real ocn_cpl_frq
! --- precipitation factor for coupled simulation
real pcp_fact ! always 1. : no precipiation adjustment
! --- import from atm
real nstep1_cpl,nstep2_cpl
logical cpl_swflx, cpl_lwmdnflx, cpl_lwmupflx, &
cpl_latflx, cpl_sensflx, &
cpl_orivers,cpl_irivers
real cpl_w2, cpl_w3
logical cpl_implicit
# if defined(RELO)
real, target, allocatable,dimension (:,:,:) :: &
imp_taux, imp_tauy, imp_taue, imp_taun, imp_wndspd, imp_ustara, &
imp_airtmp, imp_vapmix, imp_swflx, imp_lwdflx, imp_lwuflx, &
imp_latflx, imp_sensflx, &
imp_precip, imp_surtmp, imp_seatmp, &
imp_orivers,imp_irivers
# else
real, target, dimension (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy,2) :: &
imp_taux, imp_tauy, imp_taue, imp_taun, imp_wndspd, imp_ustara, &
imp_airtmp, imp_vapmix, imp_swflx, imp_lwdflx, imp_lwuflx, &
imp_latflx, imp_sensflx, &
imp_precip, imp_surtmp, imp_seatmp, &
imp_orivers,imp_irivers
# endif
#endif /* USE_NUOPC_CESMBETA */
!
#if defined (ESPC_COUPLE)
! --- import from atm
logical cpl_swflx_net, cpl_lwflx_net, &
cpl_swflx_net2down,cpl_lwflx_net2down, &
cpl_swflxd,cpl_lwflxd, &
cpl_sbhflx,cpl_lthflx, &
cpl_u10,cpl_v10,cpl_mslprs
# if defined(RELO)
real, target, allocatable,dimension (:,:) :: &
exp_sbhflx, &
exp_lthflx
# else
real, target, dimension (1-nbdy:idm+nbdy,1-nbdy:jdm+nbdy) :: &
exp_sbhflx, &
exp_lthflx
# endif
#endif /* ESPC_COUPLE */
contains
subroutine cb_allocate
!
! --- Allocate saved arrays
!
call set_r_init
!
#if defined(RELO)
call gindex_allocate !from mod_dimensions
!
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
!
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
!
#if defined(RELO)