ROMS
Loading...
Searching...
No Matches
ad_main3d.F
Go to the documentation of this file.
1#include "cppdefs.h"
2#if defined ADJOINT && defined SOLVE3D
3 SUBROUTINE ad_main3d (RunInterval)
4!
5!git $Id$
6!================================================== Hernan G. Arango ===
7! Copyright (c) 2002-2025 The ROMS Group Andrew M. Moore !
8! Licensed under a MIT/X style license !
9! See License_ROMS.md !
10!=======================================================================
11! !
12! This subroutine is the main driver for adjoint ROMS when !
13! configurated as a full 3D baroclinic ocean model. It advances !
14! backwards the adjoint model equations for all nested grids, if !
15! any, by the specified time interval (seconds), RunInterval. !
16! !
17!=======================================================================
18!
19 USE mod_param
20 USE mod_parallel
21# if defined MODEL_COUPLING && defined MCT_LIB
22 USE mod_coupler
23# endif
24# ifdef FOUR_DVAR
25 USE mod_fourdvar
26# endif
27 USE mod_iounits
28# ifdef SENSITIVITY_4DVAR
29 USE mod_ncparam
30# endif
31# ifdef NESTING
32 USE mod_nesting
33# endif
34 USE mod_scalars
35 USE mod_stepping
36# ifdef SO_SEMI
37 USE mod_storage
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
45 USE analytical_mod, ONLY : ana_vmix
46# endif
47# ifdef BIOLOGY
48 USE ad_biology_mod, ONLY : ad_biology
49# endif
50# ifdef BBL_MODEL_NOT_YET
51!! USE ad_bbl_mod, ONLY : ad_bblm
52# endif
53# if defined BULK_FLUXES_NOT_YET && !defined PRIOR_BULK_FLUXES
54!! USE ad_bulk_flux_mod, ONLY : ad_bulk_flux
55# endif
56# ifdef BVF_MIXING_NOT_YET
57!! USE ad_bvf_mix_mod, ONLY : ad_bvf_mix
58# endif
59 USE ad_diag_mod, ONLY : ad_diag
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
70 USE ad_forcing_mod, ONLY : ad_forcing
71# endif
72# ifdef GLS_MIXING_NOT_YET
73!! USE ad_gls_corstep_mod, ONLY : ad_gls_corstep
74!! USE ad_gls_prestep_mod, ONLY : ad_gls_prestep
75# endif
76# ifdef LMD_MIXING_NOT_YET
77!! USE ad_lmd_vmix_mod, ONLY : ad_lmd_vmix
78# endif
79# if defined FOUR_DVAR && defined OBSERVATIONS
80# ifdef WEAK_CONSTRAINT
81 USE ad_htobs_mod, ONLY : ad_htobs
82# else
83 USE ad_misfit_mod, ONLY : ad_misfit
84# endif
85# endif
86# ifdef MY25_MIXING
87!! USE ad_my25_corstep_mod, ONLY : ad_my25_corstep
88!! USE ad_my25_prestep_mod, ONLY : ad_my25_prestep
89# endif
90# ifdef NESTING
91 USE nesting_mod, ONLY : nesting
92 USE ad_nesting_mod, ONLY : ad_nesting
93# ifndef ONE_WAY
94 USE nesting_mod, ONLY : do_twoway
95# endif
96# endif
97# ifdef ADJUST_BOUNDARY
101# endif
102 USE ad_omega_mod, ONLY : ad_omega
103# ifndef FORCING_SV
105# endif
106# ifdef NEARSHORE_MELLOR_NOT_YET
107!! USE ad_radiation_stress_mod, ONLY : ad_radiation_stress
108# endif
109# ifndef TS_FIXED
110 USE ad_rho_eos_mod, ONLY : ad_rho_eos
111# endif
112 USE ad_rhs3d_mod, ONLY : ad_rhs3d
113# ifdef SEDIMENT_NOT_YET
114!! USE ad_sediment_mod, ONLY : ad_sediment
115# endif
116# ifdef AD_AVERAGES
117 USE ad_set_avg_mod, ONLY : ad_set_avg
118# endif
121# if defined SSH_TIDES_NOT_YET || defined UV_TIDES_NOT_YET
122!! USE ad_set_tides_mod, ONLY : ad_set_tides
123# endif
124 USE ad_set_vbc_mod, ONLY : ad_set_vbc
125 USE ad_set_zeta_mod, ONLY : ad_set_zeta
126 USE ad_step2d_mod, ONLY : ad_step2d
127# ifndef TS_FIXED
128 USE ad_step3d_t_mod, ONLY : ad_step3d_t
129# endif
131# ifdef FLOATS_NOT_YET
132!! USE ad_step_floats_mod, ONLY : ad_step_floats
133# endif
134# if defined BULK_FLUXES && !defined PRIOR_BULK_FLUXES
135 USE bulk_flux_mod, ONLY : bulk_flux
136# endif
137 USE dateclock_mod, ONLY : time_string
138# ifdef TIDE_GENERATING_FORCES
139 USE equilibrium_tide_mod, ONLY : equilibrium_tide
140# endif
141# ifdef WEAK_CONSTRAINT
143# endif
144# if defined ATM_COUPLING_NOT_YET && defined MCT_LIB
145 USE mct_coupler_mod, ONLY : ocn2atm_coupling
146# endif
147# if defined WAV_COUPLING_NOT_YET && defined MCT_LIB
148 USE mct_coupler_mod, ONLY : ocn2wav_coupling
149# endif
150# if (defined FOUR_DVAR && !defined I4DVAR_ANA_SENSITIVITY) && \
151 defined observations
152 USE obs_read_mod, ONLY : obs_read
153# endif
154 USE omega_mod, ONLY : omega
155# ifdef SO_SEMI
156 USE packing_mod, ONLY : ad_pack
157# endif
158 USE rho_eos_mod, ONLY : rho_eos
159 USE set_depth_mod, ONLY : set_depth
161 USE strings_mod, ONLY : founderror
162# ifdef SENSITIVITY_4DVAR
164# endif
165!
166 implicit none
167!
168! Imported variable declarations.
169!
170 real(dp), intent(in) :: RunInterval
171!
172! Local variable declarations.
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! Time-step adjoint 3D primitive equations backwards.
195!=======================================================================
196
197# ifdef NESTING
198!
199! Compute nonlinear model timestepping sequence and load it into
200! StepInfo array. The sequence of values are reversed to timestep
201! the adjoint model backwards.
202!
203 CALL nlm_step_sequence (runinterval, icount)
204 IF (founderror(exit_flag, noerror, __line__, &
205 & __file__)) RETURN
206# endif
207!
208! Initialize.
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! In nesting applications, the number of nesting layers (NestLayers) is
219! used to facilitate refinement grids and composite/refinament grids
220! combinations. Otherwise, the solution it is looped once for a single
221! grid application (NestLayers = 1).
222!
223 nl=0
224# ifdef NESTING
225 DO ng=1,ngrids
226 twowayinterval(ng)=dt(1)
227 END DO
228# endif
229!
230 nest_layer : DO WHILE (donestlayer)
231
232# ifdef NESTING
233!
234! Determine current nested layer (nl), number of timesteps (Nsteps)
235! to execute for grids in current nested layer, number of timesteps
236! (Rsteps) to complete the RunInterval time window, and timestep
237! counter (step_counter) for each grid. Their values are reversed
238! from the saved nonlinear model time stepping sequence.
239!
240 itcount=itcount-1 ! count backwards for adjoint
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)
246 DO ng=1,ngrids
247 step_counter(ng)=stepinfo(itcount,ng+3)
248 END DO
249 ELSE
250 nl=0
251 END IF
252# else
253!
254! Determine number of time steps to compute in each nested grid layer
255! based on the specified time interval (seconds), RunInterval. Non
256! nesting applications have NestLayers=1. Notice that RunInterval is
257! set in the calling driver. Its value may span the full period of the
258! simulation, a multi-model coupling interval (RunInterval > ifac*dt),
259! or just a single step (RunInterval=0).
260!
261 CALL ntimesteps (iadm, runinterval, nl, nsteps, rsteps)
262 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
263# endif
264!
265 IF ((nl.le.0).or.(nl.gt.nestlayers)) EXIT
266!
267! Time-step governing equations for Nsteps.
268!
269 step_loop : DO istep=nsteps,1,-1
270!
271! Set time indices and time clock.
272!
273 DO ig=1,gridsinlayer(nl)
274 ng=gridnumber(ig,nl)
275# ifdef JEDI
276 jic(ng)=jic(ng)-1
277 time4jedi(ng)=time4jedi(ng)-dt(ng)
278# endif
279 tdays(ng)=time(ng)*sec2day
280 IF (step_counter(ng).eq.1) time_step=.false.
281 IF ((iic(ng).eq.ntstart(ng)).and.(ng.eq.ngrids)) THEN
282 ad_advance=.false.
283# ifdef NESTING
284 DO ng=1,ngrids
285 twowayinterval(ng)=0.0_r8
286 END DO
287# endif
288 ELSE
289 ad_advance=.true.
290 END IF
291 END DO
292!
293!-----------------------------------------------------------------------
294! Read in required data, if any, from input NetCDF files.
295!-----------------------------------------------------------------------
296!
297 DO ig=1,gridsinlayer(nl)
298 ng=gridnumber(ig,nl)
299 CALL ad_get_data (ng)
301 & __line__, myfile)) RETURN
302 END DO
303!
304!-----------------------------------------------------------------------
305! Process input data, if any: time interpolate between snapshots.
306!-----------------------------------------------------------------------
307!
308 DO ig=1,gridsinlayer(nl)
309 ng=gridnumber(ig,nl)
310 DO tile=first_tile(ng),last_tile(ng),+1
311 CALL ad_set_data (ng, tile)
312# if defined FORWARD_READ || defined JEDI
313 CALL set_depth (ng, tile, iadm)
314# endif
315# ifdef TIDE_GENERATING_FORCES
316 CALL equilibrium_tide (ng, tile, iadm)
317# endif
318 END DO
319 END DO
320 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
321
322# if defined FORWARD_READ || defined JEDI
323!
324!-----------------------------------------------------------------------
325! Compute BASIC STATE horizontal mass fluxes (Hz*u/n and Hz*v/m).
326!-----------------------------------------------------------------------
327!
328 DO ig=1,gridsinlayer(nl)
329 ng=gridnumber(ig,nl)
330 DO tile=last_tile(ng),first_tile(ng),-1
331 CALL set_massflux (ng, tile, iadm)
332 CALL rho_eos (ng, tile, iadm)
333# if defined BULK_FLUXES && !defined PRIOR_BULK_FLUXES
334!! CALL bulk_flux (ng, tile)
335# endif
336 END DO
337 END DO
338# endif
339!
340! Avoid time-stepping if additional delayed IO time-step.
341!
342 advance : IF (ad_advance) THEN
343
344# ifdef FLOATS_NOT_YET
345!
346!-----------------------------------------------------------------------
347! Compute Lagrangian drifters trajectories: Split all the drifters
348! between all the computational threads, except in distributed-memory
349! and serial configurations. In distributed-memory, the parallel node
350! containing the drifter is selected internally since the state
351! variables do not have a global scope.
352!-----------------------------------------------------------------------
353!
354! Shift floats time indices.
355!
356 DO ig=1,gridsinlayer(nl)
357 ng=gridnumber(ig,nl)
358 IF (lfloats(ng)) THEN
359 nfp1(ng)=mod(nfp1(ng)+1,nft+1)
360 nf(ng)=mod(nf(ng)+1,nft+1)
361 nfm1(ng)=mod(nfm1(ng)+1,nft+1)
362 nfm2(ng)=mod(nfm2(ng)+1,nft+1)
363 nfm3(ng)=mod(nfm3(ng)+1,nft+1)
364!
365# ifdef _OPENMP
366 chunk_size=(nfloats(ng)+numthreads-1)/numthreads
367 lstr=1+mythread*chunk_size
368 lend=min(nfloats(ng),lstr+chunk_size-1)
369# else
370 lstr=1
371 lend=nfloats(ng)
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! If donor to a finer grid, extract data for the external contact
382! points. This is the latest solution for the coarser grid.
383!
384! It is stored in the REFINED structure so it can be used for the
385! space-time interpolation when "nputD" argument is used above.
386!-----------------------------------------------------------------------
387!
388 DO ig=1,gridsinlayer(nl)
389 ng=gridnumber(ig,nl)
390 IF (donortofiner(ng)) THEN
391 CALL ad_nesting (ng, iadm, ngetd)
392 END IF
393 END DO
394# ifndef ONE_WAY
395!
396!-----------------------------------------------------------------------
397! If refinement grids, perform two-way coupling between fine and
398! coarse grids. Correct coarse grid tracers values at the refinement
399! grid with refined accumulated fluxes. Then, replace coarse grid
400! state variable with averaged refined grid values (two-way nesting).
401! Update coarse grid depth variables.
402!
403! The two-way exchange of infomation between nested grids needs to be
404! done at the correct time-step and in the right sequence.
405!-----------------------------------------------------------------------
406!
407 DO il=1,nestlayers
408 DO ig=1,gridsinlayer(il)
409 ng=gridnumber(ig,il)
410 IF (do_twoway(iadm,nl,il,ng,istep)) THEN
411 CALL ad_nesting (ng, iadm, n2way)
412 END IF
413 END DO
414 END DO
415# endif
416# endif
417
418# ifndef TS_FIXED
419!
420!-----------------------------------------------------------------------
421! Time-step adjoint tracer equations.
422!-----------------------------------------------------------------------
423!
424# ifdef NESTING
425!
426! If composite or mosaic grids, process additional points in the
427! contact zone between connected grids for Tracer Variables.
428!
429 DO ig=1,gridsinlayer(nl)
430 ng=gridnumber(ig,nl)
431 IF (any(compositegrid(:,ng))) THEN
432 CALL ad_nesting (ng, iadm, n3dtv)
433 END IF
434 END DO
435# endif
436! Compute intermediate BASIC STATE mass fluxes (Huon,Hvom) for use in
437! the adjoint horizontal advection (ad_step3d_t) and adjoint vertical
438! velocity (ad_omega).
439!
440 DO ig=1,gridsinlayer(nl)
441 ng=gridnumber(ig,nl)
442 DO tile=first_tile(ng),last_tile(ng),+1
443 CALL reset_massflux (ng, tile, iadm) ! intermediate
444 END DO ! fluxes
445 END DO
446!
447! Compute basic STATE omega vertical velocity with intermediate mass
448! fluxes. Time-step adjoint tracer equations.
449!
450 DO ig=1,gridsinlayer(nl)
451 ng=gridnumber(ig,nl)
452 DO tile=last_tile(ng),first_tile(ng),-1
453 CALL omega (ng, tile, iadm) ! BASIC STATE w-velocity
454 CALL ad_step3d_t (ng, tile)
455 END DO
456 END DO
457# endif
458!
459!-----------------------------------------------------------------------
460! Time-step adjoint vertical mixing turbulent equations and passive
461! tracer source and sink terms, if applicable. Reinstate original
462! BASIC STATE (Huon,Hvom).
463!-----------------------------------------------------------------------
464!
465 DO ig=1,gridsinlayer(nl)
466 ng=gridnumber(ig,nl)
467 DO tile=first_tile(ng),last_tile(ng),+1
468# ifdef SEDIMENT_NOT_YET
469 CALL ad_sediment (ng, tile)
470# endif
471# ifdef BIOLOGY
472 CALL ad_biology (ng, tile)
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
479 CALL ad_omega (ng, tile, iadm)
480 CALL set_massflux (ng, tile, iadm) ! BASIC STATE
481 END DO ! mass fluxes
482 END DO
483
484# ifdef NESTING
485!
486! If composite or mosaic grids, process additional points in the
487! contact zone between connected grids for 3D momentum (u,v),
488! adjusted 2D momentum (ubar,vbar), and fluxes (Huon, Hvom).
489!
490 DO ig=1,gridsinlayer(nl)
491 ng=gridnumber(ig,nl)
492 IF (any(compositegrid(:,ng))) THEN
493 CALL ad_nesting (ng, iadm, n3duv)
494 END IF
495 END DO
496# endif
497!
498!-----------------------------------------------------------------------
499! Time-step adjoint 3D equations.
500!-----------------------------------------------------------------------
501!
502! Reinstate original BASIC STATE omega vertical velocity. Time-step
503! 3D adjoint momentum equations and couple with vertically integrated
504! equations.
505!
506 DO ig=1,gridsinlayer(nl)
507 ng=gridnumber(ig,nl)
508 DO tile=last_tile(ng),first_tile(ng),-1
509 CALL omega (ng, tile, iadm) ! BASIC STATE w-velocity
510 CALL ad_step3d_uv (ng, tile)
511 END DO
512 END DO
513!
514!-----------------------------------------------------------------------
515! Adjoint of recompute depths and thicknesses using the new time
516! filtered free-surface. This call was moved from "ad_step2d" to here.
517!-----------------------------------------------------------------------
518!
519# ifdef NESTING
520!
521! If nesting, determine vertical indices and vertical interpolation
522! weights in the contact zone using new depth arrays.
523!
524 DO ig=1,gridsinlayer(nl)
525 ng=gridnumber(ig,nl)
526 CALL ad_nesting (ng, iadm, nzwgt)
527 END DO
528# endif
529 DO ig=1,gridsinlayer(nl)
530 ng=gridnumber(ig,nl)
531 DO tile=last_tile(ng),first_tile(ng),-1
532 CALL ad_set_depth (ng, tile, iadm)
533 END DO
534 END DO
535
536# ifdef NESTING
537!
538! If composite or mosaic grids, process additional points in the
539! contact zone between connected grids for the time-averaged
540! momentum fluxes (DU_avg1, DV_avg1) and free-surface (Zt_avg).
541!
542 DO ig=1,gridsinlayer(nl)
543 ng=gridnumber(ig,nl)
544 IF (any(compositegrid(:,ng))) THEN
545 CALL ad_nesting (ng, iadm, n2dfx)
546 END IF
547 END DO
548
549# if defined MASKING && defined WET_DRY
550!
551! If nesting and wetting and drying, scale horizontal interpolation
552! weights to account for land/sea masking in contact areas. This needs
553! to be done at very time-step since the Land/Sea masking is time
554! dependent.
555!
556 DO ig=1,gridsinlayer(nl)
557 ng=gridnumber(ig,nl)
558 CALL ad_nesting (ng, iadm, nmask)
559 END DO
560# endif
561# endif
562!
563!-----------------------------------------------------------------------
564! Solve adjoint vertically integrated primitive equations for the
565! free-surface and barotropic momentum components.
566!-----------------------------------------------------------------------
567!
568 loop_2d : DO my_iif=maxval(nfast)+1,1,-1
569
570# ifdef NESTING
571!
572! If composite or mosaic grids, process additional points in the
573! contact zone between connected grids for the state variables
574! associated with the 2D engine Corrector step section.
575! If refinement, check mass flux conservation between coarse and
576! fine grids during debugging.
577!
578 DO ig=1,gridsinlayer(nl)
579 ng=gridnumber(ig,nl)
580 IF (any(compositegrid(:,ng))) THEN
581 CALL ad_nesting (ng, iadm, n2dcs)
582 END IF
583 IF (refinedgrid(ng).and.(refinescale(ng).gt.0)) THEN
584 CALL ad_nesting (ng, iadm, nmflx)
585 END IF
586 END DO
587# endif
588!
589! Corrector step - Apply 2D adjoint time-step corrector scheme. Notice
590! ============== that there is not need for a corrector step during
591! the auxiliary (nfast+1) time-step.
592!
593 DO ig=1,gridsinlayer(nl)
594 ng=gridnumber(ig,nl)
595 iif(ng)=my_iif
596 IF (iif(ng).lt.(nfast(ng)+1)) THEN
597 DO tile=first_tile(ng),last_tile(ng),+1
598 CALL ad_step2d (ng, tile)
599 END DO
600 END IF
601!
602! Set time indices for adjoint predictor step.
603!
604 next_indx1=3-indx1(ng)
605 IF (.not.predictor_2d_step(ng)) THEN
606 predictor_2d_step(ng)=.true.
607!^ knew(ng)=next_indx1
608!^ kstp(ng)=3-knew(ng)
609!^ krhs(ng)=3
610!^
611 kt=knew(ng)
612 ks=kstp(ng)
613 knew(ng)=krhs(ng)
614 kstp(ng)=kt
615 krhs(ng)=ks
616!^ IF (my_iif.lt.(nfast(ng)+1)) indx1(ng)=next_indx1
617 END IF
618 END DO
619
620# ifdef NESTING
621
622!
623! If composite or mosaic grids, process additional points in the
624! contact zone between connected grids for the state variables
625! associated with the 2D engine Predictor Step section.
626! If refinement, check mass flux conservation between coarse and
627! fine grids during debugging.
628!
629 DO ig=1,gridsinlayer(nl)
630 ng=gridnumber(ig,nl)
631 IF (any(compositegrid(:,ng))) THEN
632 CALL ad_nesting (ng, iadm, n2dps)
633 END IF
634 IF (refinedgrid(ng).and.(refinescale(ng).gt.0)) THEN
635 CALL ad_nesting (ng, iadm, nmflx)
636 END IF
637 END DO
638# endif
639!
640! Predictor step - Advance adjoint barotropic equations using 2D
641! ============== time-step predictor scheme. No actual time-
642! stepping is performed during the auxiliary (nfast+1) time-step.
643! It is needed to finalize the fast-time averaging of 2D fields,
644! if any, and compute the new time-evolving depths.
645!
646 DO ig=1,gridsinlayer(nl)
647 ng=gridnumber(ig,nl)
648 IF (my_iif.le.(nfast(ng)+1)) THEN
649 DO tile=last_tile(ng),first_tile(ng),-1
650 CALL ad_step2d (ng, tile)
651 END DO
652 END IF
653!
654! Set time indices for next adjoint corrector step. The
655! PREDICTOR_2D_STEP switch it is assumed to be false before the
656! first time-step.
657!
658 IF (predictor_2d_step(ng).and. &
659 & my_iif.le.(nfast(ng)+1)) THEN
660 predictor_2d_step(ng)=.false.
661!^ IF (FIRST_2D_STEP) THEN
662!^ kstp(ng)=indx1(ng)
663!^ ELSE
664!^ kstp(ng)=3-indx1(ng)
665!^ END IF
666!^ knew(ng)=3
667!^ krhs(ng)=indx1(ng)
668!^
669 ks=knew(ng)
670 knew(ng)=krhs(ng)
671 krhs(ng)=ks
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! If appropriate, read observation and model state at observation
684! locations. Then, compute adjoint forcing terms due to observations.
685!-----------------------------------------------------------------------
686!
687 DO ig=1,gridsinlayer(nl)
688 ng=gridnumber(ig,nl)
689# ifdef SENSITIVITY_4DVAR
690# ifdef RBL4DVAR_FCT_SENSITIVITY
691 IF (.not.lsen4dvar(ng).and.lsenfct(ng)) THEN
692# else
693 IF (.not.lsen4dvar(ng)) THEN
694# endif
695# endif
696 halfdt=0.5_r8*dt(ng)
697 IF (((time(ng)-halfdt).le.obstime(ng)).and. &
698 & (obstime(ng).lt.(time(ng)+halfdt))) THEN
699 processobs(ng)=.true.
700 CALL obs_read (ng, iadm, backward)
701 ELSE
702 processobs(ng)=.false.
703 END IF
704!
705# ifdef SP4DVAR
706!
707! Skip assimilation of obs on first timestep unless inter=Nsaddle.
708!
709 IF ((iic(ng).ne.ntstart(ng)).or.lsadd(ng)) THEN
710# endif
711
712 DO tile=first_tile(ng),last_tile(ng),+1
713# ifdef WEAK_CONSTRAINT
714 CALL ad_htobs (ng, tile, iadm)
715# else
716 CALL ad_misfit (ng, tile, iadm)
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! If appropriate, add representer coefficients (Beta hat) impulse
734! forcing to adjoint solution. Read next impulse record, if available.
735!-----------------------------------------------------------------------
736!
737 DO ig=1,gridsinlayer(nl)
738 ng=gridnumber(ig,nl)
739 IF (processobs(ng)) THEN
740 DO tile=first_tile(ng),last_tile(ng),+1
741 CALL ad_force_dual (ng, tile, kstp(ng), nstp(ng))
742 END DO
743 END IF
744 END DO
745# endif
746
747# ifdef NESTING
748
749! If composite or mosaic grids, process additional points in the
750! contact zone between connected grids for right-hand-side terms
751! (tracers).
752!
753 DO ig=1,gridsinlayer(nl)
754 ng=gridnumber(ig,nl)
755 IF (any(compositegrid(:,ng))) THEN
756 CALL ad_nesting (ng, iadm, nrhst)
757 END IF
758 END DO
759# endif
760!
761!-----------------------------------------------------------------------
762! Compute adjoint right-hand-side terms for 3D equations. If
763! applicable, time-step turbulent mixing schemes.
764!-----------------------------------------------------------------------
765!
766 DO ig=1,gridsinlayer(nl)
767 ng=gridnumber(ig,nl)
768 DO tile=first_tile(ng),last_tile(ng),+1
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
774 CALL ad_rhs3d (ng, tile)
775 END DO
776 END DO
777
778# ifdef NESTING
779!
780!-----------------------------------------------------------------------
781! If refinement grid, interpolate (space, time) state variables
782! contact points from donor grid extracted data.
783!
784! Also, fill BRY_CONTACT(:,:)%Mflux to check for mass conservation
785! between coarse and fine grids. This is only done for diagnostic
786! purposes.
787!-----------------------------------------------------------------------
788!
789 DO ig=1,gridsinlayer(nl)
790 ng=gridnumber(ig,nl)
791 IF (refinedgrid(ng).and.(refinescale(ng).gt.0)) THEN
792 CALL ad_nesting (ng, iadm, nmflx)
793 CALL ad_nesting (ng, iadm, nputd)
794 END IF
795 END DO
796# endif
797!! END IF ADVANCE
798
799# ifdef NESTING
800!
801! If composite or mosaic grids, process additional points in the
802! contact zone between connected grids for 3D kernel free-surface.
803!
804 DO ig=1,gridsinlayer(nl)
805 ng=gridnumber(ig,nl)
806 IF (any(compositegrid(:,ng))) THEN
807 CALL ad_nesting (ng, iadm, nzeta)
808 END IF
809 END DO
810# endif
811!
812!-----------------------------------------------------------------------
813! Set adjoint free-surface to it time-averaged value.
814!-----------------------------------------------------------------------
815!
816 DO ig=1,gridsinlayer(nl)
817 ng=gridnumber(ig,nl)
818 DO tile=first_tile(ng),last_tile(ng),+1
819# ifdef DIAGNOSTICS
820!! CALL set_diags (ng, tile)
821# endif
822 CALL ad_set_zeta (ng, tile)
823 END DO
824 END DO
825!
826!-----------------------------------------------------------------------
827! Compute adjoint vertical mixing coefficients for momentum and
828! tracers. Compute adjoint S-coordinate vertical velocity,
829! diagnostically from horizontal mass divergence.
830!-----------------------------------------------------------------------
831!
832 DO ig=1,gridsinlayer(nl)
833 ng=gridnumber(ig,nl)
834 DO tile=last_tile(ng),first_tile(ng),-1
835# ifdef SENSITIVITY_4DVAR
836 IF (scalars(ng)%Lstate(iswvel)) THEN
837 CALL ad_wvelocity (ng, tile, nstp(ng))
838 END IF
839# endif
840 CALL ad_omega (ng, tile, iadm)
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! If stochastic optimals with respect the seminorm of chosen
855! functional, pack adjoint state surface forcing needed by the
856! dynamical propagator.
857!-----------------------------------------------------------------------
858!
859 DO ig=1,gridsinlayer(nl)
860 ng=gridnumber(ig,nl)
861 IF (mod(iic(ng)-1,nadj(ng)).eq.0) THEN
862 sorec(ng)=sorec(ng)+1
863 DO tile=first_tile(ng),last_tile(ng),+1
864 CALL ad_pack (ng, tile, nstr(ng), nend(ng), &
865 & storage(ng)%so_state(:,sorec(ng)))
866 END DO
867 END IF
868 END DO
869# endif
870
871# ifdef NESTING
872!
873! If composite or mosaic grids, process additional points in the
874! contact zone between connected grids for bottom stress variables.
875!
876 DO ig=1,gridsinlayer(nl)
877 ng=gridnumber(ig,nl)
878 IF (any(compositegrid(:,ng))) THEN
879 CALL ad_nesting (ng, iadm, nbstr)
880 END IF
881 END DO
882# endif
883!
884!-----------------------------------------------------------------------
885! Set adjoint fields for vertical boundary conditions. Process tidal
886! forcing, if any.
887!-----------------------------------------------------------------------
888!
889 DO ig=1,gridsinlayer(nl)
890 ng=gridnumber(ig,nl)
891 DO tile=first_tile(ng),last_tile(ng),+1
892# if defined SSH_TIDES_NOT_YET || defined UV_TIDES_NOT_YET
893 CALL ad_set_tides (ng, tile)
894# endif
895 CALL ad_set_vbc (ng, tile)
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! Compute radiation stress terms.
909!-----------------------------------------------------------------------
910!
911 DO ig=1,gridsinlayer(nl)
912 ng=gridnumber(ig,nl)
913 DO tile=last_tile(ng),first_tile(ng),-1
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! Couple to waves model every CoupleSteps(Iwaves) timesteps: get
923! waves/sea fluxes.
924!-----------------------------------------------------------------------
925!
926 DO ig=1,gridsinlayer(nl)
927 ng=gridnumber(ig,nl)
928 IF ((iic(ng).ne.ntstart(ng)).and. &
929 & mod(iic(ng)-1,couplesteps(iwaves,ng)).eq.0) THEN
930 DO tile=first_tile(ng),last_tile(ng),+1
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! Couple to atmospheric model every CoupleSteps(Iatmos) timesteps: get
941! air/sea fluxes.
942!-----------------------------------------------------------------------
943!
944 DO ig=1,gridsinlayer(nl)
945 ng=gridnumber(ig,nl)
946 IF ((iic(ng).ne.ntstart(ng)).and. &
947 & mod(iic(ng)-1,couplesteps(iatmos,ng)).eq.0) THEN
948 DO tile=last_tile(ng),first_tile(ng),-1
949 CALL ocn2atm_coupling (ng, tile)
950 END DO
951 END IF
952 END DO
953# endif
954!
955!-----------------------------------------------------------------------
956! Compute adjoint density related fields and horizontal mass fluxes
957! (Hz*u/n and Hz*v/m). If applicable, compute and report diagnostics
958! and accumulate time-averaged adjoint fields which needs a
959! irreversible loop in shared-memory jobs.
960!-----------------------------------------------------------------------
961!
962 DO ig=1,gridsinlayer(nl)
963 ng=gridnumber(ig,nl)
964 DO tile=first_tile(ng),last_tile(ng),+1 ! irreversible
965# ifndef TS_FIXED
966 CALL ad_rho_eos (ng, tile, iadm)
967# endif
968 CALL ad_set_massflux (ng, tile, iadm)
969 CALL ad_diag (ng, tile)
970# ifdef AD_AVERAGES
971 CALL ad_set_avg (ng, tile)
972# endif
973 END DO
974 END DO
975 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
976
977# ifdef FORCING_SV
978!
979!-----------------------------------------------------------------------
980! Compute the adjoint forcing for the forcing singular vectors.
981!-----------------------------------------------------------------------
982!
983 DO ig=1,gridsinlayer(nl)
984 ng=gridnumber(ig,nl)
985 DO tile=first_tile(ng),last_tile(ng),+1
986 CALL ad_set_depth (ng, tile, iadm)
987 CALL ad_forcing (ng, tile, kstp(ng), nstp(ng))
988 END DO
989 END DO
990# endif
991!
992!-----------------------------------------------------------------------
993! Update 3D time-level indices.
994!-----------------------------------------------------------------------
995!
996! The original forward time-stepping indices are advanced as follows:
997!
998! nstp(ng)=1+MOD(iic(ng)-ntstart(ng),2)
999! nnew(ng)=3-nstp(ng)
1000! nrhs(ng)=nstp(ng)
1001!
1002! This yields the only 2 permutations:
1003!
1004! nstp nnew nrhs
1005! 1 2 1
1006! 2 1 2
1007!
1008! With nstp=1, nnew=1 and nrhs=2 at time zero, this is equivalent to
1009! the following:
1010!
1011! nstp(ng)=nnew(ng)
1012! nnew(ng)=nrhs(ng)
1013! nrhs(ng)=nstp(ng)
1014!
1015! The adjoint of this is as follows:
1016!
1017! nstp(ng)=nrhs(ng)
1018! nrhs(ng)=nnew(ng)
1019! nnew(ng)=nstp(ng)
1020!
1021 DO ig=1,gridsinlayer(nl)
1022 ng=gridnumber(ig,nl)
1023 IF (iic(ng).ne.ntend(ng)) THEN
1024 nrhs(ng)=nnew(ng)
1025 nnew(ng)=nstp(ng)
1026 nstp(ng)=nrhs(ng)
1027 END IF
1028 END DO
1029
1030# ifdef AD_OUTPUT_STATE
1031!
1032!-----------------------------------------------------------------------
1033! Set full adjoint output arrays. Due to the exact discrete adjoint,
1034! the predictor/corrector time-stepping scheme with multiple time
1035! levels, pieces of the adjoint solution are in two-time levels and
1036! need to be added in the "_sol" arrays for output purposes.
1037!-----------------------------------------------------------------------
1038!
1039 DO ig=1,gridsinlayer(nl)
1040 ng=gridnumber(ig,nl)
1041 IF (iic(ng).ne.ntend(ng)) THEN
1042 DO tile=last_tile(ng),first_tile(ng),-1
1043 CALL ad_out_fields (ng, tile, iadm)
1044 END DO
1045 DO tile=first_tile(ng),last_tile(ng),+1
1046 CALL ad_set_depth (ng, tile, iadm)
1047 CALL ad_out_zeta (ng, tile, iadm)
1048 END DO
1049 END IF
1050 END DO
1051# endif
1052# ifndef FORCING_SV
1053!
1054!-----------------------------------------------------------------------
1055! On the last timestep, it computes the adjoint of initial depths and
1056! level thicknesses from the initial free-surface field. Additionally,
1057! it initializes the adjoint state variables for all time levels and
1058! and applies lateral boundary conditions.
1059!-----------------------------------------------------------------------
1060!
1061 DO ig=1,gridsinlayer(nl)
1062 ng=gridnumber(ig,nl)
1063 IF (iic(ng).eq.ntend(ng)) THEN
1064 CALL ad_post_initial (ng, iadm)
1065 END IF
1066 END DO
1067# endif
1068
1069# if defined ADJUST_STFLUX || defined ADJUST_WSTRESS
1070!
1071!-----------------------------------------------------------------------
1072! Interpolate surface forcing increments and adjust surface forcing.
1073! Skip first timestep.
1074!-----------------------------------------------------------------------
1075!
1076# ifdef RBL4DVAR_FCT_SENSITIVITY
1077 DO ig=1,gridsinlayer(nl)
1078 ng=gridnumber(ig,nl)
1079 IF (.not.lsen4dvar(ng)) THEN ! ignore in forecast
1080 IF (iic(ng).ne.ntstart(ng)) THEN ! interval
1081 DO tile=first_tile(ng),last_tile(ng),+1
1082 CALL ad_frc_adjust (ng, tile, lfout(ng))
1083 END DO
1084 END IF
1085 END IF
1086 END DO
1087# else
1088 DO ig=1,gridsinlayer(nl)
1089 ng=gridnumber(ig,nl)
1090 IF (iic(ng).ne.ntstart(ng)) THEN
1091 DO tile=first_tile(ng),last_tile(ng),+1
1092 CALL ad_frc_adjust (ng, tile, lfout(ng))
1093 END DO
1094 END IF
1095 END DO
1096# endif
1097# endif
1098
1099# ifdef ADJUST_BOUNDARY
1100!
1101!-----------------------------------------------------------------------
1102! Interpolate open boundary increments and adjust open boundaries.
1103! Skip first timestep.
1104!-----------------------------------------------------------------------
1105!
1106# ifdef RBL4DVAR_FCT_SENSITIVITY
1107 DO ig=1,gridsinlayer(nl)
1108 ng=gridnumber(ig,nl)
1109 IF (.not.lsen4dvar(ng)) THEN ! ignore in forecast
1110 IF (iic(ng).ne.ntstart(ng)) THEN ! interval
1111 DO tile=first_tile(ng),last_tile(ng),+1
1112 CALL ad_obc2d_adjust (ng, tile, lbout(ng))
1113 CALL ad_set_depth_bry (ng, tile, iadm)
1114 CALL ad_obc_adjust (ng, tile, lbout(ng))
1115 END DO
1116 END IF
1117 END IF
1118 END DO
1119# else
1120 DO ig=1,gridsinlayer(nl)
1121 ng=gridnumber(ig,nl)
1122 IF (iic(ng).ne.ntstart(ng)) THEN
1123 DO tile=first_tile(ng),last_tile(ng),+1
1124 CALL ad_obc2d_adjust (ng, tile, lbout(ng))
1125 CALL ad_set_depth_bry (ng, tile, iadm)
1126 CALL ad_obc_adjust (ng, tile, lbout(ng))
1127 END DO
1128 END IF
1129 END DO
1130# endif
1131# endif
1132
1133# if defined WEAK_CONSTRAINT && !defined SP4DVAR
1134!
1135!-----------------------------------------------------------------------
1136! Gather weak constraint forcing to storage arrays.
1137!-----------------------------------------------------------------------
1138!
1139 DO ig=1,gridsinlayer(nl)
1140 ng=gridnumber(ig,nl)
1141 IF (iic(ng).ne.ntstart(ng)) THEN
1142 DO tile=first_tile(ng),last_tile(ng),+1
1143 CALL ad_set_depth (ng, tile, iadm)
1144 CALL frc_adgather (ng, tile)
1145 END DO
1146 END IF
1147 END DO
1148# endif
1149!
1150!-----------------------------------------------------------------------
1151! If appropriate, write out fields into output NetCDF files. Notice
1152! that IO data is written in delayed and serial mode.
1153!-----------------------------------------------------------------------
1154!
1155 DO ig=1,gridsinlayer(nl)
1156 ng=gridnumber(ig,nl)
1157 CALL ad_output (ng)
1159 & __line__, myfile)) RETURN
1160 END DO
1161
1162# if defined WEAK_CONSTRAINT && !defined SP4DVAR
1163!
1164!-----------------------------------------------------------------------
1165! Copy storage arrays index 1 into index 2, and clear index 1.
1166!-----------------------------------------------------------------------
1167!
1168 DO ig=1,gridsinlayer(nl)
1169 ng=gridnumber(ig,nl)
1170 IF (mod(iic(ng)-1,nadj(ng)).eq.0) THEN
1171 DO tile=first_tile(ng),last_tile(ng),+1
1172 CALL frc_clear (ng, tile)
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 !defined OBS_SPACE
1181!
1182!-----------------------------------------------------------------------
1183! Add appropriate forcing terms to the adjoint model. The form of the
1184! forcing depends on the functional whose sensitivity is required.
1185!-----------------------------------------------------------------------
1186!
1187 DO ig=1,gridsinlayer(nl)
1188 ng=gridnumber(ig,nl)
1189# ifdef SENSITIVITY_4DVAR
1190 IF (lsen4dvar(ng)) THEN
1191# endif
1192# if !defined AD_IMPULSE
1193 IF ((dends(ng).ge.tdays(ng)).and. &
1194 & (tdays(ng).ge.dstrs(ng))) THEN
1195# endif
1196 DO tile=first_tile(ng),last_tile(ng),+1
1197 CALL adsen_force (ng, tile)
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! Set adjoint time indices and time clock.
1210!-----------------------------------------------------------------------
1211!
1212 DO ig=1,gridsinlayer(nl)
1213 ng=gridnumber(ig,nl)
1214 iic(ng)=iic(ng)-1
1215# ifndef NESTING
1216 step_counter(ng)=step_counter(ng)-1
1217# endif
1218 time(ng)=time(ng)-dt(ng)
1219 CALL time_string (time(ng), time_code(ng))
1220 END DO
1221
1222 END DO step_loop
1223
1224 END DO nest_layer
1225
1226 END DO kernel_loop
1227!
1228 RETURN
1229 END SUBROUTINE ad_main3d
1230#else
1231 SUBROUTINE ad_main3d
1232 RETURN
1233 END SUBROUTINE ad_main3d
1234#endif
subroutine ad_get_data(ng)
Definition ad_get_data.F:4
subroutine ad_main3d(runinterval)
Definition ad_main3d.F:4
subroutine ad_output(ng)
Definition ad_output.F:4
subroutine ad_set_data(ng, tile)
Definition ad_set_data.F:4
subroutine, public ad_biology(ng, tile)
subroutine, public ad_diag(ng, tile)
Definition ad_diag.F:25
subroutine, public ad_force_dual(ng, tile, kfrc, nfrc)
subroutine, public ad_forcing(ng, tile, kfrc, nfrc)
Definition ad_forcing.F:26
subroutine, public ad_frc_adjust(ng, tile, linp)
subroutine ad_htobs(ng, tile, model)
Definition ad_htobs.F:30
subroutine, public ad_out_zeta(ng, tile, model)
subroutine, public ad_out_fields(ng, tile, model)
subroutine ad_misfit(ng, tile, model)
Definition ad_misfit.F:29
subroutine, public ad_nesting(ng, model, isection)
Definition ad_nesting.F:136
subroutine, public ad_obc2d_adjust(ng, tile, linp)
subroutine, public ad_obc_adjust(ng, tile, linp)
subroutine, public ad_omega(ng, tile, model)
Definition ad_omega.F:31
subroutine, public ad_post_initial(ng, model)
subroutine, public ad_rho_eos(ng, tile, model)
Definition ad_rho_eos.F:49
subroutine, public ad_rhs3d(ng, tile)
Definition ad_rhs3d.F:29
subroutine, public ad_set_avg(ng, tile)
Definition ad_set_avg.F:26
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)
Definition ad_set_vbc.F:32
subroutine, public ad_set_zeta(ng, tile)
Definition ad_set_zeta.F:27
subroutine, public ad_step2d(ng, tile)
subroutine, public ad_step3d_t(ng, tile)
Definition ad_step3d_t.F:47
subroutine, public ad_step3d_uv(ng, tile)
subroutine, public ad_wvelocity(ng, tile, ninp)
subroutine, public adsen_force(ng, tile)
Definition adsen_force.F:29
subroutine ana_vmix(ng, tile, model)
Definition ana_vmix.h:3
subroutine, public bulk_flux(ng, tile)
Definition bulk_flux.F:107
subroutine, public time_string(mytime, date_string)
Definition dateclock.F:1272
subroutine, public frc_clear(ng, tile)
Definition frc_weak.F:406
subroutine, public frc_adgather(ng, tile)
Definition frc_weak.F:27
integer, dimension(:,:), allocatable couplesteps
integer iatmos
integer iwaves
logical, dimension(:), allocatable lsenfct
logical, dimension(:), allocatable lsadd
logical, dimension(:), allocatable lsen4dvar
logical, dimension(:), allocatable processobs
integer iswvel
integer, parameter nrhst
Definition mod_nesting.F:87
integer, parameter ngetd
Definition mod_nesting.F:77
integer, parameter n2dfx
Definition mod_nesting.F:92
integer, parameter nputd
Definition mod_nesting.F:79
integer, parameter nzeta
Definition mod_nesting.F:88
real(r8), dimension(:), allocatable twowayinterval
integer, parameter nzwgt
Definition mod_nesting.F:89
integer, parameter nmask
Definition mod_nesting.F:78
logical, dimension(:), allocatable donortofiner
integer, parameter n2way
Definition mod_nesting.F:80
integer, parameter n3duv
Definition mod_nesting.F:93
integer, parameter n2dps
Definition mod_nesting.F:90
integer, parameter n3dtv
Definition mod_nesting.F:94
integer, parameter nbstr
Definition mod_nesting.F:86
integer, parameter nmflx
Definition mod_nesting.F:75
integer, parameter n2dcs
Definition mod_nesting.F:91
integer numthreads
integer, dimension(:), allocatable first_tile
integer mythread
integer, dimension(:), allocatable last_tile
integer, dimension(:), allocatable nfloats
Definition mod_param.F:543
integer, dimension(:), allocatable nstr
Definition mod_param.F:646
integer, dimension(:,:), allocatable gridnumber
Definition mod_param.F:127
integer, parameter iadm
Definition mod_param.F:665
integer nestlayers
Definition mod_param.F:118
integer, parameter nft
Definition mod_param.F:539
integer ngrids
Definition mod_param.F:113
integer, dimension(:), allocatable nend
Definition mod_param.F:647
integer, dimension(:), allocatable gridsinlayer
Definition mod_param.F:122
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
integer exit_flag
real(dp), dimension(:), allocatable time4jedi
integer, dimension(:), allocatable indx1
logical, dimension(:,:), allocatable compositegrid
type(t_scalars), dimension(:), allocatable scalars
Definition mod_scalars.F:65
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 noerror
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
Definition mod_storage.F:91
subroutine, public nesting(ng, model, isection)
Definition nesting.F:140
subroutine, public obs_read(ng, model, backward)
Definition obs_read.F:42
subroutine, public omega(ng, tile, model)
Definition omega.F:42
subroutine, public rho_eos(ng, tile, model)
Definition rho_eos.F:48
subroutine, public set_depth(ng, tile, model)
Definition set_depth.F:34
subroutine, public reset_massflux(ng, tile, model)
subroutine, public set_massflux(ng, tile, model)
logical function, public founderror(flag, noerr, line, routine)
Definition strings.F:52
subroutine nlm_step_sequence(runinterval, icount)
Definition ntimestep.F:255
subroutine ntimesteps(model, runinterval, nl, nsteps, rsteps)
Definition ntimestep.F:3
subroutine ad_pack(ng, tile, mstr, mend, ad_state)
Definition packing.F:341