1 |
C $Header$ |
C $eader: /u/u3/gcmpack/MITgcm/model/src/forward_step.F,v 1.79 2003/12/15 23:00:44 molod Exp $ |
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 |
# ifdef ALLOW_BULKFORMULAE |
# ifdef ALLOW_BULKFORMULAE |
63 |
# include "exf_constants.h" |
# include "exf_constants.h" |
66 |
# ifdef ALLOW_OBCS |
# ifdef ALLOW_OBCS |
67 |
# include "OBCS.h" |
# include "OBCS.h" |
68 |
# endif |
# endif |
69 |
#endif |
# ifdef ALLOW_PTRACERS |
70 |
|
# include "PTRACERS.h" |
71 |
|
# endif |
72 |
|
# ifdef ALLOW_CD_CODE |
73 |
|
# include "CD_CODE_VARS.h" |
74 |
|
# endif |
75 |
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
76 |
|
|
77 |
C !LOCAL VARIABLES: |
C !LOCAL VARIABLES: |
78 |
C == Routine arguments == |
C == Routine arguments == |
88 |
integer mythid |
integer mythid |
89 |
integer myiter |
integer myiter |
90 |
_RL mytime |
_RL mytime |
|
INTEGER bi,bj |
|
91 |
|
|
92 |
|
integer i,L |
93 |
CEOP |
CEOP |
94 |
|
|
95 |
|
#ifdef ALLOW_DEBUG |
96 |
|
IF ( debugLevel .GE. debLevB ) |
97 |
|
& CALL DEBUG_ENTER('FORWARD_STEP',myThid) |
98 |
|
#endif |
99 |
|
|
100 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
101 |
C-- Reset the model iteration counter and the model time. |
C-- Reset the model iteration counter and the model time. |
102 |
myiter = nIter0 + (iloop-1) |
myiter = nIter0 + (iloop-1) |
103 |
mytime = startTime + float(iloop-1)*deltaTclock |
mytime = startTime + float(iloop-1)*deltaTclock |
104 |
#endif |
#endif |
105 |
|
|
106 |
#if (defined (ALLOW_AUTODIFF_TAMC) && defined (ALLOW_AUTODIFF_MONITOR)) |
#if (defined (ALLOW_AUTODIFF_TAMC) && defined (ALLOW_AUTODIFF_MONITOR)) |
107 |
C Include call to a dummy routine. Its adjoint will be |
C Include call to a dummy routine. Its adjoint will be |
108 |
C called at the proper place in the adjoint code. |
C called at the proper place in the adjoint code. |
109 |
C The adjoint routine will print out adjoint values |
C The adjoint routine will print out adjoint values |
110 |
C if requested. The location of the call is important, |
C if requested. The location of the call is important, |
111 |
C it has to be after the adjoint of the exchanges |
C it has to be after the adjoint of the exchanges |
112 |
C (DO_GTERM_BLOCKING_EXCHANGES). |
C (DO_GTERM_BLOCKING_EXCHANGES). |
113 |
CALL DUMMY_IN_STEPPING( myTime, myIter, myThid ) |
CALL DUMMY_IN_STEPPING( myTime, myIter, myThid ) |
114 |
CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid ) |
cph I've commented this line since it may conflict with MITgcm's adjoint |
115 |
|
cph However, need to check whether that's still consistent |
116 |
|
cph with the ecco-branch (it should). |
117 |
|
cph CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid ) |
118 |
#endif |
#endif |
119 |
|
|
120 |
#ifdef EXACT_CONSERV |
#ifdef EXACT_CONSERV |
121 |
IF (exactConserv) THEN |
IF (exactConserv) THEN |
122 |
C-- Update etaH(n+1) : |
C-- Update etaH(n+1) : |
123 |
DO bj=myByLo(myThid),myByHi(myThid) |
CALL TIMER_START('UPDATE_ETAH [FORWARD_STEP]',mythid) |
124 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
CALL UPDATE_ETAH( myTime, myIter, myThid ) |
125 |
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 ) |
|
126 |
ENDIF |
ENDIF |
127 |
#endif /* EXACT_CONSERV */ |
#endif /* EXACT_CONSERV */ |
128 |
|
|
129 |
#ifdef NONLIN_FRSURF |
#ifdef NONLIN_FRSURF |
130 |
C-- compute the future surface level thickness |
IF ( select_rStar.NE.0 ) THEN |
131 |
C according to etaH(n+1) |
C-- r* : compute the future level thickness according to etaH(n+1) |
132 |
IF ( nonlinFreeSurf.GT.0) THEN |
CALL TIMER_START('CALC_R_STAR [FORWARD_STEP]',mythid) |
133 |
|
CALL CALC_R_STAR(etaH, myTime, myIter, myThid ) |
134 |
|
CALL TIMER_STOP ('CALC_R_STAR [FORWARD_STEP]',mythid) |
135 |
|
ELSEIF ( nonlinFreeSurf.GT.0) THEN |
136 |
|
C-- compute the future surface level thickness according to etaH(n+1) |
137 |
|
CALL TIMER_START('CALC_SURF_DR [FORWARD_STEP]',mythid) |
138 |
CALL CALC_SURF_DR(etaH, myTime, myIter, myThid ) |
CALL CALC_SURF_DR(etaH, myTime, myIter, myThid ) |
139 |
ENDIF |
CALL TIMER_STOP ('CALC_SURF_DR [FORWARD_STEP]',mythid) |
140 |
|
ENDIF |
141 |
#endif /* NONLIN_FRSURF */ |
#endif /* NONLIN_FRSURF */ |
142 |
|
|
|
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. |
|
143 |
#ifdef ALLOW_AUTODIFF_TAMC |
#ifdef ALLOW_AUTODIFF_TAMC |
144 |
c************************************** |
c************************************** |
145 |
#include "checkpoint_lev1_directives.h" |
#include "checkpoint_lev1_directives.h" |
146 |
c************************************** |
c************************************** |
147 |
#endif |
#endif |
148 |
CALL EXF_GETFORCING( mytime, myiter, mythid ) |
|
149 |
#else |
C-- Call external forcing package |
150 |
CALL TIMER_START('EXTERNAL_FIELDS_LOAD[THE_MAIN_LOOP]',mythid) |
#ifdef ALLOW_BULK_FORCE |
151 |
CALL EXTERNAL_FIELDS_LOAD( mytime, myiter, mythid ) |
IF ( useBulkForce ) THEN |
152 |
CALL TIMER_STOP ('EXTERNAL_FIELDS_LOAD[THE_MAIN_LOOP]',mythid) |
#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 |
|
# ifdef ALLOW_SEAICE |
179 |
|
IF ( .NOT. useSEAICE ) 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 |
|
# ifdef ALLOW_SEAICE |
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_THSICE |
204 |
|
IF (useThSIce) THEN |
205 |
|
#ifdef ALLOW_DEBUG |
206 |
|
IF ( debugLevel .GE. debLevB ) |
207 |
|
& CALL DEBUG_CALL('THSICE_MAIN',myThid) |
208 |
|
#endif |
209 |
|
C-- Step forward Therm.Sea-Ice variables |
210 |
|
C and modify forcing terms including effects from ice |
211 |
|
CALL TIMER_START('THSICE_MAIN [FORWARD_STEP]', myThid) |
212 |
|
CALL THSICE_MAIN( myTime, myIter, myThid ) |
213 |
|
CALL TIMER_STOP( 'THSICE_MAIN [FORWARD_STEP]', myThid) |
214 |
|
ENDIF |
215 |
|
#endif /* ALLOW_THSICE */ |
216 |
|
|
217 |
|
# ifdef ALLOW_SEAICE |
218 |
|
C-- Call sea ice model to compute forcing/external data fields. In |
219 |
|
C addition to computing prognostic sea-ice variables and diagnosing the |
220 |
|
C forcing/external data fields that drive the ocean model, SEAICE_MODEL |
221 |
|
C also sets theta to the freezing point under sea-ice. The implied |
222 |
|
C surface heat flux is then stored in variable surfaceTendencyTice, |
223 |
|
C which is needed by KPP package (kpp_calc.F and kpp_transport_t.F) |
224 |
|
C to diagnose surface buoyancy fluxes and for the non-local transport |
225 |
|
C term. Because this call precedes model thermodynamics, temperature |
226 |
|
C under sea-ice may not be "exactly" at the freezing point by the time |
227 |
|
C theta is dumped or time-averaged. |
228 |
|
IF ( useSEAICE ) THEN |
229 |
|
#ifdef ALLOW_DEBUG |
230 |
|
IF ( debugLevel .GE. debLevB ) |
231 |
|
& CALL DEBUG_CALL('SEAICE_MODEL',myThid) |
232 |
|
#endif |
233 |
|
CALL TIMER_START('SEAICE_MODEL [FORWARD_STEP]',myThid) |
234 |
|
CALL SEAICE_MODEL( myTime, myIter, myThid ) |
235 |
|
CALL TIMER_STOP ('SEAICE_MODEL [FORWARD_STEP]',myThid) |
236 |
|
ENDIF |
237 |
|
# endif /* ALLOW_SEAICE */ |
238 |
|
|
239 |
|
C-- Freeze water at the surface |
240 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
241 |
|
CADJ STORE theta = comlev1, key = ikey_dynamics |
242 |
#endif |
#endif |
243 |
|
IF ( allowFreezing .AND. .NOT. useSEAICE |
244 |
|
& .AND. .NOT. useThSIce ) THEN |
245 |
|
CALL FREEZE_SURFACE( myTime, myIter, myThid ) |
246 |
|
ENDIF |
247 |
|
|
248 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
249 |
|
# ifdef ALLOW_PTRACERS |
250 |
|
cph this replaces _bibj storing of ptracer within thermodynamics |
251 |
|
CADJ STORE ptracer = comlev1, key = ikey_dynamics |
252 |
|
# endif |
253 |
|
#endif |
254 |
|
|
255 |
|
#ifdef ALLOW_PTRACERS |
256 |
|
# ifdef ALLOW_GCHEM |
257 |
|
CALL GCHEM_FIELDS_LOAD( mytime, myiter, mythid ) |
258 |
|
# endif |
259 |
|
#endif |
260 |
|
|
261 |
|
#ifdef COMPONENT_MODULE |
262 |
|
IF ( useCoupler ) THEN |
263 |
|
C Post coupling data that I export. |
264 |
|
C Read in coupling data that I import. |
265 |
|
CALL TIMER_START('CPL_EXPORT-IMPORT [FORWARD_STEP]',myThid) |
266 |
|
CALL CPL_EXPORT_MY_DATA( myIter, myTime, myThid ) |
267 |
|
CALL CPL_IMPORT_EXTERNAL_DATA( myIter, myTime, myThid ) |
268 |
|
CALL TIMER_STOP ('CPL_EXPORT-IMPORT [FORWARD_STEP]',myThid) |
269 |
|
ENDIF |
270 |
|
#endif /* COMPONENT_MODULE */ |
271 |
|
|
272 |
|
#ifdef COMPONENT_MODULE |
273 |
|
# ifndef ALLOW_AIM |
274 |
|
C jmc: don't know precisely where to put this call. leave it here for now. |
275 |
|
IF ( useCoupler ) THEN |
276 |
|
CALL OCN_APPLY_IMPORT( myTime, myIter, myThid ) |
277 |
|
ENDIF |
278 |
|
# endif |
279 |
|
#endif /* COMPONENT_MODULE */ |
280 |
|
|
281 |
C-- Step forward fields and calculate time tendency terms. |
C-- Step forward fields and calculate time tendency terms. |
282 |
CALL TIMER_START('THERMODYNAMICS [THE_MAIN_LOOP]',mythid) |
|
283 |
|
C AMM |
284 |
|
#ifdef ALLOW_FIZHI |
285 |
|
if( useFIZHI) then |
286 |
|
CALL UPDATE_OCEAN_EXPORTS ( myTime, myIter, myThid ) |
287 |
|
CALL UPDATE_EARTH_EXPORTS ( myTime, myIter, myThid ) |
288 |
|
CALL UPDATE_CHEMISTRY_EXPORTS ( myTime, myIter, myThid ) |
289 |
|
CALL TIMER_START('FIZHI_WRAPPER [FORWARD_STEP]',mythid) |
290 |
|
CALL FIZHI_WRAPPER ( myTime, myIter, myThid ) |
291 |
|
CALL TIMER_STOP ('FIZHI_WRAPPER [FORWARD_STEP]',mythid) |
292 |
|
CALL STEP_FIZHI_FG ( myTime, myIter, myThid, deltaTtracer ) |
293 |
|
endif |
294 |
|
#endif |
295 |
|
C AMM |
296 |
|
|
297 |
|
#ifdef ALLOW_DEBUG |
298 |
|
IF ( debugLevel .GE. debLevB ) |
299 |
|
& CALL DEBUG_CALL('THERMODYNAMICS',myThid) |
300 |
|
#endif |
301 |
|
CALL TIMER_START('THERMODYNAMICS [FORWARD_STEP]',mythid) |
302 |
CALL THERMODYNAMICS( myTime, myIter, myThid ) |
CALL THERMODYNAMICS( myTime, myIter, myThid ) |
303 |
CALL TIMER_STOP ('THERMODYNAMICS [THE_MAIN_LOOP]',mythid) |
CALL TIMER_STOP ('THERMODYNAMICS [FORWARD_STEP]',mythid) |
304 |
|
|
305 |
|
C-- do exchanges (needed for DYNAMICS) when using stagger time-step : |
306 |
|
#ifdef ALLOW_DEBUG |
307 |
|
IF ( debugLevel .GE. debLevB ) |
308 |
|
& CALL DEBUG_CALL('DO_STAGGER_FIELDS_EXCH.',myThid) |
309 |
|
#endif |
310 |
|
CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
311 |
|
CALL DO_STAGGER_FIELDS_EXCHANGES( myTime, myIter, myThid ) |
312 |
|
CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
313 |
|
|
314 |
#ifdef ALLOW_SHAP_FILT |
#ifdef ALLOW_SHAP_FILT |
315 |
IF (useSHAP_FILT .AND. |
IF (useSHAP_FILT .AND. |
316 |
& staggerTimeStep .AND. shap_filt_TrStagg ) THEN |
& staggerTimeStep .AND. shap_filt_TrStagg ) THEN |
317 |
CALL TIMER_START('SHAP_FILT [THE_MAIN_LOOP]',myThid) |
#ifdef ALLOW_DEBUG |
318 |
CALL SHAP_FILT_APPLY_TS( gT, gS, myTime, myIter, myThid ) |
IF ( debugLevel .GE. debLevB ) |
319 |
CALL TIMER_STOP ('SHAP_FILT [THE_MAIN_LOOP]',myThid) |
& CALL DEBUG_CALL('SHAP_FILT_APPLY_TS',myThid) |
320 |
ENDIF |
#endif |
321 |
|
CALL TIMER_START('SHAP_FILT [FORWARD_STEP]',myThid) |
322 |
|
CALL SHAP_FILT_APPLY_TS(gT,gS,myTime+deltaT,myIter+1,myThid) |
323 |
|
CALL TIMER_STOP ('SHAP_FILT [FORWARD_STEP]',myThid) |
324 |
|
ENDIF |
325 |
#endif |
#endif |
326 |
|
|
327 |
#ifdef ALLOW_ZONAL_FILT |
#ifdef ALLOW_ZONAL_FILT |
328 |
IF (useZONAL_FILT .AND. |
IF (useZONAL_FILT .AND. |
329 |
& staggerTimeStep .AND. zonal_filt_TrStagg ) THEN |
& staggerTimeStep .AND. zonal_filt_TrStagg ) THEN |
330 |
CALL TIMER_START('ZONAL_FILT_APPLY [THE_MAIN_LOOP]',myThid) |
#ifdef ALLOW_DEBUG |
331 |
|
IF ( debugLevel .GE. debLevB ) |
332 |
|
& CALL DEBUG_CALL('ZONAL_FILT_APPLY_TS',myThid) |
333 |
|
#endif |
334 |
|
CALL TIMER_START('ZONAL_FILT_APPLY [FORWARD_STEP]',myThid) |
335 |
CALL ZONAL_FILT_APPLY_TS( gT, gS, myThid ) |
CALL ZONAL_FILT_APPLY_TS( gT, gS, myThid ) |
336 |
CALL TIMER_STOP ('ZONAL_FILT_APPLY [THE_MAIN_LOOP]',myThid) |
CALL TIMER_STOP ('ZONAL_FILT_APPLY [FORWARD_STEP]',myThid) |
337 |
ENDIF |
ENDIF |
338 |
#endif |
#endif |
339 |
|
|
340 |
C-- Step forward fields and calculate time tendency terms. |
C-- Step forward fields and calculate time tendency terms. |
341 |
IF ( momStepping ) THEN |
#ifndef ALLOW_AUTODIFF_TAMC |
342 |
CALL TIMER_START('DYNAMICS [THE_MAIN_LOOP]',mythid) |
IF ( momStepping ) THEN |
343 |
|
#endif |
344 |
|
#ifdef ALLOW_DEBUG |
345 |
|
IF ( debugLevel .GE. debLevB ) |
346 |
|
& CALL DEBUG_CALL('DYNAMICS',myThid) |
347 |
|
#endif |
348 |
|
CALL TIMER_START('DYNAMICS [FORWARD_STEP]',mythid) |
349 |
CALL DYNAMICS( myTime, myIter, myThid ) |
CALL DYNAMICS( myTime, myIter, myThid ) |
350 |
CALL TIMER_STOP ('DYNAMICS [THE_MAIN_LOOP]',mythid) |
CALL TIMER_STOP ('DYNAMICS [FORWARD_STEP]',mythid) |
351 |
ENDIF |
#ifndef ALLOW_AUTODIFF_TAMC |
352 |
|
ENDIF |
353 |
|
#endif |
354 |
|
|
355 |
#ifdef ALLOW_NONHYDROSTATIC |
#ifdef ALLOW_NONHYDROSTATIC |
356 |
C-- Step forward W field in N-H algorithm |
C-- Step forward W field in N-H algorithm |
357 |
IF ( momStepping .AND. nonHydrostatic ) THEN |
IF ( momStepping .AND. nonHydrostatic ) THEN |
358 |
CALL TIMER_START('CALC_GW [THE_MAIN_LOOP]',myThid) |
#ifdef ALLOW_DEBUG |
359 |
CALL CALC_GW(myThid) |
IF ( debugLevel .GE. debLevB ) |
360 |
CALL TIMER_STOP ('CALC_GW [THE_MAIN_LOOP]',myThid) |
& CALL DEBUG_CALL('CALC_GW',myThid) |
361 |
ENDIF |
#endif |
362 |
|
CALL TIMER_START('CALC_GW [FORWARD_STEP]',myThid) |
363 |
|
CALL CALC_GW(myThid) |
364 |
|
CALL TIMER_STOP ('CALC_GW [FORWARD_STEP]',myThid) |
365 |
|
ENDIF |
366 |
#endif |
#endif |
367 |
|
|
368 |
#ifdef NONLIN_FRSURF |
#ifdef NONLIN_FRSURF |
369 |
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 |
|
370 |
IF ( nonlinFreeSurf.GT.0) THEN |
IF ( nonlinFreeSurf.GT.0) THEN |
371 |
|
IF ( select_rStar.GT.0 ) THEN |
372 |
|
CALL TIMER_START('UPDATE_R_STAR [FORWARD_STEP]',myThid) |
373 |
|
CALL UPDATE_R_STAR( myTime, myIter, myThid ) |
374 |
|
CALL TIMER_STOP ('UPDATE_R_STAR [FORWARD_STEP]',myThid) |
375 |
|
ELSE |
376 |
|
CALL TIMER_START('UPDATE_SURF_DR [FORWARD_STEP]',myThid) |
377 |
CALL UPDATE_SURF_DR( myTime, myIter, myThid ) |
CALL UPDATE_SURF_DR( myTime, myIter, myThid ) |
378 |
|
CALL TIMER_STOP ('UPDATE_SURF_DR [FORWARD_STEP]',myThid) |
379 |
|
ENDIF |
380 |
ENDIF |
ENDIF |
381 |
C- update also CG2D matrix (and preconditioner) |
C- update also CG2D matrix (and preconditioner) |
382 |
IF ( nonlinFreeSurf.GT.2) THEN |
IF ( momStepping .AND. nonlinFreeSurf.GT.2 ) THEN |
383 |
|
CALL TIMER_START('UPDATE_CG2D [FORWARD_STEP]',myThid) |
384 |
CALL UPDATE_CG2D( myTime, myIter, myThid ) |
CALL UPDATE_CG2D( myTime, myIter, myThid ) |
385 |
ENDIF |
CALL TIMER_STOP ('UPDATE_CG2D [FORWARD_STEP]',myThid) |
386 |
ENDIF |
ENDIF |
387 |
#endif |
#endif |
388 |
|
|
389 |
C-- Apply Filters to u*,v* before SOLVE_FOR_PRESSURE |
C-- Apply Filters to u*,v* before SOLVE_FOR_PRESSURE |
390 |
#ifdef ALLOW_SHAP_FILT |
#ifdef ALLOW_SHAP_FILT |
391 |
IF (useSHAP_FILT .AND. shap_filt_uvStar) THEN |
IF (useSHAP_FILT .AND. shap_filt_uvStar) THEN |
392 |
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 ) |
|
393 |
IF (implicDiv2Dflow.LT.1.) THEN |
IF (implicDiv2Dflow.LT.1.) THEN |
394 |
C-- Explicit+Implicit part of the Barotropic Flow Divergence |
C-- Explicit+Implicit part of the Barotropic Flow Divergence |
395 |
C => Filtering of uVel,vVel is necessary |
C => Filtering of uVel,vVel is necessary |
396 |
CALL SHAP_FILT_APPLY_UV( uVel,vVel, myTime,myIter,myThid ) |
CALL SHAP_FILT_APPLY_UV( uVel,vVel, |
397 |
|
& myTime+deltaT, myIter+1, myThid ) |
398 |
ENDIF |
ENDIF |
399 |
CALL TIMER_STOP ('SHAP_FILT [THE_MAIN_LOOP]',myThid) |
CALL SHAP_FILT_APPLY_UV( gU,gV,myTime+deltaT,myIter+1,myThid) |
400 |
|
CALL TIMER_STOP ('SHAP_FILT [FORWARD_STEP]',myThid) |
401 |
ENDIF |
ENDIF |
402 |
#endif |
#endif |
403 |
#ifdef ALLOW_ZONAL_FILT |
#ifdef ALLOW_ZONAL_FILT |
404 |
IF (useZONAL_FILT .AND. zonal_filt_uvStar) THEN |
IF (useZONAL_FILT .AND. zonal_filt_uvStar) THEN |
405 |
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 ) |
|
406 |
IF (implicDiv2Dflow.LT.1.) THEN |
IF (implicDiv2Dflow.LT.1.) THEN |
407 |
C-- Explicit+Implicit part of the Barotropic Flow Divergence |
C-- Explicit+Implicit part of the Barotropic Flow Divergence |
408 |
C => Filtering of uVel,vVel is necessary |
C => Filtering of uVel,vVel is necessary |
409 |
CALL ZONAL_FILT_APPLY_UV( uVel, vVel, myThid ) |
CALL ZONAL_FILT_APPLY_UV( uVel, vVel, myThid ) |
410 |
ENDIF |
ENDIF |
411 |
CALL TIMER_STOP ('ZONAL_FILT_APPLY [THE_MAIN_LOOP]',myThid) |
CALL ZONAL_FILT_APPLY_UV( gU, gV, myThid ) |
412 |
|
CALL TIMER_STOP ('ZONAL_FILT_APPLY [FORWARD_STEP]',myThid) |
413 |
ENDIF |
ENDIF |
414 |
#endif |
#endif |
415 |
|
|
417 |
C Two-dimensional only for conventional hydrostatic or |
C Two-dimensional only for conventional hydrostatic or |
418 |
C three-dimensional for non-hydrostatic and/or IGW scheme. |
C three-dimensional for non-hydrostatic and/or IGW scheme. |
419 |
IF ( momStepping ) THEN |
IF ( momStepping ) THEN |
420 |
CALL TIMER_START('SOLVE_FOR_PRESSURE [THE_MAIN_LOOP]',myThid) |
CALL TIMER_START('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid) |
421 |
CALL SOLVE_FOR_PRESSURE(myTime, myIter, myThid) |
CALL SOLVE_FOR_PRESSURE(myTime, myIter, myThid) |
422 |
CALL TIMER_STOP ('SOLVE_FOR_PRESSURE [THE_MAIN_LOOP]',myThid) |
CALL TIMER_STOP ('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid) |
423 |
ENDIF |
ENDIF |
424 |
|
|
425 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
426 |
|
cph This is needed because convective_adjustment calls |
427 |
|
cph find_rho which may use pressure() |
428 |
|
CADJ STORE totphihyd = comlev1, key = ikey_dynamics |
429 |
|
#endif |
430 |
C-- Correct divergence in flow field and cycle time-stepping |
C-- Correct divergence in flow field and cycle time-stepping |
431 |
C arrays (for all fields) ; update time-counter |
C arrays (for all fields) ; update time-counter |
432 |
myIter = nIter0 + iLoop |
myIter = nIter0 + iLoop |
433 |
myTime = startTime + deltaTClock * float(iLoop) |
myTime = startTime + deltaTClock * float(iLoop) |
434 |
CALL TIMER_START('THE_CORRECTION_STEP [THE_MAIN_LOOP]',myThid) |
CALL TIMER_START('THE_CORRECTION_STEP [FORWARD_STEP]',myThid) |
435 |
CALL THE_CORRECTION_STEP(myTime, myIter, myThid) |
CALL THE_CORRECTION_STEP(myTime, myIter, myThid) |
436 |
CALL TIMER_STOP ('THE_CORRECTION_STEP [THE_MAIN_LOOP]',myThid) |
CALL TIMER_STOP ('THE_CORRECTION_STEP [FORWARD_STEP]',myThid) |
437 |
|
|
438 |
C-- Do "blocking" sends and receives for tendency "overlap" terms |
C-- Do "blocking" sends and receives for tendency "overlap" terms |
439 |
c CALL TIMER_START('BLOCKING_EXCHANGES [THE_MAIN_LOOP]',myThid) |
c CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
440 |
c CALL DO_GTERM_BLOCKING_EXCHANGES( myThid ) |
c CALL DO_GTERM_BLOCKING_EXCHANGES( myThid ) |
441 |
c CALL TIMER_STOP ('BLOCKING_EXCHANGES [THE_MAIN_LOOP]',myThid) |
c CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
442 |
|
|
443 |
C-- Do "blocking" sends and receives for field "overlap" terms |
C-- Do "blocking" sends and receives for field "overlap" terms |
444 |
CALL TIMER_START('BLOCKING_EXCHANGES [THE_MAIN_LOOP]',myThid) |
CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
445 |
CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid ) |
CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid ) |
446 |
CALL TIMER_STOP ('BLOCKING_EXCHANGES [THE_MAIN_LOOP]',myThid) |
CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
447 |
|
|
448 |
|
cswdptr -- add for seperate timestepping of chemical/biological/forcing |
449 |
|
cswdptr of ptracers --- |
450 |
|
#ifdef ALLOW_GCHEM |
451 |
|
ceh3 This is broken -- this ifdef should not be visible! |
452 |
|
#ifdef PTRACERS_SEPARATE_FORCING |
453 |
|
ceh3 needs an IF ( use GCHEM ) THEN |
454 |
|
call GCHEM_FORCING_SEP( myTime,myIter,myThid ) |
455 |
|
#endif /* PTRACERS_SEPARATE_FORCING */ |
456 |
|
#endif /* ALLOW_GCHEM */ |
457 |
|
cswdptr -- end add --- |
458 |
|
|
459 |
|
C AMM |
460 |
|
#ifdef ALLOW_GRIDALT |
461 |
|
if (useGRIDALT) CALL GRIDALT_UPDATE(myThid) |
462 |
|
#endif |
463 |
|
C AMM |
464 |
|
|
465 |
|
C AMM |
466 |
|
#ifdef ALLOW_FIZHI |
467 |
|
CALL STEP_FIZHI_CORR ( myTime, myIter, myThid ) |
468 |
|
#endif |
469 |
|
C AMM |
470 |
|
|
471 |
#ifdef ALLOW_FLT |
#ifdef ALLOW_FLT |
472 |
C-- Calculate float trajectories |
C-- Calculate float trajectories |
473 |
IF (useFLT) THEN |
IF (useFLT) THEN |
474 |
CALL TIMER_START('FLOATS [THE_MAIN_LOOP]',myThid) |
CALL TIMER_START('FLOATS [FORWARD_STEP]',myThid) |
475 |
CALL FLT_MAIN(myIter,myTime, myThid) |
CALL FLT_MAIN(myIter,myTime, myThid) |
476 |
CALL TIMER_STOP ('FLOATS [THE_MAIN_LOOP]',myThid) |
CALL TIMER_STOP ('FLOATS [FORWARD_STEP]',myThid) |
477 |
ENDIF |
ENDIF |
478 |
#endif |
#endif |
479 |
|
|
480 |
#ifndef EXCLUDE_MONITOR |
#ifdef ALLOW_MONITOR |
481 |
C-- Check status of solution (statistics, cfl, etc...) |
C-- Check status of solution (statistics, cfl, etc...) |
482 |
|
CALL TIMER_START('MONITOR [FORWARD_STEP]',myThid) |
483 |
CALL MONITOR( myIter, myTime, myThid ) |
CALL MONITOR( myIter, myTime, myThid ) |
484 |
#endif /* EXCLUDE_MONITOR */ |
CALL TIMER_STOP ('MONITOR [FORWARD_STEP]',myThid) |
485 |
|
#endif /* ALLOW_MONITOR */ |
486 |
|
|
|
#ifndef ALLOW_AUTODIFF_TAMC |
|
487 |
C-- Do IO if needed. |
C-- Do IO if needed. |
488 |
CALL TIMER_START('DO_THE_MODEL_IO [THE_MAIN_LOOP]',myThid) |
CALL TIMER_START('DO_THE_MODEL_IO [FORWARD_STEP]',myThid) |
489 |
CALL DO_THE_MODEL_IO( myTime, myIter, myThid ) |
CALL DO_THE_MODEL_IO( myTime, myIter, myThid ) |
490 |
CALL TIMER_STOP ('DO_THE_MODEL_IO [THE_MAIN_LOOP]',myThid) |
CALL TIMER_STOP ('DO_THE_MODEL_IO [FORWARD_STEP]',myThid) |
491 |
|
|
492 |
C-- Save state for restarts |
C-- Save state for restarts |
493 |
C Note: (jmc: is it still the case after ckp35 ?) |
C Note: (jmc: is it still the case after ckp35 ?) |
502 |
C etaN.0000000001 in the indexing scheme used for the model |
C etaN.0000000001 in the indexing scheme used for the model |
503 |
C "state" files. This example is referred to as a checkpoint |
C "state" files. This example is referred to as a checkpoint |
504 |
C at time level 1 |
C at time level 1 |
505 |
CALL TIMER_START('WRITE_CHECKPOINT [THE_MAIN_LOOP]',myThid) |
CALL TIMER_START('WRITE_CHECKPOINT [FORWARD_STEP]',myThid) |
506 |
|
CALL PACKAGES_WRITE_PICKUP( |
507 |
|
I .FALSE., myTime, myIter, myThid ) |
508 |
CALL WRITE_CHECKPOINT( |
CALL WRITE_CHECKPOINT( |
509 |
& .FALSE., myTime, myIter, myThid ) |
I .FALSE., myTime, myIter, myThid ) |
510 |
CALL TIMER_STOP ('WRITE_CHECKPOINT [THE_MAIN_LOOP]',myThid) |
CALL TIMER_STOP ('WRITE_CHECKPOINT [FORWARD_STEP]',myThid) |
511 |
|
|
512 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
#ifdef ALLOW_DEBUG |
513 |
|
IF ( debugLevel .GE. debLevB ) |
514 |
|
& CALL DEBUG_LEAVE('FORWARD_STEP',myThid) |
515 |
|
#endif |
516 |
|
|
517 |
|
RETURN |
518 |
END |
END |