/[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.91 by jmc, Tue Apr 6 00:31:54 2004 UTC revision 1.105 by heimbach, Thu Nov 11 02:24:20 2004 UTC
# Line 4  C $Name$ Line 4  C $Name$
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    #ifdef ALLOW_GMREDI
14    # include "GMREDI_OPTIONS.h"
15    #endif
16    
17  CBOP  CBOP
18  C     !ROUTINE: FORWARD_STEP  C     !ROUTINE: FORWARD_STEP
# Line 45  C     == Global variables == Line 49  C     == Global variables ==
49  #ifdef ALLOW_ZONAL_FILT  #ifdef ALLOW_ZONAL_FILT
50  # include "ZONAL_FILT.h"  # include "ZONAL_FILT.h"
51  #endif  #endif
52    #ifdef COMPONENT_MODULE
53    # include "CPL_PARAMS.h"
54    #endif
55    
56  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
57  # include "FFIELDS.h"  # include "FFIELDS.h"
# Line 69  C     == Global variables == Line 76  C     == Global variables ==
76  #  include "OBCS.h"  #  include "OBCS.h"
77  # endif  # endif
78  # ifdef ALLOW_PTRACERS  # ifdef ALLOW_PTRACERS
79    #  include "PTRACERS_SIZE.h"
80  #  include "PTRACERS.h"  #  include "PTRACERS.h"
81  # endif  # endif
82  # ifdef ALLOW_CD_CODE  # ifdef ALLOW_CD_CODE
83  #  include "CD_CODE_VARS.h"  #  include "CD_CODE_VARS.h"
84  # endif  # endif
85    # ifdef ALLOW_EBM
86    #  include "EBM.h"
87    # endif
88    # ifdef EXACT_CONSERV
89    #  include "SURFACE.h"
90    # endif
91    # ifdef ALLOW_KPP
92    #  include "KPP.h"
93    # endif
94    # ifdef ALLOW_GMREDI
95    #  include "GMREDI.h"
96    # endif
97  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
98    
99  C     !LOCAL VARIABLES:  C     !LOCAL VARIABLES:
# Line 83  C           mytime are local variables p Line 103  C           mytime are local variables p
103  C           arguments. Although this is fiddly it saves the need to  C           arguments. Although this is fiddly it saves the need to
104  C           impose additional synchronisation points when they are  C           impose additional synchronisation points when they are
105  C           updated.  C           updated.
106  C     myiter - iteration counter for this thread  C     myIter - iteration counter for this thread
107  C     mytime - time counter for this thread  C     myTime - time counter for this thread
108  C     mythid - thread number for this instance of the routine.  C     myThid - thread number for this instance of the routine.
109        integer iloop        INTEGER iloop
110        integer mythid        INTEGER myThid
111        integer myiter        INTEGER myIter
112        _RL     mytime        _RL     myTime
113    
114        integer i,L  C     == Local variables ==
115          INTEGER myItP1
116  CEOP  CEOP
117    
118  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
# Line 119  cph   with the ecco-branch (it should). Line 140  cph   with the ecco-branch (it should).
140  cph      CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid )  cph      CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid )
141  #endif  #endif
142    
 #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 */  
   
143  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
144  c**************************************  c**************************************
145  #include "checkpoint_lev1_directives.h"  #include "checkpoint_lev1_directives.h"
# Line 177  cph The following IF-statement creates a Line 175  cph The following IF-statement creates a
175  cph for the forcing fields requiring additional storing.  cph for the forcing fields requiring additional storing.
176  cph Therefore, the IF-statement will be put between CPP-OPTIONS,  cph Therefore, the IF-statement will be put between CPP-OPTIONS,
177  cph assuming that ALLOW_SEAICE has not yet been differentiated.  cph assuming that ALLOW_SEAICE has not yet been differentiated.
178  #  ifdef ALLOW_SEAICE  #  if (defined (ALLOW_SEAICE) || defined (ALLOW_EBM))
179        IF ( .NOT. useSEAICE ) THEN        IF ( .NOT. useSEAICE .AND. .NOT. useEBM ) THEN
180  #  endif  #  endif
181  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
182         IF ( debugLevel .GE. debLevB )         IF ( debugLevel .GE. debLevB )
# Line 187  cph assuming that ALLOW_SEAICE has not y Line 185  cph assuming that ALLOW_SEAICE has not y
185         CALL TIMER_START('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid)         CALL TIMER_START('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid)
186         CALL EXTERNAL_FIELDS_LOAD( mytime, myiter, mythid )         CALL EXTERNAL_FIELDS_LOAD( mytime, myiter, mythid )
187         CALL TIMER_STOP ('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid)         CALL TIMER_STOP ('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid)
188  #  ifdef ALLOW_SEAICE  #  if (defined (ALLOW_SEAICE) || defined (ALLOW_EBM))
189        ENDIF        ENDIF
190  #  endif  #  endif
191  # endif /* ALLOW_EXF */  # endif /* ALLOW_EXF */
# Line 202  c--   Add control vector for forcing and Line 200  c--   Add control vector for forcing and
200       &     CALL CTRL_MAP_FORCING (mythid)       &     CALL CTRL_MAP_FORCING (mythid)
201  #endif  #endif
202    
 #ifdef ALLOW_THSICE  
       IF ( useThSIce .AND. buoyancyRelation(1:7) .EQ. 'OCEANIC' ) 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 */  
   
203  # ifdef ALLOW_SEAICE  # ifdef ALLOW_SEAICE
204  C--   Call sea ice model to compute forcing/external data fields.  In  C--   Call sea ice model to compute forcing/external data fields.  In
205  C     addition to computing prognostic sea-ice variables and diagnosing the  C     addition to computing prognostic sea-ice variables and diagnosing the
# Line 238  C     theta is dumped or time-averaged. Line 222  C     theta is dumped or time-averaged.
222        ENDIF        ENDIF
223  # endif /* ALLOW_SEAICE */  # endif /* ALLOW_SEAICE */
224    
 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  
   
225  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
226  # ifdef ALLOW_PTRACERS  # ifdef ALLOW_PTRACERS
227  cph this replaces _bibj storing of ptracer within thermodynamics  cph this replaces _bibj storing of ptracer within thermodynamics
# Line 254  CADJ STORE ptracer  = comlev1, key = ike Line 229  CADJ STORE ptracer  = comlev1, key = ike
229  # endif  # endif
230  #endif  #endif
231    
232    #ifdef ALLOW_OFFLINE
233            call OFFLINE_FIELDS_LOAD( myTime, myIter, myThid )
234    #endif
235    
236  #ifdef ALLOW_PTRACERS  #ifdef ALLOW_PTRACERS
237  # ifdef ALLOW_GCHEM  # ifdef ALLOW_GCHEM
238           CALL GCHEM_FIELDS_LOAD( mytime, myiter, mythid )           CALL GCHEM_FIELDS_LOAD( mytime, myiter, mythid )
# Line 261  CADJ STORE ptracer  = comlev1, key = ike Line 240  CADJ STORE ptracer  = comlev1, key = ike
240  #endif  #endif
241    
242  #ifdef COMPONENT_MODULE  #ifdef COMPONENT_MODULE
243         IF ( useCoupler ) THEN         IF ( useCoupler .AND. cpl_earlyExpImpCall ) THEN
244  C      Post coupling data that I export.  C      Post coupling data that I export.
245  C      Read in coupling data that I import.  C      Read in coupling data that I import.
246           CALL TIMER_START('CPL_EXPORT-IMPORT  [FORWARD_STEP]',myThid)           CALL TIMER_START('CPL_EXPORT-IMPORT  [FORWARD_STEP]',myThid)
# Line 271  C      Read in coupling data that I impo Line 250  C      Read in coupling data that I impo
250         ENDIF         ENDIF
251  #endif /* COMPONENT_MODULE */  #endif /* COMPONENT_MODULE */
252    
253  #ifdef COMPONENT_MODULE  #ifdef ALLOW_EBM
254  # ifndef ALLOW_AIM          IF ( useEBM ) THEN
255  C jmc: don't know precisely where to put this call. leave it here for now.  # ifdef ALLOW_DEBUG
256         IF ( useCoupler ) THEN           IF ( debugLevel .GE. debLevB )
257           CALL OCN_APPLY_IMPORT( myTime, myIter, myThid )       &    CALL DEBUG_CALL('EBM',myThid)
        ENDIF  
258  # endif  # endif
259  #endif /* COMPONENT_MODULE */           CALL TIMER_START('EBM                [FORWARD_STEP]',mythid)
260             CALL EBM_DRIVER ( myTime, myIter, myThid )
261             CALL TIMER_STOP ('EBM                [FORWARD_STEP]',mythid)
262            ENDIF
263    #endif
264    
265  C--     Step forward fields and calculate time tendency terms.  C--     Step forward fields and calculate time tendency terms.
266    
 C AMM  
 #ifdef ALLOW_FIZHI  
         if( useFIZHI) then  
          CALL TIMER_START('FIZHI               [FORWARD_STEP]',mythid)  
          CALL UPDATE_OCEAN_EXPORTS ( myTime, myIter, myThid )  
          CALL UPDATE_EARTH_EXPORTS ( myTime, myIter, myThid )  
          CALL UPDATE_CHEMISTRY_EXPORTS ( myTime, myIter, myThid )  
          CALL FIZHI_WRAPPER ( myTime, myIter, myThid )  
          CALL STEP_FIZHI_FG ( myTime, myIter, myThid, deltaTtracer )  
          CALL TIMER_STOP ('FIZHI               [FORWARD_STEP]',mythid)  
         endif  
 #endif  
 C AMM  
   
267  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
268        IF ( debugLevel .GE. debLevB )         IF ( debugLevel .GE. debLevB )
269       &    CALL DEBUG_CALL('THERMODYNAMICS',myThid)       &    CALL DEBUG_CALL('DO_ATMOSPHERIC_PHYS',myThid)
270  #endif  #endif
271          CALL TIMER_START('THERMODYNAMICS      [FORWARD_STEP]',mythid)         CALL TIMER_START('DO_ATMOSPHERIC_PHYS [FORWARD_STEP]',mythid)
272          CALL THERMODYNAMICS( myTime, myIter, myThid )         CALL DO_ATMOSPHERIC_PHYS( myTime, myIter, myThid )
273          CALL TIMER_STOP ('THERMODYNAMICS      [FORWARD_STEP]',mythid)         CALL TIMER_STOP ('DO_ATMOSPHERIC_PHYS [FORWARD_STEP]',mythid)
274    
275  C--   do exchanges (needed for DYNAMICS) when using stagger time-step :  #ifdef ALLOW_AUTODIFF_TAMC
276  #ifdef ALLOW_DEBUG  CADJ STORE theta              = comlev1, key = ikey_dynamics
277        IF ( debugLevel .GE. debLevB )  CADJ STORE salt               = comlev1, key = ikey_dynamics
278       &    CALL DEBUG_CALL('DO_STAGGER_FIELDS_EXCH.',myThid)  CADJ STORE totphihyd          = comlev1, key = ikey_dynamics
279  #endif  CADJ STORE surfaceforcingtice = comlev1, key = ikey_dynamics
280          CALL TIMER_START('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)  # ifdef ALLOW_KPP
281          CALL DO_STAGGER_FIELDS_EXCHANGES( myTime, myIter, myThid )  CADJ STORE uvel               = comlev1, key = ikey_dynamics
282          CALL TIMER_STOP ('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)  CADJ STORE vvel               = comlev1, key = ikey_dynamics
283    # endif
284    # ifdef EXACT_CONSERV
285    CADJ STORE empmr              = comlev1, key = ikey_dynamics
286    CADJ STORE pmepr              = comlev1, key = ikey_dynamics
287    # endif
288    #endif /* ALLOW_AUTODIFF_TAMC */
289    
290  #ifdef ALLOW_SHAP_FILT  #ifndef ALLOW_OFFLINE
       IF (useSHAP_FILT .AND.  
      &     staggerTimeStep .AND. shap_filt_TrStagg ) THEN  
291  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
292          IF ( debugLevel .GE. debLevB )         IF ( debugLevel .GE. debLevB )
293       &    CALL DEBUG_CALL('SHAP_FILT_APPLY_TS',myThid)       &    CALL DEBUG_CALL('DO_OCEANIC_PHYS',myThid)
294  #endif  #endif
295          CALL TIMER_START('SHAP_FILT           [FORWARD_STEP]',myThid)         CALL TIMER_START('DO_OCEANIC_PHYS     [FORWARD_STEP]',mythid)
296          CALL SHAP_FILT_APPLY_TS(gT,gS,myTime+deltaT,myIter+1,myThid)         CALL DO_OCEANIC_PHYS( myTime, myIter, myThid )
297          CALL TIMER_STOP ('SHAP_FILT           [FORWARD_STEP]',myThid)         CALL TIMER_STOP ('DO_OCEANIC_PHYS     [FORWARD_STEP]',mythid)
       ENDIF  
298  #endif  #endif
299    
300  #ifdef ALLOW_ZONAL_FILT  #ifdef ALLOW_AUTODIFF_TAMC
301        IF (useZONAL_FILT .AND.  cph needed to be moved here from do_oceanic_physics
302       &     staggerTimeStep .AND. zonal_filt_TrStagg ) THEN  cph to be visible down the road
303    c
304    CADJ STORE surfaceForcingS    = comlev1, key = ikey_dynamics
305    CADJ STORE surfaceForcingT    = comlev1, key = ikey_dynamics
306    CADJ STORE surfaceForcingTice = comlev1, key = ikey_dynamics
307    ctest(
308    CADJ STORE IVDConvCount       = comlev1, key = ikey_dynamics
309    ctest)
310    # ifdef ALLOW_PTRACERS
311    CADJ STORE surfaceForcingPtr  = comlev1, key = ikey_dynamics
312    # endif
313    c
314    # ifdef ALLOW_GMREDI
315    CADJ STORE Kwx                = comlev1, key = ikey_dynamics
316    CADJ STORE Kwy                = comlev1, key = ikey_dynamics
317    CADJ STORE Kwz                = comlev1, key = ikey_dynamics
318    #  ifdef GM_BOLUS_ADVEC
319    CADJ STORE GM_PsiX            = comlev1, key = ikey_dynamics
320    CADJ STORE GM_PsiY            = comlev1, key = ikey_dynamics
321    #  endif
322    # endif
323    c
324    # ifdef ALLOW_KPP
325    CADJ STORE KPPghat            = comlev1, key = ikey_dynamics
326    CADJ STORE KPPfrac            = comlev1, key = ikey_dynamics
327    CADJ STORE KPPdiffKzS         = comlev1, key = ikey_dynamics
328    CADJ STORE KPPdiffKzT         = comlev1, key = ikey_dynamics
329    # endif
330    #endif /* ALLOW_AUTODIFF_TAMC */
331    
332          IF ( .NOT.staggerTimeStep ) THEN
333  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
334          IF ( debugLevel .GE. debLevB )          IF ( debugLevel .GE. debLevB )
335       &    CALL DEBUG_CALL('ZONAL_FILT_APPLY_TS',myThid)       &    CALL DEBUG_CALL('THERMODYNAMICS',myThid)
336  #endif  #endif
337          CALL TIMER_START('ZONAL_FILT_APPLY    [FORWARD_STEP]',myThid)          CALL TIMER_START('THERMODYNAMICS      [FORWARD_STEP]',mythid)
338          CALL ZONAL_FILT_APPLY_TS( gT, gS, myThid )          CALL THERMODYNAMICS( myTime, myIter, myThid )
339          CALL TIMER_STOP ('ZONAL_FILT_APPLY    [FORWARD_STEP]',myThid)          CALL TIMER_STOP ('THERMODYNAMICS      [FORWARD_STEP]',mythid)
340    C--    if not staggerTimeStep: end
341        ENDIF        ENDIF
342  #endif    
343    #ifdef COMPONENT_MODULE
344           IF ( useCoupler .AND. .NOT.cpl_earlyExpImpCall ) THEN
345    C      Post coupling data that I export.
346    C      Read in coupling data that I import.
347             myItP1 = myIter + 1
348             CALL TIMER_START('CPL_EXPORT-IMPORT  [FORWARD_STEP]',myThid)
349             CALL CPL_EXPORT_MY_DATA(       myItP1, myTime, myThid )
350             CALL CPL_IMPORT_EXTERNAL_DATA( myItP1, myTime, myThid )
351             CALL TIMER_STOP ('CPL_EXPORT-IMPORT  [FORWARD_STEP]',myThid)
352    # ifndef ALLOW_AIM
353            IF ( useRealFreshWaterFlux ) THEN
354             CALL OCN_APPLY_IMPORT( .FALSE., myTime, myIter, myThid )
355            ENDIF
356    # endif
357           ENDIF
358    #endif /* COMPONENT_MODULE */
359    
360  C--   Step forward fields and calculate time tendency terms.  C--   Step forward fields and calculate time tendency terms.
361    #ifndef ALLOW_OFFLINE
362  #ifndef ALLOW_AUTODIFF_TAMC  #ifndef ALLOW_AUTODIFF_TAMC
363        IF ( momStepping ) THEN        IF ( momStepping ) THEN
364  #endif  #endif
# Line 353  C--   Step forward fields and calculate Line 372  C--   Step forward fields and calculate
372  #ifndef ALLOW_AUTODIFF_TAMC  #ifndef ALLOW_AUTODIFF_TAMC
373        ENDIF        ENDIF
374  #endif  #endif
375    #endif
376    
377  #ifdef ALLOW_NONHYDROSTATIC  #ifdef ALLOW_NONHYDROSTATIC
378  C--   Step forward W field in N-H algorithm  C--   Step forward W field in N-H algorithm
# Line 367  C--   Step forward W field in N-H algori Line 387  C--   Step forward W field in N-H algori
387        ENDIF        ENDIF
388  #endif  #endif
389    
390    C--   Update time-counter
391          myIter = nIter0 + iLoop
392          myTime = startTime + deltaTClock * float(iLoop)
393    
394    C--   Update geometric factors:
395  #ifdef NONLIN_FRSURF  #ifdef NONLIN_FRSURF
396  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) :
397        IF ( nonlinFreeSurf.GT.0) THEN        IF ( nonlinFreeSurf.GT.0) THEN
398         IF ( select_rStar.GT.0 ) THEN         IF ( select_rStar.GT.0 ) THEN
399          CALL TIMER_START('UPDATE_R_STAR      [FORWARD_STEP]',myThid)          CALL TIMER_START('UPDATE_R_STAR      [FORWARD_STEP]',myThid)
# Line 396  C--   Apply Filters to u*,v* before SOLV Line 421  C--   Apply Filters to u*,v* before SOLV
421  C--   Explicit+Implicit part of the Barotropic Flow Divergence  C--   Explicit+Implicit part of the Barotropic Flow Divergence
422  C      => Filtering of uVel,vVel is necessary  C      => Filtering of uVel,vVel is necessary
423            CALL SHAP_FILT_APPLY_UV( uVel,vVel,            CALL SHAP_FILT_APPLY_UV( uVel,vVel,
424       &                             myTime+deltaT, myIter+1, myThid )       &                             myTime, myIter, myThid )
425          ENDIF          ENDIF
426          CALL SHAP_FILT_APPLY_UV( gU,gV,myTime+deltaT,myIter+1,myThid)          CALL SHAP_FILT_APPLY_UV( gU,gV,myTime,myIter,myThid)
427          CALL TIMER_STOP ('SHAP_FILT           [FORWARD_STEP]',myThid)          CALL TIMER_STOP ('SHAP_FILT           [FORWARD_STEP]',myThid)
428        ENDIF        ENDIF
429  #endif  #endif
# Line 418  C      => Filtering of uVel,vVel is nece Line 443  C      => Filtering of uVel,vVel is nece
443  C--   Solve elliptic equation(s).  C--   Solve elliptic equation(s).
444  C     Two-dimensional only for conventional hydrostatic or  C     Two-dimensional only for conventional hydrostatic or
445  C     three-dimensional for non-hydrostatic and/or IGW scheme.  C     three-dimensional for non-hydrostatic and/or IGW scheme.
446    #ifndef ALLOW_OFFLINE
447        IF ( momStepping ) THEN        IF ( momStepping ) THEN
448        CALL TIMER_START('SOLVE_FOR_PRESSURE  [FORWARD_STEP]',myThid)          CALL TIMER_START('SOLVE_FOR_PRESSURE  [FORWARD_STEP]',myThid)
449        CALL SOLVE_FOR_PRESSURE(myTime, myIter, myThid)          CALL SOLVE_FOR_PRESSURE(myTime, myIter, myThid)
450        CALL TIMER_STOP ('SOLVE_FOR_PRESSURE  [FORWARD_STEP]',myThid)          CALL TIMER_STOP ('SOLVE_FOR_PRESSURE  [FORWARD_STEP]',myThid)
451          ENDIF
452    #endif
453    
454    C--   Correct divergence in flow field and cycle time-stepping momentum
455    c     IF ( momStepping ) THEN
456    #ifndef ALLOW_OFFLINE
457            CALL TIMER_START('UV_CORRECTION_STEP  [FORWARD_STEP]',myThid)
458            CALL MOMENTUM_CORRECTION_STEP(myTime, myIter, myThid)
459            CALL TIMER_STOP ('UV_CORRECTION_STEP  [FORWARD_STEP]',myThid)
460    #endif
461    c     ENDIF
462    
463    #ifdef EXACT_CONSERV
464          IF (exactConserv) THEN
465    C--   Update etaH(n+1) :
466            CALL TIMER_START('UPDATE_ETAH        [FORWARD_STEP]',mythid)
467            CALL UPDATE_ETAH( myTime, myIter, myThid )
468            CALL TIMER_STOP ('UPDATE_ETAH        [FORWARD_STEP]',mythid)
469          ENDIF
470    #endif /* EXACT_CONSERV */
471    
472    #ifdef NONLIN_FRSURF
473          IF ( select_rStar.NE.0 ) THEN
474    C--   r* : compute the future level thickness according to etaH(n+1)
475            CALL TIMER_START('CALC_R_STAR       [FORWARD_STEP]',mythid)
476            CALL CALC_R_STAR(etaH, myTime, myIter, myThid )
477            CALL TIMER_STOP ('CALC_R_STAR       [FORWARD_STEP]',mythid)
478          ELSEIF ( nonlinFreeSurf.GT.0) THEN
479    C--   compute the future surface level thickness according to etaH(n+1)
480            CALL TIMER_START('CALC_SURF_DR      [FORWARD_STEP]',mythid)
481            CALL CALC_SURF_DR(etaH, myTime, myIter, myThid )
482            CALL TIMER_STOP ('CALC_SURF_DR      [FORWARD_STEP]',mythid)
483        ENDIF        ENDIF
484    #endif /* NONLIN_FRSURF */
485    
486    C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
487          IF ( staggerTimeStep ) THEN
488    C--   do exchanges of U,V (needed for multiDim) when using stagger time-step :
489    #ifdef ALLOW_DEBUG
490            IF ( debugLevel .GE. debLevB )
491         &    CALL DEBUG_CALL('DO_STAGGER_FIELDS_EXCH.',myThid)
492    #endif
493            CALL TIMER_START('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)
494            CALL DO_STAGGER_FIELDS_EXCHANGES( myTime, myIter, myThid )
495            CALL TIMER_STOP ('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)
496    
497    #ifdef ALLOW_DEBUG
498            IF ( debugLevel .GE. debLevB )
499         &    CALL DEBUG_CALL('THERMODYNAMICS',myThid)
500    #endif
501            CALL TIMER_START('THERMODYNAMICS      [FORWARD_STEP]',mythid)
502            CALL THERMODYNAMICS( myTime, myIter, myThid )
503            CALL TIMER_STOP ('THERMODYNAMICS      [FORWARD_STEP]',mythid)
504    
505    C--    if staggerTimeStep: end
506          ENDIF
507    C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
508    
509  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
510  cph This is needed because convective_adjustment calls  cph This is needed because convective_adjustment calls
511  cph find_rho which may use pressure()  cph find_rho which may use pressure()
512  CADJ STORE totphihyd  = comlev1, key = ikey_dynamics  CADJ STORE totphihyd  = comlev1, key = ikey_dynamics
513  #endif  #endif
514  C--   Correct divergence in flow field and cycle time-stepping  C--   Cycle time-stepping Tracers arrays (T,S,+pTracers)
515  C     arrays (for all fields) ; update time-counter          CALL TIMER_START('TS_CORRECTION_STEP  [FORWARD_STEP]',myThid)
516        myIter = nIter0 + iLoop          CALL TRACERS_CORRECTION_STEP(myTime, myIter, myThid)
517        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)  
518    
519  C--   Do "blocking" sends and receives for tendency "overlap" terms  C--   Do "blocking" sends and receives for tendency "overlap" terms
520  c     CALL TIMER_START('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)  c     CALL TIMER_START('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)
# Line 485  C--   Calculate float trajectories Line 564  C--   Calculate float trajectories
564        ENDIF        ENDIF
565  #endif  #endif
566    
567    C--   State-variables statistics (time-aver, diagnostics ...)
568          CALL TIMER_START('DO_STATEVARS_DIAGS  [FORWARD_STEP]',myThid)
569          CALL DO_STATEVARS_DIAGS( myTime, myIter, myThid )
570          CALL TIMER_STOP ('DO_STATEVARS_DIAGS  [FORWARD_STEP]',myThid)
571    
572    #ifndef ALLOW_OFFLINE
573  #ifdef ALLOW_MONITOR  #ifdef ALLOW_MONITOR
574  C--   Check status of solution (statistics, cfl, etc...)  C--   Check status of solution (statistics, cfl, etc...)
575        CALL TIMER_START('MONITOR             [FORWARD_STEP]',myThid)        CALL TIMER_START('MONITOR             [FORWARD_STEP]',myThid)
576        CALL MONITOR( myIter, myTime, myThid )        CALL MONITOR( myIter, myTime, myThid )
577        CALL TIMER_STOP ('MONITOR             [FORWARD_STEP]',myThid)        CALL TIMER_STOP ('MONITOR             [FORWARD_STEP]',myThid)
578  #endif /* ALLOW_MONITOR */  #endif /* ALLOW_MONITOR */
579    #endif
580    
581  C AMM  -- Diagnostics package  #ifdef ALLOW_COST
582  #ifdef ALLOW_DIAGNOSTICS  C--     compare model with data and compute cost function
583    C--     this is done after exchanges to allow interpolation
584         if(usediagnostics)then        CALL TIMER_START('COST_TILE           [FORWARD_STEP]',myThid)
585          call diagnostics_fill_state(myThid)        CALL COST_TILE  ( mytime, myiter, myThid )
586         endif        CALL TIMER_STOP ('COST_TILE           [FORWARD_STEP]',myThid)
   
 # ifdef ALLOW_PTRACERS  
       if(useptracers)then  
        call diagnostics_fill_ptracers(myThid)  
       endif  
 # endif  
   
587  #endif  #endif
 C AMM  
588    
589  C--   Do IO if needed.  C--   Do IO if needed.
590    #ifdef ALLOW_OFFLINE
591          CALL TIMER_START('OFFLINE_MODEL_IO    [FORWARD_STEP]',myThid)
592          CALL OFFLINE_MODEL_IO( myTime, myIter, myThid )
593          CALL TIMER_STOP ('OFFLINE_MODEL_IO    [FORWARD_STEP]',myThid)
594    #else
595        CALL TIMER_START('DO_THE_MODEL_IO     [FORWARD_STEP]',myThid)        CALL TIMER_START('DO_THE_MODEL_IO     [FORWARD_STEP]',myThid)
596        CALL DO_THE_MODEL_IO( myTime, myIter, myThid )        CALL DO_THE_MODEL_IO( myTime, myIter, myThid )
597        CALL TIMER_STOP ('DO_THE_MODEL_IO     [FORWARD_STEP]',myThid)        CALL TIMER_STOP ('DO_THE_MODEL_IO     [FORWARD_STEP]',myThid)
598    #endif
599    
600  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  
601        CALL TIMER_START('WRITE_CHECKPOINT    [FORWARD_STEP]',myThid)        CALL TIMER_START('WRITE_CHECKPOINT    [FORWARD_STEP]',myThid)
602        CALL PACKAGES_WRITE_PICKUP(        CALL PACKAGES_WRITE_PICKUP(
603       I               .FALSE., myTime, myIter, myThid )       I               .FALSE., myTime, myIter, myThid )
604    #ifndef ALLOW_OFFLINE
605        CALL WRITE_CHECKPOINT(        CALL WRITE_CHECKPOINT(
606       I               .FALSE., myTime, myIter, myThid )         I               .FALSE., myTime, myIter, myThid )  
607    #endif
608        CALL TIMER_STOP ('WRITE_CHECKPOINT    [FORWARD_STEP]',myThid)        CALL TIMER_STOP ('WRITE_CHECKPOINT    [FORWARD_STEP]',myThid)
609    
610  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG

Legend:
Removed from v.1.91  
changed lines
  Added in v.1.105

  ViewVC Help
Powered by ViewVC 1.1.22