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

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

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


Revision 1.105 - (show annotations) (download)
Thu Nov 11 02:24:20 2004 UTC (19 years, 6 months ago) by heimbach
Branch: MAIN
Changes since 1.104: +8 -8 lines
Restoring adjoint.

1 C $Header: /u/gcmpack/MITgcm/model/src/forward_step.F,v 1.104 2004/10/14 05:22:21 heimbach Exp $
2 C $Name: $
3
4 #include "PACKAGES_CONFIG.h"
5 #include "CPP_OPTIONS.h"
6
7 #ifdef ALLOW_GCHEM
8 # include "GCHEM_OPTIONS.h"
9 #endif
10 #ifdef ALLOW_OFFLINE
11 # include "OFFLINE_OPTIONS.h"
12 #endif
13 #ifdef ALLOW_GMREDI
14 # include "GMREDI_OPTIONS.h"
15 #endif
16
17 CBOP
18 C !ROUTINE: FORWARD_STEP
19 C !INTERFACE:
20 SUBROUTINE FORWARD_STEP( iloop, myTime, myIter, myThid )
21
22 C !DESCRIPTION: \bv
23 C *==================================================================
24 C | SUBROUTINE forward_step
25 C | o Run the ocean model and, optionally, evaluate a cost function.
26 C *==================================================================
27 C |
28 C | THE_MAIN_LOOP is the toplevel routine for the Tangent Linear and
29 C | Adjoint Model Compiler (TAMC). For this purpose the initialization
30 C | of the model was split into two parts. Those parameters that do
31 C | not depend on a specific model run are set in INITIALISE_FIXED,
32 C | whereas those that do depend on the specific realization are
33 C | initialized in INITIALISE_VARIA.
34 C |
35 C *==================================================================
36 C \ev
37
38 C !USES:
39 IMPLICIT NONE
40 C == Global variables ==
41 #include "SIZE.h"
42 #include "EEPARAMS.h"
43 #include "PARAMS.h"
44 #include "DYNVARS.h"
45
46 #ifdef ALLOW_SHAP_FILT
47 # include "SHAP_FILT.h"
48 #endif
49 #ifdef ALLOW_ZONAL_FILT
50 # include "ZONAL_FILT.h"
51 #endif
52 #ifdef COMPONENT_MODULE
53 # include "CPL_PARAMS.h"
54 #endif
55
56 #ifdef ALLOW_AUTODIFF_TAMC
57 # include "FFIELDS.h"
58
59 # ifdef ALLOW_NONHYDROSTATIC
60 # include "CG3D.h"
61 # endif
62
63 # include "tamc.h"
64 # include "ctrl.h"
65 # include "ctrl_dummy.h"
66 # include "cost.h"
67 # include "EOS.h"
68 # ifdef ALLOW_EXF
69 # include "exf_fields.h"
70 # include "exf_clim_fields.h"
71 # ifdef ALLOW_BULKFORMULAE
72 # include "exf_constants.h"
73 # endif
74 # endif
75 # ifdef ALLOW_OBCS
76 # include "OBCS.h"
77 # endif
78 # ifdef ALLOW_PTRACERS
79 # include "PTRACERS_SIZE.h"
80 # include "PTRACERS.h"
81 # endif
82 # ifdef ALLOW_CD_CODE
83 # include "CD_CODE_VARS.h"
84 # 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 */
98
99 C !LOCAL VARIABLES:
100 C == Routine arguments ==
101 C note: under the multi-threaded model myiter and
102 C mytime are local variables passed around as routine
103 C arguments. Although this is fiddly it saves the need to
104 C impose additional synchronisation points when they are
105 C updated.
106 C myIter - iteration counter for this thread
107 C myTime - time counter for this thread
108 C myThid - thread number for this instance of the routine.
109 INTEGER iloop
110 INTEGER myThid
111 INTEGER myIter
112 _RL myTime
113
114 C == Local variables ==
115 INTEGER myItP1
116 CEOP
117
118 #ifdef ALLOW_DEBUG
119 IF ( debugLevel .GE. debLevB )
120 & CALL DEBUG_ENTER('FORWARD_STEP',myThid)
121 #endif
122
123 #ifdef ALLOW_AUTODIFF_TAMC
124 C-- Reset the model iteration counter and the model time.
125 myiter = nIter0 + (iloop-1)
126 mytime = startTime + float(iloop-1)*deltaTclock
127 #endif
128
129 #if (defined (ALLOW_AUTODIFF_TAMC) && defined (ALLOW_AUTODIFF_MONITOR))
130 C Include call to a dummy routine. Its adjoint will be
131 C called at the proper place in the adjoint code.
132 C The adjoint routine will print out adjoint values
133 C if requested. The location of the call is important,
134 C it has to be after the adjoint of the exchanges
135 C (DO_GTERM_BLOCKING_EXCHANGES).
136 CALL DUMMY_IN_STEPPING( myTime, myIter, myThid )
137 cph I've commented this line since it may conflict with MITgcm's adjoint
138 cph However, need to check whether that's still consistent
139 cph with the ecco-branch (it should).
140 cph CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid )
141 #endif
142
143 #ifdef ALLOW_AUTODIFF_TAMC
144 c**************************************
145 #include "checkpoint_lev1_directives.h"
146 c**************************************
147 #endif
148
149 C-- Call external forcing package
150 #ifdef ALLOW_BULK_FORCE
151 IF ( useBulkForce ) THEN
152 #ifdef ALLOW_DEBUG
153 IF ( debugLevel .GE. debLevB )
154 & CALL DEBUG_CALL('BULKF_FIELDS_LOAD',myThid)
155 #endif
156 CALL TIMER_START('BULKF_FORCING [FORWARD_STEP]',mythid)
157 C- load all forcing fields at current time
158 CALL BULKF_FIELDS_LOAD( myTime, myIter, myThid )
159 C- calculate qnet and empmr (and wind stress)
160 CALL BULKF_FORCING( myTime, myIter, myThid )
161 CALL TIMER_STOP ('BULKF_FORCING [FORWARD_STEP]',mythid)
162 ELSE
163 #endif /* ALLOW_BULK_FORCE */
164
165 # ifdef ALLOW_EXF
166 # ifdef ALLOW_DEBUG
167 IF ( debugLevel .GE. debLevB )
168 & CALL DEBUG_CALL('EXF_GETFORCING',myThid)
169 # endif
170 CALL TIMER_START('EXF_GETFORCING [FORWARD_STEP]',mythid)
171 CALL EXF_GETFORCING( mytime, myiter, mythid )
172 CALL TIMER_STOP ('EXF_GETFORCING [FORWARD_STEP]',mythid)
173 # else /* ALLOW_EXF undef */
174 cph The following IF-statement creates an additional dependency
175 cph for the forcing fields requiring additional storing.
176 cph Therefore, the IF-statement will be put between CPP-OPTIONS,
177 cph assuming that ALLOW_SEAICE has not yet been differentiated.
178 # if (defined (ALLOW_SEAICE) || defined (ALLOW_EBM))
179 IF ( .NOT. useSEAICE .AND. .NOT. useEBM ) THEN
180 # endif
181 #ifdef ALLOW_DEBUG
182 IF ( debugLevel .GE. debLevB )
183 & CALL DEBUG_CALL('EXTERNAL_FIELDS_LOAD',myThid)
184 #endif
185 CALL TIMER_START('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid)
186 CALL EXTERNAL_FIELDS_LOAD( mytime, myiter, mythid )
187 CALL TIMER_STOP ('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid)
188 # if (defined (ALLOW_SEAICE) || defined (ALLOW_EBM))
189 ENDIF
190 # endif
191 # endif /* ALLOW_EXF */
192 #ifdef ALLOW_BULK_FORCE
193 C-- end of if/else block useBulfforce --
194 ENDIF
195 #endif /* ALLOW_BULK_FORCE */
196
197 #ifdef ALLOW_AUTODIFF
198 c-- Add control vector for forcing and parameter fields
199 if ( myiter .EQ. nIter0 )
200 & CALL CTRL_MAP_FORCING (mythid)
201 #endif
202
203 # ifdef ALLOW_SEAICE
204 C-- Call sea ice model to compute forcing/external data fields. In
205 C addition to computing prognostic sea-ice variables and diagnosing the
206 C forcing/external data fields that drive the ocean model, SEAICE_MODEL
207 C also sets theta to the freezing point under sea-ice. The implied
208 C surface heat flux is then stored in variable surfaceTendencyTice,
209 C which is needed by KPP package (kpp_calc.F and kpp_transport_t.F)
210 C to diagnose surface buoyancy fluxes and for the non-local transport
211 C term. Because this call precedes model thermodynamics, temperature
212 C under sea-ice may not be "exactly" at the freezing point by the time
213 C theta is dumped or time-averaged.
214 IF ( useSEAICE ) THEN
215 #ifdef ALLOW_DEBUG
216 IF ( debugLevel .GE. debLevB )
217 & CALL DEBUG_CALL('SEAICE_MODEL',myThid)
218 #endif
219 CALL TIMER_START('SEAICE_MODEL [FORWARD_STEP]',myThid)
220 CALL SEAICE_MODEL( myTime, myIter, myThid )
221 CALL TIMER_STOP ('SEAICE_MODEL [FORWARD_STEP]',myThid)
222 ENDIF
223 # endif /* ALLOW_SEAICE */
224
225 #ifdef ALLOW_AUTODIFF_TAMC
226 # ifdef ALLOW_PTRACERS
227 cph this replaces _bibj storing of ptracer within thermodynamics
228 CADJ STORE ptracer = comlev1, key = ikey_dynamics
229 # endif
230 #endif
231
232 #ifdef ALLOW_OFFLINE
233 call OFFLINE_FIELDS_LOAD( myTime, myIter, myThid )
234 #endif
235
236 #ifdef ALLOW_PTRACERS
237 # ifdef ALLOW_GCHEM
238 CALL GCHEM_FIELDS_LOAD( mytime, myiter, mythid )
239 # endif
240 #endif
241
242 #ifdef COMPONENT_MODULE
243 IF ( useCoupler .AND. cpl_earlyExpImpCall ) THEN
244 C Post coupling data that I export.
245 C Read in coupling data that I import.
246 CALL TIMER_START('CPL_EXPORT-IMPORT [FORWARD_STEP]',myThid)
247 CALL CPL_EXPORT_MY_DATA( myIter, myTime, myThid )
248 CALL CPL_IMPORT_EXTERNAL_DATA( myIter, myTime, myThid )
249 CALL TIMER_STOP ('CPL_EXPORT-IMPORT [FORWARD_STEP]',myThid)
250 ENDIF
251 #endif /* COMPONENT_MODULE */
252
253 #ifdef ALLOW_EBM
254 IF ( useEBM ) THEN
255 # ifdef ALLOW_DEBUG
256 IF ( debugLevel .GE. debLevB )
257 & CALL DEBUG_CALL('EBM',myThid)
258 # endif
259 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.
266
267 #ifdef ALLOW_DEBUG
268 IF ( debugLevel .GE. debLevB )
269 & CALL DEBUG_CALL('DO_ATMOSPHERIC_PHYS',myThid)
270 #endif
271 CALL TIMER_START('DO_ATMOSPHERIC_PHYS [FORWARD_STEP]',mythid)
272 CALL DO_ATMOSPHERIC_PHYS( myTime, myIter, myThid )
273 CALL TIMER_STOP ('DO_ATMOSPHERIC_PHYS [FORWARD_STEP]',mythid)
274
275 #ifdef ALLOW_AUTODIFF_TAMC
276 CADJ STORE theta = comlev1, key = ikey_dynamics
277 CADJ STORE salt = comlev1, key = ikey_dynamics
278 CADJ STORE totphihyd = comlev1, key = ikey_dynamics
279 CADJ STORE surfaceforcingtice = comlev1, key = ikey_dynamics
280 # ifdef ALLOW_KPP
281 CADJ STORE uvel = comlev1, key = ikey_dynamics
282 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 #ifndef ALLOW_OFFLINE
291 #ifdef ALLOW_DEBUG
292 IF ( debugLevel .GE. debLevB )
293 & CALL DEBUG_CALL('DO_OCEANIC_PHYS',myThid)
294 #endif
295 CALL TIMER_START('DO_OCEANIC_PHYS [FORWARD_STEP]',mythid)
296 CALL DO_OCEANIC_PHYS( myTime, myIter, myThid )
297 CALL TIMER_STOP ('DO_OCEANIC_PHYS [FORWARD_STEP]',mythid)
298 #endif
299
300 #ifdef ALLOW_AUTODIFF_TAMC
301 cph needed to be moved here from do_oceanic_physics
302 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
334 IF ( debugLevel .GE. debLevB )
335 & CALL DEBUG_CALL('THERMODYNAMICS',myThid)
336 #endif
337 CALL TIMER_START('THERMODYNAMICS [FORWARD_STEP]',mythid)
338 CALL THERMODYNAMICS( myTime, myIter, myThid )
339 CALL TIMER_STOP ('THERMODYNAMICS [FORWARD_STEP]',mythid)
340 C-- if not staggerTimeStep: end
341 ENDIF
342
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.
361 #ifndef ALLOW_OFFLINE
362 #ifndef ALLOW_AUTODIFF_TAMC
363 IF ( momStepping ) THEN
364 #endif
365 #ifdef ALLOW_DEBUG
366 IF ( debugLevel .GE. debLevB )
367 & CALL DEBUG_CALL('DYNAMICS',myThid)
368 #endif
369 CALL TIMER_START('DYNAMICS [FORWARD_STEP]',mythid)
370 CALL DYNAMICS( myTime, myIter, myThid )
371 CALL TIMER_STOP ('DYNAMICS [FORWARD_STEP]',mythid)
372 #ifndef ALLOW_AUTODIFF_TAMC
373 ENDIF
374 #endif
375 #endif
376
377 #ifdef ALLOW_NONHYDROSTATIC
378 C-- Step forward W field in N-H algorithm
379 IF ( momStepping .AND. nonHydrostatic ) THEN
380 #ifdef ALLOW_DEBUG
381 IF ( debugLevel .GE. debLevB )
382 & CALL DEBUG_CALL('CALC_GW',myThid)
383 #endif
384 CALL TIMER_START('CALC_GW [FORWARD_STEP]',myThid)
385 CALL CALC_GW(myThid)
386 CALL TIMER_STOP ('CALC_GW [FORWARD_STEP]',myThid)
387 ENDIF
388 #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
396 C- update hfacC,W,S and recip_hFac according to etaH(n+1) :
397 IF ( nonlinFreeSurf.GT.0) THEN
398 IF ( select_rStar.GT.0 ) THEN
399 CALL TIMER_START('UPDATE_R_STAR [FORWARD_STEP]',myThid)
400 CALL UPDATE_R_STAR( myTime, myIter, myThid )
401 CALL TIMER_STOP ('UPDATE_R_STAR [FORWARD_STEP]',myThid)
402 ELSE
403 CALL TIMER_START('UPDATE_SURF_DR [FORWARD_STEP]',myThid)
404 CALL UPDATE_SURF_DR( myTime, myIter, myThid )
405 CALL TIMER_STOP ('UPDATE_SURF_DR [FORWARD_STEP]',myThid)
406 ENDIF
407 ENDIF
408 C- update also CG2D matrix (and preconditioner)
409 IF ( momStepping .AND. nonlinFreeSurf.GT.2 ) THEN
410 CALL TIMER_START('UPDATE_CG2D [FORWARD_STEP]',myThid)
411 CALL UPDATE_CG2D( myTime, myIter, myThid )
412 CALL TIMER_STOP ('UPDATE_CG2D [FORWARD_STEP]',myThid)
413 ENDIF
414 #endif
415
416 C-- Apply Filters to u*,v* before SOLVE_FOR_PRESSURE
417 #ifdef ALLOW_SHAP_FILT
418 IF (useSHAP_FILT .AND. shap_filt_uvStar) THEN
419 CALL TIMER_START('SHAP_FILT [FORWARD_STEP]',myThid)
420 IF (implicDiv2Dflow.LT.1.) THEN
421 C-- Explicit+Implicit part of the Barotropic Flow Divergence
422 C => Filtering of uVel,vVel is necessary
423 CALL SHAP_FILT_APPLY_UV( uVel,vVel,
424 & myTime, myIter, myThid )
425 ENDIF
426 CALL SHAP_FILT_APPLY_UV( gU,gV,myTime,myIter,myThid)
427 CALL TIMER_STOP ('SHAP_FILT [FORWARD_STEP]',myThid)
428 ENDIF
429 #endif
430 #ifdef ALLOW_ZONAL_FILT
431 IF (useZONAL_FILT .AND. zonal_filt_uvStar) THEN
432 CALL TIMER_START('ZONAL_FILT_APPLY [FORWARD_STEP]',myThid)
433 IF (implicDiv2Dflow.LT.1.) THEN
434 C-- Explicit+Implicit part of the Barotropic Flow Divergence
435 C => Filtering of uVel,vVel is necessary
436 CALL ZONAL_FILT_APPLY_UV( uVel, vVel, myThid )
437 ENDIF
438 CALL ZONAL_FILT_APPLY_UV( gU, gV, myThid )
439 CALL TIMER_STOP ('ZONAL_FILT_APPLY [FORWARD_STEP]',myThid)
440 ENDIF
441 #endif
442
443 C-- Solve elliptic equation(s).
444 C Two-dimensional only for conventional hydrostatic or
445 C three-dimensional for non-hydrostatic and/or IGW scheme.
446 #ifndef ALLOW_OFFLINE
447 IF ( momStepping ) THEN
448 CALL TIMER_START('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid)
449 CALL SOLVE_FOR_PRESSURE(myTime, myIter, myThid)
450 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
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
510 cph This is needed because convective_adjustment calls
511 cph find_rho which may use pressure()
512 CADJ STORE totphihyd = comlev1, key = ikey_dynamics
513 #endif
514 C-- Cycle time-stepping Tracers arrays (T,S,+pTracers)
515 CALL TIMER_START('TS_CORRECTION_STEP [FORWARD_STEP]',myThid)
516 CALL TRACERS_CORRECTION_STEP(myTime, myIter, myThid)
517 CALL TIMER_STOP ('TS_CORRECTION_STEP [FORWARD_STEP]',myThid)
518
519 C-- Do "blocking" sends and receives for tendency "overlap" terms
520 c CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid)
521 c CALL DO_GTERM_BLOCKING_EXCHANGES( myThid )
522 c CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid)
523
524 C-- Do "blocking" sends and receives for field "overlap" terms
525 CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid)
526 CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid )
527 CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid)
528
529 cswdptr -- add for seperate timestepping of chemical/biological/forcing
530 cswdptr of ptracers ---
531 #ifdef ALLOW_GCHEM
532 ceh3 This is broken -- this ifdef should not be visible!
533 #ifdef PTRACERS_SEPARATE_FORCING
534 ceh3 needs an IF ( use GCHEM ) THEN
535 call GCHEM_FORCING_SEP( myTime,myIter,myThid )
536 #endif /* PTRACERS_SEPARATE_FORCING */
537 #endif /* ALLOW_GCHEM */
538 cswdptr -- end add ---
539
540 C AMM
541 #ifdef ALLOW_GRIDALT
542 if (useGRIDALT) then
543 CALL GRIDALT_UPDATE(myThid)
544 endif
545 #endif
546 C AMM
547
548 C AMM
549 #ifdef ALLOW_FIZHI
550 if( useFIZHI) then
551 CALL TIMER_START('FIZHI [FORWARD_STEP]',mythid)
552 CALL STEP_FIZHI_CORR ( myTime, myIter, myThid )
553 CALL TIMER_STOP('FIZHI [FORWARD_STEP]',mythid)
554 endif
555 #endif
556 C AMM
557
558 #ifdef ALLOW_FLT
559 C-- Calculate float trajectories
560 IF (useFLT) THEN
561 CALL TIMER_START('FLOATS [FORWARD_STEP]',myThid)
562 CALL FLT_MAIN(myIter,myTime, myThid)
563 CALL TIMER_STOP ('FLOATS [FORWARD_STEP]',myThid)
564 ENDIF
565 #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
574 C-- Check status of solution (statistics, cfl, etc...)
575 CALL TIMER_START('MONITOR [FORWARD_STEP]',myThid)
576 CALL MONITOR( myIter, myTime, myThid )
577 CALL TIMER_STOP ('MONITOR [FORWARD_STEP]',myThid)
578 #endif /* ALLOW_MONITOR */
579 #endif
580
581 #ifdef ALLOW_COST
582 C-- compare model with data and compute cost function
583 C-- this is done after exchanges to allow interpolation
584 CALL TIMER_START('COST_TILE [FORWARD_STEP]',myThid)
585 CALL COST_TILE ( mytime, myiter, myThid )
586 CALL TIMER_STOP ('COST_TILE [FORWARD_STEP]',myThid)
587 #endif
588
589 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)
596 CALL DO_THE_MODEL_IO( myTime, myIter, myThid )
597 CALL TIMER_STOP ('DO_THE_MODEL_IO [FORWARD_STEP]',myThid)
598 #endif
599
600 C-- Save state for restarts
601 CALL TIMER_START('WRITE_CHECKPOINT [FORWARD_STEP]',myThid)
602 CALL PACKAGES_WRITE_PICKUP(
603 I .FALSE., myTime, myIter, myThid )
604 #ifndef ALLOW_OFFLINE
605 CALL WRITE_CHECKPOINT(
606 I .FALSE., myTime, myIter, myThid )
607 #endif
608 CALL TIMER_STOP ('WRITE_CHECKPOINT [FORWARD_STEP]',myThid)
609
610 #ifdef ALLOW_DEBUG
611 IF ( debugLevel .GE. debLevB )
612 & CALL DEBUG_LEAVE('FORWARD_STEP',myThid)
613 #endif
614
615 RETURN
616 END

  ViewVC Help
Powered by ViewVC 1.1.22