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

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

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

revision 1.83 by molod, Mon Feb 23 22:54:54 2004 UTC revision 1.103 by heimbach, Mon Sep 27 18:00:19 2004 UTC
# Line 1  Line 1 
1  C $eader: /u/u3/gcmpack/MITgcm/model/src/forward_step.F,v 1.79 2003/12/15 23:00:44 molod Exp $  C $Header$
2  C $Name$  C $Name$
3    
4  #include "PACKAGES_CONFIG.h"  #include "PACKAGES_CONFIG.h"
5  #include "CPP_OPTIONS.h"  #include "CPP_OPTIONS.h"
6    
 cswdptr -- add --  
7  #ifdef ALLOW_GCHEM  #ifdef ALLOW_GCHEM
8  # include "GCHEM_OPTIONS.h"  # include "GCHEM_OPTIONS.h"
9  #endif  #endif
10  cswdptr -- end add ---  #ifdef ALLOW_OFFLINE
11    # include "OFFLINE_OPTIONS.h"
12    #endif
13    
14    
15  CBOP  CBOP
16  C     !ROUTINE: FORWARD_STEP  C     !ROUTINE: FORWARD_STEP
# Line 38  C     == Global variables == Line 40  C     == Global variables ==
40  #include "EEPARAMS.h"  #include "EEPARAMS.h"
41  #include "PARAMS.h"  #include "PARAMS.h"
42  #include "DYNVARS.h"  #include "DYNVARS.h"
 #include "FFIELDS.h"  
   
 #ifdef ALLOW_NONHYDROSTATIC  
 #include "CG3D.h"  
 #endif  
43    
44  #ifdef ALLOW_SHAP_FILT  #ifdef ALLOW_SHAP_FILT
45  #include "SHAP_FILT.h"  # include "SHAP_FILT.h"
46  #endif  #endif
47  #ifdef ALLOW_ZONAL_FILT  #ifdef ALLOW_ZONAL_FILT
48  #include "ZONAL_FILT.h"  # include "ZONAL_FILT.h"
49    #endif
50    #ifdef COMPONENT_MODULE
51    # include "CPL_PARAMS.h"
52  #endif  #endif
53    
54  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
55    # include "FFIELDS.h"
56    
57    # ifdef ALLOW_NONHYDROSTATIC
58    #  include "CG3D.h"
59    # endif
60    
61  # include "tamc.h"  # include "tamc.h"
62  # include "ctrl.h"  # include "ctrl.h"
63  # include "ctrl_dummy.h"  # include "ctrl_dummy.h"
# Line 59  C     == Global variables == Line 65  C     == Global variables ==
65  # include "EOS.h"  # include "EOS.h"
66  # ifdef ALLOW_EXF  # ifdef ALLOW_EXF
67  #  include "exf_fields.h"  #  include "exf_fields.h"
68    #  include "exf_clim_fields.h"
69  #  ifdef ALLOW_BULKFORMULAE  #  ifdef ALLOW_BULKFORMULAE
70  #   include "exf_constants.h"  #   include "exf_constants.h"
71  #  endif  #  endif
# Line 67  C     == Global variables == Line 74  C     == Global variables ==
74  #  include "OBCS.h"  #  include "OBCS.h"
75  # endif  # endif
76  # ifdef ALLOW_PTRACERS  # ifdef ALLOW_PTRACERS
77    #  include "PTRACERS_SIZE.h"
78  #  include "PTRACERS.h"  #  include "PTRACERS.h"
79  # endif  # endif
80  # ifdef ALLOW_CD_CODE  # ifdef ALLOW_CD_CODE
81  #  include "CD_CODE_VARS.h"  #  include "CD_CODE_VARS.h"
82  # endif  # endif
83    # ifdef ALLOW_EBM
84    #  include "EBM.h"
85    # endif
86    # ifdef EXACT_CONSERV
87    #  include "SURFACE.h"
88    # endif
89  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
90    
91  C     !LOCAL VARIABLES:  C     !LOCAL VARIABLES:
# Line 81  C           mytime are local variables p Line 95  C           mytime are local variables p
95  C           arguments. Although this is fiddly it saves the need to  C           arguments. Although this is fiddly it saves the need to
96  C           impose additional synchronisation points when they are  C           impose additional synchronisation points when they are
97  C           updated.  C           updated.
98  C     myiter - iteration counter for this thread  C     myIter - iteration counter for this thread
99  C     mytime - time counter for this thread  C     myTime - time counter for this thread
100  C     mythid - thread number for this instance of the routine.  C     myThid - thread number for this instance of the routine.
101        integer iloop        INTEGER iloop
102        integer mythid        INTEGER myThid
103        integer myiter        INTEGER myIter
104        _RL     mytime        _RL     myTime
105    
106        integer i,L  C     == Local variables ==
107          INTEGER myItP1
108  CEOP  CEOP
109    
110  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
# Line 117  cph   with the ecco-branch (it should). Line 132  cph   with the ecco-branch (it should).
132  cph      CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid )  cph      CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid )
133  #endif  #endif
134    
 #ifdef EXACT_CONSERV  
       IF (exactConserv) THEN  
 C--   Update etaH(n+1) :  
          CALL TIMER_START('UPDATE_ETAH        [FORWARD_STEP]',mythid)  
          CALL UPDATE_ETAH( myTime, myIter, myThid )  
          CALL TIMER_STOP ('UPDATE_ETAH        [FORWARD_STEP]',mythid)  
       ENDIF  
 #endif /* EXACT_CONSERV */  
   
 #ifdef NONLIN_FRSURF  
       IF ( select_rStar.NE.0 ) THEN  
 C--   r* : compute the future level thickness according to etaH(n+1)  
           CALL TIMER_START('CALC_R_STAR       [FORWARD_STEP]',mythid)  
           CALL CALC_R_STAR(etaH, myTime, myIter, myThid )  
           CALL TIMER_STOP ('CALC_R_STAR       [FORWARD_STEP]',mythid)  
       ELSEIF ( nonlinFreeSurf.GT.0) THEN  
 C--   compute the future surface level thickness according to etaH(n+1)  
           CALL TIMER_START('CALC_SURF_DR      [FORWARD_STEP]',mythid)  
           CALL CALC_SURF_DR(etaH, myTime, myIter, myThid )  
           CALL TIMER_STOP ('CALC_SURF_DR      [FORWARD_STEP]',mythid)  
       ENDIF  
 #endif /* NONLIN_FRSURF */  
   
135  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
136  c**************************************  c**************************************
137  #include "checkpoint_lev1_directives.h"  #include "checkpoint_lev1_directives.h"
# Line 175  cph The following IF-statement creates a Line 167  cph The following IF-statement creates a
167  cph for the forcing fields requiring additional storing.  cph for the forcing fields requiring additional storing.
168  cph Therefore, the IF-statement will be put between CPP-OPTIONS,  cph Therefore, the IF-statement will be put between CPP-OPTIONS,
169  cph assuming that ALLOW_SEAICE has not yet been differentiated.  cph assuming that ALLOW_SEAICE has not yet been differentiated.
170  #  ifdef ALLOW_SEAICE  #  if (defined (ALLOW_SEAICE) || defined (ALLOW_EBM))
171        IF ( .NOT. useSEAICE ) THEN        IF ( .NOT. useSEAICE .AND. .NOT. useEBM ) THEN
172  #  endif  #  endif
173  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
174         IF ( debugLevel .GE. debLevB )         IF ( debugLevel .GE. debLevB )
# Line 185  cph assuming that ALLOW_SEAICE has not y Line 177  cph assuming that ALLOW_SEAICE has not y
177         CALL TIMER_START('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid)         CALL TIMER_START('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid)
178         CALL EXTERNAL_FIELDS_LOAD( mytime, myiter, mythid )         CALL EXTERNAL_FIELDS_LOAD( mytime, myiter, mythid )
179         CALL TIMER_STOP ('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid)         CALL TIMER_STOP ('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid)
180  #  ifdef ALLOW_SEAICE  #  if (defined (ALLOW_SEAICE) || defined (ALLOW_EBM))
181        ENDIF        ENDIF
182  #  endif  #  endif
183  # endif /* ALLOW_EXF */  # endif /* ALLOW_EXF */
# Line 200  c--   Add control vector for forcing and Line 192  c--   Add control vector for forcing and
192       &     CALL CTRL_MAP_FORCING (mythid)       &     CALL CTRL_MAP_FORCING (mythid)
193  #endif  #endif
194    
 #ifdef ALLOW_THSICE  
       IF (useThSIce) THEN  
 #ifdef ALLOW_DEBUG  
         IF ( debugLevel .GE. debLevB )  
      &    CALL DEBUG_CALL('THSICE_MAIN',myThid)  
 #endif  
 C--     Step forward Therm.Sea-Ice variables  
 C       and modify forcing terms including effects from ice  
         CALL TIMER_START('THSICE_MAIN        [FORWARD_STEP]', myThid)  
         CALL THSICE_MAIN( myTime, myIter, myThid )  
         CALL TIMER_STOP( 'THSICE_MAIN        [FORWARD_STEP]', myThid)  
       ENDIF  
 #endif /* ALLOW_THSICE */  
   
195  # ifdef ALLOW_SEAICE  # ifdef ALLOW_SEAICE
196  C--   Call sea ice model to compute forcing/external data fields.  In  C--   Call sea ice model to compute forcing/external data fields.  In
197  C     addition to computing prognostic sea-ice variables and diagnosing the  C     addition to computing prognostic sea-ice variables and diagnosing the
# Line 236  C     theta is dumped or time-averaged. Line 214  C     theta is dumped or time-averaged.
214        ENDIF        ENDIF
215  # endif /* ALLOW_SEAICE */  # endif /* ALLOW_SEAICE */
216    
 C--   Freeze water at the surface  
 #ifdef ALLOW_AUTODIFF_TAMC  
 CADJ STORE theta = comlev1, key = ikey_dynamics  
 #endif  
       IF ( allowFreezing .AND. .NOT. useSEAICE  
      &                   .AND. .NOT. useThSIce ) THEN  
         CALL FREEZE_SURFACE(  myTime, myIter, myThid )  
       ENDIF  
   
217  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
218  # ifdef ALLOW_PTRACERS  # ifdef ALLOW_PTRACERS
219  cph this replaces _bibj storing of ptracer within thermodynamics  cph this replaces _bibj storing of ptracer within thermodynamics
# Line 252  CADJ STORE ptracer  = comlev1, key = ike Line 221  CADJ STORE ptracer  = comlev1, key = ike
221  # endif  # endif
222  #endif  #endif
223    
224    #ifdef ALLOW_OFFLINE
225            call OFFLINE_FIELDS_LOAD( myTime, myIter, myThid )
226    #endif
227    
228  #ifdef ALLOW_PTRACERS  #ifdef ALLOW_PTRACERS
229  # ifdef ALLOW_GCHEM  # ifdef ALLOW_GCHEM
230           CALL GCHEM_FIELDS_LOAD( mytime, myiter, mythid )           CALL GCHEM_FIELDS_LOAD( mytime, myiter, mythid )
# Line 259  CADJ STORE ptracer  = comlev1, key = ike Line 232  CADJ STORE ptracer  = comlev1, key = ike
232  #endif  #endif
233    
234  #ifdef COMPONENT_MODULE  #ifdef COMPONENT_MODULE
235         IF ( useCoupler ) THEN         IF ( useCoupler .AND. cpl_earlyExpImpCall ) THEN
236  C      Post coupling data that I export.  C      Post coupling data that I export.
237  C      Read in coupling data that I import.  C      Read in coupling data that I import.
238           CALL TIMER_START('CPL_EXPORT-IMPORT  [FORWARD_STEP]',myThid)           CALL TIMER_START('CPL_EXPORT-IMPORT  [FORWARD_STEP]',myThid)
# Line 269  C      Read in coupling data that I impo Line 242  C      Read in coupling data that I impo
242         ENDIF         ENDIF
243  #endif /* COMPONENT_MODULE */  #endif /* COMPONENT_MODULE */
244    
245  #ifdef COMPONENT_MODULE  #ifdef ALLOW_EBM
246  # ifndef ALLOW_AIM          IF ( useEBM ) THEN
247  C jmc: don't know precisely where to put this call. leave it here for now.  # ifdef ALLOW_DEBUG
248         IF ( useCoupler ) THEN           IF ( debugLevel .GE. debLevB )
249           CALL OCN_APPLY_IMPORT( myTime, myIter, myThid )       &    CALL DEBUG_CALL('EBM',myThid)
        ENDIF  
250  # endif  # endif
251  #endif /* COMPONENT_MODULE */           CALL TIMER_START('EBM                [FORWARD_STEP]',mythid)
252             CALL EBM_DRIVER ( myTime, myIter, myThid )
253             CALL TIMER_STOP ('EBM                [FORWARD_STEP]',mythid)
254            ENDIF
255    #endif
256    
257  C--     Step forward fields and calculate time tendency terms.  C--     Step forward fields and calculate time tendency terms.
258    
 C AMM  
 #ifdef ALLOW_FIZHI  
         if( useFIZHI) then  
          CALL UPDATE_OCEAN_EXPORTS ( myTime, myIter, myThid )  
          CALL UPDATE_EARTH_EXPORTS ( myTime, myIter, myThid )  
          CALL UPDATE_CHEMISTRY_EXPORTS ( myTime, myIter, myThid )  
          CALL TIMER_START('FIZHI_WRAPPER       [FORWARD_STEP]',mythid)  
          CALL FIZHI_WRAPPER ( myTime, myIter, myThid )  
          CALL TIMER_STOP ('FIZHI_WRAPPER       [FORWARD_STEP]',mythid)  
          CALL STEP_FIZHI_FG ( myTime, myIter, myThid, deltaTtracer )  
         endif  
 #endif  
 C AMM  
   
259  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
260        IF ( debugLevel .GE. debLevB )         IF ( debugLevel .GE. debLevB )
261       &    CALL DEBUG_CALL('THERMODYNAMICS',myThid)       &    CALL DEBUG_CALL('DO_ATMOSPHERIC_PHYS',myThid)
262  #endif  #endif
263          CALL TIMER_START('THERMODYNAMICS      [FORWARD_STEP]',mythid)         CALL TIMER_START('DO_ATMOSPHERIC_PHYS [FORWARD_STEP]',mythid)
264          CALL THERMODYNAMICS( myTime, myIter, myThid )         CALL DO_ATMOSPHERIC_PHYS( myTime, myIter, myThid )
265          CALL TIMER_STOP ('THERMODYNAMICS      [FORWARD_STEP]',mythid)         CALL TIMER_STOP ('DO_ATMOSPHERIC_PHYS [FORWARD_STEP]',mythid)
266    
267  C--   do exchanges (needed for DYNAMICS) when using stagger time-step :  #ifndef ALLOW_OFFLINE
268  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
269        IF ( debugLevel .GE. debLevB )         IF ( debugLevel .GE. debLevB )
270       &    CALL DEBUG_CALL('DO_STAGGER_FIELDS_EXCH.',myThid)       &    CALL DEBUG_CALL('DO_OCEANIC_PHYS',myThid)
271  #endif  #endif
272          CALL TIMER_START('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)         CALL TIMER_START('DO_OCEANIC_PHYS     [FORWARD_STEP]',mythid)
273          CALL DO_STAGGER_FIELDS_EXCHANGES( myTime, myIter, myThid )         CALL DO_OCEANIC_PHYS( myTime, myIter, myThid )
274          CALL TIMER_STOP ('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)         CALL TIMER_STOP ('DO_OCEANIC_PHYS     [FORWARD_STEP]',mythid)
   
 #ifdef ALLOW_SHAP_FILT  
       IF (useSHAP_FILT .AND.  
      &     staggerTimeStep .AND. shap_filt_TrStagg ) THEN  
 #ifdef ALLOW_DEBUG  
         IF ( debugLevel .GE. debLevB )  
      &    CALL DEBUG_CALL('SHAP_FILT_APPLY_TS',myThid)  
 #endif  
         CALL TIMER_START('SHAP_FILT           [FORWARD_STEP]',myThid)  
         CALL SHAP_FILT_APPLY_TS(gT,gS,myTime+deltaT,myIter+1,myThid)  
         CALL TIMER_STOP ('SHAP_FILT           [FORWARD_STEP]',myThid)  
       ENDIF  
275  #endif  #endif
276    
277  #ifdef ALLOW_ZONAL_FILT        IF ( .NOT.staggerTimeStep ) THEN
       IF (useZONAL_FILT .AND.  
      &     staggerTimeStep .AND. zonal_filt_TrStagg ) THEN  
278  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
279          IF ( debugLevel .GE. debLevB )          IF ( debugLevel .GE. debLevB )
280       &    CALL DEBUG_CALL('ZONAL_FILT_APPLY_TS',myThid)       &    CALL DEBUG_CALL('THERMODYNAMICS',myThid)
281  #endif  #endif
282          CALL TIMER_START('ZONAL_FILT_APPLY    [FORWARD_STEP]',myThid)          CALL TIMER_START('THERMODYNAMICS      [FORWARD_STEP]',mythid)
283          CALL ZONAL_FILT_APPLY_TS( gT, gS, myThid )          CALL THERMODYNAMICS( myTime, myIter, myThid )
284          CALL TIMER_STOP ('ZONAL_FILT_APPLY    [FORWARD_STEP]',myThid)          CALL TIMER_STOP ('THERMODYNAMICS      [FORWARD_STEP]',mythid)
285    C--    if not staggerTimeStep: end
286        ENDIF        ENDIF
287  #endif    
288    #ifdef COMPONENT_MODULE
289           IF ( useCoupler .AND. .NOT.cpl_earlyExpImpCall ) THEN
290    C      Post coupling data that I export.
291    C      Read in coupling data that I import.
292             myItP1 = myIter + 1
293             CALL TIMER_START('CPL_EXPORT-IMPORT  [FORWARD_STEP]',myThid)
294             CALL CPL_EXPORT_MY_DATA(       myItP1, myTime, myThid )
295             CALL CPL_IMPORT_EXTERNAL_DATA( myItP1, myTime, myThid )
296             CALL TIMER_STOP ('CPL_EXPORT-IMPORT  [FORWARD_STEP]',myThid)
297    # ifndef ALLOW_AIM
298            IF ( useRealFreshWaterFlux ) THEN
299             CALL OCN_APPLY_IMPORT( .FALSE., myTime, myIter, myThid )
300            ENDIF
301    # endif
302           ENDIF
303    #endif /* COMPONENT_MODULE */
304    
305  C--   Step forward fields and calculate time tendency terms.  C--   Step forward fields and calculate time tendency terms.
306    #ifndef ALLOW_OFFLINE
307  #ifndef ALLOW_AUTODIFF_TAMC  #ifndef ALLOW_AUTODIFF_TAMC
308        IF ( momStepping ) THEN        IF ( momStepping ) THEN
309  #endif  #endif
# Line 351  C--   Step forward fields and calculate Line 317  C--   Step forward fields and calculate
317  #ifndef ALLOW_AUTODIFF_TAMC  #ifndef ALLOW_AUTODIFF_TAMC
318        ENDIF        ENDIF
319  #endif  #endif
320    #endif
321    
322  #ifdef ALLOW_NONHYDROSTATIC  #ifdef ALLOW_NONHYDROSTATIC
323  C--   Step forward W field in N-H algorithm  C--   Step forward W field in N-H algorithm
# Line 365  C--   Step forward W field in N-H algori Line 332  C--   Step forward W field in N-H algori
332        ENDIF        ENDIF
333  #endif  #endif
334    
335    C--   Update time-counter
336          myIter = nIter0 + iLoop
337          myTime = startTime + deltaTClock * float(iLoop)
338    
339    C--   Update geometric factors:
340  #ifdef NONLIN_FRSURF  #ifdef NONLIN_FRSURF
341  C--   update hfacC,W,S and recip_hFac according to etaH(n+1) :  C-    update hfacC,W,S and recip_hFac according to etaH(n+1) :
342        IF ( nonlinFreeSurf.GT.0) THEN        IF ( nonlinFreeSurf.GT.0) THEN
343         IF ( select_rStar.GT.0 ) THEN         IF ( select_rStar.GT.0 ) THEN
344          CALL TIMER_START('UPDATE_R_STAR      [FORWARD_STEP]',myThid)          CALL TIMER_START('UPDATE_R_STAR      [FORWARD_STEP]',myThid)
# Line 394  C--   Apply Filters to u*,v* before SOLV Line 366  C--   Apply Filters to u*,v* before SOLV
366  C--   Explicit+Implicit part of the Barotropic Flow Divergence  C--   Explicit+Implicit part of the Barotropic Flow Divergence
367  C      => Filtering of uVel,vVel is necessary  C      => Filtering of uVel,vVel is necessary
368            CALL SHAP_FILT_APPLY_UV( uVel,vVel,            CALL SHAP_FILT_APPLY_UV( uVel,vVel,
369       &                             myTime+deltaT, myIter+1, myThid )       &                             myTime, myIter, myThid )
370          ENDIF          ENDIF
371          CALL SHAP_FILT_APPLY_UV( gU,gV,myTime+deltaT,myIter+1,myThid)          CALL SHAP_FILT_APPLY_UV( gU,gV,myTime,myIter,myThid)
372          CALL TIMER_STOP ('SHAP_FILT           [FORWARD_STEP]',myThid)          CALL TIMER_STOP ('SHAP_FILT           [FORWARD_STEP]',myThid)
373        ENDIF        ENDIF
374  #endif  #endif
# Line 416  C      => Filtering of uVel,vVel is nece Line 388  C      => Filtering of uVel,vVel is nece
388  C--   Solve elliptic equation(s).  C--   Solve elliptic equation(s).
389  C     Two-dimensional only for conventional hydrostatic or  C     Two-dimensional only for conventional hydrostatic or
390  C     three-dimensional for non-hydrostatic and/or IGW scheme.  C     three-dimensional for non-hydrostatic and/or IGW scheme.
391    #ifndef ALLOW_OFFLINE
392        IF ( momStepping ) THEN        IF ( momStepping ) THEN
393        CALL TIMER_START('SOLVE_FOR_PRESSURE  [FORWARD_STEP]',myThid)          CALL TIMER_START('SOLVE_FOR_PRESSURE  [FORWARD_STEP]',myThid)
394        CALL SOLVE_FOR_PRESSURE(myTime, myIter, myThid)          CALL SOLVE_FOR_PRESSURE(myTime, myIter, myThid)
395        CALL TIMER_STOP ('SOLVE_FOR_PRESSURE  [FORWARD_STEP]',myThid)          CALL TIMER_STOP ('SOLVE_FOR_PRESSURE  [FORWARD_STEP]',myThid)
396        ENDIF        ENDIF
397    #endif
398    
399    C--   Correct divergence in flow field and cycle time-stepping momentum
400    c     IF ( momStepping ) THEN
401    #ifndef ALLOW_OFFLINE
402            CALL TIMER_START('UV_CORRECTION_STEP  [FORWARD_STEP]',myThid)
403            CALL MOMENTUM_CORRECTION_STEP(myTime, myIter, myThid)
404            CALL TIMER_STOP ('UV_CORRECTION_STEP  [FORWARD_STEP]',myThid)
405    #endif
406    c     ENDIF
407    
408    #ifdef EXACT_CONSERV
409          IF (exactConserv) THEN
410    C--   Update etaH(n+1) :
411            CALL TIMER_START('UPDATE_ETAH        [FORWARD_STEP]',mythid)
412            CALL UPDATE_ETAH( myTime, myIter, myThid )
413            CALL TIMER_STOP ('UPDATE_ETAH        [FORWARD_STEP]',mythid)
414          ENDIF
415    #endif /* EXACT_CONSERV */
416    
417    #ifdef NONLIN_FRSURF
418          IF ( select_rStar.NE.0 ) THEN
419    C--   r* : compute the future level thickness according to etaH(n+1)
420            CALL TIMER_START('CALC_R_STAR       [FORWARD_STEP]',mythid)
421            CALL CALC_R_STAR(etaH, myTime, myIter, myThid )
422            CALL TIMER_STOP ('CALC_R_STAR       [FORWARD_STEP]',mythid)
423          ELSEIF ( nonlinFreeSurf.GT.0) THEN
424    C--   compute the future surface level thickness according to etaH(n+1)
425            CALL TIMER_START('CALC_SURF_DR      [FORWARD_STEP]',mythid)
426            CALL CALC_SURF_DR(etaH, myTime, myIter, myThid )
427            CALL TIMER_STOP ('CALC_SURF_DR      [FORWARD_STEP]',mythid)
428          ENDIF
429    #endif /* NONLIN_FRSURF */
430    
431    C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
432          IF ( staggerTimeStep ) THEN
433    C--   do exchanges of U,V (needed for multiDim) when using stagger time-step :
434    #ifdef ALLOW_DEBUG
435            IF ( debugLevel .GE. debLevB )
436         &    CALL DEBUG_CALL('DO_STAGGER_FIELDS_EXCH.',myThid)
437    #endif
438            CALL TIMER_START('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)
439            CALL DO_STAGGER_FIELDS_EXCHANGES( myTime, myIter, myThid )
440            CALL TIMER_STOP ('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)
441    
442    #ifdef ALLOW_DEBUG
443            IF ( debugLevel .GE. debLevB )
444         &    CALL DEBUG_CALL('THERMODYNAMICS',myThid)
445    #endif
446            CALL TIMER_START('THERMODYNAMICS      [FORWARD_STEP]',mythid)
447            CALL THERMODYNAMICS( myTime, myIter, myThid )
448            CALL TIMER_STOP ('THERMODYNAMICS      [FORWARD_STEP]',mythid)
449    
450    C--    if staggerTimeStep: end
451          ENDIF
452    C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
453    
454  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
455  cph This is needed because convective_adjustment calls  cph This is needed because convective_adjustment calls
456  cph find_rho which may use pressure()  cph find_rho which may use pressure()
457  CADJ STORE totphihyd  = comlev1, key = ikey_dynamics  CADJ STORE totphihyd  = comlev1, key = ikey_dynamics
458  #endif  #endif
459  C--   Correct divergence in flow field and cycle time-stepping  C--   Cycle time-stepping Tracers arrays (T,S,+pTracers)
460  C     arrays (for all fields) ; update time-counter          CALL TIMER_START('TS_CORRECTION_STEP  [FORWARD_STEP]',myThid)
461        myIter = nIter0 + iLoop          CALL TRACERS_CORRECTION_STEP(myTime, myIter, myThid)
462        myTime = startTime + deltaTClock * float(iLoop)          CALL TIMER_STOP ('TS_CORRECTION_STEP  [FORWARD_STEP]',myThid)
       CALL TIMER_START('THE_CORRECTION_STEP [FORWARD_STEP]',myThid)  
       CALL THE_CORRECTION_STEP(myTime, myIter, myThid)  
       CALL TIMER_STOP ('THE_CORRECTION_STEP [FORWARD_STEP]',myThid)  
463    
464  C--   Do "blocking" sends and receives for tendency "overlap" terms  C--   Do "blocking" sends and receives for tendency "overlap" terms
465  c     CALL TIMER_START('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)  c     CALL TIMER_START('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)
# Line 458  cswdptr -- end add --- Line 484  cswdptr -- end add ---
484    
485  C AMM  C AMM
486  #ifdef ALLOW_GRIDALT  #ifdef ALLOW_GRIDALT
487          if (useGRIDALT) CALL GRIDALT_UPDATE(myThid)          if (useGRIDALT) then
488             CALL GRIDALT_UPDATE(myThid)
489            endif
490  #endif  #endif
491  C AMM  C AMM
492    
493  C AMM  C AMM
494  #ifdef ALLOW_FIZHI  #ifdef ALLOW_FIZHI
495          CALL STEP_FIZHI_CORR ( myTime, myIter, myThid )          if( useFIZHI) then
496             CALL TIMER_START('FIZHI               [FORWARD_STEP]',mythid)
497             CALL STEP_FIZHI_CORR ( myTime, myIter, myThid )
498             CALL TIMER_STOP('FIZHI               [FORWARD_STEP]',mythid)
499            endif
500  #endif  #endif
501  C AMM  C AMM
502    
# Line 477  C--   Calculate float trajectories Line 509  C--   Calculate float trajectories
509        ENDIF        ENDIF
510  #endif  #endif
511    
512    C--   State-variables statistics (time-aver, diagnostics ...)
513          CALL TIMER_START('DO_STATEVARS_DIAGS  [FORWARD_STEP]',myThid)
514          CALL DO_STATEVARS_DIAGS( myTime, myIter, myThid )
515          CALL TIMER_STOP ('DO_STATEVARS_DIAGS  [FORWARD_STEP]',myThid)
516    
517    #ifndef ALLOW_OFFLINE
518  #ifdef ALLOW_MONITOR  #ifdef ALLOW_MONITOR
519  C--   Check status of solution (statistics, cfl, etc...)  C--   Check status of solution (statistics, cfl, etc...)
520        CALL TIMER_START('MONITOR             [FORWARD_STEP]',myThid)        CALL TIMER_START('MONITOR             [FORWARD_STEP]',myThid)
521        CALL MONITOR( myIter, myTime, myThid )        CALL MONITOR( myIter, myTime, myThid )
522        CALL TIMER_STOP ('MONITOR             [FORWARD_STEP]',myThid)        CALL TIMER_STOP ('MONITOR             [FORWARD_STEP]',myThid)
523  #endif /* ALLOW_MONITOR */  #endif /* ALLOW_MONITOR */
524    #endif
525    
526    #ifdef ALLOW_COST
527    C--     compare model with data and compute cost function
528    C--     this is done after exchanges to allow interpolation
529    ceh3 perhaps needs an IF ( useCOST ) THEN
530    CADJ STORE theta, uvel, vvel = comlev1, key = ikey_dynamics
531          CALL TIMER_START('COST_TILE           [FORWARD_STEP]',myThid)
532          CALL COST_TILE  ( mytime, myiter, myThid )
533          CALL TIMER_STOP ('COST_TILE           [FORWARD_STEP]',myThid)
534    #endif
535    
536  C--   Do IO if needed.  C--   Do IO if needed.
537    #ifdef ALLOW_OFFLINE
538          CALL TIMER_START('OFFLINE_MODEL_IO    [FORWARD_STEP]',myThid)
539          CALL OFFLINE_MODEL_IO( myTime, myIter, myThid )
540          CALL TIMER_STOP ('OFFLINE_MODEL_IO    [FORWARD_STEP]',myThid)
541    #else
542        CALL TIMER_START('DO_THE_MODEL_IO     [FORWARD_STEP]',myThid)        CALL TIMER_START('DO_THE_MODEL_IO     [FORWARD_STEP]',myThid)
543        CALL DO_THE_MODEL_IO( myTime, myIter, myThid )        CALL DO_THE_MODEL_IO( myTime, myIter, myThid )
544        CALL TIMER_STOP ('DO_THE_MODEL_IO     [FORWARD_STEP]',myThid)        CALL TIMER_STOP ('DO_THE_MODEL_IO     [FORWARD_STEP]',myThid)
545    #endif
546    
547  C--   Save state for restarts  C--   Save state for restarts
 C     Note:    (jmc: is it still the case after ckp35 ?)  
 C     =====  
 C     Because of the ordering of the timestepping code and  
 C     tendency term code at end of loop model arrays hold  
 C     U,V,T,S  at "time-level" N but gu, gv, gs, gt, guNM1,...  
 C     at "time-level" N+1/2 (guNM1 at "time-level" N+1/2 is  
 C     gu at "time-level" N-1/2) and etaN at "time-level" N+1/2.  
 C      where N = I+timeLevBase-1  
 C     Thus a checkpoint contains U.0000000000, GU.0000000001 and  
 C     etaN.0000000001 in the indexing scheme used for the model  
 C     "state" files. This example is referred to as a checkpoint  
 C     at time level 1  
548        CALL TIMER_START('WRITE_CHECKPOINT    [FORWARD_STEP]',myThid)        CALL TIMER_START('WRITE_CHECKPOINT    [FORWARD_STEP]',myThid)
549        CALL PACKAGES_WRITE_PICKUP(        CALL PACKAGES_WRITE_PICKUP(
550       I               .FALSE., myTime, myIter, myThid )       I               .FALSE., myTime, myIter, myThid )
551    #ifndef ALLOW_OFFLINE
552        CALL WRITE_CHECKPOINT(        CALL WRITE_CHECKPOINT(
553       I               .FALSE., myTime, myIter, myThid )         I               .FALSE., myTime, myIter, myThid )  
554    #endif
555        CALL TIMER_STOP ('WRITE_CHECKPOINT    [FORWARD_STEP]',myThid)        CALL TIMER_STOP ('WRITE_CHECKPOINT    [FORWARD_STEP]',myThid)
556    
557  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG

Legend:
Removed from v.1.83  
changed lines
  Added in v.1.103

  ViewVC Help
Powered by ViewVC 1.1.22