/[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.10 by jmc, Tue Mar 6 16:51:02 2001 UTC revision 1.81 by edhill, Mon Feb 2 14:45:08 2004 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2  C $Name$  C $Name$
3    
4    #include "PACKAGES_CONFIG.h"
5  #include "CPP_OPTIONS.h"  #include "CPP_OPTIONS.h"
6    
7        SUBROUTINE FORWARD_STEP(  cswdptr -- add --
8       I                    iLoop,  #ifdef ALLOW_GCHEM
9       U                    myCurrentTime, myCurrentIter,  # include "GCHEM_OPTIONS.h"
10       &                    myThid)  #endif
11  C     /==========================================================\  cswdptr -- end add ---
12  C     | SUBROUTINE FORWARD_STEP                                  |  
13  C     | o Does one instance of the model time stepping           |  CBOP
14  C     |   The time stepping loop in THE_MAIN_LOOP() calls        |  C     !ROUTINE: FORWARD_STEP
15  C     |   this routine                                           |  C     !INTERFACE:
16  C     |==========================================================|        SUBROUTINE FORWARD_STEP( iloop, myTime, myIter, myThid )
17  C     \==========================================================/  
18        IMPLICIT NONE  C     !DESCRIPTION: \bv
19  C  C     *==================================================================
20  C     Call Tree  C     | SUBROUTINE forward_step
21  C     =========  C     | o Run the ocean model and, optionally, evaluate a cost function.
22  C      C     *==================================================================
23  C      THE_MAIN_LOOP()  C     |
24  C       |  C     | THE_MAIN_LOOP is the toplevel routine for the Tangent Linear and
25  C  ==>  | ** Time stepping loop starts here **  C     | Adjoint Model Compiler (TAMC). For this purpose the initialization
26  C  |    |  C     | of the model was split into two parts. Those parameters that do
27  C /|\   |-FORWARD_STEP  C     | not depend on a specific model run are set in INITIALISE_FIXED,  
28  C  |    |  |  C     | whereas those that do depend on the specific realization are
29  C /|\   |  |--LOAD_EXTERNAL_DATA  C     | initialized in INITIALISE_VARIA.  
30  C  |    |  |   o Load and/or set time dependent forcing fields  C     |
31  C /|\   |  |  C     *==================================================================
32  C  |    |  |--DYNAMICS  C     \ev
 C /|\   |  |   o Evaluate "forward" terms  
 C  |    |  |  
 C /|\   |  |  
 C  |    |  |--SOLVE_FOR_PRESSURE  
 C /|\   |  |   o Find pressure field to keep flow non-divergent  
 C  |    |  |  
 C /|\   |  |  
 C  |    |  |--THE_CORRECTION_STEP  
 C /|\   |  |   o Correct flow field with pressure gradient  
 C  |    |  |     and cycle time-stepping arrays (for all fields)  
 C /|\   |  |  
 C  |    |  |--DO_GTERM_BLOCKING_EXCHANGES  
 C /|\   |  |   o Update overlap regions  
 C  |    |  |  
 C /|\   |  |  
 C  |    |  |--DO_THE_MODEL_IO  
 C /|\   |  |   o Write model state  
 C  |    |  |  
 C /|\   |  |  
 C  |    |  |--WRITE_CHECKPOINT  
 C /|\   |  |   o Write restart file(s)  
 C  |    |  
 C /|\   |  
 C  |<== | ** Time stepping loop finishes here **  
 C  
33    
34  C     == Global variables ===  C     !USES:
35          IMPLICIT NONE
36    C     == Global variables ==
37  #include "SIZE.h"  #include "SIZE.h"
38  #include "EEPARAMS.h"  #include "EEPARAMS.h"
39  #include "PARAMS.h"  #include "PARAMS.h"
40  #include "DYNVARS.h"  #include "DYNVARS.h"
41    #include "FFIELDS.h"
42    
43  #ifdef ALLOW_NONHYDROSTATIC  #ifdef ALLOW_NONHYDROSTATIC
44  #include "CG3D.h"  #include "CG3D.h"
45  #endif  #endif
46    
47    #ifdef ALLOW_SHAP_FILT
48    #include "SHAP_FILT.h"
49    #endif
50    #ifdef ALLOW_ZONAL_FILT
51    #include "ZONAL_FILT.h"
52    #endif
53    
54    #ifdef ALLOW_AUTODIFF_TAMC
55    # include "tamc.h"
56    # include "ctrl.h"
57    # include "ctrl_dummy.h"
58    # include "cost.h"
59    # include "EOS.h"
60    # ifdef ALLOW_EXF
61    #  include "exf_fields.h"
62    #  ifdef ALLOW_BULKFORMULAE
63    #   include "exf_constants.h"
64    #  endif
65    # endif
66    # ifdef ALLOW_OBCS
67    #  include "OBCS.h"
68    # endif
69    # ifdef ALLOW_PTRACERS
70    #  include "PTRACERS.h"
71    # endif
72    #endif /* ALLOW_AUTODIFF_TAMC */
73    
74    C     !LOCAL VARIABLES:
75  C     == Routine arguments ==  C     == Routine arguments ==
76  C     iLoop         - Invocation count (counter in THE_MAIN_LOOP)  C     note: under the multi-threaded model myiter and
77  C     myCurrentIter - Iteration counter for this thread  C           mytime are local variables passed around as routine
78  C     myCurrentTime - Time counter for this thread  C           arguments. Although this is fiddly it saves the need to
79  C     myThid - Thread number for this instance of the routine.  C           impose additional synchronisation points when they are
80        INTEGER iLoop  C           updated.
81        INTEGER myCurrentIter  C     myiter - iteration counter for this thread
82        _RL     myCurrentTime  C     mytime - time counter for this thread
83        INTEGER myThid    C     mythid - thread number for this instance of the routine.
84          integer iloop
85  C     == Local variables ==        integer mythid
86          integer myiter
87  C--   Load forcing/external data fields        _RL     mytime
88        CALL TIMER_START('I/O (READ)         [FORWARD_STEP]',myThid)        integer i,L
89        CALL EXTERNAL_FIELDS_LOAD( myCurrentTime, myCurrentIter, myThid )  CEOP
90        CALL TIMER_STOP ('I/O (READ)         [FORWARD_STEP]',myThid)  
91    #ifdef ALLOW_DEBUG
92  C--   Step forward fields and calculate time tendency terms        IF ( debugLevel .GE. debLevB )
93        CALL TIMER_START('DYNAMICS           [FORWARD_STEP]',myThid)       &    CALL DEBUG_ENTER('FORWARD_STEP',myThid)
94        CALL DYNAMICS( myCurrentTime, myCurrentIter, myThid )  #endif
95        CALL TIMER_STOP ('DYNAMICS           [FORWARD_STEP]',myThid)  
96    #ifdef ALLOW_AUTODIFF_TAMC
97    C--   Reset the model iteration counter and the model time.
98          myiter = nIter0 + (iloop-1)
99          mytime = startTime + float(iloop-1)*deltaTclock
100    #endif
101    
102    #if (defined (ALLOW_AUTODIFF_TAMC) && defined (ALLOW_AUTODIFF_MONITOR))
103    C     Include call to a dummy routine. Its adjoint will be
104    C     called at the proper place in the adjoint code.
105    C     The adjoint routine will print out adjoint values
106    C     if requested. The location of the call is important,
107    C     it has to be after the adjoint of the exchanges
108    C     (DO_GTERM_BLOCKING_EXCHANGES).
109          CALL DUMMY_IN_STEPPING( myTime, myIter, myThid )
110    cph   I've commented this line since it may conflict with MITgcm's adjoint
111    cph   However, need to check whether that's still consistent
112    cph   with the ecco-branch (it should).
113    cph      CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid )
114    #endif
115    
116    #ifdef EXACT_CONSERV
117          IF (exactConserv) THEN
118    C--   Update etaH(n+1) :
119             CALL TIMER_START('UPDATE_ETAH        [FORWARD_STEP]',mythid)
120             CALL UPDATE_ETAH( myTime, myIter, myThid )
121             CALL TIMER_STOP ('UPDATE_ETAH        [FORWARD_STEP]',mythid)
122          ENDIF
123    #endif /* EXACT_CONSERV */
124    
125    #ifdef NONLIN_FRSURF
126          IF ( select_rStar.NE.0 ) THEN
127    C--   r* : compute the future level thickness according to etaH(n+1)
128              CALL TIMER_START('CALC_R_STAR       [FORWARD_STEP]',mythid)
129              CALL CALC_R_STAR(etaH, myTime, myIter, myThid )
130              CALL TIMER_STOP ('CALC_R_STAR       [FORWARD_STEP]',mythid)
131          ELSEIF ( nonlinFreeSurf.GT.0) THEN
132    C--   compute the future surface level thickness according to etaH(n+1)
133              CALL TIMER_START('CALC_SURF_DR      [FORWARD_STEP]',mythid)
134              CALL CALC_SURF_DR(etaH, myTime, myIter, myThid )
135              CALL TIMER_STOP ('CALC_SURF_DR      [FORWARD_STEP]',mythid)
136          ENDIF
137    #endif /* NONLIN_FRSURF */
138    
139    #ifdef ALLOW_AUTODIFF_TAMC
140    c**************************************
141    #include "checkpoint_lev1_directives.h"
142    c**************************************
143    #endif
144    
145    C--   Call external forcing package
146    #ifdef ALLOW_BULK_FORCE
147          IF ( useBulkForce ) THEN
148    #ifdef ALLOW_DEBUG
149           IF ( debugLevel .GE. debLevB )
150         &    CALL DEBUG_CALL('BULKF_FIELDS_LOAD',myThid)
151    #endif
152           CALL TIMER_START('BULKF_FORCING      [FORWARD_STEP]',mythid)
153    C-    load all forcing fields at current time
154           CALL BULKF_FIELDS_LOAD( myTime, myIter, myThid )
155    C-    calculate qnet and empmr (and wind stress)
156           CALL BULKF_FORCING( myTime, myIter, myThid )
157           CALL TIMER_STOP ('BULKF_FORCING      [FORWARD_STEP]',mythid)
158          ELSE
159    #endif /* ALLOW_BULK_FORCE */
160    
161    # ifdef ALLOW_EXF
162    #  ifdef ALLOW_DEBUG
163          IF ( debugLevel .GE. debLevB )
164         &    CALL DEBUG_CALL('EXF_GETFORCING',myThid)
165    #  endif
166          CALL TIMER_START('EXF_GETFORCING     [FORWARD_STEP]',mythid)
167          CALL EXF_GETFORCING( mytime, myiter, mythid )
168          CALL TIMER_STOP ('EXF_GETFORCING     [FORWARD_STEP]',mythid)
169    # else /* ALLOW_EXF undef */
170    cph The following IF-statement creates an additional dependency
171    cph for the forcing fields requiring additional storing.
172    cph Therefore, the IF-statement will be put between CPP-OPTIONS,
173    cph assuming that ALLOW_SEAICE has not yet been differentiated.
174    #  ifdef ALLOW_SEAICE
175          IF ( .NOT. useSEAICE ) THEN
176    #  endif
177    #ifdef ALLOW_DEBUG
178           IF ( debugLevel .GE. debLevB )
179         &    CALL DEBUG_CALL('EXTERNAL_FIELDS_LOAD',myThid)
180    #endif
181           CALL TIMER_START('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid)
182           CALL EXTERNAL_FIELDS_LOAD( mytime, myiter, mythid )
183           CALL TIMER_STOP ('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid)
184    #  ifdef ALLOW_SEAICE
185          ENDIF
186    #  endif
187    # endif /* ALLOW_EXF */
188    #ifdef ALLOW_BULK_FORCE
189    C--   end of if/else block useBulfforce --
190          ENDIF
191    #endif /* ALLOW_BULK_FORCE */
192    
193    #ifdef ALLOW_AUTODIFF
194    c--   Add control vector for forcing and parameter fields
195          if ( myiter .EQ. nIter0 )
196         &     CALL CTRL_MAP_FORCING (mythid)
197    #endif
198    
199    #ifdef ALLOW_THSICE
200          IF (useThSIce) THEN
201    #ifdef ALLOW_DEBUG
202            IF ( debugLevel .GE. debLevB )
203         &    CALL DEBUG_CALL('THSICE_MAIN',myThid)
204    #endif
205    C--     Step forward Therm.Sea-Ice variables
206    C       and modify forcing terms including effects from ice
207            CALL TIMER_START('THSICE_MAIN        [FORWARD_STEP]', myThid)
208            CALL THSICE_MAIN( myTime, myIter, myThid )
209            CALL TIMER_STOP( 'THSICE_MAIN        [FORWARD_STEP]', myThid)
210          ENDIF
211    #endif /* ALLOW_THSICE */
212    
213    # ifdef ALLOW_SEAICE
214    C--   Call sea ice model to compute forcing/external data fields.  In
215    C     addition to computing prognostic sea-ice variables and diagnosing the
216    C     forcing/external data fields that drive the ocean model, SEAICE_MODEL
217    C     also sets theta to the freezing point under sea-ice.  The implied
218    C     surface heat flux is then stored in variable surfaceTendencyTice,
219    C     which is needed by KPP package (kpp_calc.F and kpp_transport_t.F)
220    C     to diagnose surface buoyancy fluxes and for the non-local transport
221    C     term.  Because this call precedes model thermodynamics, temperature
222    C     under sea-ice may not be "exactly" at the freezing point by the time
223    C     theta is dumped or time-averaged.
224          IF ( useSEAICE ) THEN
225    #ifdef ALLOW_DEBUG
226             IF ( debugLevel .GE. debLevB )
227         &    CALL DEBUG_CALL('SEAICE_MODEL',myThid)
228    #endif
229             CALL TIMER_START('SEAICE_MODEL       [FORWARD_STEP]',myThid)
230             CALL SEAICE_MODEL( myTime, myIter, myThid )
231             CALL TIMER_STOP ('SEAICE_MODEL       [FORWARD_STEP]',myThid)
232          ENDIF
233    # endif /* ALLOW_SEAICE */
234    
235    C--   Freeze water at the surface
236    #ifdef ALLOW_AUTODIFF_TAMC
237    CADJ STORE theta = comlev1, key = ikey_dynamics
238    #endif
239          IF ( allowFreezing .AND. .NOT. useSEAICE
240         &                   .AND. .NOT. useThSIce ) THEN
241            CALL FREEZE_SURFACE(  myTime, myIter, myThid )
242          ENDIF
243    
244    #ifdef ALLOW_AUTODIFF_TAMC
245    # ifdef ALLOW_PTRACERS
246    cph this replaces _bibj storing of ptracer within thermodynamics
247    CADJ STORE ptracer  = comlev1, key = ikey_dynamics
248    # endif
249    #endif
250    
251    #ifdef ALLOW_PTRACERS
252    # ifdef ALLOW_GCHEM
253             CALL GCHEM_FIELDS_LOAD( mytime, myiter, mythid )
254    # endif
255    #endif
256    
257    #ifdef COMPONENT_MODULE
258           IF ( useCoupler ) THEN
259    C      Post coupling data that I export.
260    C      Read in coupling data that I import.
261             CALL TIMER_START('CPL_EXPORT-IMPORT  [FORWARD_STEP]',myThid)
262             CALL CPL_EXPORT_MY_DATA(       myIter, myTime, myThid )
263             CALL CPL_IMPORT_EXTERNAL_DATA( myIter, myTime, myThid )
264             CALL TIMER_STOP ('CPL_EXPORT-IMPORT  [FORWARD_STEP]',myThid)
265           ENDIF
266    #endif /* COMPONENT_MODULE */
267    
268    #ifdef COMPONENT_MODULE
269    # ifndef ALLOW_AIM
270    C jmc: don't know precisely where to put this call. leave it here for now.
271           IF ( useCoupler ) THEN
272             CALL OCN_APPLY_IMPORT( myTime, myIter, myThid )
273           ENDIF
274    # endif
275    #endif /* COMPONENT_MODULE */
276    
277    C--     Step forward fields and calculate time tendency terms.
278    C AMM
279    #ifdef ALLOW_GRIDALT
280            if (useGRIDALT) CALL GRIDALT_UPDATE(myThid)
281    #endif
282    C AMM
283    
284    C AMM
285    #ifdef ALLOW_FIZHI
286            if( useFIZHI) then
287             CALL UPDATE_OCEAN_EXPORTS ( myTime, myIter, myThid )
288             CALL UPDATE_EARTH_EXPORTS ( myTime, myIter, myThid )
289             CALL UPDATE_CHEMISTRY_EXPORTS ( myTime, myIter, myThid )
290             CALL TIMER_START('FIZHI_WRAPPER       [FORWARD_STEP]',mythid)
291             CALL FIZHI_WRAPPER ( myTime, myIter, myThid )
292             CALL TIMER_STOP ('FIZHI_WRAPPER       [FORWARD_STEP]',mythid)
293             CALL STEP_FIZHI_FG ( myTime, myIter, myThid )
294            endif
295    #endif
296    C AMM
297    
298    #ifdef ALLOW_DEBUG
299          IF ( debugLevel .GE. debLevB )
300         &    CALL DEBUG_CALL('THERMODYNAMICS',myThid)
301    #endif
302            CALL TIMER_START('THERMODYNAMICS      [FORWARD_STEP]',mythid)
303            CALL THERMODYNAMICS( myTime, myIter, myThid )
304            CALL TIMER_STOP ('THERMODYNAMICS      [FORWARD_STEP]',mythid)
305    
306    C--   do exchanges (needed for DYNAMICS) when using stagger time-step :
307    #ifdef ALLOW_DEBUG
308          IF ( debugLevel .GE. debLevB )
309         &    CALL DEBUG_CALL('DO_STAGGER_FIELDS_EXCH.',myThid)
310    #endif
311            CALL TIMER_START('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)
312            CALL DO_STAGGER_FIELDS_EXCHANGES( myTime, myIter, myThid )
313            CALL TIMER_STOP ('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)
314    
315    #ifdef ALLOW_SHAP_FILT
316          IF (useSHAP_FILT .AND.
317         &     staggerTimeStep .AND. shap_filt_TrStagg ) THEN
318    #ifdef ALLOW_DEBUG
319            IF ( debugLevel .GE. debLevB )
320         &    CALL DEBUG_CALL('SHAP_FILT_APPLY_TS',myThid)
321    #endif
322            CALL TIMER_START('SHAP_FILT           [FORWARD_STEP]',myThid)
323            CALL SHAP_FILT_APPLY_TS(gT,gS,myTime+deltaT,myIter+1,myThid)
324            CALL TIMER_STOP ('SHAP_FILT           [FORWARD_STEP]',myThid)
325          ENDIF
326    #endif
327    
328    #ifdef ALLOW_ZONAL_FILT
329          IF (useZONAL_FILT .AND.
330         &     staggerTimeStep .AND. zonal_filt_TrStagg ) THEN
331    #ifdef ALLOW_DEBUG
332            IF ( debugLevel .GE. debLevB )
333         &    CALL DEBUG_CALL('ZONAL_FILT_APPLY_TS',myThid)
334    #endif
335            CALL TIMER_START('ZONAL_FILT_APPLY    [FORWARD_STEP]',myThid)
336            CALL ZONAL_FILT_APPLY_TS( gT, gS, myThid )
337            CALL TIMER_STOP ('ZONAL_FILT_APPLY    [FORWARD_STEP]',myThid)
338          ENDIF
339    #endif  
340    
341    C--   Step forward fields and calculate time tendency terms.
342    #ifndef ALLOW_AUTODIFF_TAMC
343          IF ( momStepping ) THEN
344    #endif
345    #ifdef ALLOW_DEBUG
346            IF ( debugLevel .GE. debLevB )
347         &    CALL DEBUG_CALL('DYNAMICS',myThid)
348    #endif
349            CALL TIMER_START('DYNAMICS            [FORWARD_STEP]',mythid)
350            CALL DYNAMICS( myTime, myIter, myThid )
351            CALL TIMER_STOP ('DYNAMICS            [FORWARD_STEP]',mythid)
352    #ifndef ALLOW_AUTODIFF_TAMC
353          ENDIF
354    #endif
355    
356  #ifdef ALLOW_NONHYDROSTATIC  #ifdef ALLOW_NONHYDROSTATIC
357  C--   Step forward W field in N-H algorithm  C--   Step forward W field in N-H algorithm
358        IF ( nonHydrostatic ) THEN        IF ( momStepping .AND. nonHydrostatic ) THEN
359         CALL TIMER_START('CALC_GW            [FORWARD_STEP]',myThid)  #ifdef ALLOW_DEBUG
360         CALL CALC_GW( myThid)            IF ( debugLevel .GE. debLevB )
361         CALL TIMER_STOP ('CALC_GW            [FORWARD_STEP]',myThid)       &     CALL DEBUG_CALL('CALC_GW',myThid)
362    #endif
363             CALL TIMER_START('CALC_GW          [FORWARD_STEP]',myThid)
364             CALL CALC_GW(myThid)
365             CALL TIMER_STOP ('CALC_GW          [FORWARD_STEP]',myThid)
366          ENDIF
367    #endif
368    
369    #ifdef NONLIN_FRSURF
370    C--   update hfacC,W,S and recip_hFac according to etaH(n+1) :
371          IF ( nonlinFreeSurf.GT.0) THEN
372           IF ( select_rStar.GT.0 ) THEN
373            CALL TIMER_START('UPDATE_R_STAR      [FORWARD_STEP]',myThid)
374            CALL UPDATE_R_STAR( myTime, myIter, myThid )
375            CALL TIMER_STOP ('UPDATE_R_STAR      [FORWARD_STEP]',myThid)
376           ELSE
377            CALL TIMER_START('UPDATE_SURF_DR     [FORWARD_STEP]',myThid)
378            CALL UPDATE_SURF_DR( myTime, myIter, myThid )
379            CALL TIMER_STOP ('UPDATE_SURF_DR     [FORWARD_STEP]',myThid)
380           ENDIF
381          ENDIF
382    C-    update also CG2D matrix (and preconditioner)
383          IF ( momStepping .AND. nonlinFreeSurf.GT.2 ) THEN
384            CALL TIMER_START('UPDATE_CG2D        [FORWARD_STEP]',myThid)
385            CALL UPDATE_CG2D( myTime, myIter, myThid )
386            CALL TIMER_STOP ('UPDATE_CG2D        [FORWARD_STEP]',myThid)
387        ENDIF        ENDIF
388  #endif  #endif
389    
390    C--   Apply Filters to u*,v* before SOLVE_FOR_PRESSURE
391  #ifdef ALLOW_SHAP_FILT  #ifdef ALLOW_SHAP_FILT
392  C--   Step forward all tiles, filter and exchange.        IF (useSHAP_FILT .AND. shap_filt_uvStar) THEN
393        CALL TIMER_START('SHAP_FILT          [FORWARD_STEP]',myThid)          CALL TIMER_START('SHAP_FILT           [FORWARD_STEP]',myThid)
394        CALL SHAP_FILT_APPLY(          IF (implicDiv2Dflow.LT.1.) THEN
      I                     gUnm1, gVnm1, gTnm1, gSnm1,  
      I                     myCurrentTime, myCurrentIter, myThid )  
       IF (implicDiv2Dflow.LT.1.) THEN  
395  C--   Explicit+Implicit part of the Barotropic Flow Divergence  C--   Explicit+Implicit part of the Barotropic Flow Divergence
396  C      => Filtering of uVel,vVel is necessary  C      => Filtering of uVel,vVel is necessary
397           CALL SHAP_FILT_UV( uVel, vVel, myCurrentTime, myThid )            CALL SHAP_FILT_APPLY_UV( uVel,vVel,
398         &                             myTime+deltaT, myIter+1, myThid )
399            ENDIF
400            CALL SHAP_FILT_APPLY_UV( gU,gV,myTime+deltaT,myIter+1,myThid)
401            CALL TIMER_STOP ('SHAP_FILT           [FORWARD_STEP]',myThid)
402        ENDIF        ENDIF
       CALL TIMER_STOP ('SHAP_FILT          [FORWARD_STEP]',myThid)  
403  #endif  #endif
   
404  #ifdef ALLOW_ZONAL_FILT  #ifdef ALLOW_ZONAL_FILT
405        IF (zonal_filt_lat.LT.90.) THEN        IF (useZONAL_FILT .AND. zonal_filt_uvStar) THEN
406        CALL ZONAL_FILT_APPLY(          CALL TIMER_START('ZONAL_FILT_APPLY    [FORWARD_STEP]',myThid)
407       U           gUnm1, gVnm1, gTnm1, gSnm1,          IF (implicDiv2Dflow.LT.1.) THEN
408       I           myThid )  C--   Explicit+Implicit part of the Barotropic Flow Divergence
409    C      => Filtering of uVel,vVel is necessary
410              CALL ZONAL_FILT_APPLY_UV( uVel, vVel, myThid )
411            ENDIF
412            CALL ZONAL_FILT_APPLY_UV( gU, gV, myThid )
413            CALL TIMER_STOP ('ZONAL_FILT_APPLY    [FORWARD_STEP]',myThid)
414        ENDIF        ENDIF
415  #endif  #endif  
416    
417  C--   Solve elliptic equation(s).  C--   Solve elliptic equation(s).
418  C     Two-dimensional only for conventional hydrostatic or  C     Two-dimensional only for conventional hydrostatic or
419  C     three-dimensional for non-hydrostatic and/or IGW scheme.  C     three-dimensional for non-hydrostatic and/or IGW scheme.
420        CALL TIMER_START('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid)        IF ( momStepping ) THEN
421        CALL SOLVE_FOR_PRESSURE( myThid )        CALL TIMER_START('SOLVE_FOR_PRESSURE  [FORWARD_STEP]',myThid)
422        CALL TIMER_STOP ('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid)        CALL SOLVE_FOR_PRESSURE(myTime, myIter, myThid)
423          CALL TIMER_STOP ('SOLVE_FOR_PRESSURE  [FORWARD_STEP]',myThid)
424          ENDIF
425    
426    #ifdef ALLOW_AUTODIFF_TAMC
427    cph This is needed because convective_adjustment calls
428    cph find_rho which may use pressure()
429    CADJ STORE totphihyd  = comlev1, key = ikey_dynamics
430    #endif
431  C--   Correct divergence in flow field and cycle time-stepping  C--   Correct divergence in flow field and cycle time-stepping
432  C     arrays (for all fields) ; update time-counter  C     arrays (for all fields) ; update time-counter
433        myCurrentIter = nIter0 + iLoop        myIter = nIter0 + iLoop
434        myCurrentTime = startTime + deltaTClock * float(iLoop)        myTime = startTime + deltaTClock * float(iLoop)
435        CALL THE_CORRECTION_STEP(myCurrentTime, myCurrentIter, myThid)        CALL TIMER_START('THE_CORRECTION_STEP [FORWARD_STEP]',myThid)
436          CALL THE_CORRECTION_STEP(myTime, myIter, myThid)
437          CALL TIMER_STOP ('THE_CORRECTION_STEP [FORWARD_STEP]',myThid)
438    
439  C--   Do "blocking" sends and receives for tendency "overlap" terms  C--   Do "blocking" sends and receives for tendency "overlap" terms
440  c     CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid)  c     CALL TIMER_START('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)
441  c     CALL DO_GTERM_BLOCKING_EXCHANGES( myThid )  c     CALL DO_GTERM_BLOCKING_EXCHANGES( myThid )
442  c     CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid)  c     CALL TIMER_STOP ('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)
443    
444  C--   Do "blocking" sends and receives for field "overlap" terms  C--   Do "blocking" sends and receives for field "overlap" terms
445        CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid)        CALL TIMER_START('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)
446        CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid )        CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid )
447        CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid)        CALL TIMER_STOP ('BLOCKING_EXCHANGES  [FORWARD_STEP]',myThid)
448    
449    cswdptr -- add for seperate timestepping of chemical/biological/forcing
450    cswdptr    of ptracers ---
451    #ifdef ALLOW_GCHEM
452    ceh3 This is broken -- this ifdef should not be visible!
453    #ifdef PTRACERS_SEPARATE_FORCING
454    ceh3 needs an IF ( use GCHEM ) THEN
455            call GCHEM_FORCING_SEP( myTime,myIter,myThid )
456    #endif /* PTRACERS_SEPARATE_FORCING */
457    #endif /* ALLOW_GCHEM */
458    cswdptr -- end add ---
459    
460    C AMM
461    #ifdef ALLOW_FIZHI
462            CALL STEP_FIZHI_CORR ( myTime, myIter, myThid )
463    #endif
464    C AMM
465    
466    #ifdef ALLOW_FLT
467    C--   Calculate float trajectories
468          IF (useFLT) THEN
469            CALL TIMER_START('FLOATS            [FORWARD_STEP]',myThid)
470            CALL FLT_MAIN(myIter,myTime, myThid)
471            CALL TIMER_STOP ('FLOATS            [FORWARD_STEP]',myThid)
472          ENDIF
473    #endif
474    
475    #ifdef ALLOW_MONITOR
476    C--   Check status of solution (statistics, cfl, etc...)
477          CALL TIMER_START('MONITOR             [FORWARD_STEP]',myThid)
478          CALL MONITOR( myIter, myTime, myThid )
479          CALL TIMER_STOP ('MONITOR             [FORWARD_STEP]',myThid)
480    #endif /* ALLOW_MONITOR */
481    
482  C--   Do IO if needed.  C--   Do IO if needed.
483        CALL TIMER_START('I/O (WRITE)        [FORWARD_STEP]',myThid)        CALL TIMER_START('DO_THE_MODEL_IO     [FORWARD_STEP]',myThid)
484        CALL DO_THE_MODEL_IO(.FALSE.,        CALL DO_THE_MODEL_IO( myTime, myIter, myThid )
485       &                     myCurrentTime, myCurrentIter, myThid )        CALL TIMER_STOP ('DO_THE_MODEL_IO     [FORWARD_STEP]',myThid)
       CALL TIMER_STOP ('I/O (WRITE)        [FORWARD_STEP]',myThid)  
486    
487  C--   Save state for restarts  C--   Save state for restarts
488  C     Note:    (jmc: is it still the case after ckp35 ?)  C     Note:    (jmc: is it still the case after ckp35 ?)
# Line 159  C     Thus a checkpoint contains U.00000 Line 497  C     Thus a checkpoint contains U.00000
497  C     etaN.0000000001 in the indexing scheme used for the model  C     etaN.0000000001 in the indexing scheme used for the model
498  C     "state" files. This example is referred to as a checkpoint  C     "state" files. This example is referred to as a checkpoint
499  C     at time level 1  C     at time level 1
500        CALL TIMER_START('I/O (WRITE)        [FORWARD_STEP]',myThid)        CALL TIMER_START('WRITE_CHECKPOINT    [FORWARD_STEP]',myThid)
501          CALL PACKAGES_WRITE_PICKUP(
502         I               .FALSE., myTime, myIter, myThid )
503        CALL WRITE_CHECKPOINT(        CALL WRITE_CHECKPOINT(
504       &        .FALSE., myCurrentTime, myCurrentIter, myThid )       I               .FALSE., myTime, myIter, myThid )  
505        CALL TIMER_STOP ('I/O (WRITE)        [FORWARD_STEP]',myThid)        CALL TIMER_STOP ('WRITE_CHECKPOINT    [FORWARD_STEP]',myThid)
506    
507    #ifdef ALLOW_DEBUG
508          IF ( debugLevel .GE. debLevB )
509         &    CALL DEBUG_LEAVE('FORWARD_STEP',myThid)
510    #endif
511    
512        RETURN        RETURN
513        END        END

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.81

  ViewVC Help
Powered by ViewVC 1.1.22