/[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.71 by edhill, Sun Jan 18 23:23:15 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    | | | |-INI_PRESSURE :: Compute model initial hydrostatic pressure
149  C    | | |  C    | | |
150  C    | | |-INI_TR1      :: Set initial tracer 1 distribution.  C    | | |-INI_TR1      :: Set initial tracer 1 distribution.
151  C    | | |  C    | | |
# Line 177  C    | | | |-GMREDI_INIT          :: GM Line 181  C    | | | |-GMREDI_INIT          :: GM
181  C    | | | |-KPP_INIT             :: KPP package. ( see pkg/kpp )  C    | | | |-KPP_INIT             :: KPP package. ( see pkg/kpp )
182  C    | | | |-KPP_OPEN_DIAGS      C    | | | |-KPP_OPEN_DIAGS    
183  C    | | | |-OBCS_INIT_VARIABLES  :: Open bndy. package. ( see pkg/obcs )  C    | | | |-OBCS_INIT_VARIABLES  :: Open bndy. package. ( see pkg/obcs )
184    C    | | | |-PTRACERS_INIT        :: multi. tracer package,(see pkg/ptracers)
185    C    | | | |-GCHEM_INIT           : : tracer interface pkg (see pkh/gchem)
186  C    | | | |-AIM_INIT             :: Interm. atmos package. ( see pkg/aim )  C    | | | |-AIM_INIT             :: Interm. atmos package. ( see pkg/aim )
187  C    | | | |-CTRL_MAP_INI         :: Control vector package.( see pkg/ctrl )  C    | | | |-CTRL_MAP_INI         :: Control vector package.( see pkg/ctrl )
188  C    | | | |-COST_INIT            :: Cost function package. ( see pkg/cost )  C    | | | |-COST_INIT            :: Cost function package. ( see pkg/cost )
# Line 219  C/\  | | | |                    :: Simpl Line 225  C/\  | | | |                    :: Simpl
225  C/\  | | | |                    :: for forcing datasets.  C/\  | | | |                    :: for forcing datasets.
226  C/\  | | | |                    C/\  | | | |                  
227  C/\  | | | |-EXCH :: Sync forcing. in overlap regions.  C/\  | | | |-EXCH :: Sync forcing. in overlap regions.
228    C/\  | | |-SEAICE_MODEL   :: Compute sea-ice terms. ( pkg/seaice )
229    C/\  | | |-FREEZE         :: Limit surface temperature.
230    C/\  | | |-GCHEM_FIELD_LOAD :: load tracer forcing fields (pkg/gchem)
231  C/\  | | |  C/\  | | |
232  C/\  | | |-THERMODYNAMICS :: theta, salt + tracer equations driver.  C/\  | | |-THERMODYNAMICS :: theta, salt + tracer equations driver.
233  C/\  | | | |  C/\  | | | |
234  C/\  | | | |-INTEGRATE_FOR_W :: Integrate for vertical velocity.  C/\  | | | |-INTEGRATE_FOR_W :: Integrate for vertical velocity.
235  C/\  | | | |-OBCS_APPLY_W    :: Open bndy. package ( see pkg/obcs ).  C/\  | | | |-OBCS_APPLY_W    :: Open bndy. package ( see pkg/obcs ).
236  C/\  | | | |-FIND_RHO        :: Calculates [rho(S,T,z)-Rhonil] of a slice  C/\  | | | |-FIND_RHO        :: Calculates [rho(S,T,z)-RhoConst] of a slice
237  C/\  | | | |-GRAD_SIGMA      :: Calculate isoneutral gradients  C/\  | | | |-GRAD_SIGMA      :: Calculate isoneutral gradients
238  C/\  | | | |-CALC_IVDC       :: Set Implicit Vertical Diffusivity for Convection  C/\  | | | |-CALC_IVDC       :: Set Implicit Vertical Diffusivity for Convection
239  C/\  | | | |  C/\  | | | |
240  C/\  | | | |-OBCS_CALC            :: Open bndy. package ( see pkg/obcs ).  C/\  | | | |-OBCS_CALC            :: Open bndy. package ( see pkg/obcs ).
241  C/\  | | | |-EXTERNAL_FORCING_SURF:: Accumulates appropriately dimensioned  C/\  | | | |-EXTERNAL_FORCING_SURF:: Accumulates appropriately dimensioned
242  C/\  | | | |                      :: forcing terms.  C/\  | | | | |                    :: forcing terms.
243    C/\  | | | | |-PTRACERS_FORCING_SURF :: Tracer package ( see pkg/ptracers ).
244  C/\  | | | |  C/\  | | | |
245  C/\  | | | |-GMREDI_CALC_TENSOR   :: GM package ( see pkg/gmredi ).  C/\  | | | |-GMREDI_CALC_TENSOR   :: GM package ( see pkg/gmredi ).
246  C/\  | | | |-GMREDI_CALC_TENSOR_DUMMY :: GM package ( see pkg/gmredi ).  C/\  | | | |-GMREDI_CALC_TENSOR_DUMMY :: GM package ( see pkg/gmredi ).
# Line 248  C/\  | | | | Line 258  C/\  | | | |
258  C/\  | | | |-CALC_GT              :: Calculate the temperature tendency terms  C/\  | | | |-CALC_GT              :: Calculate the temperature tendency terms
259  C/\  | | | | |  C/\  | | | | |
260  C/\  | | | | |-GAD_CALC_RHS       :: Generalised advection package  C/\  | | | | |-GAD_CALC_RHS       :: Generalised advection package
261  C/\  | | | | |                    :: ( see pkg/gad )  C/\  | | | | | |                  :: ( see pkg/gad )
262    C/\  | | | | | |-KPP_TRANSPORT_T  :: KPP non-local transport ( see pkg/kpp ).
263    C/\  | | | | |
264  C/\  | | | | |-EXTERNAL_FORCING_T :: Problem specific forcing for temperature.  C/\  | | | | |-EXTERNAL_FORCING_T :: Problem specific forcing for temperature.
265  C/\  | | | | |-ADAMS_BASHFORTH2   :: Extrapolate tendencies forward in time.  C/\  | | | | |-ADAMS_BASHFORTH2   :: Extrapolate tendencies forward in time.
266  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 270  C/\  | | | |
270  C/\  | | | |-CALC_GS              :: Calculate the salinity tendency terms  C/\  | | | |-CALC_GS              :: Calculate the salinity tendency terms
271  C/\  | | | | |  C/\  | | | | |
272  C/\  | | | | |-GAD_CALC_RHS       :: Generalised advection package  C/\  | | | | |-GAD_CALC_RHS       :: Generalised advection package
273  C/\  | | | | |                    :: ( see pkg/gad )  C/\  | | | | | |                  :: ( see pkg/gad )
274    C/\  | | | | | |-KPP_TRANSPORT_S  :: KPP non-local transport ( see pkg/kpp ).
275    C/\  | | | | |
276  C/\  | | | | |-EXTERNAL_FORCING_S :: Problem specific forcing for salt.  C/\  | | | | |-EXTERNAL_FORCING_S :: Problem specific forcing for salt.
277  C/\  | | | | |-ADAMS_BASHFORTH2   :: Extrapolate tendencies forward in time.  C/\  | | | | |-ADAMS_BASHFORTH2   :: Extrapolate tendencies forward in time.
278  C/\  | | | | |-FREESURF_RESCALE_G :: Re-scale Gs for free-surface height.  C/\  | | | | |-FREESURF_RESCALE_G :: Re-scale Gs for free-surface height.
# Line 269  C/\  | | | |-CALC_GTR1            :: Cal Line 283  C/\  | | | |-CALC_GTR1            :: Cal
283  C/\  | | | | |  C/\  | | | | |
284  C/\  | | | | |-GAD_CALC_RHS       :: Generalised advection package  C/\  | | | | |-GAD_CALC_RHS       :: Generalised advection package
285  C/\  | | | | |                    :: ( see pkg/gad )  C/\  | | | | |                    :: ( see pkg/gad )
286    C/\  | | | | |
287  C/\  | | | | |-EXTERNAL_FORCING_TR:: Problem specific forcing for tracer.  C/\  | | | | |-EXTERNAL_FORCING_TR:: Problem specific forcing for tracer.
288  C/\  | | | | |-ADAMS_BASHFORTH2   :: Extrapolate tendencies forward in time.  C/\  | | | | |-ADAMS_BASHFORTH2   :: Extrapolate tendencies forward in time.
289  C/\  | | | | |-FREESURF_RESCALE_G :: Re-scale Gs for free-surface height.  C/\  | | | | |-FREESURF_RESCALE_G :: Re-scale Gs for free-surface height.
290  C/\  | | | |  C/\  | | | |
291  C/\  | | | |-TIMESTEP_TRACER      :: Step tracer field forward in time  C/\  | | | |-TIMESTEP_TRACER      :: Step tracer field forward in time
292    C/\  | | | |
293    C/\  | | | |-PTRACERS_INTEGRATE   :: Integrate other tracer(s) ( see pkg/ptracers ).
294    C/\  | | | | |
295    C/\  | | | | |-GAD_CALC_RHS       :: Generalised advection package
296    C/\  | | | | | |                  :: ( see pkg/gad )
297    C/\  | | | | | |-KPP_TRANSPORT_PTR:: KPP non-local transport ( see pkg/kpp ).
298    C/\  | | | | |
299    C/\  | | | | |-PTRACERS_FORCING   :: Problem specific forcing for tracer.
300    C/\  | | | | |-GCHEM_FORCING_INT  :: tracer forcing for gchem pkg (if all
301    C/\  | | | | |                       tendancy terms calcualted together)
302    C/\  | | | | |-ADAMS_BASHFORTH2   :: Extrapolate tendencies forward in time.
303    C/\  | | | | |-FREESURF_RESCALE_G :: Re-scale Gs for free-surface height.
304    C/\  | | | | |-TIMESTEP_TRACER    :: Step tracer field forward in time
305    C/\  | | | |
306  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.  
307  C/\  | | | |  C/\  | | | |
308  C/\  | | | |-IMPLDIFF             :: Solve vertical implicit diffusion equation.  C/\  | | | |-IMPLDIFF             :: Solve vertical implicit diffusion equation.
309  C/\  | | | |-OBCS_APPLY_TS        :: Open bndy. package (see pkg/obcs ).  C/\  | | | |-OBCS_APPLY_TS        :: Open bndy. package (see pkg/obcs ).
# Line 334  C/\  | | | Line 362  C/\  | | |
362  C/\  | | |-DO_FIELDS_BLOCKING_EXCHANGES :: Sync up overlap regions.  C/\  | | |-DO_FIELDS_BLOCKING_EXCHANGES :: Sync up overlap regions.
363  C/\  | | | |-EXCH                                                    C/\  | | | |-EXCH                                                  
364  C/\  | | |  C/\  | | |
365    C/\  | | |-GCHEM_FORCING_SEP :: tracer forcing for gchem pkg (if
366    C/\  | | |                      tracer dependent tendencies calculated
367    C/\  | | |                      separatly)
368    C/\  | | |
369  C/\  | | |-FLT_MAIN         :: Float package ( pkg/flt ).  C/\  | | |-FLT_MAIN         :: Float package ( pkg/flt ).
370  C/\  | | |  C/\  | | |
371  C/\  | | |-MONITOR          :: Monitor package ( pkg/monitor ).  C/\  | | |-MONITOR          :: Monitor package ( pkg/monitor ).
# Line 344  C/\  | | | |-TIMEAVE_STATV_WRITE :: Time Line 376  C/\  | | | |-TIMEAVE_STATV_WRITE :: Time
376  C/\  | | | |-AIM_WRITE_DIAGS     :: Intermed. atmos diags. see pkg/aim  C/\  | | | |-AIM_WRITE_DIAGS     :: Intermed. atmos diags. see pkg/aim
377  C/\  | | | |-GMREDI_DIAGS        :: GM diags. see pkg/gmredi  C/\  | | | |-GMREDI_DIAGS        :: GM diags. see pkg/gmredi
378  C/\  | | | |-KPP_DO_DIAGS        :: KPP diags. see pkg/kpp  C/\  | | | |-KPP_DO_DIAGS        :: KPP diags. see pkg/kpp
379    C/\  | | | |-SBO_CALC            :: SBO diags. see pkg/sbo
380    C/\  | | | |-SBO_DIAGS           :: SBO diags. see pkg/sbo
381    C/\  | | | |-GCHEM_DIAGS         :: gchem diags. see pkg/gchem
382  C/\  | | |  C/\  | | |
383  C/\  | | |-WRITE_CHECKPOINT :: Do I/O for restart files.  C/\  | | |-WRITE_CHECKPOINT :: Do I/O for restart files.
384  C/\  | |  C/\  | |
# Line 367  C Line 402  C
402  CEOI  CEOI
403    
404    
405    #include "AD_CONFIG.h"
406    #include "PACKAGES_CONFIG.h"
407  #include "CPP_OPTIONS.h"  #include "CPP_OPTIONS.h"
408    
409  CBOP  CBOP
# Line 432  C     == Global variables === Line 469  C     == Global variables ===
469  #include "PARAMS.h"  #include "PARAMS.h"
470  #include "DYNVARS.h"  #include "DYNVARS.h"
471  #ifdef ALLOW_NONHYDROSTATIC  #ifdef ALLOW_NONHYDROSTATIC
472  #include "CG3D.h"  # include "CG3D.h"
473  #endif  #endif
474    
475    #ifdef ALLOW_ECCO_OPTIMIZATION
476    # include "optim.h"
477    #endif
478  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
479  #include "tamc.h"  # include "tamc.h"
 #include "cost.h"  
 #include "adcost.h"  
480  #endif  #endif
481    
482  C     !INPUT/OUTPUT PARAMETERS:  C     !INPUT/OUTPUT PARAMETERS:
# Line 457  C     myCurrentTime - Time counter for t Line 495  C     myCurrentTime - Time counter for t
495  C     myCurrentIter - Iteration counter for this thread  C     myCurrentIter - Iteration counter for this thread
496        INTEGER myCurrentIter        INTEGER myCurrentIter
497        _RL     myCurrentTime        _RL     myCurrentTime
498          logical  exst
499          logical  lastdiva
500    #ifndef ALLOW_ECCO_OPTIMIZATION
501          integer optimcycle
502    #endif
503  CEOP  CEOP
504    c--   set default:
505    #ifndef ALLOW_ECCO_OPTIMIZATION
506          optimcycle = 0
507    #endif
508          lastdiva = .TRUE.
509    
510    #ifdef ALLOW_DEBUG
511          IF (debugMode) CALL DEBUG_ENTER('THE_MODEL_MAIN',myThid)
512    #endif
513    
514  C--   This timer encompasses the whole code  C--   This timer encompasses the whole code
515        CALL TIMER_START('ALL                [THE_MODEL_MAIN]',myThid)        CALL TIMER_START('ALL                    [THE_MODEL_MAIN]',myThid)
516    
517    #ifdef ALLOW_DEBUG
518          IF (debugMode) CALL DEBUG_CALL('INITIALISE_FIXED',myThid)
519    #endif
520    
521  C--   Set model configuration (fixed arrays)  C--   Set model configuration (fixed arrays)
522        CALL TIMER_START('INITIALISE_FIXED   [THE_MODEL_MAIN]',myThid)        CALL TIMER_START('INITIALISE_FIXED       [THE_MODEL_MAIN]',myThid)
523        CALL INITIALISE_FIXED( myThid )        CALL INITIALISE_FIXED( myThid )
524        CALL TIMER_STOP ('INITIALISE_FIXED   [THE_MODEL_MAIN]',myThid)        CALL TIMER_STOP ('INITIALISE_FIXED       [THE_MODEL_MAIN]',myThid)
525    
526        myCurrentTime = startTime        myCurrentTime = startTime
527        myCurrentIter = nIter0        myCurrentIter = nIter0
528    
529  #if ( defined (ALLOW_ADJOINT_RUN) || \  #if ( defined (ALLOW_ADMTLM) )
530        defined (ALLOW_GRADIENT_CHECK) || \  c
531        defined (ALLOW_ECCO_OPTIMIZATION) )        CALL TIMER_START('ADMTLM_DRIVER          [THE_MODEL_MAIN]',mythid)
532          CALL ADMTLM_DRIVER ( myThid )
533          CALL TIMER_STOP ('ADMTLM_DRIVER          [THE_MODEL_MAIN]',mythid)
534    c
535    #elif ( defined (ALLOW_AUTODIFF))
536    
537    # ifndef EXCLUDE_CTRL_PACK
538        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
539        IF (myProcId .eq. 0) THEN        IF (myProcId .eq. 0) THEN
540           CALL CTRL_UNPACK( mycurrentiter, mycurrenttime, mythid )           inquire( file='costfinal', exist=exst )
541             IF ( .NOT. exst .AND. niter0 .EQ. 0 ) THEN
542                CALL TIMER_START('CTRL_UNPACK      [THE_MODEL_MAIN]',mythid)
543                CALL CTRL_UNPACK( .TRUE. , mythid )
544                CALL TIMER_STOP ('CTRL_UNPACK      [THE_MODEL_MAIN]',mythid)
545                IF ( optimcycle.EQ.0 .AND. mycurrentiter.EQ.niter0 ) THEN
546                   CALL TIMER_START('CTRL_PACK     [THE_MODEL_MAIN]',mythid)
547                   CALL CTRL_PACK( .TRUE. , mythid )
548                   CALL TIMER_STOP ('CTRL_PACK     [THE_MODEL_MAIN]',mythid)
549                ENDIF
550             ENDIF
551        ENDIF        ENDIF
552        _END_MASTER( mythid )        _END_MASTER( mythid )
553        _BARRIER        _BARRIER
554    # endif /* EXCLUDE_CTRL_PACK */
555    
556        fc   = 0.0        CALL COST_DEPENDENT_INIT ( mythid )
557        adfc = 1.0        _BARRIER
558    
559    # if ( defined (ALLOW_TANGENTLINEAR_RUN) )
560    c
561          CALL TIMER_START('G_THE_MAIN_LOOP           [TANGENT RUN]',mythid)
562          CALL G_THE_MAIN_LOOP ( myCurrentTime, myCurrentIter, myThid )
563          CALL TIMER_STOP ('G_THE_MAIN_LOOP           [TANGENT RUN]',mythid)
564    c
565    # elif ( defined (ALLOW_ADJOINT_RUN) || \
566             defined (ALLOW_ECCO_OPTIMIZATION) )
567    c
568    #  ifdef ALLOW_DIVIDED_ADJOINT
569    c-- The following assumes the TAF option '-pure'
570          inquire( file='costfinal', exist=exst )
571          IF ( .NOT. exst) THEN
572             CALL TIMER_START('MDTHE_MAIN_LOOP            [MD RUN]', mythid)
573             CALL MDTHE_MAIN_LOOP ( myCurrentTime, myCurrentIter, mythid )
574             CALL TIMER_STOP ('MDTHE_MAIN_LOOP            [MD RUN]', mythid)
575             CALL COST_FINAL_STORE ( mythid, lastdiva )
576          ELSE
577             CALL TIMER_START('ADTHE_MAIN_LOOP       [ADJOINT RUN]', mythid)
578             CALL ADTHE_MAIN_LOOP ( mythid )
579             CALL TIMER_STOP ('ADTHE_MAIN_LOOP       [ADJOINT RUN]', mythid)
580             CALL COST_FINAL_RESTORE ( mythid, lastdiva )
581          ENDIF
582    c--
583    #  else /* ALLOW_DIVIDED_ADJOINT undef */
584        CALL TIMER_START('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)        CALL TIMER_START('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)
585        CALL ADTHE_MAIN_LOOP ( mythid )        CALL ADTHE_MAIN_LOOP ( mythid )
586        CALL TIMER_STOP ('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)        CALL TIMER_STOP ('ADTHE_MAIN_LOOP          [ADJOINT RUN]', mythid)
587        _BARRIER  #  endif /* ALLOW_DIVIDED_ADJOINT */
588    c
589    # endif
590    
591    # ifndef EXCLUDE_CTRL_PACK
592        _BEGIN_MASTER( mythid )        _BEGIN_MASTER( mythid )
593        IF (myProcId .eq. 0) THEN        IF ( myProcId .eq. 0 .AND. lastdiva ) THEN
594           call CTRL_PACK( mycurrentiter, mycurrenttime, mythid )           CALL TIMER_START('CTRL_PACK           [THE_MODEL_MAIN]',mythid)
595             call CTRL_PACK( .FALSE. , mythid )
596             CALL TIMER_STOP ('CTRL_PACK           [THE_MODEL_MAIN]',mythid)
597        ENDIF        ENDIF
598        _END_MASTER( mythid )        _END_MASTER( mythid )
599        _BARRIER        _BARRIER
600    # endif /* EXCLUDE_CTRL_PACK */
601    
602  #ifdef ALLOW_GRADIENT_CHECK  
603        if (useGrdchk) then  # ifdef ALLOW_GRDCHK
604           CALL TIMER_START('GRDCHK_MAIN          [ADJOINT RUN]', mythid)        IF ( useGrdchk .AND. lastdiva ) THEN
605             CALL TIMER_START('GRDCHK_MAIN         [THE_MODEL_MAIN]',mythid)
606           CALL GRDCHK_MAIN( mythid )           CALL GRDCHK_MAIN( mythid )
607           CALL TIMER_STOP ('GRDCHK_MAIN          [ADJOINT RUN]', mythid)           CALL TIMER_STOP ('GRDCHK_MAIN         [THE_MODEL_MAIN]',mythid)
608           _BARRIER           _BARRIER
609        end if        ENDIF
610  #endif  # endif
   
 #else /* ALLOW_ADJOINT_RUN undef */  
611    
612  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)  
613    
614  #endif /* ALLOW_ADJOINT_RUN */  #ifdef ALLOW_DEBUG
615          IF (debugMode) CALL DEBUG_CALL('THE_MAIN_LOOP',myThid)
616    #endif
617    
618  C--   Final checkpoint (incase the in-loop checkpoint was missed)  C--   Call time stepping loop of full model
619        CALL TIMER_START('WRITE_CHECKPOINT   [THE_MODEL_MAIN]',myThid)        CALL TIMER_START('THE_MAIN_LOOP          [THE_MODEL_MAIN]',myThid)
620          CALL THE_MAIN_LOOP( myCurrentTime, myCurrentIter, myThid )
621          CALL TIMER_STOP ('THE_MAIN_LOOP          [THE_MODEL_MAIN]',myThid)
622    
623    #endif /* ALLOW_TANGENTLINEAR_RUN ALLOW_ADJOINT_RUN ALLOW_ADMTLM_RUN */
624    
625    C--   Final checkpoint (in case the in-loop checkpoint was missed)
626          CALL TIMER_START('WRITE_CHECKPOINT       [THE_MODEL_MAIN]',myThid)
627          CALL PACKAGES_WRITE_PICKUP(
628         I        .TRUE., myCurrentTime, myCurrentIter, myThid )
629        CALL WRITE_CHECKPOINT(        CALL WRITE_CHECKPOINT(
630       &        .TRUE., myCurrentTime, myCurrentIter, myThid )       I        .TRUE., myCurrentTime, myCurrentIter, myThid )
631        CALL TIMER_STOP ('WRITE_CHECKPOINT   [THE_MODEL_MAIN]',myThid)        CALL TIMER_STOP ('WRITE_CHECKPOINT       [THE_MODEL_MAIN]',myThid)
632    
633        CALL TIMER_STOP ('ALL                [THE_MODEL_MAIN]',myThid)        CALL TIMER_STOP ('ALL                    [THE_MODEL_MAIN]',myThid)
634    
635    #ifdef ALLOW_MNC
636    C     Close all open NetCDF files
637          _BEGIN_MASTER( mythid )
638          CALL MNC_FILE_CLOSE_ALL()
639          _END_MASTER( mythid )
640    #endif
641    
642  C--   Write timer statistics  C--   Write timer statistics
643        IF ( myThid .EQ. 1 ) THEN        IF ( myThid .EQ. 1 ) THEN
# Line 528  C--   Write timer statistics Line 645  C--   Write timer statistics
645         CALL COMM_STATS         CALL COMM_STATS
646        ENDIF        ENDIF
647    
648    #ifdef ALLOW_DEBUG
649          IF (debugMode) CALL DEBUG_LEAVE('THE_MODEL_MAIN',myThid)
650    #endif
651    
652        RETURN        RETURN
653        END        END

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

  ViewVC Help
Powered by ViewVC 1.1.22