/[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.103 by heimbach, Mon Sep 27 18:00:19 2004 UTC revision 1.111 by jmc, Mon Dec 20 01:55:37 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    
 #ifdef ALLOW_GCHEM  
 # include "GCHEM_OPTIONS.h"  
 #endif  
7  #ifdef ALLOW_OFFLINE  #ifdef ALLOW_OFFLINE
8  # include "OFFLINE_OPTIONS.h"  # include "OFFLINE_OPTIONS.h"
9  #endif  #endif
10    #ifdef ALLOW_GMREDI
11    # include "GMREDI_OPTIONS.h"
12    #endif
13    
14  CBOP  CBOP
15  C     !ROUTINE: FORWARD_STEP  C     !ROUTINE: FORWARD_STEP
# Line 86  C     == Global variables == Line 85  C     == Global variables ==
85  # ifdef EXACT_CONSERV  # ifdef EXACT_CONSERV
86  #  include "SURFACE.h"  #  include "SURFACE.h"
87  # endif  # endif
88    # ifdef ALLOW_KPP
89    #  include "KPP.h"
90    # endif
91    # ifdef ALLOW_GMREDI
92    #  include "GMREDI.h"
93    # endif
94  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
95    
96  C     !LOCAL VARIABLES:  C     !LOCAL VARIABLES:
# Line 118  C--   Reset the model iteration counter Line 123  C--   Reset the model iteration counter
123        mytime = startTime + float(iloop-1)*deltaTclock        mytime = startTime + float(iloop-1)*deltaTclock
124  #endif  #endif
125    
 #if (defined (ALLOW_AUTODIFF_TAMC) && defined (ALLOW_AUTODIFF_MONITOR))  
 C     Include call to a dummy routine. Its adjoint will be  
 C     called at the proper place in the adjoint code.  
 C     The adjoint routine will print out adjoint values  
 C     if requested. The location of the call is important,  
 C     it has to be after the adjoint of the exchanges  
 C     (DO_GTERM_BLOCKING_EXCHANGES).  
       CALL DUMMY_IN_STEPPING( myTime, myIter, myThid )  
 cph   I've commented this line since it may conflict with MITgcm's adjoint  
 cph   However, need to check whether that's still consistent  
 cph   with the ecco-branch (it should).  
 cph      CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid )  
 #endif  
   
126  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
127  c**************************************  c**************************************
128  #include "checkpoint_lev1_directives.h"  #include "checkpoint_lev1_directives.h"
129  c**************************************  c**************************************
130  #endif  #endif
131    
132    C--   Switch on/off diagnostics for snap-shot output:
133    #ifdef ALLOW_DIAGNOSTICS
134          IF ( useDiagnostics ) THEN
135            CALL DIAGNOSTICS_SWITCH_ONOFF( myIter, myThid )
136          ENDIF
137    #endif
138    
139  C--   Call external forcing package  C--   Call external forcing package
140  #ifdef ALLOW_BULK_FORCE  #ifdef ALLOW_BULK_FORCE
141        IF ( useBulkForce ) THEN        IF ( useBulkForce ) THEN
# Line 192  c--   Add control vector for forcing and Line 190  c--   Add control vector for forcing and
190       &     CALL CTRL_MAP_FORCING (mythid)       &     CALL CTRL_MAP_FORCING (mythid)
191  #endif  #endif
192    
193    #if (defined (ALLOW_AUTODIFF_TAMC) && defined (ALLOW_AUTODIFF_MONITOR))
194    C     Include call to a dummy routine. Its adjoint will be
195    C     called at the proper place in the adjoint code.
196    C     The adjoint routine will print out adjoint values
197    C     if requested. The location of the call is important,
198    C     it has to be after the adjoint of the exchanges
199    C     (DO_GTERM_BLOCKING_EXCHANGES).
200          CALL DUMMY_IN_STEPPING( myTime, myIter, myThid )
201    cph   I've commented this line since it may conflict with MITgcm's adjoint
202    cph   However, need to check whether that's still consistent
203    cph   with the ecco-branch (it should).
204    cph      CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid )
205    #endif
206    
207  # ifdef ALLOW_SEAICE  # ifdef ALLOW_SEAICE
208  C--   Call sea ice model to compute forcing/external data fields.  In  C--   Call sea ice model to compute forcing/external data fields.  In
209  C     addition to computing prognostic sea-ice variables and diagnosing the  C     addition to computing prognostic sea-ice variables and diagnosing the
# Line 227  CADJ STORE ptracer  = comlev1, key = ike Line 239  CADJ STORE ptracer  = comlev1, key = ike
239    
240  #ifdef ALLOW_PTRACERS  #ifdef ALLOW_PTRACERS
241  # ifdef ALLOW_GCHEM  # ifdef ALLOW_GCHEM
242            IF ( useGCHEM ) THEN
243           CALL GCHEM_FIELDS_LOAD( mytime, myiter, mythid )           CALL GCHEM_FIELDS_LOAD( mytime, myiter, mythid )
244            ENDIF
245  # endif  # endif
246  #endif  #endif
247    
# Line 264  C--     Step forward fields and calculat Line 278  C--     Step forward fields and calculat
278         CALL DO_ATMOSPHERIC_PHYS( myTime, myIter, myThid )         CALL DO_ATMOSPHERIC_PHYS( myTime, myIter, myThid )
279         CALL TIMER_STOP ('DO_ATMOSPHERIC_PHYS [FORWARD_STEP]',mythid)         CALL TIMER_STOP ('DO_ATMOSPHERIC_PHYS [FORWARD_STEP]',mythid)
280    
281    #ifdef ALLOW_AUTODIFF_TAMC
282    CADJ STORE theta              = comlev1, key = ikey_dynamics
283    CADJ STORE salt               = comlev1, key = ikey_dynamics
284    CADJ STORE totphihyd          = comlev1, key = ikey_dynamics
285    CADJ STORE surfaceforcingtice = comlev1, key = ikey_dynamics
286    # ifdef ALLOW_KPP
287    CADJ STORE uvel               = comlev1, key = ikey_dynamics
288    CADJ STORE vvel               = comlev1, key = ikey_dynamics
289    # endif
290    # ifdef EXACT_CONSERV
291    CADJ STORE empmr              = comlev1, key = ikey_dynamics
292    CADJ STORE pmepr              = comlev1, key = ikey_dynamics
293    # endif
294    #endif /* ALLOW_AUTODIFF_TAMC */
295    
296  #ifndef ALLOW_OFFLINE  #ifndef ALLOW_OFFLINE
297  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
298         IF ( debugLevel .GE. debLevB )         IF ( debugLevel .GE. debLevB )
# Line 274  C--     Step forward fields and calculat Line 303  C--     Step forward fields and calculat
303         CALL TIMER_STOP ('DO_OCEANIC_PHYS     [FORWARD_STEP]',mythid)         CALL TIMER_STOP ('DO_OCEANIC_PHYS     [FORWARD_STEP]',mythid)
304  #endif  #endif
305    
306    #ifdef ALLOW_GCHEM
307    C     GCHEM package is an interface for any bio-geochemical or
308    C     ecosystem model you would like to include.
309    C     If GCHEM_SEPARATE_FORCING is not defined, you are
310    C     responsible for computing tendency terms for passive
311    C     tracers and storing them on a 3DxNumPtracers-array called
312    C     gchemTendency in GCHEM_CALC_TENDENCY. This tendency is then added
313    C     to gPtr in ptracers_forcing later-on.
314    C     If GCHEM_SEPARATE_FORCING is defined, you are reponsible for
315    C     UPDATING ptracers directly in GCHEM_FORCING_SEP. This amounts
316    C     to a completely separate time step that you have to implement
317    C     yourself (Eulerian seems to be fine in most cases).
318    CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
319    C     CAVEAT: Up to now, when GCHEM is turned on the field ptracerForcingSurf,
320    C     which is needed for KPP is not set properly. ptracerForcingSurf must
321    C     be treated differently depending on whether GCHEM_SEPARATE_FORCING
322    C     is define or not. TBD.
323    CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
324    #ifdef ALLOW_DEBUG
325           IF ( debugLevel .GE. debLevB )
326         &      CALL DEBUG_CALL('GCHEM_CALC_TENDENCY',myThid)
327    #endif
328           IF ( useGCHEM ) THEN
329            CALL TIMER_START('GCHEM_CALC_TENDENCY [FORWARD_STEP]',myThid)
330            CALL GCHEM_CALC_TENDENCY( myTime, myIter, myThid )
331            CALL TIMER_STOP ('GCHEM_CALC_TENDENCY [FORWARD_STEP]',myThid)
332           ENDIF
333    #endif /* ALLOW_GCHEM */
334    
335    #ifdef ALLOW_AUTODIFF_TAMC
336    cph needed to be moved here from do_oceanic_physics
337    cph to be visible down the road
338    c
339    CADJ STORE surfaceForcingS    = comlev1, key = ikey_dynamics
340    CADJ STORE surfaceForcingT    = comlev1, key = ikey_dynamics
341    CADJ STORE surfaceForcingTice = comlev1, key = ikey_dynamics
342    ctest(
343    CADJ STORE IVDConvCount       = comlev1, key = ikey_dynamics
344    ctest)
345    # ifdef ALLOW_PTRACERS
346    CADJ STORE surfaceForcingPtr  = comlev1, key = ikey_dynamics
347    # endif
348    c
349    # ifdef ALLOW_GMREDI
350    CADJ STORE Kwx                = comlev1, key = ikey_dynamics
351    CADJ STORE Kwy                = comlev1, key = ikey_dynamics
352    CADJ STORE Kwz                = comlev1, key = ikey_dynamics
353    #  ifdef GM_BOLUS_ADVEC
354    CADJ STORE GM_PsiX            = comlev1, key = ikey_dynamics
355    CADJ STORE GM_PsiY            = comlev1, key = ikey_dynamics
356    #  endif
357    # endif
358    c
359    # ifdef ALLOW_KPP
360    CADJ STORE KPPghat            = comlev1, key = ikey_dynamics
361    CADJ STORE KPPfrac            = comlev1, key = ikey_dynamics
362    CADJ STORE KPPdiffKzS         = comlev1, key = ikey_dynamics
363    CADJ STORE KPPdiffKzT         = comlev1, key = ikey_dynamics
364    # endif
365    #endif /* ALLOW_AUTODIFF_TAMC */
366    
367        IF ( .NOT.staggerTimeStep ) THEN        IF ( .NOT.staggerTimeStep ) THEN
368  #ifdef ALLOW_DEBUG  #ifdef ALLOW_DEBUG
369          IF ( debugLevel .GE. debLevB )          IF ( debugLevel .GE. debLevB )
# Line 461  C--   Cycle time-stepping Tracers arrays Line 551  C--   Cycle time-stepping Tracers arrays
551          CALL TRACERS_CORRECTION_STEP(myTime, myIter, myThid)          CALL TRACERS_CORRECTION_STEP(myTime, myIter, myThid)
552          CALL TIMER_STOP ('TS_CORRECTION_STEP  [FORWARD_STEP]',myThid)          CALL TIMER_STOP ('TS_CORRECTION_STEP  [FORWARD_STEP]',myThid)
553    
554    #ifdef ALLOW_GCHEM
555    C     Add separate timestepping of chemical/biological/forcing
556    C     of ptracers here in GCHEM_FORCING_SEP
557    #ifdef ALLOW_DEBUG
558            IF ( debugLevel .GE. debLevB )
559         &    CALL DEBUG_CALL('GCHEM_FORCING_SEP',myThid)
560    #endif /* ALLOW_DEBUG */
561            IF ( useGCHEM ) THEN
562             CALL TIMER_START('GCHEM_FORCING_SEP  [FORWARD_STEP]',myThid)
563             CALL GCHEM_FORCING_SEP( myTime,myIter,myThid )
564             CALL TIMER_STOP ('GCHEM_FORCING_SEP  [FORWARD_STEP]',myThid)
565            ENDIF  
566    #endif /* ALLOW_GCHEM */
567    
568  C--   Do "blocking" sends and receives for tendency "overlap" terms  C--   Do "blocking" sends and receives for tendency "overlap" terms
569  c     CALL TIMER_START('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)  c     CALL TIMER_START('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)
570  c     CALL DO_GTERM_BLOCKING_EXCHANGES( myThid )  c     CALL DO_GTERM_BLOCKING_EXCHANGES( myThid )
# Line 471  C--   Do "blocking" sends and receives f Line 575  C--   Do "blocking" sends and receives f
575        CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid )        CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid )
576        CALL TIMER_STOP ('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)        CALL TIMER_STOP ('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)
577    
 cswdptr -- add for seperate timestepping of chemical/biological/forcing  
 cswdptr    of ptracers ---  
 #ifdef ALLOW_GCHEM  
 ceh3 This is broken -- this ifdef should not be visible!  
 #ifdef PTRACERS_SEPARATE_FORCING  
 ceh3 needs an IF ( use GCHEM ) THEN  
         call GCHEM_FORCING_SEP( myTime,myIter,myThid )  
 #endif /* PTRACERS_SEPARATE_FORCING */  
 #endif /* ALLOW_GCHEM */  
 cswdptr -- end add ---  
578    
579  C AMM  C AMM
580  #ifdef ALLOW_GRIDALT  #ifdef ALLOW_GRIDALT
# Line 526  C--   Check status of solution (statisti Line 620  C--   Check status of solution (statisti
620  #ifdef ALLOW_COST  #ifdef ALLOW_COST
621  C--     compare model with data and compute cost function  C--     compare model with data and compute cost function
622  C--     this is done after exchanges to allow interpolation  C--     this is done after exchanges to allow interpolation
 ceh3 perhaps needs an IF ( useCOST ) THEN  
 CADJ STORE theta, uvel, vvel = comlev1, key = ikey_dynamics  
623        CALL TIMER_START('COST_TILE           [FORWARD_STEP]',myThid)        CALL TIMER_START('COST_TILE           [FORWARD_STEP]',myThid)
624        CALL COST_TILE  ( mytime, myiter, myThid )        CALL COST_TILE  ( mytime, myiter, myThid )
625        CALL TIMER_STOP ('COST_TILE           [FORWARD_STEP]',myThid)        CALL TIMER_STOP ('COST_TILE           [FORWARD_STEP]',myThid)

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

  ViewVC Help
Powered by ViewVC 1.1.22