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 |
|
cswdptr -- add -- |
8 |
|
#ifdef ALLOW_GCHEM |
9 |
|
# include "GCHEM_OPTIONS.h" |
10 |
|
#endif |
11 |
|
cswdptr -- end add --- |
12 |
|
|
13 |
CBOP |
CBOP |
14 |
C !ROUTINE: FORWARD_STEP |
C !ROUTINE: FORWARD_STEP |
15 |
C !INTERFACE: |
C !INTERFACE: |
56 |
# include "ctrl.h" |
# include "ctrl.h" |
57 |
# include "ctrl_dummy.h" |
# include "ctrl_dummy.h" |
58 |
# include "cost.h" |
# include "cost.h" |
59 |
# ifdef INCLUDE_EXTERNAL_FORCING_PACKAGE |
# include "EOS.h" |
60 |
|
# ifdef ALLOW_EXF |
61 |
# include "exf_fields.h" |
# include "exf_fields.h" |
62 |
|
# include "exf_clim_fields.h" |
63 |
# ifdef ALLOW_BULKFORMULAE |
# ifdef ALLOW_BULKFORMULAE |
64 |
# include "exf_constants.h" |
# include "exf_constants.h" |
65 |
# endif |
# endif |
67 |
# ifdef ALLOW_OBCS |
# ifdef ALLOW_OBCS |
68 |
# include "OBCS.h" |
# include "OBCS.h" |
69 |
# endif |
# endif |
70 |
#endif |
# ifdef ALLOW_PTRACERS |
71 |
|
# include "PTRACERS.h" |
72 |
|
# endif |
73 |
|
# ifdef ALLOW_CD_CODE |
74 |
|
# include "CD_CODE_VARS.h" |
75 |
|
# endif |
76 |
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
77 |
|
|
78 |
C !LOCAL VARIABLES: |
C !LOCAL VARIABLES: |
79 |
C == Routine arguments == |
C == Routine arguments == |
89 |
integer mythid |
integer mythid |
90 |
integer myiter |
integer myiter |
91 |
_RL mytime |
_RL mytime |
|
INTEGER bi,bj |
|
92 |
|
|
93 |
|
integer i,L |
94 |
CEOP |
CEOP |
95 |
|
|
96 |
|
#ifdef ALLOW_DEBUG |
97 |
|
IF ( debugLevel .GE. debLevB ) |
98 |
|
& CALL DEBUG_ENTER('FORWARD_STEP',myThid) |
99 |
|
#endif |
100 |
|
|
101 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
102 |
C-- Reset the model iteration counter and the model time. |
C-- Reset the model iteration counter and the model time. |
103 |
myiter = nIter0 + (iloop-1) |
myiter = nIter0 + (iloop-1) |
104 |
mytime = startTime + float(iloop-1)*deltaTclock |
mytime = startTime + float(iloop-1)*deltaTclock |
105 |
#endif |
#endif |
106 |
|
|
107 |
#if (defined (ALLOW_AUTODIFF_TAMC) && defined (ALLOW_AUTODIFF_MONITOR)) |
#if (defined (ALLOW_AUTODIFF_TAMC) && defined (ALLOW_AUTODIFF_MONITOR)) |
108 |
C Include call to a dummy routine. Its adjoint will be |
C Include call to a dummy routine. Its adjoint will be |
109 |
C called at the proper place in the adjoint code. |
C called at the proper place in the adjoint code. |
110 |
C The adjoint routine will print out adjoint values |
C The adjoint routine will print out adjoint values |
111 |
C if requested. The location of the call is important, |
C if requested. The location of the call is important, |
112 |
C it has to be after the adjoint of the exchanges |
C it has to be after the adjoint of the exchanges |
113 |
C (DO_GTERM_BLOCKING_EXCHANGES). |
C (DO_GTERM_BLOCKING_EXCHANGES). |
114 |
CALL DUMMY_IN_STEPPING( myTime, myIter, myThid ) |
CALL DUMMY_IN_STEPPING( myTime, myIter, myThid ) |
115 |
CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid ) |
cph I've commented this line since it may conflict with MITgcm's adjoint |
116 |
|
cph However, need to check whether that's still consistent |
117 |
|
cph with the ecco-branch (it should). |
118 |
|
cph CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid ) |
119 |
#endif |
#endif |
120 |
|
|
121 |
#ifdef EXACT_CONSERV |
#ifdef EXACT_CONSERV |
122 |
IF (exactConserv) THEN |
IF (exactConserv) THEN |
123 |
C-- Update etaH(n+1) : |
C-- Update etaH(n+1) : |
124 |
DO bj=myByLo(myThid),myByHi(myThid) |
CALL TIMER_START('UPDATE_ETAH [FORWARD_STEP]',mythid) |
125 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
CALL UPDATE_ETAH( myTime, myIter, myThid ) |
126 |
CALL CALC_EXACT_ETA( .FALSE., bi,bj, uVel,vVel, |
CALL TIMER_STOP ('UPDATE_ETAH [FORWARD_STEP]',mythid) |
|
I myTime, myIter, myThid ) |
|
|
ENDDO |
|
|
ENDDO |
|
|
IF (implicDiv2Dflow .NE. 1. _d 0 .OR. useOBCS ) |
|
|
& _EXCH_XY_R8(etaH, myThid ) |
|
127 |
ENDIF |
ENDIF |
128 |
#endif /* EXACT_CONSERV */ |
#endif /* EXACT_CONSERV */ |
129 |
|
|
130 |
#ifdef NONLIN_FRSURF |
#ifdef NONLIN_FRSURF |
131 |
C-- compute the future surface level thickness |
IF ( select_rStar.NE.0 ) THEN |
132 |
C according to etaH(n+1) |
C-- r* : compute the future level thickness according to etaH(n+1) |
133 |
IF ( nonlinFreeSurf.GT.0) THEN |
CALL TIMER_START('CALC_R_STAR [FORWARD_STEP]',mythid) |
134 |
|
CALL CALC_R_STAR(etaH, myTime, myIter, myThid ) |
135 |
|
CALL TIMER_STOP ('CALC_R_STAR [FORWARD_STEP]',mythid) |
136 |
|
ELSEIF ( nonlinFreeSurf.GT.0) THEN |
137 |
|
C-- compute the future surface level thickness according to etaH(n+1) |
138 |
|
CALL TIMER_START('CALC_SURF_DR [FORWARD_STEP]',mythid) |
139 |
CALL CALC_SURF_DR(etaH, myTime, myIter, myThid ) |
CALL CALC_SURF_DR(etaH, myTime, myIter, myThid ) |
140 |
ENDIF |
CALL TIMER_STOP ('CALC_SURF_DR [FORWARD_STEP]',mythid) |
141 |
|
ENDIF |
142 |
#endif /* NONLIN_FRSURF */ |
#endif /* NONLIN_FRSURF */ |
143 |
|
|
|
C-- Load forcing/external data fields. |
|
|
#ifdef INCLUDE_EXTERNAL_FORCING_PACKAGE |
|
|
C NOTE, that although the exf package is part of the |
|
|
C distribution, it is not currently maintained, i.e. |
|
|
C exf is disabled by default in genmake. |
|
144 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
145 |
c************************************** |
c************************************** |
146 |
#include "checkpoint_lev1_directives.h" |
#include "checkpoint_lev1_directives.h" |
147 |
c************************************** |
c************************************** |
148 |
#endif |
#endif |
149 |
CALL EXF_GETFORCING( mytime, myiter, mythid ) |
|
150 |
#else |
C-- Call external forcing package |
151 |
CALL TIMER_START('EXTERNAL_FIELDS_LOAD[THE_MAIN_LOOP]',mythid) |
#ifdef ALLOW_BULK_FORCE |
152 |
CALL EXTERNAL_FIELDS_LOAD( mytime, myiter, mythid ) |
IF ( useBulkForce ) THEN |
153 |
CALL TIMER_STOP ('EXTERNAL_FIELDS_LOAD[THE_MAIN_LOOP]',mythid) |
#ifdef ALLOW_DEBUG |
154 |
|
IF ( debugLevel .GE. debLevB ) |
155 |
|
& CALL DEBUG_CALL('BULKF_FIELDS_LOAD',myThid) |
156 |
|
#endif |
157 |
|
CALL TIMER_START('BULKF_FORCING [FORWARD_STEP]',mythid) |
158 |
|
C- load all forcing fields at current time |
159 |
|
CALL BULKF_FIELDS_LOAD( myTime, myIter, myThid ) |
160 |
|
C- calculate qnet and empmr (and wind stress) |
161 |
|
CALL BULKF_FORCING( myTime, myIter, myThid ) |
162 |
|
CALL TIMER_STOP ('BULKF_FORCING [FORWARD_STEP]',mythid) |
163 |
|
ELSE |
164 |
|
#endif /* ALLOW_BULK_FORCE */ |
165 |
|
|
166 |
|
# ifdef ALLOW_EXF |
167 |
|
# ifdef ALLOW_DEBUG |
168 |
|
IF ( debugLevel .GE. debLevB ) |
169 |
|
& CALL DEBUG_CALL('EXF_GETFORCING',myThid) |
170 |
|
# endif |
171 |
|
CALL TIMER_START('EXF_GETFORCING [FORWARD_STEP]',mythid) |
172 |
|
CALL EXF_GETFORCING( mytime, myiter, mythid ) |
173 |
|
CALL TIMER_STOP ('EXF_GETFORCING [FORWARD_STEP]',mythid) |
174 |
|
# else /* ALLOW_EXF undef */ |
175 |
|
cph The following IF-statement creates an additional dependency |
176 |
|
cph for the forcing fields requiring additional storing. |
177 |
|
cph Therefore, the IF-statement will be put between CPP-OPTIONS, |
178 |
|
cph assuming that ALLOW_SEAICE has not yet been differentiated. |
179 |
|
# ifdef ALLOW_SEAICE |
180 |
|
IF ( .NOT. useSEAICE ) THEN |
181 |
|
# endif |
182 |
|
#ifdef ALLOW_DEBUG |
183 |
|
IF ( debugLevel .GE. debLevB ) |
184 |
|
& CALL DEBUG_CALL('EXTERNAL_FIELDS_LOAD',myThid) |
185 |
|
#endif |
186 |
|
CALL TIMER_START('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid) |
187 |
|
CALL EXTERNAL_FIELDS_LOAD( mytime, myiter, mythid ) |
188 |
|
CALL TIMER_STOP ('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid) |
189 |
|
# ifdef ALLOW_SEAICE |
190 |
|
ENDIF |
191 |
|
# endif |
192 |
|
# endif /* ALLOW_EXF */ |
193 |
|
#ifdef ALLOW_BULK_FORCE |
194 |
|
C-- end of if/else block useBulfforce -- |
195 |
|
ENDIF |
196 |
|
#endif /* ALLOW_BULK_FORCE */ |
197 |
|
|
198 |
|
#ifdef ALLOW_AUTODIFF |
199 |
|
c-- Add control vector for forcing and parameter fields |
200 |
|
if ( myiter .EQ. nIter0 ) |
201 |
|
& CALL CTRL_MAP_FORCING (mythid) |
202 |
|
#endif |
203 |
|
|
204 |
|
#ifdef ALLOW_THSICE |
205 |
|
IF (useThSIce) THEN |
206 |
|
#ifdef ALLOW_DEBUG |
207 |
|
IF ( debugLevel .GE. debLevB ) |
208 |
|
& CALL DEBUG_CALL('THSICE_MAIN',myThid) |
209 |
|
#endif |
210 |
|
C-- Step forward Therm.Sea-Ice variables |
211 |
|
C and modify forcing terms including effects from ice |
212 |
|
CALL TIMER_START('THSICE_MAIN [FORWARD_STEP]', myThid) |
213 |
|
CALL THSICE_MAIN( myTime, myIter, myThid ) |
214 |
|
CALL TIMER_STOP( 'THSICE_MAIN [FORWARD_STEP]', myThid) |
215 |
|
ENDIF |
216 |
|
#endif /* ALLOW_THSICE */ |
217 |
|
|
218 |
|
# ifdef ALLOW_SEAICE |
219 |
|
C-- Call sea ice model to compute forcing/external data fields. In |
220 |
|
C addition to computing prognostic sea-ice variables and diagnosing the |
221 |
|
C forcing/external data fields that drive the ocean model, SEAICE_MODEL |
222 |
|
C also sets theta to the freezing point under sea-ice. The implied |
223 |
|
C surface heat flux is then stored in variable surfaceTendencyTice, |
224 |
|
C which is needed by KPP package (kpp_calc.F and kpp_transport_t.F) |
225 |
|
C to diagnose surface buoyancy fluxes and for the non-local transport |
226 |
|
C term. Because this call precedes model thermodynamics, temperature |
227 |
|
C under sea-ice may not be "exactly" at the freezing point by the time |
228 |
|
C theta is dumped or time-averaged. |
229 |
|
IF ( useSEAICE ) THEN |
230 |
|
#ifdef ALLOW_DEBUG |
231 |
|
IF ( debugLevel .GE. debLevB ) |
232 |
|
& CALL DEBUG_CALL('SEAICE_MODEL',myThid) |
233 |
|
#endif |
234 |
|
CALL TIMER_START('SEAICE_MODEL [FORWARD_STEP]',myThid) |
235 |
|
CALL SEAICE_MODEL( myTime, myIter, myThid ) |
236 |
|
CALL TIMER_STOP ('SEAICE_MODEL [FORWARD_STEP]',myThid) |
237 |
|
ENDIF |
238 |
|
# endif /* ALLOW_SEAICE */ |
239 |
|
|
240 |
|
C-- Freeze water at the surface |
241 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
242 |
|
CADJ STORE theta = comlev1, key = ikey_dynamics |
243 |
|
#endif |
244 |
|
IF ( allowFreezing .AND. .NOT. useSEAICE |
245 |
|
& .AND. .NOT. useThSIce ) THEN |
246 |
|
CALL FREEZE_SURFACE( myTime, myIter, myThid ) |
247 |
|
ENDIF |
248 |
|
|
249 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
250 |
|
# ifdef ALLOW_PTRACERS |
251 |
|
cph this replaces _bibj storing of ptracer within thermodynamics |
252 |
|
CADJ STORE ptracer = comlev1, key = ikey_dynamics |
253 |
|
# endif |
254 |
#endif |
#endif |
255 |
|
|
256 |
|
#ifdef ALLOW_PTRACERS |
257 |
|
# ifdef ALLOW_GCHEM |
258 |
|
CALL GCHEM_FIELDS_LOAD( mytime, myiter, mythid ) |
259 |
|
# endif |
260 |
|
#endif |
261 |
|
|
262 |
|
#ifdef COMPONENT_MODULE |
263 |
|
IF ( useCoupler ) THEN |
264 |
|
C Post coupling data that I export. |
265 |
|
C Read in coupling data that I import. |
266 |
|
CALL TIMER_START('CPL_EXPORT-IMPORT [FORWARD_STEP]',myThid) |
267 |
|
CALL CPL_EXPORT_MY_DATA( myIter, myTime, myThid ) |
268 |
|
CALL CPL_IMPORT_EXTERNAL_DATA( myIter, myTime, myThid ) |
269 |
|
CALL TIMER_STOP ('CPL_EXPORT-IMPORT [FORWARD_STEP]',myThid) |
270 |
|
ENDIF |
271 |
|
#endif /* COMPONENT_MODULE */ |
272 |
|
|
273 |
|
#ifdef COMPONENT_MODULE |
274 |
|
# ifndef ALLOW_AIM |
275 |
|
C jmc: don't know precisely where to put this call. leave it here for now. |
276 |
|
IF ( useCoupler ) THEN |
277 |
|
CALL OCN_APPLY_IMPORT( myTime, myIter, myThid ) |
278 |
|
ENDIF |
279 |
|
# endif |
280 |
|
#endif /* COMPONENT_MODULE */ |
281 |
|
|
282 |
C-- Step forward fields and calculate time tendency terms. |
C-- Step forward fields and calculate time tendency terms. |
283 |
CALL TIMER_START('THERMODYNAMICS [THE_MAIN_LOOP]',mythid) |
|
284 |
|
C AMM |
285 |
|
#ifdef ALLOW_FIZHI |
286 |
|
if( useFIZHI) then |
287 |
|
CALL TIMER_START('FIZHI [FORWARD_STEP]',mythid) |
288 |
|
CALL UPDATE_OCEAN_EXPORTS ( myTime, myIter, myThid ) |
289 |
|
CALL UPDATE_EARTH_EXPORTS ( myTime, myIter, myThid ) |
290 |
|
CALL UPDATE_CHEMISTRY_EXPORTS ( myTime, myIter, myThid ) |
291 |
|
CALL FIZHI_WRAPPER ( myTime, myIter, myThid ) |
292 |
|
CALL STEP_FIZHI_FG ( myTime, myIter, myThid, deltaTtracer ) |
293 |
|
CALL TIMER_STOP ('FIZHI [FORWARD_STEP]',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 ) |
CALL THERMODYNAMICS( myTime, myIter, myThid ) |
304 |
CALL TIMER_STOP ('THERMODYNAMICS [THE_MAIN_LOOP]',mythid) |
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 |
#ifdef ALLOW_SHAP_FILT |
316 |
IF (useSHAP_FILT .AND. |
IF (useSHAP_FILT .AND. |
317 |
& staggerTimeStep .AND. shap_filt_TrStagg ) THEN |
& staggerTimeStep .AND. shap_filt_TrStagg ) THEN |
318 |
CALL TIMER_START('SHAP_FILT [THE_MAIN_LOOP]',myThid) |
#ifdef ALLOW_DEBUG |
319 |
CALL SHAP_FILT_APPLY_TS( gT, gS, myTime, myIter, myThid ) |
IF ( debugLevel .GE. debLevB ) |
320 |
CALL TIMER_STOP ('SHAP_FILT [THE_MAIN_LOOP]',myThid) |
& CALL DEBUG_CALL('SHAP_FILT_APPLY_TS',myThid) |
321 |
ENDIF |
#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 |
#endif |
327 |
|
|
328 |
#ifdef ALLOW_ZONAL_FILT |
#ifdef ALLOW_ZONAL_FILT |
329 |
IF (useZONAL_FILT .AND. |
IF (useZONAL_FILT .AND. |
330 |
& staggerTimeStep .AND. zonal_filt_TrStagg ) THEN |
& staggerTimeStep .AND. zonal_filt_TrStagg ) THEN |
331 |
CALL TIMER_START('ZONAL_FILT_APPLY [THE_MAIN_LOOP]',myThid) |
#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 ) |
CALL ZONAL_FILT_APPLY_TS( gT, gS, myThid ) |
337 |
CALL TIMER_STOP ('ZONAL_FILT_APPLY [THE_MAIN_LOOP]',myThid) |
CALL TIMER_STOP ('ZONAL_FILT_APPLY [FORWARD_STEP]',myThid) |
338 |
ENDIF |
ENDIF |
339 |
#endif |
#endif |
340 |
|
|
341 |
C-- Step forward fields and calculate time tendency terms. |
C-- Step forward fields and calculate time tendency terms. |
342 |
IF ( momStepping ) THEN |
#ifndef ALLOW_AUTODIFF_TAMC |
343 |
CALL TIMER_START('DYNAMICS [THE_MAIN_LOOP]',mythid) |
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 ) |
CALL DYNAMICS( myTime, myIter, myThid ) |
351 |
CALL TIMER_STOP ('DYNAMICS [THE_MAIN_LOOP]',mythid) |
CALL TIMER_STOP ('DYNAMICS [FORWARD_STEP]',mythid) |
352 |
ENDIF |
#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 ( momStepping .AND. nonHydrostatic ) THEN |
IF ( momStepping .AND. nonHydrostatic ) THEN |
359 |
CALL TIMER_START('CALC_GW [THE_MAIN_LOOP]',myThid) |
#ifdef ALLOW_DEBUG |
360 |
CALL CALC_GW(myThid) |
IF ( debugLevel .GE. debLevB ) |
361 |
CALL TIMER_STOP ('CALC_GW [THE_MAIN_LOOP]',myThid) |
& CALL DEBUG_CALL('CALC_GW',myThid) |
362 |
ENDIF |
#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 |
#endif |
368 |
|
|
369 |
#ifdef NONLIN_FRSURF |
#ifdef NONLIN_FRSURF |
370 |
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) : |
|
IF ( momStepping ) THEN |
|
371 |
IF ( nonlinFreeSurf.GT.0) THEN |
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 ) |
CALL UPDATE_SURF_DR( myTime, myIter, myThid ) |
379 |
|
CALL TIMER_STOP ('UPDATE_SURF_DR [FORWARD_STEP]',myThid) |
380 |
|
ENDIF |
381 |
ENDIF |
ENDIF |
382 |
C- update also CG2D matrix (and preconditioner) |
C- update also CG2D matrix (and preconditioner) |
383 |
IF ( nonlinFreeSurf.GT.2) THEN |
IF ( momStepping .AND. nonlinFreeSurf.GT.2 ) THEN |
384 |
|
CALL TIMER_START('UPDATE_CG2D [FORWARD_STEP]',myThid) |
385 |
CALL UPDATE_CG2D( myTime, myIter, myThid ) |
CALL UPDATE_CG2D( myTime, myIter, myThid ) |
386 |
ENDIF |
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 |
C-- Apply Filters to u*,v* before SOLVE_FOR_PRESSURE |
391 |
#ifdef ALLOW_SHAP_FILT |
#ifdef ALLOW_SHAP_FILT |
392 |
IF (useSHAP_FILT .AND. shap_filt_uvStar) THEN |
IF (useSHAP_FILT .AND. shap_filt_uvStar) THEN |
393 |
CALL TIMER_START('SHAP_FILT [THE_MAIN_LOOP]',myThid) |
CALL TIMER_START('SHAP_FILT [FORWARD_STEP]',myThid) |
|
CALL SHAP_FILT_APPLY_UV( gUnm1,gVnm1, myTime,myIter,myThid ) |
|
394 |
IF (implicDiv2Dflow.LT.1.) THEN |
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_APPLY_UV( uVel,vVel, myTime,myIter,myThid ) |
CALL SHAP_FILT_APPLY_UV( uVel,vVel, |
398 |
|
& myTime+deltaT, myIter+1, myThid ) |
399 |
ENDIF |
ENDIF |
400 |
CALL TIMER_STOP ('SHAP_FILT [THE_MAIN_LOOP]',myThid) |
CALL SHAP_FILT_APPLY_UV( gU,gV,myTime+deltaT,myIter+1,myThid) |
401 |
|
CALL TIMER_STOP ('SHAP_FILT [FORWARD_STEP]',myThid) |
402 |
ENDIF |
ENDIF |
403 |
#endif |
#endif |
404 |
#ifdef ALLOW_ZONAL_FILT |
#ifdef ALLOW_ZONAL_FILT |
405 |
IF (useZONAL_FILT .AND. zonal_filt_uvStar) THEN |
IF (useZONAL_FILT .AND. zonal_filt_uvStar) THEN |
406 |
CALL TIMER_START('ZONAL_FILT_APPLY [THE_MAIN_LOOP]',myThid) |
CALL TIMER_START('ZONAL_FILT_APPLY [FORWARD_STEP]',myThid) |
|
CALL ZONAL_FILT_APPLY_UV( gUnm1, gVnm1, myThid ) |
|
407 |
IF (implicDiv2Dflow.LT.1.) THEN |
IF (implicDiv2Dflow.LT.1.) THEN |
408 |
C-- Explicit+Implicit part of the Barotropic Flow Divergence |
C-- Explicit+Implicit part of the Barotropic Flow Divergence |
409 |
C => Filtering of uVel,vVel is necessary |
C => Filtering of uVel,vVel is necessary |
410 |
CALL ZONAL_FILT_APPLY_UV( uVel, vVel, myThid ) |
CALL ZONAL_FILT_APPLY_UV( uVel, vVel, myThid ) |
411 |
ENDIF |
ENDIF |
412 |
CALL TIMER_STOP ('ZONAL_FILT_APPLY [THE_MAIN_LOOP]',myThid) |
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 |
|
|
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 |
IF ( momStepping ) THEN |
IF ( momStepping ) THEN |
421 |
CALL TIMER_START('SOLVE_FOR_PRESSURE [THE_MAIN_LOOP]',myThid) |
CALL TIMER_START('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid) |
422 |
CALL SOLVE_FOR_PRESSURE(myTime, myIter, myThid) |
CALL SOLVE_FOR_PRESSURE(myTime, myIter, myThid) |
423 |
CALL TIMER_STOP ('SOLVE_FOR_PRESSURE [THE_MAIN_LOOP]',myThid) |
CALL TIMER_STOP ('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid) |
424 |
ENDIF |
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 |
myIter = nIter0 + iLoop |
myIter = nIter0 + iLoop |
434 |
myTime = startTime + deltaTClock * float(iLoop) |
myTime = startTime + deltaTClock * float(iLoop) |
435 |
CALL TIMER_START('THE_CORRECTION_STEP [THE_MAIN_LOOP]',myThid) |
CALL TIMER_START('THE_CORRECTION_STEP [FORWARD_STEP]',myThid) |
436 |
CALL THE_CORRECTION_STEP(myTime, myIter, myThid) |
CALL THE_CORRECTION_STEP(myTime, myIter, myThid) |
437 |
CALL TIMER_STOP ('THE_CORRECTION_STEP [THE_MAIN_LOOP]',myThid) |
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 [THE_MAIN_LOOP]',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 [THE_MAIN_LOOP]',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 [THE_MAIN_LOOP]',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 [THE_MAIN_LOOP]',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_GRIDALT |
462 |
|
if (useGRIDALT) then |
463 |
|
CALL GRIDALT_UPDATE(myThid) |
464 |
|
endif |
465 |
|
#endif |
466 |
|
C AMM |
467 |
|
|
468 |
|
C AMM |
469 |
|
#ifdef ALLOW_FIZHI |
470 |
|
if( useFIZHI) then |
471 |
|
CALL TIMER_START('FIZHI [FORWARD_STEP]',mythid) |
472 |
|
CALL STEP_FIZHI_CORR ( myTime, myIter, myThid ) |
473 |
|
CALL TIMER_STOP('FIZHI [FORWARD_STEP]',mythid) |
474 |
|
endif |
475 |
|
#endif |
476 |
|
C AMM |
477 |
|
|
478 |
#ifdef ALLOW_FLT |
#ifdef ALLOW_FLT |
479 |
C-- Calculate float trajectories |
C-- Calculate float trajectories |
480 |
IF (useFLT) THEN |
IF (useFLT) THEN |
481 |
CALL TIMER_START('FLOATS [THE_MAIN_LOOP]',myThid) |
CALL TIMER_START('FLOATS [FORWARD_STEP]',myThid) |
482 |
CALL FLT_MAIN(myIter,myTime, myThid) |
CALL FLT_MAIN(myIter,myTime, myThid) |
483 |
CALL TIMER_STOP ('FLOATS [THE_MAIN_LOOP]',myThid) |
CALL TIMER_STOP ('FLOATS [FORWARD_STEP]',myThid) |
484 |
ENDIF |
ENDIF |
485 |
#endif |
#endif |
486 |
|
|
487 |
#ifndef EXCLUDE_MONITOR |
#ifdef ALLOW_MONITOR |
488 |
C-- Check status of solution (statistics, cfl, etc...) |
C-- Check status of solution (statistics, cfl, etc...) |
489 |
|
CALL TIMER_START('MONITOR [FORWARD_STEP]',myThid) |
490 |
CALL MONITOR( myIter, myTime, myThid ) |
CALL MONITOR( myIter, myTime, myThid ) |
491 |
#endif /* EXCLUDE_MONITOR */ |
CALL TIMER_STOP ('MONITOR [FORWARD_STEP]',myThid) |
492 |
|
#endif /* ALLOW_MONITOR */ |
493 |
|
|
494 |
|
C AMM -- Diagnostics package |
495 |
|
#ifdef ALLOW_DIAGNOSTICS |
496 |
|
|
497 |
|
if(usediagnostics)then |
498 |
|
call diagnostics_fill_state(myThid) |
499 |
|
endif |
500 |
|
|
501 |
|
# ifdef ALLOW_PTRACERS |
502 |
|
if(useptracers)then |
503 |
|
call diagnostics_fill_ptracers(myThid) |
504 |
|
endif |
505 |
|
# endif |
506 |
|
|
507 |
|
#endif |
508 |
|
C AMM |
509 |
|
|
|
#ifndef ALLOW_AUTODIFF_TAMC |
|
510 |
C-- Do IO if needed. |
C-- Do IO if needed. |
511 |
CALL TIMER_START('DO_THE_MODEL_IO [THE_MAIN_LOOP]',myThid) |
CALL TIMER_START('DO_THE_MODEL_IO [FORWARD_STEP]',myThid) |
512 |
CALL DO_THE_MODEL_IO( myTime, myIter, myThid ) |
CALL DO_THE_MODEL_IO( myTime, myIter, myThid ) |
513 |
CALL TIMER_STOP ('DO_THE_MODEL_IO [THE_MAIN_LOOP]',myThid) |
CALL TIMER_STOP ('DO_THE_MODEL_IO [FORWARD_STEP]',myThid) |
514 |
|
|
515 |
C-- Save state for restarts |
C-- Save state for restarts |
516 |
C Note: (jmc: is it still the case after ckp35 ?) |
C Note: (jmc: is it still the case after ckp35 ?) |
525 |
C etaN.0000000001 in the indexing scheme used for the model |
C etaN.0000000001 in the indexing scheme used for the model |
526 |
C "state" files. This example is referred to as a checkpoint |
C "state" files. This example is referred to as a checkpoint |
527 |
C at time level 1 |
C at time level 1 |
528 |
CALL TIMER_START('WRITE_CHECKPOINT [THE_MAIN_LOOP]',myThid) |
CALL TIMER_START('WRITE_CHECKPOINT [FORWARD_STEP]',myThid) |
529 |
|
CALL PACKAGES_WRITE_PICKUP( |
530 |
|
I .FALSE., myTime, myIter, myThid ) |
531 |
CALL WRITE_CHECKPOINT( |
CALL WRITE_CHECKPOINT( |
532 |
& .FALSE., myTime, myIter, myThid ) |
I .FALSE., myTime, myIter, myThid ) |
533 |
CALL TIMER_STOP ('WRITE_CHECKPOINT [THE_MAIN_LOOP]',myThid) |
CALL TIMER_STOP ('WRITE_CHECKPOINT [FORWARD_STEP]',myThid) |
534 |
|
|
535 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#ifdef ALLOW_DEBUG |
536 |
|
IF ( debugLevel .GE. debLevB ) |
537 |
|
& CALL DEBUG_LEAVE('FORWARD_STEP',myThid) |
538 |
|
#endif |
539 |
|
|
540 |
|
RETURN |
541 |
END |
END |