3 |
|
|
4 |
#include "CPP_OPTIONS.h" |
#include "CPP_OPTIONS.h" |
5 |
|
|
6 |
SUBROUTINE FORWARD_STEP( |
CBOP |
7 |
I doHalfStep, iLoop, |
C !ROUTINE: FORWARD_STEP |
8 |
U myCurrentTime, myCurrentIter, |
C !INTERFACE: |
9 |
& myThid) |
SUBROUTINE FORWARD_STEP( iloop, myTime, myIter, myThid ) |
10 |
C /==========================================================\ |
|
11 |
C | SUBROUTINE FORWARD_STEP | |
C !DESCRIPTION: \bv |
12 |
C | o Does one instance of the model time stepping | |
C *================================================================== |
13 |
C | The time stepping loop in THE_MAIN_LOOP() calls | |
C | SUBROUTINE forward_step |
14 |
C | this routine | |
C | o Run the ocean model and, optionally, evaluate a cost function. |
15 |
C |==========================================================| |
C *================================================================== |
16 |
C \==========================================================/ |
C | |
17 |
IMPLICIT NONE |
C | THE_MAIN_LOOP is the toplevel routine for the Tangent Linear and |
18 |
C |
C | Adjoint Model Compiler (TAMC). For this purpose the initialization |
19 |
C Call Tree |
C | of the model was split into two parts. Those parameters that do |
20 |
C ========= |
C | not depend on a specific model run are set in INITIALISE_FIXED, |
21 |
C |
C | whereas those that do depend on the specific realization are |
22 |
C THE_MAIN_LOOP() |
C | initialized in INITIALISE_VARIA. |
23 |
C | |
C | |
24 |
C ==> | ** Time stepping loop starts here ** |
C *================================================================== |
25 |
C | | |
C \ev |
|
C /|\ |-FORWARD_STEP |
|
|
C | | | |
|
|
C /|\ | |--LOAD_EXTERNAL_DATA |
|
|
C | | | o Load and/or set time dependent forcing fields |
|
|
C /|\ | | |
|
|
C | | |--DYNAMICS |
|
|
C /|\ | | o Evaluate "forward" terms |
|
|
C | | | |
|
|
C /|\ | | |
|
|
C | | |--DO_THE_MODEL_IO |
|
|
C /|\ | | o Write model state |
|
|
C | | | |
|
|
C /|\ | | |
|
|
C | | |--SOLVE_FOR_PRESSURE |
|
|
C /|\ | | o Find pressure field to keep flow non-divergent |
|
|
C | | | |
|
|
C /|\ | | |
|
|
C | | |--THE_CORRECTION_STEP |
|
|
C /|\ | | o Correct flow field with pressure gradient |
|
|
C | | | and cycle time-stepping arrays (for all fields) |
|
|
C /|\ | | |
|
|
C | | |--DO_GTERM_BLOCKING_EXCHANGES |
|
|
C /|\ | | o Update overlap regions |
|
|
C | | | |
|
|
C /|\ | | |
|
|
C | | |--WRITE_CHECKPOINT |
|
|
C /|\ | | o Write restart file(s) |
|
|
C | | |
|
|
C /|\ | |
|
|
C |<== | ** Time stepping loop finishes here ** |
|
|
C |
|
26 |
|
|
27 |
C == Global variables === |
C !USES: |
28 |
|
IMPLICIT NONE |
29 |
|
C == Global variables == |
30 |
#include "SIZE.h" |
#include "SIZE.h" |
31 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
32 |
#include "PARAMS.h" |
#include "PARAMS.h" |
33 |
#include "DYNVARS.h" |
#include "DYNVARS.h" |
34 |
#include "CG2D.h" |
#include "FFIELDS.h" |
35 |
|
|
36 |
#ifdef ALLOW_NONHYDROSTATIC |
#ifdef ALLOW_NONHYDROSTATIC |
37 |
#include "CG3D.h" |
#include "CG3D.h" |
38 |
#endif |
#endif |
39 |
|
|
40 |
|
#ifdef ALLOW_SHAP_FILT |
41 |
|
#include "SHAP_FILT.h" |
42 |
|
#endif |
43 |
|
#ifdef ALLOW_ZONAL_FILT |
44 |
|
#include "ZONAL_FILT.h" |
45 |
|
#endif |
46 |
|
|
47 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
48 |
|
# include "tamc.h" |
49 |
|
# include "ctrl.h" |
50 |
|
# include "ctrl_dummy.h" |
51 |
|
# include "cost.h" |
52 |
|
# include "EOS.h" |
53 |
|
# ifdef INCLUDE_EXTERNAL_FORCING_PACKAGE |
54 |
|
# include "exf_fields.h" |
55 |
|
# if (defined (ALLOW_BULKFORMULAE) || defined (ALLOW_BULK_FORCE)) |
56 |
|
# include "exf_constants.h" |
57 |
|
# endif |
58 |
|
# endif |
59 |
|
# ifdef ALLOW_OBCS |
60 |
|
# include "OBCS.h" |
61 |
|
# endif |
62 |
|
#endif |
63 |
|
|
64 |
|
C !LOCAL VARIABLES: |
65 |
C == Routine arguments == |
C == Routine arguments == |
66 |
C doHalfStep - If .TRUE. then this is the last half step |
C note: under the multi-threaded model myiter and |
67 |
C iLoop - Invocation count (counter in THE_MAIN_LOOP) |
C mytime are local variables passed around as routine |
68 |
C myCurrentIter - Iteration counter for this thread |
C arguments. Although this is fiddly it saves the need to |
69 |
C myCurrentTime - Time counter for this thread |
C impose additional synchronisation points when they are |
70 |
C myThid - Thread number for this instance of the routine. |
C updated. |
71 |
LOGICAL doHalfStep |
C myiter - iteration counter for this thread |
72 |
INTEGER iLoop |
C mytime - time counter for this thread |
73 |
INTEGER myCurrentIter |
C mythid - thread number for this instance of the routine. |
74 |
_RL myCurrentTime |
integer iloop |
75 |
INTEGER myThid |
integer mythid |
76 |
|
integer myiter |
77 |
C == Local variables == |
_RL mytime |
78 |
|
#ifdef ALLOW_BULK_FORCE |
79 |
C-- Load forcing/external data fields |
INTEGER bi,bj |
80 |
CALL TIMER_START('I/O (READ) [FORWARD_STEP]',myThid) |
#endif |
|
CALL EXTERNAL_FIELDS_LOAD( myCurrentTime, myCurrentIter, myThid ) |
|
|
CALL TIMER_STOP ('I/O (READ) [FORWARD_STEP]',myThid) |
|
|
|
|
|
C-- Step forward fields and calculate time tendency terms |
|
|
CALL TIMER_START('DYNAMICS [FORWARD_STEP]',myThid) |
|
|
CALL DYNAMICS( myCurrentTime, myCurrentIter, myThid ) |
|
|
CALL TIMER_STOP ('DYNAMICS [FORWARD_STEP]',myThid) |
|
81 |
|
|
82 |
#ifdef ALLOW_NONHYDROSTATIC |
CEOP |
83 |
C-- Step forward W field in N-H algorithm |
|
84 |
IF ( nonHydrostatic ) THEN |
#ifdef ALLOW_AUTODIFF_TAMC |
85 |
CALL TIMER_START('CALC_GW [FORWARD_STEP]',myThid) |
C-- Reset the model iteration counter and the model time. |
86 |
CALL CALC_GW( myThid) |
myiter = nIter0 + (iloop-1) |
87 |
CALL TIMER_STOP ('CALC_GW [FORWARD_STEP]',myThid) |
mytime = startTime + float(iloop-1)*deltaTclock |
88 |
|
#endif |
89 |
|
|
90 |
|
#if (defined (ALLOW_AUTODIFF_TAMC) && defined (ALLOW_AUTODIFF_MONITOR)) |
91 |
|
C Include call to a dummy routine. Its adjoint will be |
92 |
|
C called at the proper place in the adjoint code. |
93 |
|
C The adjoint routine will print out adjoint values |
94 |
|
C if requested. The location of the call is important, |
95 |
|
C it has to be after the adjoint of the exchanges |
96 |
|
C (DO_GTERM_BLOCKING_EXCHANGES). |
97 |
|
CALL DUMMY_IN_STEPPING( myTime, myIter, myThid ) |
98 |
|
cph I've commented this line since it may conflict with MITgcm's adjoint |
99 |
|
cph However, need to check whether that's still consistent |
100 |
|
cph with the ecco-branch (it should). |
101 |
|
cph CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid ) |
102 |
|
#endif |
103 |
|
|
104 |
|
#ifdef EXACT_CONSERV |
105 |
|
IF (exactConserv) THEN |
106 |
|
C-- Update etaH(n+1) : |
107 |
|
CALL TIMER_START('UPDATE_ETAH [FORWARD_STEP]',mythid) |
108 |
|
CALL UPDATE_ETAH( myTime, myIter, myThid ) |
109 |
|
CALL TIMER_STOP ('UPDATE_ETAH [FORWARD_STEP]',mythid) |
110 |
ENDIF |
ENDIF |
111 |
|
#endif /* EXACT_CONSERV */ |
112 |
|
|
113 |
|
#ifdef NONLIN_FRSURF |
114 |
|
IF ( select_rStar.NE.0 ) THEN |
115 |
|
C-- r* : compute the future level thickness according to etaH(n+1) |
116 |
|
CALL TIMER_START('CALC_R_STAR [FORWARD_STEP]',mythid) |
117 |
|
CALL CALC_R_STAR(etaH, myTime, myIter, myThid ) |
118 |
|
CALL TIMER_STOP ('CALC_R_STAR [FORWARD_STEP]',mythid) |
119 |
|
ELSEIF ( nonlinFreeSurf.GT.0) THEN |
120 |
|
C-- compute the future surface level thickness according to etaH(n+1) |
121 |
|
CALL TIMER_START('CALC_SURF_DR [FORWARD_STEP]',mythid) |
122 |
|
CALL CALC_SURF_DR(etaH, myTime, myIter, myThid ) |
123 |
|
CALL TIMER_STOP ('CALC_SURF_DR [FORWARD_STEP]',mythid) |
124 |
|
ENDIF |
125 |
|
#endif /* NONLIN_FRSURF */ |
126 |
|
|
127 |
|
C-- Load forcing/external data fields. |
128 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
129 |
|
c************************************** |
130 |
|
#include "checkpoint_lev1_directives.h" |
131 |
|
c************************************** |
132 |
#endif |
#endif |
133 |
|
|
134 |
#ifdef ALLOW_SHAP_FILT |
|
135 |
C-- Step forward all tiles, filter and exchange. |
C-- Call external forcing package |
136 |
CALL TIMER_START('SHAP_FILT [FORWARD_STEP]',myThid) |
cswdblk -- add --- |
137 |
CALL SHAP_FILT_APPLY( |
#ifdef ALLOW_BULK_FORCE |
138 |
I gUnm1, gVnm1, gTnm1, gSnm1, |
CALL TIMER_START('BULKF_FIELDS_LOAD[THE_MAIN_LOOP]',mythid) |
139 |
I myCurrentTime, myCurrentIter, myThid ) |
CALL BULKF_FIELDS_LOAD( mytime, myiter, mythid ) |
140 |
CALL TIMER_STOP ('SHAP_FILT [FORWARD_STEP]',myThid) |
CALL TIMER_STOP ('BULKF_FIELDS_LOAD[THE_MAIN_LOOP]',mythid) |
141 |
|
c calculate qnet and empmr (and wind stress) |
142 |
|
DO bj=myByLo(myThid),myByHi(myThid) |
143 |
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
144 |
|
CALL BULKF_FORCING( bi,bj, mytime, myiter, mythid ) |
145 |
|
ENDDO |
146 |
|
ENDDO |
147 |
|
c Update the tile edges. |
148 |
|
_EXCH_XY_R8(Qnet, mythid) |
149 |
|
_EXCH_XY_R8(EmPmR, mythid) |
150 |
|
CALL EXCH_UV_XY_RS(fu, fv, .TRUE., myThid) |
151 |
|
C _EXCH_XY_R8(fu , mythid) |
152 |
|
C _EXCH_XY_R8(fv , mythid) |
153 |
|
cswdblk -- end add --- |
154 |
|
#else /* ALLOW_BULK_FORCE undef */ |
155 |
|
# ifdef INCLUDE_EXTERNAL_FORCING_PACKAGE |
156 |
|
C NOTE, that although the exf package is part of the |
157 |
|
C distribution, it is not currently maintained, i.e. |
158 |
|
C exf is disabled by default in genmake. |
159 |
|
CALL TIMER_START('EXF_GETFORCING [FORWARD_STEP]',mythid) |
160 |
|
CALL EXF_GETFORCING( mytime, myiter, mythid ) |
161 |
|
CALL TIMER_STOP ('EXF_GETFORCING [FORWARD_STEP]',mythid) |
162 |
|
# else /* INCLUDE_EXTERNAL_FORCING_PACKAGE undef */ |
163 |
|
cph The following IF-statement creates an additional dependency |
164 |
|
cph for the forcing fields requiring additional storing. |
165 |
|
cph Therefore, the IF-statement will be put between CPP-OPTIONS, |
166 |
|
cph assuming that ALLOW_SEAICE has not yet been differentiated. |
167 |
|
# ifdef ALLOW_SEAICE |
168 |
|
IF ( .NOT. useSEAICE ) THEN |
169 |
|
# endif |
170 |
|
CALL TIMER_START('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid) |
171 |
|
CALL EXTERNAL_FIELDS_LOAD( mytime, myiter, mythid ) |
172 |
|
CALL TIMER_STOP ('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid) |
173 |
|
# ifdef ALLOW_SEAICE |
174 |
|
ENDIF |
175 |
|
# endif |
176 |
|
# endif /* INCLUDE_EXTERNAL_FORCING_PACKAGE */ |
177 |
|
|
178 |
|
#if (defined (ALLOW_ADJOINT_RUN) || defined (ALLOW_TANGENTLINEAR_RUN)) |
179 |
|
c-- Add control vector for forcing and parameter fields |
180 |
|
if ( myiter .EQ. nIter0 ) |
181 |
|
& CALL CTRL_MAP_FORCING (mythid) |
182 |
#endif |
#endif |
183 |
|
|
184 |
#ifdef ALLOW_ZONAL_FILT |
# ifdef ALLOW_SEAICE |
185 |
CALL ZONAL_FILT_APPLY( |
C-- Call sea ice model to compute forcing/external data fields. In |
186 |
U gUnm1, gVnm1, gTnm1, gSnm1, |
C addition to computing prognostic sea-ice variables and diagnosing the |
187 |
I myThid ) |
C forcing/external data fields that drive the ocean model, SEAICE_MODEL |
188 |
|
C also sets theta to the freezing point under sea-ice. The implied |
189 |
|
C surface heat flux is then stored in variable surfaceTendencyTice, |
190 |
|
C which is needed by KPP package (kpp_calc.F and kpp_transport_t.F) |
191 |
|
C to diagnose surface buoyancy fluxes and for the non-local transport |
192 |
|
C term. Because this call precedes model thermodynamics, temperature |
193 |
|
C under sea-ice may not be "exactly" at the freezing point by the time |
194 |
|
C theta is dumped or time-averaged. |
195 |
|
IF ( useSEAICE ) THEN |
196 |
|
CALL TIMER_START('SEAICE_MODEL [FORWARD_STEP]',myThid) |
197 |
|
CALL SEAICE_MODEL( myTime, myIter, myThid ) |
198 |
|
CALL TIMER_STOP ('SEAICE_MODEL [FORWARD_STEP]',myThid) |
199 |
|
ENDIF |
200 |
|
# endif /* ALLOW_SEAICE */ |
201 |
|
#endif /* ALLOW_BULK_FORCE */ |
202 |
|
|
203 |
|
C-- Step forward fields and calculate time tendency terms. |
204 |
|
CALL TIMER_START('THERMODYNAMICS [FORWARD_STEP]',mythid) |
205 |
|
CALL THERMODYNAMICS( myTime, myIter, myThid ) |
206 |
|
CALL TIMER_STOP ('THERMODYNAMICS [FORWARD_STEP]',mythid) |
207 |
|
|
208 |
|
C-- do exchanges (needed for DYNAMICS) when using stagger time-step : |
209 |
|
CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
210 |
|
CALL DO_STAGGER_FIELDS_EXCHANGES( myTime, myIter, myThid ) |
211 |
|
CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
212 |
|
|
213 |
|
#ifdef ALLOW_SHAP_FILT |
214 |
|
IF (useSHAP_FILT .AND. |
215 |
|
& staggerTimeStep .AND. shap_filt_TrStagg ) THEN |
216 |
|
CALL TIMER_START('SHAP_FILT [FORWARD_STEP]',myThid) |
217 |
|
CALL SHAP_FILT_APPLY_TS( gT, gS, myTime, myIter, myThid ) |
218 |
|
CALL TIMER_STOP ('SHAP_FILT [FORWARD_STEP]',myThid) |
219 |
|
ENDIF |
220 |
#endif |
#endif |
221 |
|
#ifdef ALLOW_ZONAL_FILT |
222 |
|
IF (useZONAL_FILT .AND. |
223 |
|
& staggerTimeStep .AND. zonal_filt_TrStagg ) THEN |
224 |
|
CALL TIMER_START('ZONAL_FILT_APPLY [FORWARD_STEP]',myThid) |
225 |
|
CALL ZONAL_FILT_APPLY_TS( gT, gS, myThid ) |
226 |
|
CALL TIMER_STOP ('ZONAL_FILT_APPLY [FORWARD_STEP]',myThid) |
227 |
|
ENDIF |
228 |
|
#endif |
229 |
|
|
230 |
C-- Do IO if needed. |
C-- Step forward fields and calculate time tendency terms. |
231 |
C Note: |
IF ( momStepping ) THEN |
232 |
C ===== |
CALL TIMER_START('DYNAMICS [FORWARD_STEP]',mythid) |
233 |
C At this point model arrays hold U,V,T,S at "time-level" N |
CALL DYNAMICS( myTime, myIter, myThid ) |
234 |
C and cg2d_x at "time-level" N-1/2 where N = I+timeLevBase-1. |
CALL TIMER_STOP ('DYNAMICS [FORWARD_STEP]',mythid) |
235 |
C By convention this is taken to be the model "state". |
ENDIF |
|
CALL TIMER_START('I/O (WRITE) [FORWARD_STEP]',myThid) |
|
|
CALL DO_THE_MODEL_IO( |
|
|
& doHalfStep, myCurrentTime, myCurrentIter, myThid ) |
|
|
CALL TIMER_STOP ('I/O (WRITE) [FORWARD_STEP]',myThid) |
|
236 |
|
|
237 |
|
#ifdef ALLOW_NONHYDROSTATIC |
238 |
|
C-- Step forward W field in N-H algorithm |
239 |
|
IF ( momStepping .AND. nonHydrostatic ) THEN |
240 |
|
CALL TIMER_START('CALC_GW [FORWARD_STEP]',myThid) |
241 |
|
CALL CALC_GW(myThid) |
242 |
|
CALL TIMER_STOP ('CALC_GW [FORWARD_STEP]',myThid) |
243 |
|
ENDIF |
244 |
|
#endif |
245 |
|
|
246 |
IF (.NOT. doHalfStep) THEN |
#ifdef NONLIN_FRSURF |
247 |
|
C-- update hfacC,W,S and recip_hFac according to etaH(n+1) : |
248 |
|
IF ( nonlinFreeSurf.GT.0) THEN |
249 |
|
IF ( select_rStar.GT.0 ) THEN |
250 |
|
CALL TIMER_START('UPDATE_R_STAR [FORWARD_STEP]',myThid) |
251 |
|
CALL UPDATE_R_STAR( myTime, myIter, myThid ) |
252 |
|
CALL TIMER_STOP ('UPDATE_R_STAR [FORWARD_STEP]',myThid) |
253 |
|
ELSE |
254 |
|
CALL TIMER_START('UPDATE_SURF_DR [FORWARD_STEP]',myThid) |
255 |
|
CALL UPDATE_SURF_DR( myTime, myIter, myThid ) |
256 |
|
CALL TIMER_STOP ('UPDATE_SURF_DR [FORWARD_STEP]',myThid) |
257 |
|
ENDIF |
258 |
|
ENDIF |
259 |
|
C- update also CG2D matrix (and preconditioner) |
260 |
|
IF ( momStepping .AND. nonlinFreeSurf.GT.2 ) THEN |
261 |
|
CALL TIMER_START('UPDATE_CG2D [FORWARD_STEP]',myThid) |
262 |
|
CALL UPDATE_CG2D( myTime, myIter, myThid ) |
263 |
|
CALL TIMER_STOP ('UPDATE_CG2D [FORWARD_STEP]',myThid) |
264 |
|
ENDIF |
265 |
|
#endif |
266 |
|
|
267 |
|
C-- Apply Filters to u*,v* before SOLVE_FOR_PRESSURE |
268 |
|
#ifdef ALLOW_SHAP_FILT |
269 |
|
IF (useSHAP_FILT .AND. shap_filt_uvStar) THEN |
270 |
|
CALL TIMER_START('SHAP_FILT [FORWARD_STEP]',myThid) |
271 |
|
CALL SHAP_FILT_APPLY_UV( gU,gV, myTime,myIter,myThid ) |
272 |
|
IF (implicDiv2Dflow.LT.1.) THEN |
273 |
|
C-- Explicit+Implicit part of the Barotropic Flow Divergence |
274 |
|
C => Filtering of uVel,vVel is necessary |
275 |
|
CALL SHAP_FILT_APPLY_UV( uVel,vVel, myTime,myIter,myThid ) |
276 |
|
ENDIF |
277 |
|
CALL TIMER_STOP ('SHAP_FILT [FORWARD_STEP]',myThid) |
278 |
|
ENDIF |
279 |
|
#endif |
280 |
|
#ifdef ALLOW_ZONAL_FILT |
281 |
|
IF (useZONAL_FILT .AND. zonal_filt_uvStar) THEN |
282 |
|
CALL TIMER_START('ZONAL_FILT_APPLY [FORWARD_STEP]',myThid) |
283 |
|
CALL ZONAL_FILT_APPLY_UV( gU, gV, myThid ) |
284 |
|
IF (implicDiv2Dflow.LT.1.) THEN |
285 |
|
C-- Explicit+Implicit part of the Barotropic Flow Divergence |
286 |
|
C => Filtering of uVel,vVel is necessary |
287 |
|
CALL ZONAL_FILT_APPLY_UV( uVel, vVel, myThid ) |
288 |
|
ENDIF |
289 |
|
CALL TIMER_STOP ('ZONAL_FILT_APPLY [FORWARD_STEP]',myThid) |
290 |
|
ENDIF |
291 |
|
#endif |
292 |
|
|
293 |
C-- Solve elliptic equation(s). |
C-- Solve elliptic equation(s). |
294 |
C Two-dimensional only for conventional hydrostatic or |
C Two-dimensional only for conventional hydrostatic or |
295 |
C three-dimensional for non-hydrostatic and/or IGW scheme. |
C three-dimensional for non-hydrostatic and/or IGW scheme. |
296 |
CALL TIMER_START('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid) |
IF ( momStepping ) THEN |
297 |
CALL SOLVE_FOR_PRESSURE( myThid ) |
CALL TIMER_START('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid) |
298 |
CALL TIMER_STOP ('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid) |
CALL SOLVE_FOR_PRESSURE(myTime, myIter, myThid) |
299 |
|
CALL TIMER_STOP ('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid) |
300 |
|
ENDIF |
301 |
|
|
302 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
303 |
|
cph This is needed because convective_adjustment calls |
304 |
|
cph find_rho which may use pressure() |
305 |
|
CADJ STORE totphihyd = comlev1, key = ikey_dynamics |
306 |
|
#endif |
307 |
C-- Correct divergence in flow field and cycle time-stepping |
C-- Correct divergence in flow field and cycle time-stepping |
308 |
C arrays (for all fields) |
C arrays (for all fields) ; update time-counter |
309 |
CALL THE_CORRECTION_STEP(myCurrentTime, myCurrentIter, myThid) |
myIter = nIter0 + iLoop |
310 |
|
myTime = startTime + deltaTClock * float(iLoop) |
311 |
|
CALL TIMER_START('THE_CORRECTION_STEP [FORWARD_STEP]',myThid) |
312 |
|
CALL THE_CORRECTION_STEP(myTime, myIter, myThid) |
313 |
|
CALL TIMER_STOP ('THE_CORRECTION_STEP [FORWARD_STEP]',myThid) |
314 |
|
|
315 |
C-- Do "blocking" sends and receives for tendency "overlap" terms |
C-- Do "blocking" sends and receives for tendency "overlap" terms |
316 |
C CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
c CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
317 |
C CALL DO_GTERM_BLOCKING_EXCHANGES( myThid ) |
c CALL DO_GTERM_BLOCKING_EXCHANGES( myThid ) |
318 |
C CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
c CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
319 |
|
|
320 |
C-- Do "blocking" sends and receives for field "overlap" terms |
C-- Do "blocking" sends and receives for field "overlap" terms |
321 |
CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
322 |
CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid ) |
CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid ) |
323 |
CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
324 |
|
|
325 |
c myCurrentIter = myCurrentIter + 1 |
#ifdef ALLOW_FLT |
326 |
c myCurrentTime = myCurrentTime + deltaTClock |
C-- Calculate float trajectories |
327 |
myCurrentIter = nIter0 + iLoop |
IF (useFLT) THEN |
328 |
myCurrentTime = startTime + deltaTClock * float(iLoop) |
CALL TIMER_START('FLOATS [FORWARD_STEP]',myThid) |
329 |
|
CALL FLT_MAIN(myIter,myTime, myThid) |
330 |
|
CALL TIMER_STOP ('FLOATS [FORWARD_STEP]',myThid) |
331 |
|
ENDIF |
332 |
|
#endif |
333 |
|
|
334 |
|
#ifndef EXCLUDE_MONITOR |
335 |
|
C-- Check status of solution (statistics, cfl, etc...) |
336 |
|
CALL TIMER_START('MONITOR [FORWARD_STEP]',myThid) |
337 |
|
CALL MONITOR( myIter, myTime, myThid ) |
338 |
|
CALL TIMER_STOP ('MONITOR [FORWARD_STEP]',myThid) |
339 |
|
#endif /* EXCLUDE_MONITOR */ |
340 |
|
|
341 |
|
C-- Do IO if needed. |
342 |
|
CALL TIMER_START('DO_THE_MODEL_IO [FORWARD_STEP]',myThid) |
343 |
|
CALL DO_THE_MODEL_IO( myTime, myIter, myThid ) |
344 |
|
CALL TIMER_STOP ('DO_THE_MODEL_IO [FORWARD_STEP]',myThid) |
345 |
|
|
346 |
C-- Save state for restarts |
C-- Save state for restarts |
347 |
C Note: |
C Note: (jmc: is it still the case after ckp35 ?) |
348 |
C ===== |
C ===== |
349 |
C Because of the ordering of the timestepping code and |
C Because of the ordering of the timestepping code and |
350 |
C tendency term code at end of loop model arrays hold |
C tendency term code at end of loop model arrays hold |
351 |
C U,V,T,S at "time-level" N but gu, gv, gs, gt, guNM1,... |
C U,V,T,S at "time-level" N but gu, gv, gs, gt, guNM1,... |
352 |
C at "time-level" N+1/2 (guNM1 at "time-level" N+1/2 is |
C at "time-level" N+1/2 (guNM1 at "time-level" N+1/2 is |
353 |
C gu at "time-level" N-1/2) and cg2d_x at "time-level" N+1/2. |
C gu at "time-level" N-1/2) and etaN at "time-level" N+1/2. |
354 |
C where N = I+timeLevBase-1 |
C where N = I+timeLevBase-1 |
355 |
C Thus a checkpoint contains U.0000000000, GU.0000000001 and |
C Thus a checkpoint contains U.0000000000, GU.0000000001 and |
356 |
C cg2d_x.0000000001 in the indexing scheme used for the model |
C etaN.0000000001 in the indexing scheme used for the model |
357 |
C "state" files. This example is referred to as a checkpoint |
C "state" files. This example is referred to as a checkpoint |
358 |
C at time level 1 |
C at time level 1 |
359 |
CALL TIMER_START('I/O (WRITE) [FORWARD_STEP]',myThid) |
CALL TIMER_START('WRITE_CHECKPOINT [FORWARD_STEP]',myThid) |
360 |
CALL WRITE_CHECKPOINT( |
CALL WRITE_CHECKPOINT( |
361 |
& .FALSE., myCurrentTime, myCurrentIter, myThid ) |
& .FALSE., myTime, myIter, myThid ) |
362 |
CALL TIMER_STOP ('I/O (WRITE) [FORWARD_STEP]',myThid) |
CALL TIMER_STOP ('WRITE_CHECKPOINT [FORWARD_STEP]',myThid) |
|
|
|
|
ENDIF |
|
363 |
|
|
|
RETURN |
|
364 |
END |
END |