/[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.42 by cnh, Wed Sep 26 18:09:16 2001 UTC revision 1.80 by heimbach, Fri Sep 17 22:57:12 2004 UTC
# Line 7  C !TITLE: MITGCM KERNEL CODE SYNOPSIS Line 7  C !TITLE: MITGCM KERNEL CODE SYNOPSIS
7  C !AUTHORS: mitgcm developers ( support@mitgcm.org )  C !AUTHORS: mitgcm developers ( support@mitgcm.org )
8  C !AFFILIATION: Massachussetts Institute of Technology  C !AFFILIATION: Massachussetts Institute of Technology
9  C !DATE:  C !DATE:
10  C !INTRODUCTION: model/ subdirectory  C !INTRODUCTION: Kernel dynamical routines
11  C This document summarises MITgcm code under the model/ subdirectory.  C This document summarises MITgcm code under the model/ subdirectory.
12  C The code under model/ ( src/ and inc/ ) contains most of  C The code under model/ ( src/ and inc/ ) contains most of
13  C the driver routines for the baseline forms of the kernel equations in the  C the driver routines for the baseline forms of the kernel equations in the
# Line 91  C    | | |-CTRL_INIT           :: Contro Line 91  C    | | |-CTRL_INIT           :: Contro
91  C    | | |-OPTIM_READPARMS     :: Optimisation support package. see pkg/ctrl  C    | | |-OPTIM_READPARMS     :: Optimisation support package. see pkg/ctrl
92  C    | | |-GRDCHK_READPARMS    :: Gradient check package. see pkg/grdchk  C    | | |-GRDCHK_READPARMS    :: Gradient check package. see pkg/grdchk
93  C    | | |-ECCO_READPARMS      :: ECCO Support Package. see pkg/ecco  C    | | |-ECCO_READPARMS      :: ECCO Support Package. see pkg/ecco
94    C    | | |-PTRACERS_READPARMS  :: multiple tracer package, see pkg/ptracers
95    C    | | |-GCHEM_READPARMS     :: tracer interface package, see pkg/gchem
96  C    | |  C    | |
97  C    | |-PACKAGES_CHECK  C    | |-PACKAGES_CHECK
98  C    | | |  C    | | |
# Line 101  C    | | Line 103  C    | |
103  C    | |-PACKAGES_INIT_FIXED  C    | |-PACKAGES_INIT_FIXED
104  C    | | |-OBCS_INIT_FIXED     :: Open bndy Package. see pkg/obcs  C    | | |-OBCS_INIT_FIXED     :: Open bndy Package. see pkg/obcs
105  C    | | |-FLT_INIT            :: Floats Package. see pkg/flt  C    | | |-FLT_INIT            :: Floats Package. see pkg/flt
106    C    | | |-GCHEM_INIT_FIXED    :: tracer interface pachage, see pkg/gchem
107  C    | |  C    | |
108  C    | |-ZONAL_FILT_INIT       :: FFT filter Package. see pkg/zonal_filt  C    | |-ZONAL_FILT_INIT       :: FFT filter Package. see pkg/zonal_filt
109  C    | |  C    | |
# Line 142  C    | | | |-INI_VEL    :: Initialize 3D Line 145  C    | | | |-INI_VEL    :: Initialize 3D
145  C    | | | |-INI_THETA  :: Set model initial temperature field.  C    | | | |-INI_THETA  :: Set model initial temperature field.
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    | | |  C    | | | |-INI_PRESSURE :: Compute model initial hydrostatic pressure
149  C    | | |-INI_TR1      :: Set initial tracer 1 distribution.  C    | | | |-READ_CHECKPOINT :: Read the checkpoint
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 177  C    | | | |-GMREDI_INIT          :: GM Line 180  C    | | | |-GMREDI_INIT          :: GM
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)
184    C    | | | |-GCHEM_INIT           : : tracer interface pkg (see pkh/gchem)
185  C    | | | |-AIM_INIT             :: Interm. atmos package. ( see pkg/aim )  C    | | | |-AIM_INIT             :: Interm. atmos package. ( see pkg/aim )
186  C    | | | |-CTRL_MAP_INI         :: Control vector package.( see pkg/ctrl )  C    | | | |-CTRL_MAP_INI         :: Control vector package.( see pkg/ctrl )
187  C    | | | |-COST_INIT            :: Cost function package. ( see pkg/cost )  C    | | | |-COST_INIT            :: Cost function package. ( see pkg/cost )
# Line 219  C/\  | | | |                    :: Simpl Line 224  C/\  | | | |                    :: Simpl
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 )
228    C/\  | | |-FREEZE         :: Limit surface temperature.
229    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.
232  C/\  | | | |  C/\  | | | |
233  C/\  | | | |-INTEGRATE_FOR_W :: Integrate for vertical velocity.  C/\  | | | |-INTEGRATE_FOR_W :: Integrate for vertical velocity.
234  C/\  | | | |-OBCS_APPLY_W    :: Open bndy. package ( see pkg/obcs ).  C/\  | | | |-OBCS_APPLY_W    :: Open bndy. package ( see pkg/obcs ).
235  C/\  | | | |-FIND_RHO        :: Calculates [rho(S,T,z)-Rhonil] of a slice  C/\  | | | |-FIND_RHO        :: Calculates [rho(S,T,z)-RhoConst] of a slice
236  C/\  | | | |-GRAD_SIGMA      :: Calculate isoneutral gradients  C/\  | | | |-GRAD_SIGMA      :: Calculate isoneutral gradients
237  C/\  | | | |-CALC_IVDC       :: Set Implicit Vertical Diffusivity for Convection  C/\  | | | |-CALC_IVDC       :: Set Implicit Vertical Diffusivity for Convection
238  C/\  | | | |  C/\  | | | |
239  C/\  | | | |-OBCS_CALC            :: Open bndy. package ( see pkg/obcs ).  C/\  | | | |-OBCS_CALC            :: Open bndy. package ( see pkg/obcs ).
240  C/\  | | | |-EXTERNAL_FORCING_SURF:: Accumulates appropriately dimensioned  C/\  | | | |-EXTERNAL_FORCING_SURF:: Accumulates appropriately dimensioned
241  C/\  | | | |                      :: forcing terms.  C/\  | | | | |                    :: forcing terms.
242    C/\  | | | | |-PTRACERS_FORCING_SURF :: Tracer package ( see pkg/ptracers ).
243  C/\  | | | |  C/\  | | | |
244  C/\  | | | |-GMREDI_CALC_TENSOR   :: GM package ( see pkg/gmredi ).  C/\  | | | |-GMREDI_CALC_TENSOR   :: GM package ( see pkg/gmredi ).
245  C/\  | | | |-GMREDI_CALC_TENSOR_DUMMY :: GM package ( see pkg/gmredi ).  C/\  | | | |-GMREDI_CALC_TENSOR_DUMMY :: GM package ( see pkg/gmredi ).
# Line 248  C/\  | | | | Line 257  C/\  | | | |
257  C/\  | | | |-CALC_GT              :: Calculate the temperature tendency terms  C/\  | | | |-CALC_GT              :: Calculate the temperature tendency terms
258  C/\  | | | | |  C/\  | | | | |
259  C/\  | | | | |-GAD_CALC_RHS       :: Generalised advection package  C/\  | | | | |-GAD_CALC_RHS       :: Generalised advection package
260  C/\  | | | | |                    :: ( see pkg/gad )  C/\  | | | | | |                  :: ( see pkg/gad )
261    C/\  | | | | | |-KPP_TRANSPORT_T  :: KPP non-local transport ( see pkg/kpp ).
262    C/\  | | | | |
263  C/\  | | | | |-EXTERNAL_FORCING_T :: Problem specific forcing for temperature.  C/\  | | | | |-EXTERNAL_FORCING_T :: Problem specific forcing for temperature.
264  C/\  | | | | |-ADAMS_BASHFORTH2   :: Extrapolate tendencies forward in time.  C/\  | | | | |-ADAMS_BASHFORTH2   :: Extrapolate tendencies forward in time.
265  C/\  | | | | |-FREESURF_RESCALE_G :: Re-scale Gt for free-surface height.  C/\  | | | | |-FREESURF_RESCALE_G :: Re-scale Gt for free-surface height.
# Line 258  C/\  | | | | Line 269  C/\  | | | |
269  C/\  | | | |-CALC_GS              :: Calculate the salinity tendency terms  C/\  | | | |-CALC_GS              :: Calculate the salinity tendency terms
270  C/\  | | | | |  C/\  | | | | |
271  C/\  | | | | |-GAD_CALC_RHS       :: Generalised advection package  C/\  | | | | |-GAD_CALC_RHS       :: Generalised advection package
272  C/\  | | | | |                    :: ( see pkg/gad )  C/\  | | | | | |                  :: ( see pkg/gad )
273    C/\  | | | | | |-KPP_TRANSPORT_S  :: KPP non-local transport ( see pkg/kpp ).
274    C/\  | | | | |
275  C/\  | | | | |-EXTERNAL_FORCING_S :: Problem specific forcing for salt.  C/\  | | | | |-EXTERNAL_FORCING_S :: Problem specific forcing for salt.
276  C/\  | | | | |-ADAMS_BASHFORTH2   :: Extrapolate tendencies forward in time.  C/\  | | | | |-ADAMS_BASHFORTH2   :: Extrapolate tendencies forward in time.
277  C/\  | | | | |-FREESURF_RESCALE_G :: Re-scale Gs for free-surface height.  C/\  | | | | |-FREESURF_RESCALE_G :: Re-scale Gs for free-surface height.
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/\  | | | |
281  C/\  | | | |-CALC_GTR1            :: Calculate other tracer(s) tendency terms  C/\  | | | |-TIMESTEP_TRACER      :: Step tracer field forward in time
282    C/\  | | | |
283    C/\  | | | |-PTRACERS_INTEGRATE   :: Integrate other tracer(s) ( see pkg/ptracers ).
284  C/\  | | | | |  C/\  | | | | |
285  C/\  | | | | |-GAD_CALC_RHS       :: Generalised advection package  C/\  | | | | |-GAD_CALC_RHS       :: Generalised advection package
286  C/\  | | | | |                    :: ( see pkg/gad )  C/\  | | | | | |                  :: ( see pkg/gad )
287  C/\  | | | | |-EXTERNAL_FORCING_TR:: Problem specific forcing for tracer.  C/\  | | | | | |-KPP_TRANSPORT_PTR:: KPP non-local transport ( see pkg/kpp ).
288    C/\  | | | | |
289    C/\  | | | | |-PTRACERS_FORCING   :: Problem specific forcing for tracer.
290    C/\  | | | | |-GCHEM_FORCING_INT  :: tracer forcing for gchem pkg (if all
291    C/\  | | | | |                       tendancy 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
295  C/\  | | | |  C/\  | | | |
 C/\  | | | |-TIMESTEP_TRACER      :: Step tracer field forward in time  
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 334  C/\  | | | Line 352  C/\  | | |
352  C/\  | | |-DO_FIELDS_BLOCKING_EXCHANGES :: Sync up overlap regions.  C/\  | | |-DO_FIELDS_BLOCKING_EXCHANGES :: Sync up overlap regions.
353  C/\  | | | |-EXCH                                                    C/\  | | | |-EXCH                                                  
354  C/\  | | |  C/\  | | |
355    C/\  | | |-GCHEM_FORCING_SEP :: tracer forcing for gchem pkg (if
356    C/\  | | |                      tracer dependent tendencies calculated
357    C/\  | | |                      separatly)
358    C/\  | | |
359  C/\  | | |-FLT_MAIN         :: Float package ( pkg/flt ).  C/\  | | |-FLT_MAIN         :: Float package ( pkg/flt ).
360  C/\  | | |  C/\  | | |
361  C/\  | | |-MONITOR          :: Monitor package ( pkg/monitor ).  C/\  | | |-MONITOR          :: Monitor package ( pkg/monitor ).
# Line 344  C/\  | | | |-TIMEAVE_STATV_WRITE :: Time Line 366  C/\  | | | |-TIMEAVE_STATV_WRITE :: Time
366  C/\  | | | |-AIM_WRITE_DIAGS     :: Intermed. atmos diags. see pkg/aim  C/\  | | | |-AIM_WRITE_DIAGS     :: Intermed. atmos diags. see pkg/aim
367  C/\  | | | |-GMREDI_DIAGS        :: GM diags. see pkg/gmredi  C/\  | | | |-GMREDI_DIAGS        :: GM diags. see pkg/gmredi
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
370    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
373  C/\  | | |  C/\  | | |
374  C/\  | | |-WRITE_CHECKPOINT :: Do I/O for restart files.  C/\  | | |-WRITE_CHECKPOINT :: Do I/O for restart files.
375  C/\  | |  C/\  | |
# Line 367  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 430  C     == Global variables === Line 458  C     == Global variables ===
458  #include "SIZE.h"  #include "SIZE.h"
459  #include "EEPARAMS.h"  #include "EEPARAMS.h"
460  #include "PARAMS.h"  #include "PARAMS.h"
461    #ifdef ALLOW_MNC
462    #include "MNC_PARAMS.h"
463    #endif
464  #include "DYNVARS.h"  #include "DYNVARS.h"
465  #ifdef ALLOW_NONHYDROSTATIC  #ifdef ALLOW_NONHYDROSTATIC
466  #include "CG3D.h"  # include "CG3D.h"
467  #endif  #endif
468    
469    #ifdef ALLOW_ECCO_OPTIMIZATION
470    # include "optim.h"
471    #endif
472  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
473  #include "tamc.h"  # include "tamc.h"
 #include "cost.h"  
 #include "adcost.h"  
474  #endif  #endif
475    
476  C     !INPUT/OUTPUT PARAMETERS:  C     !INPUT/OUTPUT PARAMETERS:
# Line 457  C     myCurrentTime - Time counter for t Line 489  C     myCurrentTime - Time counter for t
489  C     myCurrentIter - Iteration counter for this thread  C     myCurrentIter - Iteration counter for this thread
490        INTEGER myCurrentIter        INTEGER myCurrentIter
491        _RL     myCurrentTime        _RL     myCurrentTime
492          logical  exst
493          logical  lastdiva
494    #ifndef ALLOW_ECCO_OPTIMIZATION
495          integer optimcycle
496    #endif
497  CEOP  CEOP
498    c--   set default:
499    #ifndef ALLOW_ECCO_OPTIMIZATION
500          optimcycle = 0
501    #endif
502          lastdiva = .TRUE.
503    
504    #ifdef ALLOW_DEBUG
505          IF (debugMode) CALL DEBUG_ENTER('THE_MODEL_MAIN',myThid)
506    #endif
507    
508  C--   This timer encompasses the whole code  C--   This timer encompasses the whole code
509        CALL TIMER_START('ALL                [THE_MODEL_MAIN]',myThid)        CALL TIMER_START('ALL                    [THE_MODEL_MAIN]',myThid)
510    
511    #ifdef ALLOW_DEBUG
512          IF (debugMode) CALL DEBUG_CALL('INITIALISE_FIXED',myThid)
513    #endif
514    
515  C--   Set model configuration (fixed arrays)  C--   Set model configuration (fixed arrays)
516        CALL TIMER_START('INITIALISE_FIXED   [THE_MODEL_MAIN]',myThid)        CALL TIMER_START('INITIALISE_FIXED       [THE_MODEL_MAIN]',myThid)
517        CALL INITIALISE_FIXED( myThid )        CALL INITIALISE_FIXED( myThid )
518        CALL TIMER_STOP ('INITIALISE_FIXED   [THE_MODEL_MAIN]',myThid)        CALL TIMER_STOP ('INITIALISE_FIXED       [THE_MODEL_MAIN]',myThid)
519    
520        myCurrentTime = startTime        myCurrentTime = startTime
521        myCurrentIter = nIter0        myCurrentIter = nIter0
522    
523  #if ( defined (ALLOW_ADJOINT_RUN) || \  #if ( defined (ALLOW_ADMTLM) )
524        defined (ALLOW_GRADIENT_CHECK) || \  c
525        defined (ALLOW_ECCO_OPTIMIZATION) )        CALL TIMER_START('ADMTLM_DRIVER          [THE_MODEL_MAIN]',mythid)
526          CALL ADMTLM_DRIVER ( myThid )
527          CALL TIMER_STOP ('ADMTLM_DRIVER          [THE_MODEL_MAIN]',mythid)
528    c
529    #elif ( defined (ALLOW_AUTODIFF))
530    
531    # ifndef EXCLUDE_CTRL_PACK
532        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
533        IF (myProcId .eq. 0) THEN        IF (myProcId .eq. 0) THEN
534           CALL CTRL_UNPACK( mycurrentiter, mycurrenttime, mythid )           inquire( file='costfinal', exist=exst )
535             IF ( .NOT. exst .AND. niter0 .EQ. 0 ) THEN
536                IF ( optimcycle.NE.0 ) THEN
537                   CALL TIMER_START('CTRL_UNPACK   [THE_MODEL_MAIN]',mythid)
538                   CALL CTRL_UNPACK( .TRUE. , mythid )
539                   CALL TIMER_STOP ('CTRL_UNPACK   [THE_MODEL_MAIN]',mythid)
540                ENDIF
541                IF ( optimcycle.EQ.0 .AND. mycurrentiter.EQ.niter0 ) THEN
542                   CALL TIMER_START('CTRL_PACK     [THE_MODEL_MAIN]',mythid)
543                   CALL CTRL_PACK( .TRUE. , mythid )
544                   CALL TIMER_STOP ('CTRL_PACK     [THE_MODEL_MAIN]',mythid)
545                ENDIF
546             ENDIF
547        ENDIF        ENDIF
548        _END_MASTER( mythid )        _END_MASTER( mythid )
549        _BARRIER        _BARRIER
550    # endif /* EXCLUDE_CTRL_PACK */
551    
552          CALL COST_DEPENDENT_INIT ( mythid )
553          _BARRIER
554    
555        fc   = 0.0  # if ( defined (ALLOW_TANGENTLINEAR_RUN) )
556        adfc = 1.0  c
557          CALL TIMER_START('G_THE_MAIN_LOOP           [TANGENT RUN]',mythid)
558          CALL G_THE_MAIN_LOOP ( myCurrentTime, myCurrentIter, myThid )
559          CALL TIMER_STOP ('G_THE_MAIN_LOOP           [TANGENT RUN]',mythid)
560    c
561    # elif ( defined (ALLOW_ADJOINT_RUN) || \
562             defined (ALLOW_ECCO_OPTIMIZATION) )
563    c
564    #  ifdef ALLOW_DIVIDED_ADJOINT
565    c-- The following assumes the TAF option '-pure'
566          inquire( file='costfinal', exist=exst )
567          IF ( .NOT. exst) THEN
568             CALL TIMER_START('MDTHE_MAIN_LOOP            [MD RUN]', mythid)
569             CALL MDTHE_MAIN_LOOP ( myCurrentTime, myCurrentIter, mythid )
570             CALL TIMER_STOP ('MDTHE_MAIN_LOOP            [MD RUN]', mythid)
571             CALL COST_FINAL_STORE ( mythid, lastdiva )
572          ELSE
573             CALL TIMER_START('ADTHE_MAIN_LOOP       [ADJOINT RUN]', mythid)
574             CALL ADTHE_MAIN_LOOP ( myCurrentTime, myCurrentIter, mythid )
575             CALL TIMER_STOP ('ADTHE_MAIN_LOOP       [ADJOINT RUN]', mythid)
576             CALL COST_FINAL_RESTORE ( mythid, lastdiva )
577          ENDIF
578    c--
579    #  else /* ALLOW_DIVIDED_ADJOINT undef */
580        CALL TIMER_START('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)        CALL TIMER_START('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)
581        CALL ADTHE_MAIN_LOOP ( mythid )        CALL ADTHE_MAIN_LOOP ( myCurrentTime, myCurrentIter, mythid )
582    cph      CALL ADTHE_MAIN_LOOP ( mythid )
583        CALL TIMER_STOP ('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)        CALL TIMER_STOP ('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)
584        _BARRIER  #  endif /* ALLOW_DIVIDED_ADJOINT */
585    c
586    # endif
587    
588    # ifndef EXCLUDE_CTRL_PACK
589        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
590        IF (myProcId .eq. 0) THEN        IF ( myProcId .eq. 0 .AND. lastdiva ) THEN
591           call CTRL_PACK( mycurrentiter, mycurrenttime, mythid )           CALL TIMER_START('CTRL_PACK           [THE_MODEL_MAIN]',mythid)
592             call CTRL_PACK( .FALSE. , mythid )
593             CALL TIMER_STOP ('CTRL_PACK           [THE_MODEL_MAIN]',mythid)
594        ENDIF        ENDIF
595        _END_MASTER( mythid )        _END_MASTER( mythid )
596        _BARRIER        _BARRIER
597    # endif /* EXCLUDE_CTRL_PACK */
598    
599  #ifdef ALLOW_GRADIENT_CHECK  
600        if (useGrdchk) then  # ifdef ALLOW_GRDCHK
601           CALL TIMER_START('GRDCHK_MAIN          [ADJOINT RUN]', mythid)        IF ( useGrdchk .AND. lastdiva ) THEN
602             CALL TIMER_START('GRDCHK_MAIN         [THE_MODEL_MAIN]',mythid)
603           CALL GRDCHK_MAIN( mythid )           CALL GRDCHK_MAIN( mythid )
604           CALL TIMER_STOP ('GRDCHK_MAIN          [ADJOINT RUN]', mythid)           CALL TIMER_STOP ('GRDCHK_MAIN         [THE_MODEL_MAIN]',mythid)
605           _BARRIER           _BARRIER
606        end if        ENDIF
607  #endif  # endif
   
 #else /* ALLOW_ADJOINT_RUN undef */  
608    
609  C--   Call time stepping loop of full model  #else /* ALL AD-related undef */
       CALL TIMER_START('THE_MAIN_LOOP      [THE_MODEL_MAIN]',myThid)  
       CALL THE_MAIN_LOOP(myCurrentTime, myCurrentIter, myThid )  
       CALL TIMER_STOP ('THE_MAIN_LOOP      [THE_MODEL_MAIN]',myThid)  
610    
611  #endif /* ALLOW_ADJOINT_RUN */  #ifdef ALLOW_DEBUG
612          IF (debugMode) CALL DEBUG_CALL('THE_MAIN_LOOP',myThid)
613    #endif
614    
615  C--   Final checkpoint (incase the in-loop checkpoint was missed)  C--   Call time stepping loop of full model
616        CALL TIMER_START('WRITE_CHECKPOINT   [THE_MODEL_MAIN]',myThid)        CALL TIMER_START('THE_MAIN_LOOP          [THE_MODEL_MAIN]',myThid)
617          CALL THE_MAIN_LOOP( myCurrentTime, myCurrentIter, myThid )
618          CALL TIMER_STOP ('THE_MAIN_LOOP          [THE_MODEL_MAIN]',myThid)
619    
620    #endif /* ALLOW_TANGENTLINEAR_RUN ALLOW_ADJOINT_RUN ALLOW_ADMTLM_RUN */
621    
622    C--   Final checkpoint (in case the in-loop checkpoint was missed)
623          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)
631    
632        CALL TIMER_STOP ('ALL                [THE_MODEL_MAIN]',myThid)  #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
# Line 528  C--   Write timer statistics Line 644  C--   Write timer statistics
644         CALL COMM_STATS         CALL COMM_STATS
645        ENDIF        ENDIF
646    
647    #ifdef ALLOW_DEBUG
648          IF (debugMode) CALL DEBUG_LEAVE('THE_MODEL_MAIN',myThid)
649    #endif
650    
651        RETURN        RETURN
652        END        END

Legend:
Removed from v.1.42  
changed lines
  Added in v.1.80

  ViewVC Help
Powered by ViewVC 1.1.22