/[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.43 by adcroft, Fri Sep 28 16:49:54 2001 UTC revision 1.53 by heimbach, Fri Mar 7 05:51:52 2003 UTC
# Line 142  C    | | | |-INI_VEL    :: Initialize 3D Line 142  C    | | | |-INI_VEL    :: Initialize 3D
142  C    | | | |-INI_THETA  :: Set model initial temperature field.  C    | | | |-INI_THETA  :: Set model initial temperature field.
143  C    | | | |-INI_SALT   :: Set model initial salinity field.  C    | | | |-INI_SALT   :: Set model initial salinity field.
144  C    | | | |-INI_PSURF  :: Set model initial free-surface height/pressure.  C    | | | |-INI_PSURF  :: Set model initial free-surface height/pressure.
145    C    | | | |-INI_PRESSURE :: Compute model initial hydrostatic pressure
146  C    | | |  C    | | |
147  C    | | |-INI_TR1      :: Set initial tracer 1 distribution.  C    | | |-INI_TR1      :: Set initial tracer 1 distribution.
148  C    | | |  C    | | |
# Line 219  C/\  | | | |                    :: Simpl Line 220  C/\  | | | |                    :: Simpl
220  C/\  | | | |                    :: for forcing datasets.  C/\  | | | |                    :: for forcing datasets.
221  C/\  | | | |                    C/\  | | | |                  
222  C/\  | | | |-EXCH :: Sync forcing. in overlap regions.  C/\  | | | |-EXCH :: Sync forcing. in overlap regions.
223    C/\  | | |-SEAICE_MODEL   :: Compute sea-ice terms. ( pkg/seaice )
224  C/\  | | |  C/\  | | |
225  C/\  | | |-THERMODYNAMICS :: theta, salt + tracer equations driver.  C/\  | | |-THERMODYNAMICS :: theta, salt + tracer equations driver.
226  C/\  | | | |  C/\  | | | |
227  C/\  | | | |-INTEGRATE_FOR_W :: Integrate for vertical velocity.  C/\  | | | |-INTEGRATE_FOR_W :: Integrate for vertical velocity.
228  C/\  | | | |-OBCS_APPLY_W    :: Open bndy. package ( see pkg/obcs ).  C/\  | | | |-OBCS_APPLY_W    :: Open bndy. package ( see pkg/obcs ).
229  C/\  | | | |-FIND_RHO        :: Calculates [rho(S,T,z)-Rhonil] of a slice  C/\  | | | |-FIND_RHO        :: Calculates [rho(S,T,z)-RhoConst] of a slice
230  C/\  | | | |-GRAD_SIGMA      :: Calculate isoneutral gradients  C/\  | | | |-GRAD_SIGMA      :: Calculate isoneutral gradients
231  C/\  | | | |-CALC_IVDC       :: Set Implicit Vertical Diffusivity for Convection  C/\  | | | |-CALC_IVDC       :: Set Implicit Vertical Diffusivity for Convection
232  C/\  | | | |  C/\  | | | |
# Line 344  C/\  | | | |-TIMEAVE_STATV_WRITE :: Time Line 346  C/\  | | | |-TIMEAVE_STATV_WRITE :: Time
346  C/\  | | | |-AIM_WRITE_DIAGS     :: Intermed. atmos diags. see pkg/aim  C/\  | | | |-AIM_WRITE_DIAGS     :: Intermed. atmos diags. see pkg/aim
347  C/\  | | | |-GMREDI_DIAGS        :: GM diags. see pkg/gmredi  C/\  | | | |-GMREDI_DIAGS        :: GM diags. see pkg/gmredi
348  C/\  | | | |-KPP_DO_DIAGS        :: KPP diags. see pkg/kpp  C/\  | | | |-KPP_DO_DIAGS        :: KPP diags. see pkg/kpp
349    C/\  | | | |-SBO_CALC            :: SBO diags. see pkg/sbo
350    C/\  | | | |-SBO_DIAGS           :: SBO diags. see pkg/sbo
351  C/\  | | |  C/\  | | |
352  C/\  | | |-WRITE_CHECKPOINT :: Do I/O for restart files.  C/\  | | |-WRITE_CHECKPOINT :: Do I/O for restart files.
353  C/\  | |  C/\  | |
# Line 437  C     == Global variables === Line 441  C     == Global variables ===
441    
442  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
443  #include "tamc.h"  #include "tamc.h"
 #include "cost.h"  
 #include "adcost.h"  
444  #endif  #endif
445    
446  C     !INPUT/OUTPUT PARAMETERS:  C     !INPUT/OUTPUT PARAMETERS:
# Line 457  C     myCurrentTime - Time counter for t Line 459  C     myCurrentTime - Time counter for t
459  C     myCurrentIter - Iteration counter for this thread  C     myCurrentIter - Iteration counter for this thread
460        INTEGER myCurrentIter        INTEGER myCurrentIter
461        _RL     myCurrentTime        _RL     myCurrentTime
462          logical  exst
463          logical  lastdiva
464  CEOP  CEOP
465    c--   set default:
466          lastdiva = .TRUE.
467    
468  C--   This timer encompasses the whole code  C--   This timer encompasses the whole code
469        CALL TIMER_START('ALL                [THE_MODEL_MAIN]',myThid)        CALL TIMER_START('ALL                    [THE_MODEL_MAIN]',myThid)
   
470    
471  C--   Set model configuration (fixed arrays)  C--   Set model configuration (fixed arrays)
472        CALL TIMER_START('INITIALISE_FIXED   [THE_MODEL_MAIN]',myThid)        CALL TIMER_START('INITIALISE_FIXED       [THE_MODEL_MAIN]',myThid)
473        CALL INITIALISE_FIXED( myThid )        CALL INITIALISE_FIXED( myThid )
474        CALL TIMER_STOP ('INITIALISE_FIXED   [THE_MODEL_MAIN]',myThid)        CALL TIMER_STOP ('INITIALISE_FIXED       [THE_MODEL_MAIN]',myThid)
475    
476        myCurrentTime = startTime        myCurrentTime = startTime
477        myCurrentIter = nIter0        myCurrentIter = nIter0
478    
479  #if ( defined (ALLOW_ADJOINT_RUN) || \  #if ( defined (ALLOW_ADJOINT_RUN) || \
480          defined (ALLOW_TANGENTLINEAR_RUN) || \
481        defined (ALLOW_GRADIENT_CHECK) || \        defined (ALLOW_GRADIENT_CHECK) || \
482        defined (ALLOW_ECCO_OPTIMIZATION) )        defined (ALLOW_ECCO_OPTIMIZATION) )
483    
484        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
485        IF (myProcId .eq. 0) THEN        IF (myProcId .eq. 0) THEN
486           CALL CTRL_UNPACK( mycurrentiter, mycurrenttime, mythid )           inquire( file='costfinal', exist=exst )
487             IF ( .NOT. exst) THEN
488                CALL TIMER_START('CTRL_UNPACK      [THE_MODEL_MAIN]',mythid)
489                CALL CTRL_UNPACK( mycurrentiter, mycurrenttime, mythid )
490                CALL TIMER_STOP ('CTRL_UNPACK      [THE_MODEL_MAIN]',mythid)
491             ENDIF
492        ENDIF        ENDIF
493        _END_MASTER( mythid )        _END_MASTER( mythid )
494        _BARRIER        _BARRIER
495    
496        fc   = 0.0        CALL COST_DEPENDENT_INIT ( mythid )
497        adfc = 1.0        _BARRIER
498    
499    #if ( defined (ALLOW_ADJOINT_RUN) || \
500          defined (ALLOW_ECCO_OPTIMIZATION) )
501    # ifdef ALLOW_DIVIDED_ADJOINT
502    c-- The following assumes the TAF option '-pure'
503          inquire( file='costfinal', exist=exst )
504          IF ( .NOT. exst) THEN
505             CALL TIMER_START('MDTHE_MAIN_LOOP            [MD RUN]', mythid)
506             CALL MDTHE_MAIN_LOOP ( myCurrentTime, myCurrentIter, mythid )
507             CALL TIMER_STOP ('MDTHE_MAIN_LOOP            [MD RUN]', mythid)
508             CALL COST_FINAL_STORE ( mythid, lastdiva )
509          ELSE
510             CALL TIMER_START('ADTHE_MAIN_LOOP       [ADJOINT RUN]', mythid)
511             CALL ADTHE_MAIN_LOOP ( mythid )
512             CALL TIMER_STOP ('ADTHE_MAIN_LOOP       [ADJOINT RUN]', mythid)
513             CALL COST_FINAL_RESTORE ( mythid, lastdiva )
514          ENDIF
515    c--
516    # else
517        CALL TIMER_START('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)        CALL TIMER_START('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)
518        CALL ADTHE_MAIN_LOOP ( mythid )        CALL ADTHE_MAIN_LOOP ( mythid )
519        CALL TIMER_STOP ('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)        CALL TIMER_STOP ('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)
520    # endif
521    c--
522    #elif (defined (ALLOW_TANGENTLINEAR_RUN))
523          CALL TIMER_START('G_THE_MAIN_LOOP           [TANGENT RUN]',mythid)
524          CALL G_THE_MAIN_LOOP ( myCurrentTime, myCurrentIter, myThid )
525          CALL TIMER_STOP ('G_THE_MAIN_LOOP           [TANGENT RUN]',mythid)
526    #endif
527        _BARRIER        _BARRIER
528    
529        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
530        IF (myProcId .eq. 0) THEN        IF ( myProcId .eq. 0 .AND. lastdiva ) THEN
531             CALL TIMER_START('CTRL_PACK           [THE_MODEL_MAIN]',mythid)
532           call CTRL_PACK( mycurrentiter, mycurrenttime, mythid )           call CTRL_PACK( mycurrentiter, mycurrenttime, mythid )
533             CALL TIMER_STOP ('CTRL_PACK           [THE_MODEL_MAIN]',mythid)
534        ENDIF        ENDIF
535        _END_MASTER( mythid )        _END_MASTER( mythid )
536        _BARRIER        _BARRIER
537    
538  #ifdef ALLOW_GRADIENT_CHECK  #ifdef ALLOW_GRADIENT_CHECK
539        if (useGrdchk) then        IF ( useGrdchk .AND. lastdiva ) THEN
540           CALL TIMER_START('GRDCHK_MAIN          [ADJOINT RUN]', mythid)           CALL TIMER_START('GRDCHK_MAIN         [THE_MODEL_MAIN]',mythid)
541           CALL GRDCHK_MAIN( mythid )           CALL GRDCHK_MAIN( mythid )
542           CALL TIMER_STOP ('GRDCHK_MAIN          [ADJOINT RUN]', mythid)           CALL TIMER_STOP ('GRDCHK_MAIN         [THE_MODEL_MAIN]',mythid)
543           _BARRIER           _BARRIER
544        end if        ENDIF
545  #endif  #endif
546    
547  #else /* ALLOW_ADJOINT_RUN undef */  #else /* ALLOW_ADJOINT_RUN undef */
548    
549  C--   Call time stepping loop of full model  C--   Call time stepping loop of full model
550        CALL TIMER_START('THE_MAIN_LOOP      [THE_MODEL_MAIN]',myThid)        CALL TIMER_START('THE_MAIN_LOOP          [THE_MODEL_MAIN]',myThid)
551        CALL THE_MAIN_LOOP(myCurrentTime, myCurrentIter, myThid )        CALL THE_MAIN_LOOP( myCurrentTime, myCurrentIter, myThid )
552        CALL TIMER_STOP ('THE_MAIN_LOOP      [THE_MODEL_MAIN]',myThid)        CALL TIMER_STOP ('THE_MAIN_LOOP          [THE_MODEL_MAIN]',myThid)
553    
554  #endif /* ALLOW_ADJOINT_RUN */  #endif /* ALLOW_ADJOINT_RUN */
555    
556  C--   Final checkpoint (incase the in-loop checkpoint was missed)  C--   Sea-ice checkpoint (in case the in-loop checkpoint was missed)
557        CALL TIMER_START('WRITE_CHECKPOINT   [THE_MODEL_MAIN]',myThid)  #ifdef ALLOW_SEAICE
558          IF ( useSEAICE )
559         &     CALL SEAICE_WRITE_PICKUP(
560         &     .TRUE., myCurrentTime, myCurrentIter, myThid )
561    #endif
562    
563    C--   Final checkpoint (in case the in-loop checkpoint was missed)
564          CALL TIMER_START('WRITE_CHECKPOINT       [THE_MODEL_MAIN]',myThid)
565        CALL WRITE_CHECKPOINT(        CALL WRITE_CHECKPOINT(
566       &        .TRUE., myCurrentTime, myCurrentIter, myThid )       &        .TRUE., myCurrentTime, myCurrentIter, myThid )
567        CALL TIMER_STOP ('WRITE_CHECKPOINT   [THE_MODEL_MAIN]',myThid)        CALL TIMER_STOP ('WRITE_CHECKPOINT       [THE_MODEL_MAIN]',myThid)
568    
569        CALL TIMER_STOP ('ALL                [THE_MODEL_MAIN]',myThid)        CALL TIMER_STOP ('ALL                    [THE_MODEL_MAIN]',myThid)
570    
571  C--   Write timer statistics  C--   Write timer statistics
572        IF ( myThid .EQ. 1 ) THEN        IF ( myThid .EQ. 1 ) THEN

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.53

  ViewVC Help
Powered by ViewVC 1.1.22