/[MITgcm]/MITgcm/model/src/the_model_main.F
ViewVC logotype

Diff of /MITgcm/model/src/the_model_main.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.59 by stephd, Mon Oct 6 20:37:30 2003 UTC revision 1.86 by heimbach, Fri Dec 10 19:56:31 2004 UTC
# Line 146  C    | | | |-INI_THETA  :: Set model ini Line 146  C    | | | |-INI_THETA  :: Set model ini
146  C    | | | |-INI_SALT   :: Set model initial salinity field.  C    | | | |-INI_SALT   :: Set model initial salinity field.
147  C    | | | |-INI_PSURF  :: Set model initial free-surface height/pressure.  C    | | | |-INI_PSURF  :: Set model initial free-surface height/pressure.
148  C    | | | |-INI_PRESSURE :: Compute model initial hydrostatic pressure  C    | | | |-INI_PRESSURE :: Compute model initial hydrostatic pressure
149  C    | | |  C    | | | |-READ_CHECKPOINT :: Read the checkpoint
 C    | | |-INI_TR1      :: Set initial tracer 1 distribution.  
150  C    | | |  C    | | |
151  C    | | |-THE_CORRECTION_STEP :: Step forward to next time step.  C    | | |-THE_CORRECTION_STEP :: Step forward to next time step.
152  C    | | | |                   :: Here applied to move restart conditions  C    | | | |                   :: Here applied to move restart conditions
# Line 226  C/\  | | | |                    :: for f Line 225  C/\  | | | |                    :: for f
225  C/\  | | | |                    C/\  | | | |                  
226  C/\  | | | |-EXCH :: Sync forcing. in overlap regions.  C/\  | | | |-EXCH :: Sync forcing. in overlap regions.
227  C/\  | | |-SEAICE_MODEL   :: Compute sea-ice terms. ( pkg/seaice )  C/\  | | |-SEAICE_MODEL   :: Compute sea-ice terms. ( pkg/seaice )
228    C/\  | | |-FREEZE         :: Limit surface temperature.
229  C/\  | | |-GCHEM_FIELD_LOAD :: load tracer forcing fields (pkg/gchem)  C/\  | | |-GCHEM_FIELD_LOAD :: load tracer forcing fields (pkg/gchem)
230  C/\  | | |  C/\  | | |
231  C/\  | | |-THERMODYNAMICS :: theta, salt + tracer equations driver.  C/\  | | |-THERMODYNAMICS :: theta, salt + tracer equations driver.
# Line 278  C/\  | | | | |-FREESURF_RESCALE_G :: Re- Line 278  C/\  | | | | |-FREESURF_RESCALE_G :: Re-
278  C/\  | | | |  C/\  | | | |
279  C/\  | | | |-TIMESTEP_TRACER      :: Step tracer field forward in time  C/\  | | | |-TIMESTEP_TRACER      :: Step tracer field forward in time
280  C/\  | | | |  C/\  | | | |
 C/\  | | | |-CALC_GTR1            :: Calculate other tracer(s) tendency terms  
 C/\  | | | | |  
 C/\  | | | | |-GAD_CALC_RHS       :: Generalised advection package  
 C/\  | | | | |                    :: ( see pkg/gad )  
 C/\  | | | | |  
 C/\  | | | | |-EXTERNAL_FORCING_TR:: Problem specific forcing for tracer.  
 C/\  | | | | |-ADAMS_BASHFORTH2   :: Extrapolate tendencies forward in time.  
 C/\  | | | | |-FREESURF_RESCALE_G :: Re-scale Gs for free-surface height.  
 C/\  | | | |  
281  C/\  | | | |-TIMESTEP_TRACER      :: Step tracer field forward in time  C/\  | | | |-TIMESTEP_TRACER      :: Step tracer field forward in time
282  C/\  | | | |  C/\  | | | |
283  C/\  | | | |-PTRACERS_INTEGRATE   :: Integrate other tracer(s) ( see pkg/ptracers ).  C/\  | | | |-PTRACERS_INTEGRATE   :: Integrate other tracer(s) ( see pkg/ptracers ).
# Line 303  C/\  | | | | |-FREESURF_RESCALE_G :: Re- Line 294  C/\  | | | | |-FREESURF_RESCALE_G :: Re-
294  C/\  | | | | |-TIMESTEP_TRACER    :: Step tracer field forward in time  C/\  | | | | |-TIMESTEP_TRACER    :: Step tracer field forward in time
295  C/\  | | | |  C/\  | | | |
296  C/\  | | | |-OBCS_APPLY_TS        :: Open bndy. package (see pkg/obcs ).  C/\  | | | |-OBCS_APPLY_TS        :: Open bndy. package (see pkg/obcs ).
 C/\  | | | |-FREEZE               :: Limit range of temperature.  
297  C/\  | | | |  C/\  | | | |
298  C/\  | | | |-IMPLDIFF             :: Solve vertical implicit diffusion equation.  C/\  | | | |-IMPLDIFF             :: Solve vertical implicit diffusion equation.
299  C/\  | | | |-OBCS_APPLY_TS        :: Open bndy. package (see pkg/obcs ).  C/\  | | | |-OBCS_APPLY_TS        :: Open bndy. package (see pkg/obcs ).
# Line 378  C/\  | | | |-GMREDI_DIAGS        :: GM d Line 368  C/\  | | | |-GMREDI_DIAGS        :: GM d
368  C/\  | | | |-KPP_DO_DIAGS        :: KPP diags. see pkg/kpp  C/\  | | | |-KPP_DO_DIAGS        :: KPP diags. see pkg/kpp
369  C/\  | | | |-SBO_CALC            :: SBO diags. see pkg/sbo  C/\  | | | |-SBO_CALC            :: SBO diags. see pkg/sbo
370  C/\  | | | |-SBO_DIAGS           :: SBO diags. see pkg/sbo  C/\  | | | |-SBO_DIAGS           :: SBO diags. see pkg/sbo
371    C/\  | | | |-SEAICE_DO_DIAGS     :: SEAICE diags. see pkg/seaice
372  C/\  | | | |-GCHEM_DIAGS         :: gchem diags. see pkg/gchem  C/\  | | | |-GCHEM_DIAGS         :: gchem diags. see pkg/gchem
373  C/\  | | |  C/\  | | |
374  C/\  | | |-WRITE_CHECKPOINT :: Do I/O for restart files.  C/\  | | |-WRITE_CHECKPOINT :: Do I/O for restart files.
# Line 402  C Line 393  C
393  CEOI  CEOI
394    
395    
396    #include "AD_CONFIG.h"
397    #include "PACKAGES_CONFIG.h"
398  #include "CPP_OPTIONS.h"  #include "CPP_OPTIONS.h"
399    
400  CBOP  CBOP
# Line 467  C     == Global variables === Line 460  C     == Global variables ===
460  #include "PARAMS.h"  #include "PARAMS.h"
461  #include "DYNVARS.h"  #include "DYNVARS.h"
462  #ifdef ALLOW_NONHYDROSTATIC  #ifdef ALLOW_NONHYDROSTATIC
463  #include "CG3D.h"  # include "CG3D.h"
464  #endif  #endif
465    
466  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
467  #include "tamc.h"  # include "tamc.h"
468    #endif
469    #ifdef ALLOW_CTRL
470    # include "optim.h"
471  #endif  #endif
472    
473  C     !INPUT/OUTPUT PARAMETERS:  C     !INPUT/OUTPUT PARAMETERS:
# Line 496  CEOP Line 492  CEOP
492  c--   set default:  c--   set default:
493        lastdiva = .TRUE.        lastdiva = .TRUE.
494    
495  #ifndef DISABLE_DEBUGMODE  #ifdef ALLOW_DEBUG
496        IF (debugMode) CALL DEBUG_ENTER('THE_MODEL_MAIN',myThid)        IF (debugMode) CALL DEBUG_ENTER('THE_MODEL_MAIN',myThid)
497  #endif  #endif
498    
499  C--   This timer encompasses the whole code  C--   This timer encompasses the whole code
500        CALL TIMER_START('ALL                    [THE_MODEL_MAIN]',myThid)        CALL TIMER_START('ALL                    [THE_MODEL_MAIN]',myThid)
501    
502  #ifndef DISABLE_DEBUGMODE  #ifdef ALLOW_DEBUG
503        IF (debugMode) CALL DEBUG_CALL('INITIALISE_FIXED',myThid)        IF (debugMode) CALL DEBUG_CALL('INITIALISE_FIXED',myThid)
504  #endif  #endif
505    
# Line 515  C--   Set model configuration (fixed arr Line 511  C--   Set model configuration (fixed arr
511        myCurrentTime = startTime        myCurrentTime = startTime
512        myCurrentIter = nIter0        myCurrentIter = nIter0
513    
514  #if ( defined (ALLOW_ADMTLM_RUN) )  #if ( defined (ALLOW_ADMTLM) )
515  c  c
516        CALL TIMER_START('ADMTLM_DRIVER          [THE_MODEL_MAIN]',mythid)        STOP 'should never get here; ADMTLM_DSVD calls ADMTLM_DRIVER'
       CALL ADMTLM_DRIVER ( myThid )  
       CALL TIMER_STOP ('ADMTLM_DRIVER          [THE_MODEL_MAIN]',mythid)  
517  c  c
518  #elif ( defined (ALLOW_ADJOINT_RUN) || \  #elif ( defined (ALLOW_AUTODIFF))
       defined (ALLOW_TANGENTLINEAR_RUN) || \  
       defined (ALLOW_GRADIENT_CHECK) || \  
       defined (ALLOW_ECCO_OPTIMIZATION) )  
519    
520    # ifndef EXCLUDE_CTRL_PACK
521        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
522        IF (myProcId .eq. 0) THEN        IF (myProcId .eq. 0) THEN
523           inquire( file='costfinal', exist=exst )           inquire( file='costfinal', exist=exst )
524           IF ( .NOT. exst) THEN           IF ( .NOT. exst .AND. niter0 .EQ. 0 ) THEN
525              CALL TIMER_START('CTRL_UNPACK      [THE_MODEL_MAIN]',mythid)              IF ( optimcycle.NE.0 ) THEN
526              CALL CTRL_UNPACK( mycurrentiter, mycurrenttime, mythid )                 CALL TIMER_START('CTRL_UNPACK   [THE_MODEL_MAIN]',mythid)
527              CALL TIMER_STOP ('CTRL_UNPACK      [THE_MODEL_MAIN]',mythid)                 CALL CTRL_UNPACK( .TRUE. , mythid )
528                   CALL TIMER_STOP ('CTRL_UNPACK   [THE_MODEL_MAIN]',mythid)
529                ENDIF
530           ENDIF           ENDIF
531        ENDIF        ENDIF
532        _END_MASTER( mythid )        _END_MASTER( mythid )
533        _BARRIER        _BARRIER
534    # endif /* EXCLUDE_CTRL_PACK */
535    
536    # ifdef ALLOW_COST
537        CALL COST_DEPENDENT_INIT ( mythid )        CALL COST_DEPENDENT_INIT ( mythid )
538        _BARRIER        _BARRIER
539    # endif
540    
541  # if ( defined (ALLOW_TANGENTLINEAR_RUN) )  # if ( defined (ALLOW_TANGENTLINEAR_RUN) )
542  c  c
# Line 560  c-- The following assumes the TAF option Line 557  c-- The following assumes the TAF option
557           CALL COST_FINAL_STORE ( mythid, lastdiva )           CALL COST_FINAL_STORE ( mythid, lastdiva )
558        ELSE        ELSE
559           CALL TIMER_START('ADTHE_MAIN_LOOP       [ADJOINT RUN]', mythid)           CALL TIMER_START('ADTHE_MAIN_LOOP       [ADJOINT RUN]', mythid)
560           CALL ADTHE_MAIN_LOOP ( mythid )           CALL ADTHE_MAIN_LOOP ( myCurrentTime, myCurrentIter, mythid )
561           CALL TIMER_STOP ('ADTHE_MAIN_LOOP       [ADJOINT RUN]', mythid)           CALL TIMER_STOP ('ADTHE_MAIN_LOOP       [ADJOINT RUN]', mythid)
562           CALL COST_FINAL_RESTORE ( mythid, lastdiva )           CALL COST_FINAL_RESTORE ( mythid, lastdiva )
563        ENDIF        ENDIF
564  c--  c--
565  #  else /* ALLOW_DIVIDED_ADJOINT undef */  #  else /* ALLOW_DIVIDED_ADJOINT undef */
566        CALL TIMER_START('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)        CALL TIMER_START('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)
567        CALL ADTHE_MAIN_LOOP ( mythid )        CALL ADTHE_MAIN_LOOP ( myCurrentTime, myCurrentIter, mythid )
568    cph      CALL ADTHE_MAIN_LOOP ( mythid )
569        CALL TIMER_STOP ('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)        CALL TIMER_STOP ('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)
570  #  endif /* ALLOW_DIVIDED_ADJOINT */  #  endif /* ALLOW_DIVIDED_ADJOINT */
571  c  c
572    # else /* forward run only within AD setting */
573    
574    #ifdef ALLOW_DEBUG
575          IF (debugMode) CALL DEBUG_CALL('THE_MAIN_LOOP',myThid)
576    #endif
577    C--   Call time stepping loop of full model
578          CALL TIMER_START('THE_MAIN_LOOP          [THE_MODEL_MAIN]',myThid)
579          CALL THE_MAIN_LOOP( myCurrentTime, myCurrentIter, myThid )
580          CALL TIMER_STOP ('THE_MAIN_LOOP          [THE_MODEL_MAIN]',myThid)
581    
582  # endif  # endif
583    
584    # ifndef EXCLUDE_CTRL_PACK
585        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
586        IF ( myProcId .eq. 0 .AND. lastdiva ) THEN        IF ( myProcId .eq. 0 .AND. lastdiva ) THEN
587           CALL TIMER_START('CTRL_PACK           [THE_MODEL_MAIN]',mythid)           CALL TIMER_START('CTRL_PACK           [THE_MODEL_MAIN]',mythid)
588           call CTRL_PACK( mycurrentiter, mycurrenttime, mythid )           call CTRL_PACK( .FALSE. , mythid )
589           CALL TIMER_STOP ('CTRL_PACK           [THE_MODEL_MAIN]',mythid)           CALL TIMER_STOP ('CTRL_PACK           [THE_MODEL_MAIN]',mythid)
590             IF ( optimcycle.EQ.0 .AND. mycurrentiter.EQ.niter0 ) THEN
591                CALL TIMER_START('CTRL_PACK     [THE_MODEL_MAIN]',mythid)
592                CALL CTRL_PACK( .TRUE. , mythid )
593                CALL TIMER_STOP ('CTRL_PACK     [THE_MODEL_MAIN]',mythid)
594             ENDIF
595        ENDIF        ENDIF
596        _END_MASTER( mythid )        _END_MASTER( mythid )
597        _BARRIER        _BARRIER
598  c  # endif /* EXCLUDE_CTRL_PACK */
599    
600    
601  # ifdef ALLOW_GRADIENT_CHECK  # ifdef ALLOW_GRDCHK
602        IF ( useGrdchk .AND. lastdiva ) THEN        IF ( useGrdchk .AND. lastdiva ) THEN
603           CALL TIMER_START('GRDCHK_MAIN         [THE_MODEL_MAIN]',mythid)           CALL TIMER_START('GRDCHK_MAIN         [THE_MODEL_MAIN]',mythid)
604           CALL GRDCHK_MAIN( mythid )           CALL GRDCHK_MAIN( mythid )
# Line 594  c Line 609  c
609    
610  #else /* ALL AD-related undef */  #else /* ALL AD-related undef */
611    
612  #ifndef DISABLE_DEBUGMODE  #ifdef ALLOW_DEBUG
613        IF (debugMode) CALL DEBUG_CALL('THE_MAIN_LOOP',myThid)        IF (debugMode) CALL DEBUG_CALL('THE_MAIN_LOOP',myThid)
614  #endif  #endif
   
615  C--   Call time stepping loop of full model  C--   Call time stepping loop of full model
616        CALL TIMER_START('THE_MAIN_LOOP          [THE_MODEL_MAIN]',myThid)        CALL TIMER_START('THE_MAIN_LOOP          [THE_MODEL_MAIN]',myThid)
617        CALL THE_MAIN_LOOP( myCurrentTime, myCurrentIter, myThid )        CALL THE_MAIN_LOOP( myCurrentTime, myCurrentIter, myThid )
# Line 605  C--   Call time stepping loop of full mo Line 619  C--   Call time stepping loop of full mo
619    
620  #endif /* ALLOW_TANGENTLINEAR_RUN ALLOW_ADJOINT_RUN ALLOW_ADMTLM_RUN */  #endif /* ALLOW_TANGENTLINEAR_RUN ALLOW_ADJOINT_RUN ALLOW_ADMTLM_RUN */
621    
 C--   Sea-ice checkpoint (in case the in-loop checkpoint was missed)  
 #ifdef ALLOW_SEAICE  
       IF ( useSEAICE )  
      &     CALL SEAICE_WRITE_PICKUP(  
      &     .TRUE., myCurrentTime, myCurrentIter, myThid )  
 #endif  
   
622  C--   Final checkpoint (in case the in-loop checkpoint was missed)  C--   Final checkpoint (in case the in-loop checkpoint was missed)
623        CALL TIMER_START('WRITE_CHECKPOINT       [THE_MODEL_MAIN]',myThid)        CALL TIMER_START('WRITE_CHECKPOINT       [THE_MODEL_MAIN]',myThid)
624          CALL PACKAGES_WRITE_PICKUP(
625         I        .TRUE., myCurrentTime, myCurrentIter, myThid )
626        CALL WRITE_CHECKPOINT(        CALL WRITE_CHECKPOINT(
627       &        .TRUE., myCurrentTime, myCurrentIter, myThid )       I        .TRUE., myCurrentTime, myCurrentIter, myThid )
628        CALL TIMER_STOP ('WRITE_CHECKPOINT       [THE_MODEL_MAIN]',myThid)        CALL TIMER_STOP ('WRITE_CHECKPOINT       [THE_MODEL_MAIN]',myThid)
629    
630        CALL TIMER_STOP ('ALL                    [THE_MODEL_MAIN]',myThid)        CALL TIMER_STOP ('ALL                    [THE_MODEL_MAIN]',myThid)
631    
632    #ifdef ALLOW_MNC
633          IF (useMNC) THEN
634    C       Close all open NetCDF files
635            _BEGIN_MASTER( mythid )
636            CALL MNC_FILE_CLOSE_ALL( myThid )
637            _END_MASTER( mythid )
638          ENDIF
639    #endif
640    
641  C--   Write timer statistics  C--   Write timer statistics
642        IF ( myThid .EQ. 1 ) THEN        IF ( myThid .EQ. 1 ) THEN
643         CALL TIMER_PRINTALL( myThid )         CALL TIMER_PRINTALL( myThid )
644         CALL COMM_STATS         CALL COMM_STATS
645        ENDIF        ENDIF
646    
647  #ifndef DISABLE_DEBUGMODE  #ifdef ALLOW_DEBUG
648        IF (debugMode) CALL DEBUG_LEAVE('THE_MODEL_MAIN',myThid)        IF (debugMode) CALL DEBUG_LEAVE('THE_MODEL_MAIN',myThid)
649  #endif  #endif
650    

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.86

  ViewVC Help
Powered by ViewVC 1.1.22