4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
21# if defined MODEL_COUPLING && defined MCT_LIB
23# endif
24# ifdef FOUR_DVAR
26# endif
28# ifdef SENSITIVITY_4DVAR
30# endif
31# ifdef NESTING
33# endif
36# ifdef SO_SEMI
38# endif
39
40# if defined AD_SENSITIVITY || defined I4DVAR_ANA_SENSITIVITY || \
41 defined opt_observations || defined sensitivity_4dvar
43# endif
44# ifdef ANA_VMIX
46# endif
47# ifdef BIOLOGY
49# endif
50# ifdef BBL_MODEL_NOT_YET
51
52# endif
53# if defined BULK_FLUXES_NOT_YET && !defined PRIOR_BULK_FLUXES
54
55# endif
56# ifdef BVF_MIXING_NOT_YET
57
58# endif
60# if defined ADJUST_STFLUX || defined ADJUST_WSTRESS
62# endif
63# ifdef AD_OUTPUT_STATE
65# endif
66# ifdef WEAK_CONSTRAINT
68# endif
69# ifdef FORCING_SV
71# endif
72# ifdef GLS_MIXING_NOT_YET
73
74
75# endif
76# ifdef LMD_MIXING_NOT_YET
77
78# endif
79# if defined FOUR_DVAR && defined OBSERVATIONS
80# ifdef WEAK_CONSTRAINT
82# else
84# endif
85# endif
86# ifdef MY25_MIXING
87
88
89# endif
90# ifdef NESTING
93# ifndef ONE_WAY
95# endif
96# endif
97# ifdef ADJUST_BOUNDARY
101# endif
103# ifndef FORCING_SV
105# endif
106# ifdef NEARSHORE_MELLOR_NOT_YET
107
108# endif
109# ifndef TS_FIXED
111# endif
113# ifdef SEDIMENT_NOT_YET
114
115# endif
116# ifdef AD_AVERAGES
118# endif
121# if defined SSH_TIDES_NOT_YET || defined UV_TIDES_NOT_YET
122
123# endif
127# ifndef TS_FIXED
129# endif
131# ifdef FLOATS_NOT_YET
132
133# endif
134# if defined BULK_FLUXES && !defined PRIOR_BULK_FLUXES
136# endif
138# ifdef TIDE_GENERATING_FORCES
140# endif
141# ifdef WEAK_CONSTRAINT
143# endif
144# if defined ATM_COUPLING_NOT_YET && defined MCT_LIB
146# endif
147# if defined WAV_COUPLING_NOT_YET && defined MCT_LIB
149# endif
150# if (defined FOUR_DVAR && !defined I4DVAR_ANA_SENSITIVITY) && \
151 defined observations
153# endif
155# ifdef SO_SEMI
156 USE packing_mod,
ONLY :
ad_pack
157# endif
162# ifdef SENSITIVITY_4DVAR
164# endif
165
166 implicit none
167
168
169
170 real(dp), intent(in) :: RunInterval
171
172
173
174 logical :: backward = .true.
175 logical :: ad_advance
176 logical :: DoNestLayer, Time_Step
177 integer :: Nsteps, Rsteps
178 integer :: ig, il, is, istep, ng, nl, tile
179 integer :: my_iif, next_indx1
180# ifdef FLOATS_NOT_YET
181 integer :: Lend, Lstr, chunk_size
182# endif
183 integer :: ks, kt
184# ifdef NESTING
185 integer :: icount, itcount
186# endif
187
188 real(r8) :: HalfDT, MaxDT, my_StepTime
189
190 character (len=*), parameter :: MyFile = &
191 & __FILE__
192
193
194
195
196
197# ifdef NESTING
198
199
200
201
202
205 & __file__)) RETURN
206# endif
207
208
209
210 time_step=.true.
211 donestlayer=.true.
212# ifdef NESTING
213 itcount=icount+1
214# endif
215
216 kernel_loop : DO WHILE (time_step)
217
218
219
220
221
222
223 nl=0
224# ifdef NESTING
227 END DO
228# endif
229
230 nest_layer : DO WHILE (donestlayer)
231
232# ifdef NESTING
233
234
235
236
237
238
239
240 itcount=itcount-1
241 IF (itcount.gt.0) THEN
242 nl=stepinfo(itcount,1)
243 nsteps=stepinfo(itcount,2)
244 IF (itcount.eq.icount) nsteps=1
245 rsteps=stepinfo(itcount,3)
248 END DO
249 ELSE
250 nl=0
251 END IF
252# else
253
254
255
256
257
258
259
260
263# endif
264
266
267
268
269 step_loop : DO istep=nsteps,1,-1
270
271
272
275# ifdef JEDI
278# endif
282 ad_advance=.false.
283# ifdef NESTING
286 END DO
287# endif
288 ELSE
289 ad_advance=.true.
290 END IF
291 END DO
292
293
294
295
296
301 & __line__, myfile)) RETURN
302 END DO
303
304
305
306
307
312# if defined FORWARD_READ || defined JEDI
314# endif
315# ifdef TIDE_GENERATING_FORCES
316 CALL equilibrium_tide (ng, tile,
iadm)
317# endif
318 END DO
319 END DO
321
322# if defined FORWARD_READ || defined JEDI
323
324
325
326
327
333# if defined BULK_FLUXES && !defined PRIOR_BULK_FLUXES
334
335# endif
336 END DO
337 END DO
338# endif
339
340
341
342 advance : IF (ad_advance) THEN
343
344# ifdef FLOATS_NOT_YET
345
346
347
348
349
350
351
352
353
354
355
364
365# ifdef _OPENMP
368 lend=min(
nfloats(ng),lstr+chunk_size-1)
369# else
370 lstr=1
372# endif
373 CALL ad_step_floats (ng, lstr, lend)
374 END IF
375 END DO
376# endif
377
378# ifdef NESTING
379
380
381
382
383
384
385
386
387
392 END IF
393 END DO
394# ifndef ONE_WAY
395
396
397
398
399
400
401
402
403
404
405
406
410 IF (do_twoway(
iadm,nl,il,ng,istep))
THEN
412 END IF
413 END DO
414 END DO
415# endif
416# endif
417
418# ifndef TS_FIXED
419
420
421
422
423
424# ifdef NESTING
425
426
427
428
433 END IF
434 END DO
435# endif
436
437
438
439
444 END DO
445 END DO
446
447
448
449
455 END DO
456 END DO
457# endif
458
459
460
461
462
463
464
468# ifdef SEDIMENT_NOT_YET
469 CALL ad_sediment (ng, tile)
470# endif
471# ifdef BIOLOGY
473# endif
474# ifdef MY25_MIXING_NOT_YET
475 CALL ad_my25_corstep (ng, tile)
476# elif defined GLS_MIXING_NOT_YET
477 CALL ad_gls_corstep (ng, tile)
478# endif
481 END DO
482 END DO
483
484# ifdef NESTING
485
486
487
488
489
494 END IF
495 END DO
496# endif
497
498
499
500
501
502
503
504
505
511 END DO
512 END DO
513
514
515
516
517
518
519# ifdef NESTING
520
521
522
523
527 END DO
528# endif
533 END DO
534 END DO
535
536# ifdef NESTING
537
538
539
540
541
546 END IF
547 END DO
548
549# if defined MASKING && defined WET_DRY
550
551
552
553
554
555
559 END DO
560# endif
561# endif
562
563
564
565
566
567
568 loop_2d :
DO my_iif=maxval(
nfast)+1,1,-1
569
570# ifdef NESTING
571
572
573
574
575
576
577
582 END IF
585 END IF
586 END DO
587# endif
588
589
590
591
592
599 END DO
600 END IF
601
602
603
604 next_indx1=3-
indx1(ng)
607
608
609
610
616
617 END IF
618 END DO
619
620# ifdef NESTING
621
622
623
624
625
626
627
628
633 END IF
636 END IF
637 END DO
638# endif
639
640
641
642
643
644
645
648 IF (my_iif.le.(
nfast(ng)+1))
THEN
651 END DO
652 END IF
653
654
655
656
657
659 & my_iif.le.(
nfast(ng)+1))
THEN
661
662
663
664
665
666
667
668
672 END IF
673 END DO
674
675 END DO loop_2d
676
677 END IF advance
678
679# if (defined FOUR_DVAR && !defined I4DVAR_ANA_SENSITIVITY) && \
680 defined observations
681
682
683
684
685
686
689# ifdef SENSITIVITY_4DVAR
690# ifdef RBL4DVAR_FCT_SENSITIVITY
692# else
694# endif
695# endif
701 ELSE
703 END IF
704
705# ifdef SP4DVAR
706
707
708
710# endif
711
713# ifdef WEAK_CONSTRAINT
715# else
717# endif
718 END DO
720 & __line__, myfile)) RETURN
721# ifdef SENSITIVITY_4DVAR
722 END IF
723# endif
724# ifdef SP4DVAR
725 END IF
726# endif
727 END DO
728# endif
729
730# ifdef WEAK_CONSTRAINT
731
732
733
734
735
736
742 END DO
743 END IF
744 END DO
745# endif
746
747# ifdef NESTING
748
749
750
751
752
757 END IF
758 END DO
759# endif
760
761
762
763
764
765
769# ifdef MY25_MIXING_NOT_YET
770 CALL ad_my25_prestep (ng, tile)
771# elif defined GLS_MIXING_NOT_YET
772 CALL ad_gls_prestep (ng, tile)
773# endif
775 END DO
776 END DO
777
778# ifdef NESTING
779
780
781
782
783
784
785
786
787
788
794 END IF
795 END DO
796# endif
797
798
799# ifdef NESTING
800
801
802
803
808 END IF
809 END DO
810# endif
811
812
813
814
815
819# ifdef DIAGNOSTICS
820
821# endif
823 END DO
824 END DO
825
826
827
828
829
830
831
835# ifdef SENSITIVITY_4DVAR
838 END IF
839# endif
841# if defined ANA_VMIX_NOT_YET
842 CALL ad_ana_vmix (ng, tile,
iadm)
843# elif defined LMD_MIXING_NOT_YET
844 CALL ad_lmd_vmix (ng, tile)
845# elif defined BVF_MIXING
846 CALL ad_bvf_mix (ng, tile)
847# endif
848 END DO
849 END DO
850
851# ifdef SO_SEMI
852
853
854
855
856
857
858
861 IF (mod(
iic(ng)-1,
nadj(ng)).eq.0)
THEN
866 END DO
867 END IF
868 END DO
869# endif
870
871# ifdef NESTING
872
873
874
875
880 END IF
881 END DO
882# endif
883
884
885
886
887
888
892# if defined SSH_TIDES_NOT_YET || defined UV_TIDES_NOT_YET
893 CALL ad_set_tides (ng, tile)
894# endif
896# ifdef BBL_MODEL_NOT_YET
897 CALL ad_bblm (ng, tile)
898# endif
899# if defined BULK_FLUXES_NOT_YET && !defined PRIOR_BULK_FLUXES
900 CALL ad_bulk_flux (ng, tile)
901# endif
902 END DO
903 END DO
904
905# ifdef NEARSHORE_MELLOR_NOT_YET
906
907
908
909
910
914 CALL ad_radiation_stress (ng, tile)
915 END DO
916 END DO
917# endif
918
919# if defined WAV_COUPLING_NOT_YET && defined MCT_LIB
920
921
922
923
924
925
931 CALL ocn2wav_coupling (ng, tile)
932 END DO
933 END IF
934 END DO
935# endif
936
937# if defined ATM_COUPLING_NOT_YET && defined MCT_LIB
938
939
940
941
942
943
949 CALL ocn2atm_coupling (ng, tile)
950 END DO
951 END IF
952 END DO
953# endif
954
955
956
957
958
959
960
961
965# ifndef TS_FIXED
967# endif
970# ifdef AD_AVERAGES
972# endif
973 END DO
974 END DO
976
977# ifdef FORCING_SV
978
979
980
981
982
988 END DO
989 END DO
990# endif
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1027 END IF
1028 END DO
1029
1030# ifdef AD_OUTPUT_STATE
1031
1032
1033
1034
1035
1036
1037
1038
1044 END DO
1048 END DO
1049 END IF
1050 END DO
1051# endif
1052# ifndef FORCING_SV
1053
1054
1055
1056
1057
1058
1059
1060
1065 END IF
1066 END DO
1067# endif
1068
1069# if defined ADJUST_STFLUX || defined ADJUST_WSTRESS
1070
1071
1072
1073
1074
1075
1076# ifdef RBL4DVAR_FCT_SENSITIVITY
1083 END DO
1084 END IF
1085 END IF
1086 END DO
1087# else
1093 END DO
1094 END IF
1095 END DO
1096# endif
1097# endif
1098
1099# ifdef ADJUST_BOUNDARY
1100
1101
1102
1103
1104
1105
1106# ifdef RBL4DVAR_FCT_SENSITIVITY
1115 END DO
1116 END IF
1117 END IF
1118 END DO
1119# else
1127 END DO
1128 END IF
1129 END DO
1130# endif
1131# endif
1132
1133# if defined WEAK_CONSTRAINT && !defined SP4DVAR
1134
1135
1136
1137
1138
1145 END DO
1146 END IF
1147 END DO
1148# endif
1149
1150
1151
1152
1153
1154
1159 & __line__, myfile)) RETURN
1160 END DO
1161
1162# if defined WEAK_CONSTRAINT && !defined SP4DVAR
1163
1164
1165
1166
1167
1170 IF (mod(
iic(ng)-1,
nadj(ng)).eq.0)
THEN
1173 END DO
1174 END IF
1175 END DO
1176# endif
1177
1178# if (defined AD_SENSITIVITY || defined I4DVAR_ANA_SENSITIVITY || \
1179 defined opt_observations || defined sensitivity_4dvar) && \
1180
1181
1182
1183
1184
1185
1186
1189# ifdef SENSITIVITY_4DVAR
1191# endif
1192# if !defined AD_IMPULSE
1195# endif
1198 END DO
1199# if !defined AD_IMPULSE
1200 END IF
1201# endif
1202# ifdef SENSITIVITY_4DVAR
1203 END IF
1204# endif
1205 END DO
1206# endif
1207
1208
1209
1210
1211
1215# ifndef NESTING
1217# endif
1220 END DO
1221
1222 END DO step_loop
1223
1224 END DO nest_layer
1225
1226 END DO kernel_loop
1227
1228 RETURN
subroutine ad_get_data(ng)
subroutine ad_set_data(ng, tile)
subroutine, public ad_biology(ng, tile)
subroutine, public ad_diag(ng, tile)
subroutine, public ad_force_dual(ng, tile, kfrc, nfrc)
subroutine, public ad_forcing(ng, tile, kfrc, nfrc)
subroutine, public ad_frc_adjust(ng, tile, linp)
subroutine ad_htobs(ng, tile, model)
subroutine, public ad_out_zeta(ng, tile, model)
subroutine, public ad_out_fields(ng, tile, model)
subroutine ad_misfit(ng, tile, model)
subroutine, public ad_nesting(ng, model, isection)
subroutine, public ad_obc2d_adjust(ng, tile, linp)
subroutine, public ad_obc_adjust(ng, tile, linp)
subroutine, public ad_omega(ng, tile, model)
subroutine, public ad_post_initial(ng, model)
subroutine, public ad_rho_eos(ng, tile, model)
subroutine, public ad_rhs3d(ng, tile)
subroutine, public ad_set_avg(ng, tile)
subroutine, public ad_set_depth_bry(ng, tile, model)
subroutine, public ad_set_depth(ng, tile, model)
subroutine, public ad_set_massflux(ng, tile, model)
subroutine, public ad_set_vbc(ng, tile)
subroutine, public ad_set_zeta(ng, tile)
subroutine, public ad_step2d(ng, tile)
subroutine, public ad_step3d_t(ng, tile)
subroutine, public ad_step3d_uv(ng, tile)
subroutine, public ad_wvelocity(ng, tile, ninp)
subroutine, public adsen_force(ng, tile)
subroutine ana_vmix(ng, tile, model)
subroutine, public bulk_flux(ng, tile)
subroutine, public time_string(mytime, date_string)
subroutine, public frc_clear(ng, tile)
subroutine, public frc_adgather(ng, tile)
integer, dimension(:,:), allocatable couplesteps
logical, dimension(:), allocatable lsenfct
logical, dimension(:), allocatable lsadd
logical, dimension(:), allocatable lsen4dvar
logical, dimension(:), allocatable processobs
real(r8), dimension(:), allocatable twowayinterval
logical, dimension(:), allocatable donortofiner
integer, dimension(:), allocatable first_tile
integer, dimension(:), allocatable last_tile
integer, dimension(:), allocatable nfloats
integer, dimension(:), allocatable nstr
integer, dimension(:,:), allocatable gridnumber
integer, dimension(:), allocatable nend
integer, dimension(:), allocatable gridsinlayer
logical, dimension(:), allocatable lfloats
real(dp), dimension(:), allocatable obstime
integer, dimension(:), allocatable iic
real(dp), dimension(:), allocatable dt
integer, dimension(:), allocatable sorec
logical, dimension(:), allocatable predictor_2d_step
integer, dimension(:), allocatable jic
real(dp), dimension(:), allocatable tdays
real(r8), dimension(:), allocatable dends
integer, dimension(:), allocatable nfast
real(dp), parameter sec2day
integer, dimension(:), allocatable ntend
character(len=22), dimension(:), allocatable time_code
real(dp), dimension(:), allocatable time4jedi
integer, dimension(:), allocatable indx1
logical, dimension(:,:), allocatable compositegrid
type(t_scalars), dimension(:), allocatable scalars
real(r8), dimension(:), allocatable dstrs
real(dp), dimension(:), allocatable time
logical, dimension(:), allocatable refinedgrid
integer, dimension(:), allocatable refinescale
integer, dimension(:), allocatable ntstart
integer, dimension(:), allocatable step_counter
integer, dimension(:), allocatable nadj
integer, dimension(:), allocatable iif
integer, dimension(:), allocatable nfm2
integer, dimension(:), allocatable lbout
integer, dimension(:), allocatable kstp
integer, dimension(:), allocatable knew
integer, dimension(:), allocatable nfm1
integer, dimension(:), allocatable nrhs
integer, dimension(:), allocatable nf
integer, dimension(:), allocatable nfm3
integer, dimension(:), allocatable nnew
integer, dimension(:), allocatable nfp1
integer, dimension(:), allocatable krhs
integer, dimension(:), allocatable lfout
integer, dimension(:), allocatable nstp
type(t_storage), dimension(:), allocatable storage
subroutine, public nesting(ng, model, isection)
subroutine, public obs_read(ng, model, backward)
subroutine, public omega(ng, tile, model)
subroutine, public rho_eos(ng, tile, model)
subroutine, public set_depth(ng, tile, model)
subroutine, public reset_massflux(ng, tile, model)
subroutine, public set_massflux(ng, tile, model)
logical function, public founderror(flag, noerr, line, routine)
subroutine nlm_step_sequence(runinterval, icount)
subroutine ntimesteps(model, runinterval, nl, nsteps, rsteps)
subroutine ad_pack(ng, tile, mstr, mend, ad_state)