1 |
C $Header$ |
C $Header$ |
2 |
C $Name$ |
C $Name$ |
3 |
|
|
|
#include "AD_CONFIG.h" |
|
4 |
#include "PACKAGES_CONFIG.h" |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_OPTIONS.h" |
#include "CPP_OPTIONS.h" |
6 |
|
|
7 |
cswdptr -- add -- |
#ifdef ALLOW_OFFLINE |
8 |
#ifdef ALLOW_GCHEM |
# include "OFFLINE_OPTIONS.h" |
9 |
# include "GCHEM_OPTIONS.h" |
#endif |
10 |
|
#ifdef ALLOW_GMREDI |
11 |
|
# include "GMREDI_OPTIONS.h" |
12 |
#endif |
#endif |
|
cswdptr -- end add --- |
|
13 |
|
|
14 |
CBOP |
CBOP |
15 |
C !ROUTINE: FORWARD_STEP |
C !ROUTINE: FORWARD_STEP |
39 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
40 |
#include "PARAMS.h" |
#include "PARAMS.h" |
41 |
#include "DYNVARS.h" |
#include "DYNVARS.h" |
|
#include "FFIELDS.h" |
|
42 |
|
|
43 |
#ifdef ALLOW_NONHYDROSTATIC |
#ifdef ALLOW_MNC |
44 |
#include "CG3D.h" |
#include "MNC_PARAMS.h" |
45 |
|
EXTERNAL DIFFERENT_MULTIPLE |
46 |
|
LOGICAL DIFFERENT_MULTIPLE |
47 |
|
#endif |
48 |
|
|
49 |
|
#ifdef HAVE_SIGREG |
50 |
|
#include "SIGREG.h" |
51 |
#endif |
#endif |
52 |
|
|
53 |
#ifdef ALLOW_SHAP_FILT |
#ifdef ALLOW_SHAP_FILT |
54 |
#include "SHAP_FILT.h" |
# include "SHAP_FILT.h" |
55 |
#endif |
#endif |
56 |
#ifdef ALLOW_ZONAL_FILT |
#ifdef ALLOW_ZONAL_FILT |
57 |
#include "ZONAL_FILT.h" |
# include "ZONAL_FILT.h" |
58 |
|
#endif |
59 |
|
#ifdef COMPONENT_MODULE |
60 |
|
# include "CPL_PARAMS.h" |
61 |
#endif |
#endif |
62 |
|
|
63 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
64 |
|
# include "FFIELDS.h" |
65 |
|
|
66 |
# include "tamc.h" |
# include "tamc.h" |
67 |
# include "ctrl.h" |
# include "ctrl.h" |
68 |
# include "ctrl_dummy.h" |
# include "ctrl_dummy.h" |
69 |
# include "cost.h" |
# include "cost.h" |
70 |
# include "EOS.h" |
# include "EOS.h" |
71 |
# ifdef INCLUDE_EXTERNAL_FORCING_PACKAGE |
# ifdef ALLOW_EXF |
72 |
# include "exf_fields.h" |
# include "exf_fields.h" |
73 |
|
# include "exf_clim_fields.h" |
74 |
# ifdef ALLOW_BULKFORMULAE |
# ifdef ALLOW_BULKFORMULAE |
75 |
# include "exf_constants.h" |
# include "exf_constants.h" |
76 |
# endif |
# endif |
79 |
# include "OBCS.h" |
# include "OBCS.h" |
80 |
# endif |
# endif |
81 |
# ifdef ALLOW_PTRACERS |
# ifdef ALLOW_PTRACERS |
82 |
|
# include "PTRACERS_SIZE.h" |
83 |
# include "PTRACERS.h" |
# include "PTRACERS.h" |
84 |
# endif |
# endif |
85 |
|
# ifdef ALLOW_CD_CODE |
86 |
|
# include "CD_CODE_VARS.h" |
87 |
|
# endif |
88 |
|
# ifdef ALLOW_EBM |
89 |
|
# include "EBM.h" |
90 |
|
# endif |
91 |
|
# ifdef EXACT_CONSERV |
92 |
|
# include "SURFACE.h" |
93 |
|
# endif |
94 |
|
# ifdef ALLOW_KPP |
95 |
|
# include "KPP.h" |
96 |
|
# endif |
97 |
|
# ifdef ALLOW_GMREDI |
98 |
|
# include "GMREDI.h" |
99 |
|
# endif |
100 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#endif /* ALLOW_AUTODIFF_TAMC */ |
101 |
|
|
102 |
C !LOCAL VARIABLES: |
C !LOCAL VARIABLES: |
106 |
C arguments. Although this is fiddly it saves the need to |
C arguments. Although this is fiddly it saves the need to |
107 |
C impose additional synchronisation points when they are |
C impose additional synchronisation points when they are |
108 |
C updated. |
C updated. |
109 |
C myiter - iteration counter for this thread |
C myIter - iteration counter for this thread |
110 |
C mytime - time counter for this thread |
C myTime - time counter for this thread |
111 |
C mythid - thread number for this instance of the routine. |
C myThid - thread number for this instance of the routine. |
112 |
integer iloop |
INTEGER iloop |
113 |
integer mythid |
INTEGER myThid |
114 |
integer myiter |
INTEGER myIter |
115 |
_RL mytime |
_RL myTime |
116 |
#ifdef ALLOW_BULK_FORCE |
|
117 |
INTEGER bi,bj |
C == Local variables == |
118 |
|
#ifdef COMPONENT_MODULE |
119 |
|
INTEGER myItP1 |
120 |
#endif |
#endif |
|
|
|
121 |
CEOP |
CEOP |
122 |
|
|
123 |
#ifndef DISABLE_DEBUGMODE |
#ifdef ALLOW_DEBUG |
124 |
IF ( debugLevel .GE. debLevB ) |
IF ( debugLevel .GE. debLevB ) |
125 |
& CALL DEBUG_ENTER('FORWARD_STEP',myThid) |
& CALL DEBUG_ENTER('FORWARD_STEP',myThid) |
126 |
#endif |
#endif |
127 |
|
|
128 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
129 |
C-- Reset the model iteration counter and the model time. |
C-- Reset the model iteration counter and the model time. |
130 |
myiter = nIter0 + (iloop-1) |
myIter = nIter0 + (iloop-1) |
131 |
mytime = startTime + float(iloop-1)*deltaTclock |
myTime = startTime + float(iloop-1)*deltaTclock |
|
#endif |
|
|
|
|
|
#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 ) |
|
132 |
#endif |
#endif |
133 |
|
|
|
#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 */ |
|
|
|
|
|
C-- Load forcing/external data fields. |
|
134 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
135 |
c************************************** |
c************************************** |
136 |
#include "checkpoint_lev1_directives.h" |
#include "checkpoint_lev1_directives.h" |
137 |
c************************************** |
c************************************** |
138 |
#endif |
#endif |
139 |
|
|
140 |
|
C-- Switch on/off diagnostics for snap-shot output: |
141 |
|
#ifdef ALLOW_DIAGNOSTICS |
142 |
|
IF ( useDiagnostics ) THEN |
143 |
|
CALL DIAGNOSTICS_SWITCH_ONOFF( myTime, myIter, myThid ) |
144 |
|
ENDIF |
145 |
|
#endif |
146 |
|
|
147 |
|
C-- State-variables diagnostics |
148 |
|
IF ( usediagnostics ) THEN |
149 |
|
CALL TIMER_START('DO_STATEVARS_DIAGS [FORWARD_STEP]',myThid) |
150 |
|
CALL DO_STATEVARS_DIAGS( myTime, 0, myIter, myThid ) |
151 |
|
CALL TIMER_STOP ('DO_STATEVARS_DIAGS [FORWARD_STEP]',myThid) |
152 |
|
ENDIF |
153 |
|
|
154 |
C-- Call external forcing package |
C-- Call external forcing package |
155 |
#ifdef ALLOW_BULK_FORCE |
#ifdef ALLOW_BULK_FORCE |
156 |
IF ( useBulkforce ) THEN |
IF ( useBulkForce ) THEN |
157 |
#ifndef DISABLE_DEBUGMODE |
#ifdef ALLOW_DEBUG |
158 |
IF ( debugLevel .GE. debLevB ) |
IF ( debugLevel .GE. debLevB ) |
159 |
& CALL DEBUG_CALL('BULKF_FIELDS_LOAD',myThid) |
& CALL DEBUG_CALL('BULKF_FIELDS_LOAD',myThid) |
160 |
#endif |
#endif |
161 |
CALL TIMER_START('BULKF_FIELDS_LOAD[THE_MAIN_LOOP]',mythid) |
CALL TIMER_START('BULKF_FORCING [FORWARD_STEP]',mythid) |
162 |
CALL BULKF_FIELDS_LOAD( mytime, myiter, mythid ) |
C- load all forcing fields at current time |
163 |
CALL TIMER_STOP ('BULKF_FIELDS_LOAD[THE_MAIN_LOOP]',mythid) |
CALL BULKF_FIELDS_LOAD( myTime, myIter, myThid ) |
164 |
c calculate qnet and empmr (and wind stress) |
C- calculate qnet and empmr (and wind stress) |
165 |
DO bj=myByLo(myThid),myByHi(myThid) |
CALL BULKF_FORCING( myTime, myIter, myThid ) |
166 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
CALL TIMER_STOP ('BULKF_FORCING [FORWARD_STEP]',mythid) |
|
CALL BULKF_FORCING( bi,bj, mytime, myiter, mythid ) |
|
|
ENDDO |
|
|
ENDDO |
|
|
c Update the tile edges. |
|
|
_EXCH_XY_R8(Qnet, mythid) |
|
|
_EXCH_XY_R8(EmPmR, mythid) |
|
|
CALL EXCH_UV_XY_RS(fu, fv, .TRUE., myThid) |
|
|
C _EXCH_XY_R8(fu , mythid) |
|
|
C _EXCH_XY_R8(fv , mythid) |
|
167 |
ELSE |
ELSE |
168 |
#endif /* ALLOW_BULK_FORCE */ |
#endif /* ALLOW_BULK_FORCE */ |
169 |
|
|
170 |
# ifdef ALLOW_EXF |
# ifdef ALLOW_EXF |
171 |
C NOTE, that although the exf package is part of the |
# ifdef ALLOW_DEBUG |
|
C distribution, it is not currently maintained, i.e. |
|
|
C exf is disabled by default in genmake. |
|
|
#ifndef DISABLE_DEBUGMODE |
|
172 |
IF ( debugLevel .GE. debLevB ) |
IF ( debugLevel .GE. debLevB ) |
173 |
& CALL DEBUG_CALL('EXF_GETFORCING',myThid) |
& CALL DEBUG_CALL('EXF_GETFORCING',myThid) |
174 |
#endif |
# endif |
175 |
CALL TIMER_START('EXF_GETFORCING [FORWARD_STEP]',mythid) |
CALL TIMER_START('EXF_GETFORCING [FORWARD_STEP]',mythid) |
176 |
CALL EXF_GETFORCING( mytime, myiter, mythid ) |
CALL EXF_GETFORCING( mytime, myiter, mythid ) |
177 |
CALL TIMER_STOP ('EXF_GETFORCING [FORWARD_STEP]',mythid) |
CALL TIMER_STOP ('EXF_GETFORCING [FORWARD_STEP]',mythid) |
180 |
cph for the forcing fields requiring additional storing. |
cph for the forcing fields requiring additional storing. |
181 |
cph Therefore, the IF-statement will be put between CPP-OPTIONS, |
cph Therefore, the IF-statement will be put between CPP-OPTIONS, |
182 |
cph assuming that ALLOW_SEAICE has not yet been differentiated. |
cph assuming that ALLOW_SEAICE has not yet been differentiated. |
183 |
# ifdef ALLOW_SEAICE |
# if (defined (ALLOW_SEAICE) || defined (ALLOW_EBM)) |
184 |
IF ( .NOT. useSEAICE ) THEN |
IF ( .NOT. useSEAICE .AND. .NOT. useEBM ) THEN |
185 |
# endif |
# endif |
186 |
#ifndef DISABLE_DEBUGMODE |
#ifdef ALLOW_DEBUG |
187 |
IF ( debugLevel .GE. debLevB ) |
IF ( debugLevel .GE. debLevB ) |
188 |
& CALL DEBUG_CALL('EXTERNAL_FIELDS_LOAD',myThid) |
& CALL DEBUG_CALL('EXTERNAL_FIELDS_LOAD',myThid) |
189 |
#endif |
#endif |
190 |
CALL TIMER_START('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid) |
CALL TIMER_START('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid) |
191 |
CALL EXTERNAL_FIELDS_LOAD( mytime, myiter, mythid ) |
CALL EXTERNAL_FIELDS_LOAD( mytime, myiter, mythid ) |
192 |
CALL TIMER_STOP ('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid) |
CALL TIMER_STOP ('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid) |
193 |
# ifdef ALLOW_SEAICE |
# if (defined (ALLOW_SEAICE) || defined (ALLOW_EBM)) |
194 |
ENDIF |
ENDIF |
195 |
# endif |
# endif |
196 |
# endif /* ALLOW_EXF */ |
# endif /* ALLOW_EXF */ |
199 |
ENDIF |
ENDIF |
200 |
#endif /* ALLOW_BULK_FORCE */ |
#endif /* ALLOW_BULK_FORCE */ |
201 |
|
|
202 |
#if (defined (ALLOW_ADJOINT_RUN) || defined (ALLOW_TANGENTLINEAR_RUN)) |
#ifdef ALLOW_AUTODIFF |
203 |
c-- Add control vector for forcing and parameter fields |
c-- Add control vector for forcing and parameter fields |
204 |
if ( myiter .EQ. nIter0 ) |
if ( myiter .EQ. nIter0 ) |
205 |
& CALL CTRL_MAP_FORCING (mythid) |
& CALL CTRL_MAP_FORCING (mythid) |
206 |
#endif |
#endif |
207 |
|
|
208 |
|
#if (defined (ALLOW_AUTODIFF_TAMC) && defined (ALLOW_AUTODIFF_MONITOR)) |
209 |
|
C Include call to a dummy routine. Its adjoint will be |
210 |
|
C called at the proper place in the adjoint code. |
211 |
|
C The adjoint routine will print out adjoint values |
212 |
|
C if requested. The location of the call is important, |
213 |
|
C it has to be after the adjoint of the exchanges |
214 |
|
C (DO_GTERM_BLOCKING_EXCHANGES). |
215 |
|
CALL DUMMY_IN_STEPPING( myTime, myIter, myThid ) |
216 |
|
cph I've commented this line since it may conflict with MITgcm's adjoint |
217 |
|
cph However, need to check whether that's still consistent |
218 |
|
cph with the ecco-branch (it should). |
219 |
|
cph CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid ) |
220 |
|
#endif |
221 |
|
|
222 |
# ifdef ALLOW_SEAICE |
# ifdef ALLOW_SEAICE |
223 |
C-- Call sea ice model to compute forcing/external data fields. In |
C-- Call sea ice model to compute forcing/external data fields. In |
224 |
C addition to computing prognostic sea-ice variables and diagnosing the |
C addition to computing prognostic sea-ice variables and diagnosing the |
231 |
C under sea-ice may not be "exactly" at the freezing point by the time |
C under sea-ice may not be "exactly" at the freezing point by the time |
232 |
C theta is dumped or time-averaged. |
C theta is dumped or time-averaged. |
233 |
IF ( useSEAICE ) THEN |
IF ( useSEAICE ) THEN |
234 |
#ifndef DISABLE_DEBUGMODE |
#ifdef ALLOW_DEBUG |
235 |
IF ( debugLevel .GE. debLevB ) |
IF ( debugLevel .GE. debLevB ) |
236 |
& CALL DEBUG_CALL('SEAICE_MODEL',myThid) |
& CALL DEBUG_CALL('SEAICE_MODEL',myThid) |
237 |
#endif |
#endif |
248 |
# endif |
# endif |
249 |
#endif |
#endif |
250 |
|
|
251 |
|
#ifdef ALLOW_OFFLINE |
252 |
|
call OFFLINE_FIELDS_LOAD( myTime, myIter, myThid ) |
253 |
|
#endif |
254 |
|
|
255 |
#ifdef ALLOW_PTRACERS |
#ifdef ALLOW_PTRACERS |
256 |
# ifdef ALLOW_GCHEM |
# ifdef ALLOW_GCHEM |
257 |
|
IF ( useGCHEM ) THEN |
258 |
|
#ifdef ALLOW_DEBUG |
259 |
|
IF ( debugLevel .GE. debLevB ) |
260 |
|
& CALL DEBUG_CALL('GCHEM_FIELDS_LOAD',myThid) |
261 |
|
#endif /* ALLOW_DEBUG */ |
262 |
CALL GCHEM_FIELDS_LOAD( mytime, myiter, mythid ) |
CALL GCHEM_FIELDS_LOAD( mytime, myiter, mythid ) |
263 |
|
ENDIF |
264 |
# endif |
# endif |
265 |
#endif |
#endif |
266 |
|
|
267 |
|
#ifdef COMPONENT_MODULE |
268 |
|
IF ( useCoupler .AND. cpl_earlyExpImpCall ) THEN |
269 |
|
C Post coupling data that I export. |
270 |
|
C Read in coupling data that I import. |
271 |
|
CALL TIMER_START('CPL_EXPORT-IMPORT [FORWARD_STEP]',myThid) |
272 |
|
CALL CPL_EXPORT_MY_DATA( myIter, myTime, myThid ) |
273 |
|
CALL CPL_IMPORT_EXTERNAL_DATA( myIter, myTime, myThid ) |
274 |
|
CALL TIMER_STOP ('CPL_EXPORT-IMPORT [FORWARD_STEP]',myThid) |
275 |
|
ENDIF |
276 |
|
#endif /* COMPONENT_MODULE */ |
277 |
|
|
278 |
|
#ifdef ALLOW_EBM |
279 |
|
IF ( useEBM ) THEN |
280 |
|
# ifdef ALLOW_DEBUG |
281 |
|
IF ( debugLevel .GE. debLevB ) |
282 |
|
& CALL DEBUG_CALL('EBM',myThid) |
283 |
|
# endif |
284 |
|
CALL TIMER_START('EBM [FORWARD_STEP]',mythid) |
285 |
|
CALL EBM_DRIVER ( myTime, myIter, myThid ) |
286 |
|
CALL TIMER_STOP ('EBM [FORWARD_STEP]',mythid) |
287 |
|
ENDIF |
288 |
|
#endif |
289 |
|
|
290 |
C-- Step forward fields and calculate time tendency terms. |
C-- Step forward fields and calculate time tendency terms. |
291 |
#ifndef DISABLE_DEBUGMODE |
|
292 |
IF ( debugLevel .GE. debLevB ) |
#ifdef ALLOW_DEBUG |
293 |
& CALL DEBUG_CALL('THERMODYNAMICS',myThid) |
IF ( debugLevel .GE. debLevB ) |
294 |
|
& CALL DEBUG_CALL('DO_ATMOSPHERIC_PHYS',myThid) |
295 |
#endif |
#endif |
296 |
CALL TIMER_START('THERMODYNAMICS [FORWARD_STEP]',mythid) |
CALL TIMER_START('DO_ATMOSPHERIC_PHYS [FORWARD_STEP]',mythid) |
297 |
CALL THERMODYNAMICS( myTime, myIter, myThid ) |
CALL DO_ATMOSPHERIC_PHYS( myTime, myIter, myThid ) |
298 |
CALL TIMER_STOP ('THERMODYNAMICS [FORWARD_STEP]',mythid) |
CALL TIMER_STOP ('DO_ATMOSPHERIC_PHYS [FORWARD_STEP]',mythid) |
299 |
|
|
300 |
C-- do exchanges (needed for DYNAMICS) when using stagger time-step : |
#ifdef ALLOW_AUTODIFF_TAMC |
301 |
#ifndef DISABLE_DEBUGMODE |
CADJ STORE theta = comlev1, key = ikey_dynamics |
302 |
IF ( debugLevel .GE. debLevB ) |
CADJ STORE salt = comlev1, key = ikey_dynamics |
303 |
& CALL DEBUG_CALL('DO_STAGGER_FIELDS_EXCH.',myThid) |
CADJ STORE totphihyd = comlev1, key = ikey_dynamics |
304 |
|
CADJ STORE surfaceforcingtice = comlev1, key = ikey_dynamics |
305 |
|
# ifdef ALLOW_KPP |
306 |
|
CADJ STORE uvel = comlev1, key = ikey_dynamics |
307 |
|
CADJ STORE vvel = comlev1, key = ikey_dynamics |
308 |
|
# endif |
309 |
|
# ifdef EXACT_CONSERV |
310 |
|
CADJ STORE empmr = comlev1, key = ikey_dynamics |
311 |
|
CADJ STORE pmepr = comlev1, key = ikey_dynamics |
312 |
|
# endif |
313 |
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
314 |
|
|
315 |
|
#ifndef ALLOW_OFFLINE |
316 |
|
#ifdef ALLOW_DEBUG |
317 |
|
IF ( debugLevel .GE. debLevB ) |
318 |
|
& CALL DEBUG_CALL('DO_OCEANIC_PHYS',myThid) |
319 |
|
#endif |
320 |
|
CALL TIMER_START('DO_OCEANIC_PHYS [FORWARD_STEP]',mythid) |
321 |
|
CALL DO_OCEANIC_PHYS( myTime, myIter, myThid ) |
322 |
|
CALL TIMER_STOP ('DO_OCEANIC_PHYS [FORWARD_STEP]',mythid) |
323 |
#endif |
#endif |
|
CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
|
|
CALL DO_STAGGER_FIELDS_EXCHANGES( myTime, myIter, myThid ) |
|
|
CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
|
324 |
|
|
325 |
#ifdef ALLOW_SHAP_FILT |
#ifdef ALLOW_GCHEM |
326 |
IF (useSHAP_FILT .AND. |
C GCHEM package is an interface for any bio-geochemical or |
327 |
& staggerTimeStep .AND. shap_filt_TrStagg ) THEN |
C ecosystem model you would like to include. |
328 |
#ifndef DISABLE_DEBUGMODE |
C If GCHEM_SEPARATE_FORCING is not defined, you are |
329 |
|
C responsible for computing tendency terms for passive |
330 |
|
C tracers and storing them on a 3DxNumPtracers-array called |
331 |
|
C gchemTendency in GCHEM_CALC_TENDENCY. This tendency is then added |
332 |
|
C to gPtr in ptracers_forcing later-on. |
333 |
|
C If GCHEM_SEPARATE_FORCING is defined, you are reponsible for |
334 |
|
C UPDATING ptracers directly in GCHEM_FORCING_SEP. This amounts |
335 |
|
C to a completely separate time step that you have to implement |
336 |
|
C yourself (Eulerian seems to be fine in most cases). |
337 |
|
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
338 |
|
C CAVEAT: Up to now, when GCHEM is turned on the field ptracerForcingSurf, |
339 |
|
C which is needed for KPP is not set properly. ptracerForcingSurf must |
340 |
|
C be treated differently depending on whether GCHEM_SEPARATE_FORCING |
341 |
|
C is define or not. TBD. |
342 |
|
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
343 |
|
IF ( useGCHEM ) THEN |
344 |
|
#ifdef ALLOW_DEBUG |
345 |
IF ( debugLevel .GE. debLevB ) |
IF ( debugLevel .GE. debLevB ) |
346 |
& CALL DEBUG_CALL('SHAP_FILT_APPLY_TS',myThid) |
& CALL DEBUG_CALL('GCHEM_CALC_TENDENCY',myThid) |
347 |
#endif |
#endif |
348 |
CALL TIMER_START('SHAP_FILT [FORWARD_STEP]',myThid) |
CALL TIMER_START('GCHEM_CALC_TENDENCY [FORWARD_STEP]',myThid) |
349 |
CALL SHAP_FILT_APPLY_TS(gT,gS,myTime+deltaT,myIter+1,myThid) |
CALL GCHEM_CALC_TENDENCY( myTime, myIter, myThid ) |
350 |
CALL TIMER_STOP ('SHAP_FILT [FORWARD_STEP]',myThid) |
CALL TIMER_STOP ('GCHEM_CALC_TENDENCY [FORWARD_STEP]',myThid) |
351 |
ENDIF |
ENDIF |
352 |
#endif |
#endif /* ALLOW_GCHEM */ |
353 |
#ifdef ALLOW_ZONAL_FILT |
|
354 |
IF (useZONAL_FILT .AND. |
#ifdef ALLOW_AUTODIFF_TAMC |
355 |
& staggerTimeStep .AND. zonal_filt_TrStagg ) THEN |
cph needed to be moved here from do_oceanic_physics |
356 |
#ifndef DISABLE_DEBUGMODE |
cph to be visible down the road |
357 |
|
c |
358 |
|
CADJ STORE surfaceForcingS = comlev1, key = ikey_dynamics |
359 |
|
CADJ STORE surfaceForcingT = comlev1, key = ikey_dynamics |
360 |
|
CADJ STORE surfaceForcingTice = comlev1, key = ikey_dynamics |
361 |
|
ctest( |
362 |
|
CADJ STORE IVDConvCount = comlev1, key = ikey_dynamics |
363 |
|
ctest) |
364 |
|
# ifdef ALLOW_PTRACERS |
365 |
|
CADJ STORE surfaceForcingPtr = comlev1, key = ikey_dynamics |
366 |
|
# endif |
367 |
|
c |
368 |
|
# ifdef ALLOW_GMREDI |
369 |
|
CADJ STORE Kwx = comlev1, key = ikey_dynamics |
370 |
|
CADJ STORE Kwy = comlev1, key = ikey_dynamics |
371 |
|
CADJ STORE Kwz = comlev1, key = ikey_dynamics |
372 |
|
# ifdef GM_BOLUS_ADVEC |
373 |
|
CADJ STORE GM_PsiX = comlev1, key = ikey_dynamics |
374 |
|
CADJ STORE GM_PsiY = comlev1, key = ikey_dynamics |
375 |
|
# endif |
376 |
|
# endif |
377 |
|
c |
378 |
|
# ifdef ALLOW_KPP |
379 |
|
CADJ STORE KPPghat = comlev1, key = ikey_dynamics |
380 |
|
CADJ STORE KPPfrac = comlev1, key = ikey_dynamics |
381 |
|
CADJ STORE KPPdiffKzS = comlev1, key = ikey_dynamics |
382 |
|
CADJ STORE KPPdiffKzT = comlev1, key = ikey_dynamics |
383 |
|
# endif |
384 |
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
385 |
|
|
386 |
|
IF ( .NOT.staggerTimeStep ) THEN |
387 |
|
#ifdef ALLOW_DEBUG |
388 |
IF ( debugLevel .GE. debLevB ) |
IF ( debugLevel .GE. debLevB ) |
389 |
& CALL DEBUG_CALL('ZONAL_FILT_APPLY_TS',myThid) |
& CALL DEBUG_CALL('THERMODYNAMICS',myThid) |
390 |
#endif |
#endif |
391 |
CALL TIMER_START('ZONAL_FILT_APPLY [FORWARD_STEP]',myThid) |
CALL TIMER_START('THERMODYNAMICS [FORWARD_STEP]',mythid) |
392 |
CALL ZONAL_FILT_APPLY_TS( gT, gS, myThid ) |
CALL THERMODYNAMICS( myTime, myIter, myThid ) |
393 |
CALL TIMER_STOP ('ZONAL_FILT_APPLY [FORWARD_STEP]',myThid) |
CALL TIMER_STOP ('THERMODYNAMICS [FORWARD_STEP]',mythid) |
394 |
|
C-- if not staggerTimeStep: end |
395 |
ENDIF |
ENDIF |
396 |
#endif |
|
397 |
|
#ifdef COMPONENT_MODULE |
398 |
|
IF ( useCoupler .AND. .NOT.cpl_earlyExpImpCall ) THEN |
399 |
|
C Post coupling data that I export. |
400 |
|
C Read in coupling data that I import. |
401 |
|
myItP1 = myIter + 1 |
402 |
|
CALL TIMER_START('CPL_EXPORT-IMPORT [FORWARD_STEP]',myThid) |
403 |
|
CALL CPL_EXPORT_MY_DATA( myItP1, myTime, myThid ) |
404 |
|
CALL CPL_IMPORT_EXTERNAL_DATA( myItP1, myTime, myThid ) |
405 |
|
CALL TIMER_STOP ('CPL_EXPORT-IMPORT [FORWARD_STEP]',myThid) |
406 |
|
# ifndef ALLOW_AIM |
407 |
|
IF ( useRealFreshWaterFlux ) THEN |
408 |
|
CALL OCN_APPLY_IMPORT( .FALSE., myTime, myIter, myThid ) |
409 |
|
ENDIF |
410 |
|
# endif |
411 |
|
ENDIF |
412 |
|
#endif /* COMPONENT_MODULE */ |
413 |
|
|
414 |
C-- Step forward fields and calculate time tendency terms. |
C-- Step forward fields and calculate time tendency terms. |
415 |
|
#ifndef ALLOW_OFFLINE |
416 |
#ifndef ALLOW_AUTODIFF_TAMC |
#ifndef ALLOW_AUTODIFF_TAMC |
417 |
IF ( momStepping ) THEN |
IF ( momStepping ) THEN |
418 |
#endif |
#endif |
419 |
#ifndef DISABLE_DEBUGMODE |
#ifdef ALLOW_DEBUG |
420 |
IF ( debugLevel .GE. debLevB ) |
IF ( debugLevel .GE. debLevB ) |
421 |
& CALL DEBUG_CALL('DYNAMICS',myThid) |
& CALL DEBUG_CALL('DYNAMICS',myThid) |
422 |
#endif |
#endif |
426 |
#ifndef ALLOW_AUTODIFF_TAMC |
#ifndef ALLOW_AUTODIFF_TAMC |
427 |
ENDIF |
ENDIF |
428 |
#endif |
#endif |
429 |
|
#endif |
430 |
|
|
431 |
#ifdef ALLOW_NONHYDROSTATIC |
C-- Update time-counter |
432 |
C-- Step forward W field in N-H algorithm |
myIter = nIter0 + iLoop |
433 |
IF ( momStepping .AND. nonHydrostatic ) THEN |
myTime = startTime + deltaTClock * float(iLoop) |
434 |
#ifndef DISABLE_DEBUGMODE |
|
435 |
IF ( debugLevel .GE. debLevB ) |
#ifdef ALLOW_MNC |
436 |
& CALL DEBUG_CALL('CALC_GW',myThid) |
C Update the default next iter for MNC |
437 |
#endif |
IF ( useMNC ) THEN |
438 |
CALL TIMER_START('CALC_GW [FORWARD_STEP]',myThid) |
CALL MNC_CW_CITER_SETG( 1, 1, -1, myIter , myThid ) |
439 |
CALL CALC_GW(myThid) |
|
440 |
CALL TIMER_STOP ('CALC_GW [FORWARD_STEP]',myThid) |
C TODO: Logic should be added here so that users can specify, on |
441 |
ENDIF |
C a per-citer-group basis, when it is time to update the |
442 |
|
C "current" (and not just the "next") iteration |
443 |
|
|
444 |
|
C TODO: the following is just a temporary band-aid (mostly, for |
445 |
|
C Baylor) until someone writes a routine that better handles time |
446 |
|
C boundaries such as weeks, months, years, etc. |
447 |
|
IF ( mnc_filefreq .GT. 0 ) THEN |
448 |
|
IF (DIFFERENT_MULTIPLE(mnc_filefreq,myTime,deltaTClock)) |
449 |
|
& THEN |
450 |
|
CALL MNC_CW_CITER_SETG( 1, 1, myIter, -1 , myThid ) |
451 |
|
ENDIF |
452 |
|
ENDIF |
453 |
|
ENDIF |
454 |
#endif |
#endif |
455 |
|
|
456 |
|
C-- Update geometric factors: |
457 |
#ifdef NONLIN_FRSURF |
#ifdef NONLIN_FRSURF |
458 |
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) : |
459 |
IF ( nonlinFreeSurf.GT.0) THEN |
IF ( nonlinFreeSurf.GT.0) THEN |
460 |
IF ( select_rStar.GT.0 ) THEN |
IF ( select_rStar.GT.0 ) THEN |
461 |
CALL TIMER_START('UPDATE_R_STAR [FORWARD_STEP]',myThid) |
CALL TIMER_START('UPDATE_R_STAR [FORWARD_STEP]',myThid) |
478 |
C-- Apply Filters to u*,v* before SOLVE_FOR_PRESSURE |
C-- Apply Filters to u*,v* before SOLVE_FOR_PRESSURE |
479 |
#ifdef ALLOW_SHAP_FILT |
#ifdef ALLOW_SHAP_FILT |
480 |
IF (useSHAP_FILT .AND. shap_filt_uvStar) THEN |
IF (useSHAP_FILT .AND. shap_filt_uvStar) THEN |
481 |
CALL TIMER_START('SHAP_FILT [FORWARD_STEP]',myThid) |
CALL TIMER_START('SHAP_FILT_UV [FORWARD_STEP]',myThid) |
482 |
IF (implicDiv2Dflow.LT.1.) THEN |
IF (implicDiv2Dflow.LT.1.) THEN |
483 |
C-- Explicit+Implicit part of the Barotropic Flow Divergence |
C-- Explicit+Implicit part of the Barotropic Flow Divergence |
484 |
C => Filtering of uVel,vVel is necessary |
C => Filtering of uVel,vVel is necessary |
485 |
CALL SHAP_FILT_APPLY_UV( uVel,vVel, |
CALL SHAP_FILT_APPLY_UV( uVel,vVel, |
486 |
& myTime+deltaT, myIter+1, myThid ) |
& myTime, myIter, myThid ) |
487 |
ENDIF |
ENDIF |
488 |
CALL SHAP_FILT_APPLY_UV( gU,gV,myTime+deltaT,myIter+1,myThid) |
CALL SHAP_FILT_APPLY_UV( gU,gV,myTime,myIter,myThid) |
489 |
CALL TIMER_STOP ('SHAP_FILT [FORWARD_STEP]',myThid) |
CALL TIMER_STOP ('SHAP_FILT_UV [FORWARD_STEP]',myThid) |
490 |
ENDIF |
ENDIF |
491 |
#endif |
#endif |
492 |
#ifdef ALLOW_ZONAL_FILT |
#ifdef ALLOW_ZONAL_FILT |
493 |
IF (useZONAL_FILT .AND. zonal_filt_uvStar) THEN |
IF (useZONAL_FILT .AND. zonal_filt_uvStar) THEN |
494 |
CALL TIMER_START('ZONAL_FILT_APPLY [FORWARD_STEP]',myThid) |
CALL TIMER_START('ZONAL_FILT_UV [FORWARD_STEP]',myThid) |
495 |
IF (implicDiv2Dflow.LT.1.) THEN |
IF (implicDiv2Dflow.LT.1.) THEN |
496 |
C-- Explicit+Implicit part of the Barotropic Flow Divergence |
C-- Explicit+Implicit part of the Barotropic Flow Divergence |
497 |
C => Filtering of uVel,vVel is necessary |
C => Filtering of uVel,vVel is necessary |
498 |
CALL ZONAL_FILT_APPLY_UV( uVel, vVel, myThid ) |
CALL ZONAL_FILT_APPLY_UV( uVel, vVel, myThid ) |
499 |
ENDIF |
ENDIF |
500 |
CALL ZONAL_FILT_APPLY_UV( gU, gV, myThid ) |
CALL ZONAL_FILT_APPLY_UV( gU, gV, myThid ) |
501 |
CALL TIMER_STOP ('ZONAL_FILT_APPLY [FORWARD_STEP]',myThid) |
CALL TIMER_STOP ('ZONAL_FILT_UV [FORWARD_STEP]',myThid) |
502 |
ENDIF |
ENDIF |
503 |
#endif |
#endif |
504 |
|
|
505 |
C-- Solve elliptic equation(s). |
C-- Solve elliptic equation(s). |
506 |
C Two-dimensional only for conventional hydrostatic or |
C Two-dimensional only for conventional hydrostatic or |
507 |
C three-dimensional for non-hydrostatic and/or IGW scheme. |
C three-dimensional for non-hydrostatic and/or IGW scheme. |
508 |
|
#ifndef ALLOW_OFFLINE |
509 |
IF ( momStepping ) THEN |
IF ( momStepping ) THEN |
510 |
CALL TIMER_START('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid) |
CALL TIMER_START('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid) |
511 |
CALL SOLVE_FOR_PRESSURE(myTime, myIter, myThid) |
CALL SOLVE_FOR_PRESSURE(myTime, myIter, myThid) |
512 |
CALL TIMER_STOP ('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid) |
CALL TIMER_STOP ('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid) |
513 |
ENDIF |
ENDIF |
514 |
|
#endif |
515 |
|
|
516 |
|
C-- Correct divergence in flow field and cycle time-stepping momentum |
517 |
|
c IF ( momStepping ) THEN |
518 |
|
#ifndef ALLOW_OFFLINE |
519 |
|
CALL TIMER_START('MOM_CORRECTION_STEP [FORWARD_STEP]',myThid) |
520 |
|
CALL MOMENTUM_CORRECTION_STEP(myTime, myIter, myThid) |
521 |
|
CALL TIMER_STOP ('MOM_CORRECTION_STEP [FORWARD_STEP]',myThid) |
522 |
|
#endif |
523 |
|
c ENDIF |
524 |
|
|
525 |
|
#ifdef EXACT_CONSERV |
526 |
|
IF (exactConserv) THEN |
527 |
|
C-- Update etaH(n+1) : |
528 |
|
CALL TIMER_START('UPDATE_ETAH [FORWARD_STEP]',mythid) |
529 |
|
CALL UPDATE_ETAH( myTime, myIter, myThid ) |
530 |
|
CALL TIMER_STOP ('UPDATE_ETAH [FORWARD_STEP]',mythid) |
531 |
|
ENDIF |
532 |
|
#endif /* EXACT_CONSERV */ |
533 |
|
|
534 |
|
#ifdef NONLIN_FRSURF |
535 |
|
IF ( select_rStar.NE.0 ) THEN |
536 |
|
C-- r* : compute the future level thickness according to etaH(n+1) |
537 |
|
CALL TIMER_START('CALC_R_STAR [FORWARD_STEP]',mythid) |
538 |
|
CALL CALC_R_STAR(etaH, myTime, myIter, myThid ) |
539 |
|
CALL TIMER_STOP ('CALC_R_STAR [FORWARD_STEP]',mythid) |
540 |
|
ELSEIF ( nonlinFreeSurf.GT.0) THEN |
541 |
|
C-- compute the future surface level thickness according to etaH(n+1) |
542 |
|
CALL TIMER_START('CALC_SURF_DR [FORWARD_STEP]',mythid) |
543 |
|
CALL CALC_SURF_DR(etaH, myTime, myIter, myThid ) |
544 |
|
CALL TIMER_STOP ('CALC_SURF_DR [FORWARD_STEP]',mythid) |
545 |
|
ENDIF |
546 |
|
#endif /* NONLIN_FRSURF */ |
547 |
|
|
548 |
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
549 |
|
IF ( staggerTimeStep ) THEN |
550 |
|
C-- do exchanges of U,V (needed for multiDim) when using stagger time-step : |
551 |
|
#ifdef ALLOW_DEBUG |
552 |
|
IF ( debugLevel .GE. debLevB ) |
553 |
|
& CALL DEBUG_CALL('DO_STAGGER_FIELDS_EXCH.',myThid) |
554 |
|
#endif |
555 |
|
CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
556 |
|
CALL DO_STAGGER_FIELDS_EXCHANGES( myTime, myIter, myThid ) |
557 |
|
CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
558 |
|
|
559 |
|
C-- State-variables diagnostics |
560 |
|
IF ( usediagnostics ) THEN |
561 |
|
CALL TIMER_START('DO_STATEVARS_DIAGS [FORWARD_STEP]',myThid) |
562 |
|
CALL DO_STATEVARS_DIAGS( myTime, 1, myIter, myThid ) |
563 |
|
CALL TIMER_STOP ('DO_STATEVARS_DIAGS [FORWARD_STEP]',myThid) |
564 |
|
ENDIF |
565 |
|
|
566 |
|
#ifdef ALLOW_DEBUG |
567 |
|
IF ( debugLevel .GE. debLevB ) |
568 |
|
& CALL DEBUG_CALL('THERMODYNAMICS',myThid) |
569 |
|
#endif |
570 |
|
CALL TIMER_START('THERMODYNAMICS [FORWARD_STEP]',mythid) |
571 |
|
CALL THERMODYNAMICS( myTime, myIter, myThid ) |
572 |
|
CALL TIMER_STOP ('THERMODYNAMICS [FORWARD_STEP]',mythid) |
573 |
|
|
574 |
|
C-- if staggerTimeStep: end |
575 |
|
ENDIF |
576 |
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
577 |
|
|
578 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
579 |
cph This is needed because convective_adjustment calls |
cph This is needed because convective_adjustment calls |
580 |
cph find_rho which may use pressure() |
cph find_rho which may use pressure() |
581 |
CADJ STORE totphihyd = comlev1, key = ikey_dynamics |
CADJ STORE totphihyd = comlev1, key = ikey_dynamics |
582 |
#endif |
#endif |
583 |
C-- Correct divergence in flow field and cycle time-stepping |
C-- Cycle time-stepping Tracers arrays (T,S,+pTracers) |
584 |
C arrays (for all fields) ; update time-counter |
CALL TIMER_START('TRC_CORRECTION_STEP [FORWARD_STEP]',myThid) |
585 |
myIter = nIter0 + iLoop |
CALL TRACERS_CORRECTION_STEP(myTime, myIter, myThid) |
586 |
myTime = startTime + deltaTClock * float(iLoop) |
CALL TIMER_STOP ('TRC_CORRECTION_STEP [FORWARD_STEP]',myThid) |
587 |
CALL TIMER_START('THE_CORRECTION_STEP [FORWARD_STEP]',myThid) |
|
588 |
CALL THE_CORRECTION_STEP(myTime, myIter, myThid) |
#ifdef ALLOW_GCHEM |
589 |
CALL TIMER_STOP ('THE_CORRECTION_STEP [FORWARD_STEP]',myThid) |
C Add separate timestepping of chemical/biological/forcing |
590 |
|
C of ptracers here in GCHEM_FORCING_SEP |
591 |
|
IF ( useGCHEM ) THEN |
592 |
|
#ifdef ALLOW_DEBUG |
593 |
|
IF ( debugLevel .GE. debLevB ) |
594 |
|
& CALL DEBUG_CALL('GCHEM_FORCING_SEP',myThid) |
595 |
|
#endif /* ALLOW_DEBUG */ |
596 |
|
CALL TIMER_START('GCHEM_FORCING_SEP [FORWARD_STEP]',myThid) |
597 |
|
CALL GCHEM_FORCING_SEP( myTime,myIter,myThid ) |
598 |
|
CALL TIMER_STOP ('GCHEM_FORCING_SEP [FORWARD_STEP]',myThid) |
599 |
|
ENDIF |
600 |
|
#endif /* ALLOW_GCHEM */ |
601 |
|
|
602 |
C-- Do "blocking" sends and receives for tendency "overlap" terms |
C-- Do "blocking" sends and receives for tendency "overlap" terms |
603 |
c CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
c CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
609 |
CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid ) |
CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid ) |
610 |
CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
611 |
|
|
|
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 --- |
|
612 |
|
|
613 |
|
C AMM |
614 |
|
#ifdef ALLOW_GRIDALT |
615 |
|
if (useGRIDALT) then |
616 |
|
CALL GRIDALT_UPDATE(myThid) |
617 |
|
endif |
618 |
|
#endif |
619 |
|
C AMM |
620 |
|
|
621 |
|
C AMM |
622 |
|
#ifdef ALLOW_FIZHI |
623 |
|
if( useFIZHI) then |
624 |
|
CALL TIMER_START('FIZHI [FORWARD_STEP]',mythid) |
625 |
|
CALL STEP_FIZHI_CORR ( myTime, myIter, myThid ) |
626 |
|
CALL TIMER_STOP('FIZHI [FORWARD_STEP]',mythid) |
627 |
|
endif |
628 |
|
#endif |
629 |
|
C AMM |
630 |
|
|
631 |
#ifdef ALLOW_FLT |
#ifdef ALLOW_FLT |
632 |
C-- Calculate float trajectories |
C-- Calculate float trajectories |
637 |
ENDIF |
ENDIF |
638 |
#endif |
#endif |
639 |
|
|
640 |
#ifndef EXCLUDE_MONITOR |
C-- State-variables time-averaging |
641 |
|
CALL TIMER_START('DO_STATEVARS_TAVE [FORWARD_STEP]',myThid) |
642 |
|
CALL DO_STATEVARS_TAVE( myTime, myIter, myThid ) |
643 |
|
CALL TIMER_STOP ('DO_STATEVARS_TAVE [FORWARD_STEP]',myThid) |
644 |
|
|
645 |
|
#ifndef ALLOW_OFFLINE |
646 |
|
#ifdef ALLOW_MONITOR |
647 |
C-- Check status of solution (statistics, cfl, etc...) |
C-- Check status of solution (statistics, cfl, etc...) |
648 |
CALL TIMER_START('MONITOR [FORWARD_STEP]',myThid) |
CALL TIMER_START('MONITOR [FORWARD_STEP]',myThid) |
649 |
CALL MONITOR( myIter, myTime, myThid ) |
CALL MONITOR( myIter, myTime, myThid ) |
650 |
CALL TIMER_STOP ('MONITOR [FORWARD_STEP]',myThid) |
CALL TIMER_STOP ('MONITOR [FORWARD_STEP]',myThid) |
651 |
#endif /* EXCLUDE_MONITOR */ |
#endif /* ALLOW_MONITOR */ |
652 |
|
#endif |
653 |
|
|
654 |
|
#ifdef ALLOW_COST |
655 |
|
C-- compare model with data and compute cost function |
656 |
|
C-- this is done after exchanges to allow interpolation |
657 |
|
CALL TIMER_START('COST_TILE [FORWARD_STEP]',myThid) |
658 |
|
CALL COST_TILE ( mytime, myiter, myThid ) |
659 |
|
CALL TIMER_STOP ('COST_TILE [FORWARD_STEP]',myThid) |
660 |
|
#endif |
661 |
|
|
662 |
C-- Do IO if needed. |
C-- Do IO if needed. |
663 |
|
#ifdef ALLOW_OFFLINE |
664 |
|
CALL TIMER_START('OFFLINE_MODEL_IO [FORWARD_STEP]',myThid) |
665 |
|
CALL OFFLINE_MODEL_IO( myTime, myIter, myThid ) |
666 |
|
CALL TIMER_STOP ('OFFLINE_MODEL_IO [FORWARD_STEP]',myThid) |
667 |
|
#else |
668 |
CALL TIMER_START('DO_THE_MODEL_IO [FORWARD_STEP]',myThid) |
CALL TIMER_START('DO_THE_MODEL_IO [FORWARD_STEP]',myThid) |
669 |
CALL DO_THE_MODEL_IO( myTime, myIter, myThid ) |
CALL DO_THE_MODEL_IO( myTime, myIter, myThid ) |
670 |
CALL TIMER_STOP ('DO_THE_MODEL_IO [FORWARD_STEP]',myThid) |
CALL TIMER_STOP ('DO_THE_MODEL_IO [FORWARD_STEP]',myThid) |
671 |
|
#endif |
672 |
|
|
673 |
|
#ifdef HAVE_SIGREG |
674 |
|
IF ( useSIGREG ) THEN |
675 |
|
IF ( i_got_signal .GT. 0 ) THEN |
676 |
|
CALL PACKAGES_WRITE_PICKUP( |
677 |
|
I .TRUE., myTime, myIter, myThid ) |
678 |
|
#ifndef ALLOW_OFFLINE |
679 |
|
CALL WRITE_CHECKPOINT( |
680 |
|
I .TRUE., myTime, myIter, myThid ) |
681 |
|
#endif |
682 |
|
STOP 'Checkpoint completed -- killed by signal handler' |
683 |
|
ENDIF |
684 |
|
ENDIF |
685 |
|
#endif |
686 |
|
|
687 |
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 |
|
688 |
CALL TIMER_START('WRITE_CHECKPOINT [FORWARD_STEP]',myThid) |
CALL TIMER_START('WRITE_CHECKPOINT [FORWARD_STEP]',myThid) |
689 |
|
CALL PACKAGES_WRITE_PICKUP( |
690 |
|
I .FALSE., myTime, myIter, myThid ) |
691 |
|
#ifndef ALLOW_OFFLINE |
692 |
CALL WRITE_CHECKPOINT( |
CALL WRITE_CHECKPOINT( |
693 |
& .FALSE., myTime, myIter, myThid ) |
I .FALSE., myTime, myIter, myThid ) |
694 |
|
#endif |
695 |
CALL TIMER_STOP ('WRITE_CHECKPOINT [FORWARD_STEP]',myThid) |
CALL TIMER_STOP ('WRITE_CHECKPOINT [FORWARD_STEP]',myThid) |
696 |
|
|
697 |
#ifndef DISABLE_DEBUGMODE |
#ifdef ALLOW_DEBUG |
698 |
IF ( debugLevel .GE. debLevB ) |
IF ( debugLevel .GE. debLevB ) |
699 |
& CALL DEBUG_LEAVE('FORWARD_STEP',myThid) |
& CALL DEBUG_LEAVE('FORWARD_STEP',myThid) |
700 |
#endif |
#endif |
701 |
|
|
702 |
|
RETURN |
703 |
END |
END |