/[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.96 by jmc, Sat Jul 29 21:02:12 2006 UTC revision 1.106 by jmc, Thu Oct 15 00:38:21 2009 UTC
# Line 43  C    |              :: specific region i Line 43  C    |              :: specific region i
43  C    |  C    |
44  C    |-INITIALISE_FIXED :: Set fixed model arrays such as topography,  C    |-INITIALISE_FIXED :: Set fixed model arrays such as topography,
45  C    | |                :: grid, solver matrices etc..  C    | |                :: grid, solver matrices etc..
46  C    | |                C    | |
47  C    | |-INI_PARMS :: Routine to set kernel model parameters.  C    | |-INI_PARMS :: Routine to set kernel model parameters.
48  C    | |           :: By default kernel parameters are read from file  C    | |           :: By default kernel parameters are read from file
49  C    | |           :: "data" in directory in which code executes.  C    | |           :: "data" in directory in which code executes.
# Line 163  C    | | | |-CONVECTIVE_ADJUSTMENT :: Co Line 163  C    | | | |-CONVECTIVE_ADJUSTMENT :: Co
163  C    | | | | |-FIND_RHO  :: Find adjacent densities.  C    | | | | |-FIND_RHO  :: Find adjacent densities.
164  C    | | | | |-CONVECT   :: Mix static instability.  C    | | | | |-CONVECT   :: Mix static instability.
165  C    | | | | |-TIMEAVE_CUMULATE :: Update convection statistics.  C    | | | | |-TIMEAVE_CUMULATE :: Update convection statistics.
166  C    | | | |  C    | | | |
167  C    | | | |-CALC_EXACT_ETA        :: Change SSH to flow divergence.      C    | | | |-CALC_EXACT_ETA        :: Change SSH to flow divergence.
168  C    | | |  C    | | |
169  C    | | |-CONVECTIVE_ADJUSTMENT_INI :: Control static instability mixing  C    | | |-CONVECTIVE_ADJUSTMENT_INI :: Control static instability mixing
170  C    | | | |                         :: Extra time history interactions.  C    | | | |                         :: Extra time history interactions.
171  C    | | | |                        C    | | | |
172  C    | | | |-FIND_RHO  :: Find adjacent densities.  C    | | | |-FIND_RHO  :: Find adjacent densities.
173  C    | | | |-CONVECT   :: Mix static instability.  C    | | | |-CONVECT   :: Mix static instability.
174  C    | | | |-TIMEAVE_CUMULATE :: Update convection statistics.  C    | | | |-TIMEAVE_CUMULATE :: Update convection statistics.
# Line 178  C    | | | |                       :: pa Line 178  C    | | | |                       :: pa
178  C    | | | |  C    | | | |
179  C    | | | |-GMREDI_INIT          :: GM package. ( see pkg/gmredi )  C    | | | |-GMREDI_INIT          :: GM package. ( see pkg/gmredi )
180  C    | | | |-KPP_INIT             :: KPP package. ( see pkg/kpp )  C    | | | |-KPP_INIT             :: KPP package. ( see pkg/kpp )
181  C    | | | |-KPP_OPEN_DIAGS      C    | | | |-KPP_OPEN_DIAGS
182  C    | | | |-OBCS_INIT_VARIABLES  :: Open bndy. package. ( see pkg/obcs )  C    | | | |-OBCS_INIT_VARIABLES  :: Open bndy. package. ( see pkg/obcs )
183  C    | | | |-PTRACERS_INIT        :: multi. tracer package,(see pkg/ptracers)  C    | | | |-PTRACERS_INIT        :: multi. tracer package,(see pkg/ptracers)
184  C    | | | |-GCHEM_INIT           :: tracer interface pkg (see pkh/gchem)  C    | | | |-GCHEM_INIT           :: tracer interface pkg (see pkh/gchem)
# Line 222  C/\  | | |-EXF_GETFORCING :: External fo Line 222  C/\  | | |-EXF_GETFORCING :: External fo
222  C/\  | | |-EXTERNAL_FIELDS_LOAD :: Control loading time dep. external data.  C/\  | | |-EXTERNAL_FIELDS_LOAD :: Control loading time dep. external data.
223  C/\  | | | |                    :: Simple interpolation between end-points  C/\  | | | |                    :: Simple interpolation between end-points
224  C/\  | | | |                    :: for forcing datasets.  C/\  | | | |                    :: for forcing datasets.
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.  C/\  | | |-FREEZE         :: Limit surface temperature.
# Line 288  C/\  | | | | | |-KPP_TRANSPORT_PTR:: KPP Line 288  C/\  | | | | | |-KPP_TRANSPORT_PTR:: KPP
288  C/\  | | | | |  C/\  | | | | |
289  C/\  | | | | |-PTRACERS_FORCING   :: Problem specific forcing for tracer.  C/\  | | | | |-PTRACERS_FORCING   :: Problem specific forcing for tracer.
290  C/\  | | | | |-GCHEM_FORCING_INT  :: tracer forcing for gchem pkg (if all  C/\  | | | | |-GCHEM_FORCING_INT  :: tracer forcing for gchem pkg (if all
291  C/\  | | | | |                       tendancy terms calcualted together)  C/\  | | | | |                       tendency terms calcualted together)
292  C/\  | | | | |-ADAMS_BASHFORTH2   :: Extrapolate tendencies forward in time.  C/\  | | | | |-ADAMS_BASHFORTH2   :: Extrapolate tendencies forward in time.
293  C/\  | | | | |-FREESURF_RESCALE_G :: Re-scale Gs for free-surface height.  C/\  | | | | |-FREESURF_RESCALE_G :: Re-scale Gs for free-surface height.
294  C/\  | | | | |-TIMESTEP_TRACER    :: Step tracer field forward in time  C/\  | | | | |-TIMESTEP_TRACER    :: Step tracer field forward in time
# Line 307  C/\  | | | |-CALC_GRAD_PHI_SURF :: Calcu Line 307  C/\  | | | |-CALC_GRAD_PHI_SURF :: Calcu
307  C/\  | | | |                       Potential anomaly.  C/\  | | | |                       Potential anomaly.
308  C/\  | | | |-CALC_VISCOSITY     :: Calculate net vertical viscosity  C/\  | | | |-CALC_VISCOSITY     :: Calculate net vertical viscosity
309  C/\  | | | | |-KPP_CALC_VISC    :: KPP package ( see pkg/kpp ).  C/\  | | | | |-KPP_CALC_VISC    :: KPP package ( see pkg/kpp ).
310  C/\  | | | |                                                        C/\  | | | |
311  C/\  | | | |-CALC_PHI_HYD       :: Integrate the hydrostatic relation.  C/\  | | | |-CALC_PHI_HYD       :: Integrate the hydrostatic relation.
312  C/\  | | | |-MOM_FLUXFORM       :: Flux form mom eqn. package ( see  C/\  | | | |-MOM_FLUXFORM       :: Flux form mom eqn. package ( see
313  C/\  | | | |                       pkg/mom_fluxform ).  C/\  | | | |                       pkg/mom_fluxform ).
# Line 349  C/\  | | | | |-FIND_RHO  :: Find adjacen Line 349  C/\  | | | | |-FIND_RHO  :: Find adjacen
349  C/\  | | | | |-CONVECT   :: Mix static instability.  C/\  | | | | |-CONVECT   :: Mix static instability.
350  C/\  | | | | |-TIMEAVE_CUMULATE :: Update convection statistics.  C/\  | | | | |-TIMEAVE_CUMULATE :: Update convection statistics.
351  C/\  | | | |  C/\  | | | |
352  C/\  | | | |-CALC_EXACT_ETA        :: Change SSH to flow divergence.      C/\  | | | |-CALC_EXACT_ETA        :: Change SSH to flow divergence.
353  C/\  | | |  C/\  | | |
354  C/\  | | |-DO_FIELDS_BLOCKING_EXCHANGES :: Sync up overlap regions.  C/\  | | |-DO_FIELDS_BLOCKING_EXCHANGES :: Sync up overlap regions.
355  C/\  | | | |-EXCH                                                    C/\  | | | |-EXCH
356  C/\  | | |  C/\  | | |
357  C/\  | | |-GCHEM_FORCING_SEP :: tracer forcing for gchem pkg (if  C/\  | | |-GCHEM_FORCING_SEP :: tracer forcing for gchem pkg (if
358  C/\  | | |                      tracer dependent tendencies calculated  C/\  | | |                      tracer dependent tendencies calculated
# Line 410  C     !INTERFACE: Line 410  C     !INTERFACE:
410    
411  C     !DESCRIPTION: \bv  C     !DESCRIPTION: \bv
412  C     *==========================================================*  C     *==========================================================*
413  C     | SUBROUTINE THE_MODEL_MAIN                                  C     | SUBROUTINE THE_MODEL_MAIN
414  C     | o Master controlling routine for model using the MITgcm    C     | o Master controlling routine for model using the MITgcm
415  C     |   UV parallel wrapper.                                      C     |   UV parallel wrapper.
416  C     *==========================================================*  C     *==========================================================*
417  C     | THE_MODEL_MAIN is invoked by the MITgcm UV parallel        C     | THE_MODEL_MAIN is invoked by the MITgcm UV parallel
418  C     | wrapper with a single integer argument "myThid". This      C     | wrapper with a single integer argument "myThid". This
419  C     | variable identifies the thread number of an instance of    C     | variable identifies the thread number of an instance of
420  C     | THE_MODEL_MAIN. Each instance of THE_MODEL_MAIN works      C     | THE_MODEL_MAIN. Each instance of THE_MODEL_MAIN works
421  C     | on a particular region of the models domain and            C     | on a particular region of the models domain and
422  C     | synchronises with other instances as necessary. The        C     | synchronises with other instances as necessary. The
423  C     | routine has to "understand" the MITgcm parallel            C     | routine has to "understand" the MITgcm parallel
424  C     | environment and the numerical algorithm. Editing this      C     | environment and the numerical algorithm. Editing this
425  C     | routine is best done with some knowledge of both aspects.  C     | routine is best done with some knowledge of both aspects.
426  C     | Notes                                                      C     | Notes
427  C     | =====                                                      C     | =====
428  C     | C*P* comments indicating place holders for which code is    C     | C*P* comments indicating place holders for which code is
429  C     |      presently being developed.                            C     |      presently being developed.
430  C     *==========================================================*  C     *==========================================================*
431  C     \ev  C     \ev
432    
# Line 474  C     == Global variables === Line 474  C     == Global variables ===
474  C     !INPUT/OUTPUT PARAMETERS:  C     !INPUT/OUTPUT PARAMETERS:
475  C     == Routine arguments ==  C     == Routine arguments ==
476  C     myThid - Thread number for this instance of the routine.  C     myThid - Thread number for this instance of the routine.
477        INTEGER myThid          INTEGER myThid
478    
479  C     !LOCAL VARIABLES:  C     !LOCAL VARIABLES:
480  C     == Local variables ==  C     == Local variables ==
# Line 494  c--   set default: Line 494  c--   set default:
494        lastdiva = .TRUE.        lastdiva = .TRUE.
495    
496  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
497        IF (debugMode) CALL DEBUG_ENTER('THE_MODEL_MAIN',myThid)  C-    cannot test for debugMode which has not yet been set
498          CALL DEBUG_ENTER('THE_MODEL_MAIN',myThid)
499  #endif  #endif
500    
501  #if defined(USE_PAPI) || defined(USE_PCL_FLOPS_SFP) || defined(USE_PCL_FLOPS) || defined(USE_PCL)  #if defined(USE_PAPI) || defined(USE_PCL_FLOPS_SFP) || defined(USE_PCL_FLOPS) || defined(USE_PCL)
# Line 504  C--   This timer encompasses the whole c Line 505  C--   This timer encompasses the whole c
505        CALL TIMER_START('ALL                    [THE_MODEL_MAIN]',myThid)        CALL TIMER_START('ALL                    [THE_MODEL_MAIN]',myThid)
506    
507  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
508        IF (debugMode) CALL DEBUG_CALL('INITIALISE_FIXED',myThid)  C-    cannot test for debugMode which has not yet been set
509          CALL DEBUG_CALL('INITIALISE_FIXED',myThid)
510  #endif  #endif
511    
512  C--   Set model configuration (fixed arrays)  C--   Set model configuration (fixed arrays)
# Line 512  C--   Set model configuration (fixed arr Line 514  C--   Set model configuration (fixed arr
514        CALL INITIALISE_FIXED( myThid )        CALL INITIALISE_FIXED( myThid )
515        CALL TIMER_STOP ('INITIALISE_FIXED       [THE_MODEL_MAIN]',myThid)        CALL TIMER_STOP ('INITIALISE_FIXED       [THE_MODEL_MAIN]',myThid)
516    
517    #ifdef ALLOW_DEBUG
518          IF (debugMode) CALL DEBUG_LEAVE('INITIALISE_FIXED',myThid)
519    #endif
520    
521        myCurrentTime = startTime        myCurrentTime = startTime
522        myCurrentIter = nIter0        myCurrentIter = nIter0
523    
# Line 544  c Line 550  c
550    
551  # if ( defined (ALLOW_TANGENTLINEAR_RUN) )  # if ( defined (ALLOW_TANGENTLINEAR_RUN) )
552  c  c
553    #ifdef ALLOW_DEBUG
554          IF (debugMode) CALL DEBUG_CALL('G_THE_MAIN_LOOP',myThid)
555    #endif
556        CALL TIMER_START('G_THE_MAIN_LOOP           [TANGENT RUN]',mythid)        CALL TIMER_START('G_THE_MAIN_LOOP           [TANGENT RUN]',mythid)
557        CALL G_THE_MAIN_LOOP ( myCurrentTime, myCurrentIter, myThid )        CALL G_THE_MAIN_LOOP ( myCurrentTime, myCurrentIter, myThid )
558        CALL TIMER_STOP ('G_THE_MAIN_LOOP           [TANGENT RUN]',mythid)        CALL TIMER_STOP ('G_THE_MAIN_LOOP           [TANGENT RUN]',mythid)
# Line 555  c Line 564  c
564  c-- The following assumes the TAF option '-pure'  c-- The following assumes the TAF option '-pure'
565        inquire( file='costfinal', exist=exst )        inquire( file='costfinal', exist=exst )
566        IF ( .NOT. exst) THEN        IF ( .NOT. exst) THEN
567    #ifdef ALLOW_DEBUG
568             IF (debugMode) CALL DEBUG_CALL('MDTHE_MAIN_LOOP',myThid)
569    #endif
570           CALL TIMER_START('MDTHE_MAIN_LOOP            [MD RUN]', mythid)           CALL TIMER_START('MDTHE_MAIN_LOOP            [MD RUN]', mythid)
571           CALL MDTHE_MAIN_LOOP ( myCurrentTime, myCurrentIter, mythid )           CALL MDTHE_MAIN_LOOP ( myCurrentTime, myCurrentIter, mythid )
572           CALL TIMER_STOP ('MDTHE_MAIN_LOOP            [MD RUN]', mythid)           CALL TIMER_STOP ('MDTHE_MAIN_LOOP            [MD RUN]', mythid)
573           CALL COST_FINAL_STORE ( mythid, lastdiva )           CALL COST_FINAL_STORE ( mythid, lastdiva )
574        ELSE        ELSE
575    #ifdef ALLOW_DEBUG
576             IF (debugMode) CALL DEBUG_CALL('ADTHE_MAIN_LOOP',myThid)
577    #endif
578           CALL TIMER_START('ADTHE_MAIN_LOOP       [ADJOINT RUN]', mythid)           CALL TIMER_START('ADTHE_MAIN_LOOP       [ADJOINT RUN]', mythid)
579           CALL ADTHE_MAIN_LOOP ( myCurrentTime, myCurrentIter, mythid )           CALL ADTHE_MAIN_LOOP (  mythid )
580           CALL TIMER_STOP ('ADTHE_MAIN_LOOP       [ADJOINT RUN]', mythid)           CALL TIMER_STOP ('ADTHE_MAIN_LOOP       [ADJOINT RUN]', mythid)
581           CALL COST_FINAL_RESTORE ( mythid, lastdiva )           CALL COST_FINAL_RESTORE ( mythid, lastdiva )
582        ENDIF        ENDIF
583  c--  c--
584  #  else /* ALLOW_DIVIDED_ADJOINT undef */  #  else /* ALLOW_DIVIDED_ADJOINT undef */
585    #ifdef ALLOW_DEBUG
586          IF (debugMode) CALL DEBUG_CALL('ADTHE_MAIN_LOOP',myThid)
587    #endif
588        CALL TIMER_START('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)        CALL TIMER_START('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)
589        CALL ADTHE_MAIN_LOOP ( myCurrentTime, myCurrentIter, mythid )  #ifdef ALLOW_ECCO
590  cph      CALL ADTHE_MAIN_LOOP ( mythid )        CALL ADTHE_MAIN_LOOP ( myCurrentTime, mythid )
591    #else
592          CALL ADTHE_MAIN_LOOP ( mythid )
593    #endif
594        CALL TIMER_STOP ('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)        CALL TIMER_STOP ('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)
595  #  endif /* ALLOW_DIVIDED_ADJOINT */  #  endif /* ALLOW_DIVIDED_ADJOINT */
596  c  c
# Line 579  c Line 600  c
600        IF (debugMode) CALL DEBUG_CALL('THE_MAIN_LOOP',myThid)        IF (debugMode) CALL DEBUG_CALL('THE_MAIN_LOOP',myThid)
601  #endif  #endif
602  C--   Call time stepping loop of full model  C--   Call time stepping loop of full model
603    #ifdef ALLOW_DEBUG
604          IF (debugMode) CALL DEBUG_CALL('THE_MAIN_LOOP',myThid)
605    #endif
606        CALL TIMER_START('THE_MAIN_LOOP          [THE_MODEL_MAIN]',myThid)        CALL TIMER_START('THE_MAIN_LOOP          [THE_MODEL_MAIN]',myThid)
607        CALL THE_MAIN_LOOP( myCurrentTime, myCurrentIter, myThid )        CALL THE_MAIN_LOOP( myCurrentTime, myCurrentIter, myThid )
608        CALL TIMER_STOP ('THE_MAIN_LOOP          [THE_MODEL_MAIN]',myThid)        CALL TIMER_STOP ('THE_MAIN_LOOP          [THE_MODEL_MAIN]',myThid)
# Line 624  C--   Call time stepping loop of full mo Line 648  C--   Call time stepping loop of full mo
648    
649  #endif /* ALLOW_TANGENTLINEAR_RUN ALLOW_ADJOINT_RUN ALLOW_ADMTLM */  #endif /* ALLOW_TANGENTLINEAR_RUN ALLOW_ADJOINT_RUN ALLOW_ADMTLM */
650    
 C--   Final checkpoint (in case the in-loop checkpoint was missed)  
       CALL TIMER_START('WRITE_CHECKPOINT       [THE_MODEL_MAIN]',myThid)  
       CALL PACKAGES_WRITE_PICKUP(  
      I        .TRUE., myCurrentTime, myCurrentIter, myThid )  
       CALL WRITE_CHECKPOINT(  
      I        .TRUE., myCurrentTime, myCurrentIter, myThid )  
       CALL TIMER_STOP ('WRITE_CHECKPOINT       [THE_MODEL_MAIN]',myThid)  
   
       CALL TIMER_STOP ('ALL                    [THE_MODEL_MAIN]',myThid)  
   
651  #ifdef ALLOW_DIAGNOSTICS  #ifdef ALLOW_DIAGNOSTICS
652        IF (useDiagnostics) THEN        IF (useDiagnostics) THEN
653  C       Close all diagnostics output files  C       Close all diagnostics output files
# Line 650  C       Close all open NetCDF files Line 664  C       Close all open NetCDF files
664        ENDIF        ENDIF
665  #endif  #endif
666    
667    C--   This timer encompasses the whole code
668          CALL TIMER_STOP ('ALL                    [THE_MODEL_MAIN]',myThid)
669    
670  C--   Write timer statistics  C--   Write timer statistics
671        IF ( myThid .EQ. 1 ) THEN        IF ( myThid .EQ. 1 ) THEN
672         CALL TIMER_PRINTALL( myThid )         CALL TIMER_PRINTALL( myThid )

Legend:
Removed from v.1.96  
changed lines
  Added in v.1.106

  ViewVC Help
Powered by ViewVC 1.1.22