24#if defined READ_WATER && defined MASKING && defined DISTRIBUTE
48 logical,
pointer :: fstate(:)
49 logical,
pointer :: lstate(:)
50#if defined READ_WATER && defined MASKING && defined DISTRIBUTE
51 integer ,
pointer :: ijwater(:,:)
54 integer,
pointer :: sflag(:)
56 real(
r8),
pointer :: sposx(:)
57 real(
r8),
pointer :: sposy(:)
59 real(
dp),
pointer :: cs_r(:)
60 real(
dp),
pointer :: cs_w(:)
61 real(
dp),
pointer :: sc_r(:)
62 real(
dp),
pointer :: sc_w(:)
112 real(
dp) :: datenumber(2)
114 real(
dp) :: tide_datenumber(2)
116 character (len=22) :: string
117 character (len=25) :: calendar
137# ifdef DIAGNOSTICS_TS
149# ifdef DIAGNOSTICS_UV
249 integer,
allocatable ::
iic(:)
250 integer,
allocatable ::
iif(:)
255 integer,
allocatable ::
jic(:)
295#if defined POWER_LAW && defined SOLVE3D
356#ifdef SENSITIVITY_4DVAR
466 real(
dp) ::
g = 9.81_dp
516#if defined ADJOINT || defined TANGENT || defined TL_IOMS
698 real(
dp),
allocatable :: diffmin(:)
699 real(
dp),
allocatable :: diffmax(:)
702 real(
dp),
allocatable :: viscmin(:)
703 real(
dp),
allocatable :: viscmax(:)
749#if defined SPLINES_VDIFF || defined SPLINES_VVISC
813 real(
dp),
parameter ::
pi = 3.14159265358979323846_dp
819 real(
dp),
parameter ::
spval = nf90_fill_double
978 logical,
allocatable :: ldefstd(:)
1001 logical,
allocatable :: lwrtstd(:)
1014#ifdef AD_OUTPUT_STATE
1015 logical,
allocatable :: lwrtstate3d(:)
1017#if defined STOCHASTIC_OPT && !defined STOCH_OPT_WHITE
1018 logical,
allocatable :: soinitial(:)
1122#ifdef ADJUST_BOUNDARY
1127 logical,
allocatable ::
lobc(:,:,:)
1158#if defined ADJUST_STFLUX || defined ADJUST_WSTRESS
1200#if defined AVERAGES && defined AVERAGES_DETIDE && \
1201 (defined ssh_tides || defined uv_tides)
1247#if defined FOUR_DVAR || defined VERIFICATION
1388 real(
r8),
allocatable :: sigma_max(:,:)
1389 real(
r8),
allocatable :: sigma_ml(:,:)
1390 real(
r8),
allocatable :: sigma_do(:,:)
1391 real(
r8),
allocatable :: sigma_dz(:,:)
1397 real(
r8),
allocatable :: mld_uniform(:)
1463#if defined TANGENT || defined TL_IOMS
1509# if defined SG_BBL || defined SSW_BBL
1553#if defined LMD_SKPP || defined SOLAR_SOURCE
1586 & (/ 0.35_r8, 0.6_r8, 1.0_r8, 1.5_r8, 1.4_r8, &
1587 & 0.42_r8, 0.37_r8, 0.33_r8, 0.00468592_r8 /)
1590 & (/ 23.0_r8, 20.0_r8, 17.0_r8, 14.0_r8, 7.9_r8, &
1591 & 5.13_r8, 3.54_r8, 2.34_r8, 1.51_r8 /)
1594 & (/ 0.58_r8, 0.62_r8, 0.67_r8, 0.77_r8, 0.78_r8, &
1595 & 0.57_r8, 0.57_r8, 0.57_r8, 0.55_r8 /)
1662# if defined LMD_SKPP || defined LMD_BKPP
1753# if defined CANUTO_A || defined CANUTO_B
1779# elif defined CANUTO_B
1780 real(
r8),
parameter ::
gls_gh0 = 0.0444_r8
1782 real(
r8),
parameter ::
gls_l1 = 0.127_r8
1783 real(
r8),
parameter ::
gls_l2 = 0.00336_r8
1784 real(
r8),
parameter ::
gls_l3 = 0.0906_r8
1785 real(
r8),
parameter ::
gls_l4 = 0.101_r8
1786 real(
r8),
parameter ::
gls_l5 = 11.2_r8
1787 real(
r8),
parameter ::
gls_l6 = 0.4_r8
1788 real(
r8),
parameter ::
gls_l7 = 0.0_r8
1789 real(
r8),
parameter ::
gls_l8 = 0.318_r8
1791 real(
r8),
parameter ::
gls_gh0 = 0.028_r8
1816#if defined MY25_MIXING || defined GLS_MIXING
1915 real(
r8),
parameter :: inival = 0.0_r8
1921 IF (.not.
allocated(
scalars))
THEN
1927 allocate (
scalars(ng) % Fstate(9+2*
mt) )
1929 scalars(ng) % Fstate = .false.
1931 allocate (
scalars(ng) % Lstate(8+2*
mt) )
1933 scalars(ng) % Lstate = .false.
1935 allocate (
scalars(ng) % Fstate(5) )
1937 scalars(ng) % Fstate = .false.
1939 allocate (
scalars(ng) % Lstate(3) )
1941 scalars(ng) % Lstate = .false.
1944#if defined READ_WATER && defined MASKING && defined DISTRIBUTE
1945 allocate (
scalars(ng) % IJwater((
lm(ng)+2)*(
mm(ng)+2),4) )
1950 allocate (
scalars(ng) % Cs_r(
n(ng)) )
1954 allocate (
scalars(ng) % Cs_w(0:
n(ng)) )
1958 allocate (
scalars(ng) % sc_r(
n(ng)) )
1962 allocate (
scalars(ng) % sc_w(0:
n(ng)) )
1978 IF (.not.
allocated(
indx1))
THEN
1982 IF (.not.
allocated(
iic))
THEN
1986 IF (.not.
allocated(
iif))
THEN
1995 IF (.not.
allocated(
frcrec))
THEN
1999 IF (.not.
allocated(
sorec))
THEN
2006 IF (.not.
allocated(
jic))
THEN
2017#if defined FOUR_DVAR || defined VERIFICATION
2019# if defined GLS_MIXING || defined MY25_MIXING
2028# ifdef ADJUST_WSTRESS
2031# ifdef ADJUST_STFLUX
2038 IF (.not.
associated(
inert))
THEN
2048 IF (.not.
allocated(
ndtfast))
THEN
2052 IF (.not.
allocated(
nfast))
THEN
2057 IF (.not.
allocated(
dt))
THEN
2061 IF (.not.
allocated(
dtfast))
THEN
2065 IF (.not.
allocated(
timeend))
THEN
2069 IF (.not.
allocated(
avgtime))
THEN
2073 IF (.not.
allocated(
diatime))
THEN
2077 IF (.not.
allocated(
imptime))
THEN
2081 IF (.not.
allocated(
initime))
THEN
2089 IF (.not.
allocated(
obstime))
THEN
2093 IF (.not.
allocated(
frctime))
THEN
2098 IF (.not.
allocated(
ntimes))
THEN
2107 IF (.not.
allocated(
ntfirst))
THEN
2111 IF (.not.
allocated(
ntstart))
THEN
2115 IF (.not.
allocated(
ntend))
THEN
2129 IF (.not.
allocated(
tdays))
THEN
2134 IF (.not.
allocated(
time))
THEN
2153 IF (.not.
allocated(
nrecfrc))
THEN
2173 IF (.not.
allocated(
obcdata))
THEN
2182 IF (.not.
allocated(
lfloats))
THEN
2221 IF (.not.
allocated(
volcons))
THEN
2225#if defined ADJOINT || defined TANGENT || defined TL_IOMS
2236 IF (.not.
allocated(
lsponge))
THEN
2257 IF (.not.
allocated(
lsshclm))
THEN
2261 IF (.not.
allocated(
lm2clm))
THEN
2265 IF (.not.
allocated(
lm3clm))
THEN
2291 IF (.not.
allocated(
luvsrc))
THEN
2295 IF (.not.
allocated(
lwsrc))
THEN
2308 IF (.not.
allocated(
maxrho))
THEN
2313 IF (.not.
allocated(
levsfrc))
THEN
2317 IF (.not.
allocated(
levbfrc))
THEN
2331 IF (.not.
allocated(
tcline))
THEN
2335 IF (.not.
allocated(
hc))
THEN
2339 IF (.not.
allocated(
theta_s))
THEN
2343 IF (.not.
allocated(
theta_b))
THEN
2348 IF (.not.
allocated(
hmin))
THEN
2352 IF (.not.
allocated(
hmax))
THEN
2357 IF (.not.
allocated(
xl))
THEN
2361 IF (.not.
allocated(
el))
THEN
2366 IF (.not.
allocated(
lonmin))
THEN
2370 IF (.not.
allocated(
lonmax))
THEN
2374 IF (.not.
allocated(
latmin))
THEN
2378 IF (.not.
allocated(
latmax))
THEN
2383 IF (.not.
allocated(
idigits))
THEN
2387 IF (.not.
allocated(
jdigits))
THEN
2392 IF (.not.
allocated(
kdigits))
THEN
2410 IF (.not.
allocated(
dxmin))
THEN
2414 IF (.not.
allocated(
dxmax))
THEN
2418 IF (.not.
allocated(
dymin))
THEN
2422 IF (.not.
allocated(
dymax))
THEN
2428 IF (.not.
allocated(
dxminw))
THEN
2432 IF (.not.
allocated(
dxmaxw))
THEN
2436 IF (.not.
allocated(
dyminw))
THEN
2440 IF (.not.
allocated(
dymaxw))
THEN
2448 IF (.not.
allocated(
dzmin))
THEN
2452 IF (.not.
allocated(
dzmax))
THEN
2457 IF (.not.
allocated(
dzminw))
THEN
2461 IF (.not.
allocated(
dzmaxw))
THEN
2468 IF (.not.
allocated(
grdmax))
THEN
2474 IF (.not.
allocated(diffmin))
THEN
2475 allocate ( diffmin(
ngrids) )
2478 IF (.not.
allocated(diffmax))
THEN
2479 allocate ( diffmax(
ngrids) )
2484 IF (.not.
allocated(
cg_min))
THEN
2488 IF (.not.
allocated(
cg_max))
THEN
2492 IF (.not.
allocated(
cg_cor))
THEN
2498 IF (.not.
allocated(viscmin))
THEN
2499 allocate ( viscmin(
ngrids) )
2502 IF (.not.
allocated(viscmax))
THEN
2503 allocate ( viscmax(
ngrids) )
2508 IF (.not.
allocated(
r0))
THEN
2512 IF (.not.
allocated(
tcoef))
THEN
2516 IF (.not.
allocated(
scoef))
THEN
2521 IF (.not.
allocated(
t0))
THEN
2525 IF (.not.
allocated(
s0))
THEN
2530 IF (.not.
allocated(
gamma2))
THEN
2535 IF (.not.
allocated(
lmd_jwt))
THEN
2540 IF (.not.
allocated(
rx0))
THEN
2544 IF (.not.
allocated(
rx1))
THEN
2549 IF (.not.
allocated(
rdrg))
THEN
2553 IF (.not.
allocated(
rdrg2))
THEN
2558 IF (.not.
allocated(
zos))
THEN
2562 IF (.not.
allocated(
zob))
THEN
2567 IF (.not.
allocated(
dcrit))
THEN
2573 IF (.not.
allocated(
nconv))
THEN
2579 IF (.not.
allocated(
weight))
THEN
2584 IF (.not.
allocated(
akk_bak))
THEN
2588 IF (.not.
allocated(
akp_bak))
THEN
2592 IF (.not.
allocated(
akv_bak))
THEN
2613 IF (.not.
allocated(
visc2))
THEN
2630 IF (.not.
allocated(
visc4))
THEN
2635 IF (.not.
allocated(
tkenu2))
THEN
2639 IF (.not.
allocated(
tkenu4))
THEN
2644 IF (.not.
allocated(
akt_bak))
THEN
2652 IF (.not.
allocated(
kdiff))
THEN
2657 IF (.not.
allocated(
ad_tnu2))
THEN
2661 IF (.not.
allocated(
nl_tnu2))
THEN
2665 IF (.not.
allocated(
tl_tnu2))
THEN
2669 IF (.not.
allocated(
tnu2))
THEN
2674 IF (.not.
allocated(
ad_tnu4))
THEN
2678 IF (.not.
allocated(
nl_tnu4))
THEN
2682 IF (.not.
allocated(
tl_tnu4))
THEN
2686 IF (.not.
allocated(
tnu4))
THEN
2722 IF (.not.
allocated(
ldefadj))
THEN
2726 IF (.not.
allocated(
ldefavg))
THEN
2730 IF (.not.
allocated(
ldefdai))
THEN
2734 IF (.not.
allocated(
ldefdia))
THEN
2738 IF (.not.
allocated(
ldeferr))
THEN
2742 IF (.not.
allocated(
ldefflt))
THEN
2746 IF (.not.
allocated(
ldefhis))
THEN
2750 IF (.not.
allocated(
ldefhss))
THEN
2754 IF (.not.
allocated(
ldefini))
THEN
2758 IF (.not.
allocated(
ldefirp))
THEN
2762 IF (.not.
allocated(
ldefitl))
THEN
2766 IF (.not.
allocated(
ldeflcz))
THEN
2770 IF (.not.
allocated(
ldeflze))
THEN
2774 IF (.not.
allocated(
ldefmod))
THEN
2778 IF (.not.
allocated(
ldefqck))
THEN
2782 IF (.not.
allocated(
ldefrst))
THEN
2786 IF (.not.
allocated(
ldefxtr))
THEN
2791 IF (.not.
allocated(
ldefsca))
THEN
2795 IF (.not.
allocated(
ldefsct))
THEN
2799 IF (.not.
allocated(
ldefspa))
THEN
2803 IF (.not.
allocated(
ldefspt))
THEN
2808 IF (.not.
allocated(
ldefsta))
THEN
2816 IF (.not.
allocated(
ldeftlm))
THEN
2820 IF (.not.
allocated(
ldeftlf))
THEN
2854 IF (.not.
allocated(
lwrtadj))
THEN
2858 IF (.not.
allocated(
lwrtavg))
THEN
2862 IF (.not.
allocated(
lwrtdia))
THEN
2866 IF (.not.
allocated(
lwrthis))
THEN
2870 IF (.not.
allocated(
lwrtper))
THEN
2874 IF (.not.
allocated(
lwrtqck))
THEN
2878 IF (.not.
allocated(
lwrtrst))
THEN
2882 IF (.not.
allocated(
lwrttlf))
THEN
2886 IF (.not.
allocated(
lwrttlm))
THEN
2890 IF (.not.
allocated(
lwrtxtr))
THEN
2895 IF (.not.
allocated(
ldefnrm))
THEN
2899 IF (.not.
allocated(
lwrtnrm))
THEN
2905 IF (.not.
allocated(ldefstd))
THEN
2906 allocate ( ldefstd(
ngrids) )
2909 IF (.not.
allocated(lwrtstd))
THEN
2910 allocate ( lwrtstd(
ngrids) )
2915#ifdef AD_OUTPUT_STATE
2916 IF (.not.
allocated(lwrtstate3d))
THEN
2917 allocate ( lwrtstate3d(
ngrids) )
2921#if defined STOCHASTIC_OPT && !defined STOCH_OPT_WHITE
2922 IF (.not.
allocated(soinitial))
THEN
2923 allocate ( soinitial(
ngrids) )
2960 IF (.not.
allocated(
ldefout))
THEN
2965 IF (.not.
allocated(
ndefadj))
THEN
2969 IF (.not.
allocated(
ndefavg))
THEN
2973 IF (.not.
allocated(
ndefdia))
THEN
2977 IF (.not.
allocated(
ndefhis))
THEN
2981 IF (.not.
allocated(
ndefqck))
THEN
2985 IF (.not.
allocated(
ndeftlm))
THEN
2989 IF (.not.
allocated(
ndefxtr))
THEN
2994 IF (.not.
allocated(
ntsavg))
THEN
2998 IF (.not.
allocated(
ntsdia))
THEN
3003 IF (.not.
allocated(
nadj))
THEN
3007 IF (.not.
allocated(
navg))
THEN
3011 IF (.not.
allocated(
ndia))
THEN
3015 IF (.not.
allocated(
nflt))
THEN
3019 IF (.not.
allocated(
nhis))
THEN
3023 IF (.not.
allocated(
nqck))
THEN
3027 IF (.not.
allocated(
nrst))
THEN
3031 IF (.not.
allocated(
nsta))
THEN
3035 IF (.not.
allocated(
ntlm))
THEN
3039 IF (.not.
allocated(
nxtr))
THEN
3044 IF (.not.
allocated(
nsca))
THEN
3048 IF (.not.
allocated(
nsct))
THEN
3052 IF (.not.
allocated(
nspa))
THEN
3056 IF (.not.
allocated(
nspt))
THEN
3060 IF (.not.
allocated(
crec))
THEN
3071 IF (.not.
allocated(
ninfo))
THEN
3076 IF (.not.
allocated(
nobc))
THEN
3080 IF (.not.
allocated(
nbrec))
THEN
3089#ifdef ADJUST_BOUNDARY
3090 IF (.not.
allocated(
lobc))
THEN
3096 IF (.not.
allocated(
nsff))
THEN
3100 IF (.not.
allocated(
nfrec))
THEN
3104 IF (.not.
allocated(
sfcount))
THEN
3110 IF (.not.
allocated(
lstflux))
THEN
3116 IF (.not.
allocated(
nrrec))
THEN
3121 IF (.not.
allocated(
lastrec))
THEN
3139#if defined AVERAGES && defined AVERAGES_DETIDE && \
3140 (defined ssh_tides || defined uv_tides)
3141 IF (.not.
allocated(
hcount))
THEN
3147 IF (.not.
allocated(
kstrs))
THEN
3151 IF (.not.
allocated(
kends))
THEN
3156 IF (.not.
allocated(
dstrs))
THEN
3160 IF (.not.
allocated(
dends))
THEN
3165 IF (.not.
allocated(
trnorm))
THEN
3175 IF (.not.
allocated(
so_sdev))
THEN
3180 IF (.not.
allocated(
so_sdev))
THEN
3186#if defined FOUR_DVAR || defined VERIFICATION
3187 IF (.not.
allocated(
cnorm))
THEN
3191 IF (.not.
allocated(
cnormb))
THEN
3210 IF (.not.
allocated(
timeiau))
THEN
3230 IF (.not.
allocated(
balance))
THEN
3235 IF (.not.
allocated(
hdecay))
THEN
3239 IF (.not.
allocated(
vdecay))
THEN
3244 IF (.not.
allocated(
tdecay))
THEN
3249 IF (.not.
allocated(
hdecayb))
THEN
3253 IF (.not.
allocated(
vdecayb))
THEN
3266 IF (.not.
allocated(
s_bgqc))
THEN
3272 IF (.not.
allocated(sigma_max))
THEN
3276 IF (.not.
allocated(sigma_ml))
THEN
3280 IF (.not.
allocated(sigma_do))
THEN
3284 IF (.not.
allocated(sigma_dz))
THEN
3289 IF (.not.
allocated(mld_uniform))
THEN
3290 allocate ( mld_uniform(
ngrids) )
3296 IF (.not.
allocated(
obcfac))
THEN
3326 IF (.not.
allocated(
tobc_in))
THEN
3336 IF (.not.
allocated(
znudg))
THEN
3340 IF (.not.
allocated(
m2nudg))
THEN
3344 IF (.not.
allocated(
m3nudg))
THEN
3348 IF (.not.
allocated(
tnudg))
THEN
3354 IF (.not.
allocated(
blk_zq))
THEN
3358 IF (.not.
allocated(
blk_zt))
THEN
3362 IF (.not.
allocated(
blk_zw))
THEN
3368 IF (.not.
allocated(
gls_m))
THEN
3372 IF (.not.
allocated(
gls_n))
THEN
3376 IF (.not.
allocated(
gls_p))
THEN
3396 IF (.not.
allocated(
gls_c1))
THEN
3400 IF (.not.
allocated(
gls_c2))
THEN
3404 IF (.not.
allocated(
gls_c3m))
THEN
3408 IF (.not.
allocated(
gls_c3p))
THEN
3459#ifdef SUBOBJECT_DEALLOCATION
3467 IF (
associated(
scalars(ng)%Fstate))
THEN
3468 deallocate (
scalars(ng)%Fstate )
3471 IF (
associated(
scalars(ng)%Lstate))
THEN
3472 deallocate (
scalars(ng)%Lstate )
3475 IF (
associated(
scalars(ng)%Fstate))
THEN
3476 deallocate (
scalars(ng)%Fstate )
3479 IF (
associated(
scalars(ng)%Lstate))
THEN
3480 deallocate (
scalars(ng)%Lstate )
3484# if defined READ_WATER && defined MASKING && defined DISTRIBUTE
3485 IF (
associated(
scalars(ng)%IJwater))
THEN
3486 deallocate (
scalars(ng)%IJwater )
3489 IF (
associated(
scalars(ng)%Cs_r))
THEN
3490 deallocate (
scalars(ng)%Cs_r )
3493 IF (
associated(
scalars(ng)%Cs_w))
THEN
3494 deallocate (
scalars(ng)%Cs_w )
3497 IF (
associated(
scalars(ng)%sc_r))
THEN
3498 deallocate (
scalars(ng)%sc_r )
3501 IF (
associated(
scalars(ng)%sc_w))
THEN
3502 deallocate (
scalars(ng)%sc_w )
3510 IF (ng.eq.ngrids)
THEN
3526 IF (
allocated(
iic))
deallocate (
iic )
3528 IF (
allocated(
iif))
deallocate (
iif )
3542 IF (
allocated(
time))
deallocate (
time )
3558 IF (
allocated(
dt))
deallocate (
dt )
3620#if defined ADJOINT || defined TANGENT || defined TL_IOMS
3672 IF (
allocated(
hc))
deallocate (
hc )
3678 IF (
allocated(
hmin))
deallocate (
hmin )
3680 IF (
allocated(
hmax))
deallocate (
hmax )
3682 IF (
allocated(
xl))
deallocate (
xl )
3684 IF (
allocated(
el))
deallocate (
el )
3742 IF (
allocated(diffmin))
deallocate ( diffmin )
3744 IF (
allocated(diffmax))
deallocate ( diffmax )
3754 IF (
allocated(viscmin))
deallocate ( viscmin )
3756 IF (
allocated(viscmax))
deallocate ( viscmax )
3759 IF (
allocated(
r0))
deallocate (
r0 )
3765 IF (
allocated(
t0))
deallocate (
t0 )
3767 IF (
allocated(
s0))
deallocate (
s0 )
3773 IF (
allocated(
rx0))
deallocate (
rx0 )
3775 IF (
allocated(
rx1))
deallocate (
rx1 )
3777 IF (
allocated(
rdrg))
deallocate (
rdrg )
3781 IF (
allocated(
zos))
deallocate (
zos )
3783 IF (
allocated(
zob))
deallocate (
zob )
3833 IF (
allocated(
tnu2))
deallocate (
tnu2 )
3841 IF (
allocated(
tnu4))
deallocate (
tnu4 )
3890 IF (
allocated(ldefstd))
deallocate ( ldefstd )
3942 IF (
allocated(lwrtstd))
deallocate ( lwrtstd )
3956#ifdef AD_OUTPUT_STATE
3957 IF (
allocated(lwrtstate3d))
deallocate ( lwrtstate3d )
3960#if defined STOCHASTIC_OPT && !defined STOCH_OPT_WHITE
3961 IF (
allocated(soinitial))
deallocate ( soinitial )
3998 IF (
allocated(
nadj))
deallocate (
nadj )
4000 IF (
allocated(
navg))
deallocate (
navg )
4002 IF (
allocated(
ndia))
deallocate (
ndia )
4004 IF (
allocated(
nflt))
deallocate (
nflt )
4006 IF (
allocated(
nhis))
deallocate (
nhis )
4008 IF (
allocated(
nqck))
deallocate (
nqck )
4010 IF (
allocated(
nrst))
deallocate (
nrst )
4012 IF (
allocated(
nsta))
deallocate (
nsta )
4014 IF (
allocated(
ntlm))
deallocate (
ntlm )
4017 IF (
allocated(
nsca))
deallocate (
nsca )
4019 IF (
allocated(
nsct))
deallocate (
nsct )
4021 IF (
allocated(
nspa))
deallocate (
nspa )
4023 IF (
allocated(
nspt))
deallocate (
nspt )
4025 IF (
allocated(
crec))
deallocate (
crec )
4032 IF (
allocated(
nobc))
deallocate (
nobc )
4038#ifdef ADJUST_BOUNDARY
4039 IF (
allocated(
lobc))
deallocate (
lobc )
4042 IF (
allocated(
nsff))
deallocate (
nsff )
4062#if defined AVERAGES && defined AVERAGES_DETIDE && \
4063 (defined ssh_tides || defined uv_tides)
4081#if defined FOUR_DVAR || defined VERIFICATION
4115 IF (
allocated(sigma_max))
deallocate ( sigma_max )
4117 IF (
allocated(sigma_ml))
deallocate ( sigma_ml )
4119 IF (
allocated(sigma_do))
deallocate ( sigma_do )
4121 IF (
allocated(sigma_dz))
deallocate ( sigma_dz )
4123 IF (
allocated(mld_uniform))
deallocate ( mld_uniform )
4213 integer :: i, ic, j, ng, itrc
4215 real(
r8) :: one, zero
4216 real(
r8),
parameter :: inival = 0.0_r8
4242# ifdef DIAGNOSTICS_TS
4251# if defined TS_DIF2 || defined TS_DIF4
4256# if defined MIX_GEO_TS || defined MIX_ISO_TS
4264# ifdef DIAGNOSTICS_UV
4288# ifdef BOTTOM_STREAMING
4292# ifdef SURFACE_STREAMING
4302# if defined VEGETATION && defined VEG_DRAG
4306# if defined UV_VIS2 || defined UV_VIS4
4347# ifdef BOTTOM_STREAMING
4351# ifdef SURFACE_STREAMING
4362# if defined VEGETATION && defined VEG_DRAG
4368# if defined UV_VIS2 || defined UV_VIS4
4394#if defined FOUR_DVAR || defined VERIFICATION
4400#ifdef ADJUST_BOUNDARY
4410 lobc(i,j,ng)=.false.
4435 co=1.0_r8/(2.0_r8+sqrt(2.0_r8))
4449#if defined AVERAGES && defined AVERAGES_DETIDE && \
4450 (defined ssh_tides || defined uv_tides)
4453#ifdef ADJUST_BOUNDARY
4456#if defined ADJUST_STFLUX || defined ADJUST_WSTRESS
4524 tnu2(itrc,ng)=inival
4528 tnu4(itrc,ng)=inival
4551#if defined ADJOINT || defined TANGENT || defined TL_IOMS
4587#if defined LMD_SKPP || defined LMD_BKPP
4596#if defined FOUR_DVAR || defined VERIFICATION
4658#if defined AVERAGES && defined AVERAGES_DETIDE && \
4659 (defined ssh_tides || defined uv_tides)
4689#ifdef AD_OUTPUT_STATE
4690 lwrtstate3d(ng)=.false.
4692#if defined STOCHASTIC_OPT && !defined STOCH_OPT_WHITE
4693 soinitial(ng)=.false.
4711# if defined SG_BBL || defined SSW_BBL
4718 & sqrt(1.0_r8/(2.0_r8*
sg_z1p)))
4720#if defined GLS_MIXING || defined MY25_MIXING
4721# if defined CANUTO_A || defined CANUTO_B
4761# ifdef KANTHA_CLAYSON
integer, dimension(:), allocatable n
real(r8), dimension(:), allocatable dmem
integer, dimension(:), allocatable lm
integer, dimension(:), allocatable mm
real(dp), dimension(:), allocatable cg_min
real(r8), dimension(:), allocatable tkenu4
real(r8), parameter my_gh0
real(r8), dimension(:), allocatable blk_zt
real(r8), dimension(:,:), allocatable tdecay
logical, dimension(:), allocatable clm_file
logical, dimension(:), allocatable luvsrc
integer, dimension(:), allocatable crec
real(dp), dimension(:), allocatable dzmaxw
logical, dimension(:,:), allocatable lwrtnrm
integer, dimension(:), allocatable kends
real(r8), dimension(:), allocatable ad_akv_fac
real(dp), dimension(:), allocatable dxmaxw
real(r8), parameter my_sq
logical, dimension(:), allocatable lwrtqck
real(r8), dimension(:), allocatable gls_p
real(r8), dimension(:), allocatable gls_n
real(dp), dimension(:,:), allocatable m3obc_out
logical, dimension(:), allocatable lfloats
logical, dimension(:), allocatable lwrtdia
real(dp), parameter day2sec
integer, dimension(:), allocatable obccount
real(r8), dimension(:,:), allocatable tl_tnu2
real(dp), dimension(:), allocatable dzmin
logical, dimension(:), allocatable lreadqck
integer, dimension(:), allocatable nrrec
real(dp), dimension(:), allocatable totvolume
real(r8), dimension(:,:), allocatable tnu2
logical, dimension(:), allocatable luvsponge
real(r8), parameter my_c3
subroutine, public allocate_scalars
integer, dimension(:), allocatable ninfo
real(dp), parameter spval
real(dp), dimension(:), allocatable hmin
integer, dimension(:), allocatable nspa
logical, dimension(:,:), allocatable ltracersrc
logical, dimension(:), allocatable lnudgem2clm
real(r8), dimension(:), allocatable tl_m2diff
logical, dimension(:), allocatable ladjusted
real(r8), parameter my_lmax
integer, dimension(:), allocatable ntimes
real(r8), dimension(:), allocatable gls_m
real(dp), dimension(:), allocatable obstime
logical, dimension(:), allocatable ldefitl
real(r8), dimension(:), allocatable blk_zw
real(r8), parameter gls_l5
integer, dimension(:), allocatable nxtr
real(r8), dimension(:), allocatable gls_cmupr
real(r8), dimension(:), allocatable zos_hsig_alpha
integer, dimension(:), allocatable iic
integer, dimension(:), allocatable ndefhis
logical, dimension(:), allocatable ldeferr
real(dp), dimension(:), allocatable dzminw
real(r8), dimension(:), allocatable ml_depth
real(r8), dimension(:,:), allocatable tl_tdiff
real(r8), parameter gls_ghcri
integer, dimension(:), allocatable ntlm
real(r8), dimension(:), allocatable t0
real(r8), dimension(:), allocatable el
real(dp), dimension(:), allocatable theta_s
logical, dimension(:), allocatable lreadstd
real(dp), dimension(:), allocatable dt
real(r8), parameter my_qmin
real(r8), dimension(:), allocatable dtdz_min
real(r8), parameter gls_l2
logical, dimension(:), allocatable ldefhss
subroutine, public initialize_scalars
real(dp), parameter spval_check
integer, dimension(:), allocatable nobc
real(r8), parameter gls_l7
logical, dimension(:,:), allocatable ad_volcons
logical, dimension(:), allocatable lsponge
real(r8), parameter gls_l3
logical, dimension(:), allocatable setgridconfig
real(r8), dimension(:), allocatable latmax
logical, dimension(:), allocatable lwrtxtr
real(r8), parameter gls_l4
real(r8), dimension(:), allocatable dcrit
real(r8), dimension(:), allocatable sz_alpha
real(dp), dimension(:), allocatable timeiau
logical, dimension(:), allocatable lprocessobc
integer, dimension(:), allocatable levbfrc
logical, dimension(:,:,:), allocatable lobc
logical, dimension(:), allocatable ewperiodic
real(r8), dimension(:,:), allocatable so_sdev
logical, dimension(:), allocatable nsperiodic
real(dp), dimension(:), allocatable maxrho
real(dp), dimension(:), allocatable minvolume
logical, dimension(:), allocatable lwrttlf
logical, dimension(:), allocatable lnudging
integer, dimension(:), allocatable sorec
integer, dimension(:), allocatable nconv
real(dp), parameter large
real(dp), dimension(:), allocatable znudg
logical, dimension(:), allocatable lm3clm
logical, dimension(:,:), allocatable lstflux
logical, dimension(:), allocatable ldefflt
real(r8), dimension(:), allocatable tl_akv_fac
integer, dimension(:), allocatable next_kstp
integer, parameter linear
logical, dimension(:), allocatable balance
logical, dimension(:), allocatable ldefdia
real(dp), dimension(:,:,:), allocatable tobc_out
logical, dimension(:), allocatable lsshclm
real(dp), dimension(:), allocatable avgtime
logical, dimension(:), allocatable ldeftlf
real(r8), dimension(:), allocatable user
integer, dimension(:), allocatable nrst
real(r8), dimension(:,:), allocatable nl_tnu2
integer, dimension(:), allocatable nqck
logical, dimension(:), allocatable synchro_flag
integer, dimension(:), allocatable frcrec
real(r8), dimension(9) lmd_mu1
logical, dimension(:), allocatable lreadfrc
real(dp), dimension(:), allocatable m2nudg
logical, dimension(:), allocatable predictor_2d_step
logical, dimension(:), allocatable lastrec
character(len= *), parameter hashmethod
real(r8), dimension(:), allocatable latmin
real(r8), dimension(:), allocatable gls_c2
real(dp), dimension(:,:), allocatable fsobc_out
logical, dimension(:), allocatable lprocesstides
integer, dimension(:), allocatable nfrec
real(r8), dimension(:), allocatable charnok_alpha
integer, dimension(:), allocatable ndeftlm
real(dp), dimension(:), allocatable dxmin
logical, dimension(:), allocatable ldefini
real(r8), dimension(:), allocatable zos
real(dp), dimension(:,:,:), allocatable tobc_in
real(dp), dimension(:,:), allocatable tnudg
real(r8), dimension(:,:), allocatable s_bgqc
real(r8), parameter my_c2
logical, dimension(:), allocatable ldeftide
real(r8), dimension(:), allocatable rdrg
logical, dimension(:), allocatable ldefspt
logical, dimension(:), allocatable ldefavg
real(dp), dimension(:,:,:), allocatable weight
logical, dimension(:,:), allocatable ltracersponge
real(r8), dimension(:), allocatable lnm_depth
logical, dimension(:), allocatable ldeflze
logical, dimension(:), allocatable ldefqck
real(r8), parameter my_e1
integer, dimension(:), allocatable jic
real(r8), dimension(:,:), allocatable tl_tnu4
integer, dimension(:), allocatable nflt
integer, dimension(:), allocatable navg
real(r8), dimension(:,:), allocatable p_bgqc
real(r8), dimension(:), allocatable s0
real(dp), dimension(:), allocatable tdays
real(dp), parameter sg_pi
logical, dimension(:,:), allocatable volcons
real(r8), parameter my_b1
integer, dimension(:), allocatable lmd_jwt
logical, dimension(:), allocatable lwrtavg
real(r8), dimension(:), allocatable dends
real(dp), dimension(:), allocatable frctime
real(r8), parameter gls_l8
integer, dimension(:), allocatable kstrs
real(r8), dimension(:), allocatable tcoef
integer, dimension(:), allocatable idigits
logical, dimension(:), allocatable ldefadj
real(dp), dimension(:), allocatable dymax
real(r8), dimension(:), allocatable akk_bak
real(r8), dimension(:), allocatable gls_cmu0
logical, dimension(:), allocatable frequentimpulse
real(r8), dimension(:), allocatable visc2
logical, dimension(:), allocatable lcycleadj
logical, dimension(:), allocatable getdonordata
integer, dimension(:), allocatable nfast
real(dp), dimension(:), allocatable dymaxw
real(dp), dimension(:), allocatable tcline
integer, dimension(:), allocatable ndtfast
logical, dimension(:), allocatable ldefhis
real(r8), dimension(:,:), allocatable ad_akt_fac
logical, dimension(:), allocatable ldefsct
real(r8), dimension(:), allocatable lonmax
real(r8), parameter gls_ghmin
real(dp), parameter deg2rad
logical, dimension(:), allocatable lwrtadj
logical, dimension(:), allocatable ldefspa
logical, dimension(:), allocatable lwsrc
real(r8), dimension(:), allocatable ad_visc4
real(dp), dimension(:), allocatable obcfac
real(r8), dimension(:), allocatable visc4
real(dp), parameter sec2day
real(dp), dimension(:), allocatable cg_max
integer, dimension(:), allocatable ntend
logical, dimension(:), allocatable lcycletlm
subroutine, public deallocate_scalars(ng)
real(r8), dimension(:), allocatable gls_sigk
logical, dimension(:), allocatable ldefmod
real(r8), dimension(:), allocatable tl_visc4
real(r8), parameter my_c1
logical, dimension(:), allocatable ldefirp
real(r8), parameter my_a1
real(r8), dimension(:), allocatable crgban_cw
logical, dimension(:), allocatable obcdata
real(r8), dimension(9) lmd_mu2
logical, dimension(:,:), allocatable ldefnrm
real(dp), dimension(:), allocatable theta_b
integer, dimension(:), allocatable first_time
character(len=22), dimension(:), allocatable time_code
logical, dimension(:), allocatable lsediment
logical, dimension(:), allocatable lwrtcost
real(dp), dimension(:), allocatable dxminw
integer, dimension(:), allocatable hcount
real(r8), dimension(:,:,:), allocatable vdecay
real(r8), dimension(:), allocatable gamma2
real(dp), dimension(:), allocatable maxvolume
integer, dimension(:), allocatable extractflag
integer, dimension(:), allocatable ndefqck
logical, dimension(:), allocatable lwrtinfo
logical, dimension(:), allocatable nudgingcoeff
real(r8), parameter my_a2
real(dp), dimension(:), allocatable grdmax
real(dp), dimension(:), allocatable rx1
integer, dimension(:), allocatable nsta
integer, dimension(:), allocatable nrecfrc
real(r8), dimension(:,:), allocatable ad_tnu2
real(r8), dimension(:,:), allocatable akt_bak
logical, dimension(:), allocatable lnudgem3clm
logical, dimension(:), allocatable iauswitch
logical, dimension(:), allocatable lwrtstate2d
real(dp), dimension(:), allocatable hc
real(dp), dimension(:), allocatable time4jedi
real(dp), dimension(:), allocatable initimes
real(dp), parameter jul_off
integer, dimension(:), allocatable nhis
real(dp), dimension(:), allocatable diatime
real(r8), dimension(:), allocatable akv_bak
real(r8), dimension(:), allocatable gls_pmin
integer, dimension(:), allocatable ndefavg
logical, dimension(:), allocatable lreadtlm
real(r8), parameter gls_e2
logical, dimension(:), allocatable lwrtper
integer, dimension(:), allocatable indx1
logical, dimension(:,:), allocatable compositegrid
real(r8), dimension(:), allocatable nl_visc4
integer, dimension(:), allocatable kdigits
real(r8), dimension(:), allocatable lonmin
logical, dimension(:), allocatable lclimatology
real(r8), dimension(:), allocatable ad_visc2
logical, dimension(:,:), allocatable cnorm
integer, dimension(:), allocatable sfcount
real(r8), dimension(:,:), allocatable ad_tnu4
real(r8), parameter gls_l6
integer, dimension(:), allocatable bgqc_type
real(r8), dimension(:), allocatable tl_visc2
logical, dimension(:), allocatable ldefxtr
real(r8), dimension(4) hgamma
integer, dimension(:), allocatable nsca
real(r8), dimension(:,:), allocatable nl_tnu4
real(dp), dimension(:), allocatable dzmax
real(dp), dimension(:,:), allocatable obc_time
integer, parameter isouth
real(r8), dimension(:), allocatable nl_visc2
integer, dimension(:), allocatable ndefxtr
real(r8), dimension(:), allocatable akp_bak
logical, dimension(:), allocatable sporadicimpulse
real(r8), dimension(:,:), allocatable akt_limit
real(r8), parameter my_b2
type(t_scalars), dimension(:), allocatable scalars
real(r8), dimension(:), allocatable blk_zq
real(r8), dimension(:), allocatable gls_c1
integer, dimension(:), allocatable nspt
real(r8), dimension(:), allocatable dstrs
logical, dimension(:), allocatable lm2clm
real(r8), dimension(9) lmd_r1
real(r8), dimension(:), allocatable akv_limit
logical, dimension(:), allocatable perfectrst
real(dp), dimension(:), allocatable timeend
real(r8), dimension(:), allocatable zob
real(dp), dimension(:), allocatable m3nudg
real(r8), dimension(:), allocatable rdrg2
integer, dimension(:), pointer inert
real(r8), dimension(:,:,:), allocatable hdecayb
real(r8), parameter gls_gh0
logical, dimension(:), allocatable lwrttime
real(dp), dimension(:), allocatable dxmax
real(r8), dimension(:), allocatable tl_m3diff
logical, dimension(:), allocatable ldefsca
logical, dimension(:), allocatable lwrthis
logical, dimension(:,:), allocatable tl_volcons
real(r8), dimension(:,:), allocatable kdiff
logical, dimension(:), allocatable lreadadm
character(len=20) phase4dvar
real(dp), dimension(:), allocatable dtfast
integer, dimension(:), allocatable ntfirst
real(dp), dimension(:,:), allocatable m2obc_out
logical, dimension(:), allocatable ldefrst
real(dp), dimension(:), allocatable imptime
logical, dimension(:), allocatable lbiology
logical, dimension(:), allocatable lwrttlm
logical, dimension(:), allocatable ldefout
logical, dimension(:), allocatable lwrtrst
real(dp), parameter rad2deg
real(r8), dimension(:), allocatable xl
real(dp), dimension(:), allocatable time
real(r8), parameter gls_l1
real(r8), parameter my_e2
integer, dimension(:), allocatable nsct
logical, dimension(:), allocatable ldefsta
logical, dimension(:), allocatable refinedgrid
logical, dimension(:), allocatable lstations
logical, dimension(:), allocatable ldeftlm
logical, dimension(:,:), allocatable ltracerclm
integer, dimension(:), allocatable nsff
integer, dimension(:), allocatable refinescale
real(r8), dimension(:), allocatable gls_sigp
character(len=80) blowup_string
integer, dimension(:), allocatable ntstart
real(r8), dimension(:), allocatable tkenu2
integer, dimension(:), allocatable step_counter
real(dp), dimension(:,:), allocatable sf_time
real(r8), dimension(:,:), allocatable tnu4
real(r8), dimension(:), allocatable gls_kmin
logical, dimension(:), allocatable processinputdata
integer, parameter inorth
integer, dimension(:), allocatable ndefadj
integer, dimension(:), allocatable levsfrc
integer, dimension(:), allocatable nbrec
logical, dimension(:), allocatable ldeflcz
real(r8), dimension(:), allocatable trnorm
real(dp), dimension(:), allocatable hmax
logical, dimension(:,:), allocatable cnormb
integer, dimension(:), allocatable nadj
real(dp), dimension(:), allocatable rx0
logical, dimension(:), allocatable ldefdai
integer, dimension(:), allocatable jdigits
integer, dimension(:), allocatable ndia
real(r8), dimension(:), allocatable r0
integer, dimension(:), allocatable vstretching
logical, dimension(:,:), allocatable lnudgetclm
integer, dimension(:), allocatable nprovenance
real(r8), dimension(:), allocatable so_decay
logical, dimension(:), allocatable lreadfwd
integer, dimension(:), allocatable iif
real(dp), dimension(:), allocatable dymin
real(dp), dimension(:,:), allocatable m2obc_in
integer, dimension(:), allocatable ntsdia
real(dp), dimension(:), allocatable cg_cor
real(r8), dimension(:,:,:), allocatable vdecayb
integer, dimension(:,:), allocatable iprovenance
real(dp), dimension(:), allocatable initime
integer, dimension(:), allocatable ntsavg
integer, dimension(:), allocatable ndefdia
logical, dimension(:), allocatable lcyclerst
real(r8), dimension(:,:,:), allocatable hdecay
real(r8), dimension(:), allocatable gls_c3m
real(dp), dimension(:,:), allocatable fsobc_in
real(r8), dimension(:), allocatable scoef
real(dp), dimension(:), allocatable maxspeed
real(r8), dimension(:,:), allocatable tl_akt_fac
real(r8), parameter my_dtfac
real(r8), dimension(:), allocatable wec_alpha
real(r8), dimension(4) vgamma
logical, dimension(:), allocatable lreadblk
real(dp), dimension(:), allocatable dyminw
real(dp), dimension(:,:), allocatable m3obc_in
integer, dimension(:), allocatable vtransform
real(r8), dimension(:), allocatable gls_c3p