1 |
jmc |
1.100 |
C $Header: /u/gcmpack/MITgcm/model/src/forward_step.F,v 1.99 2004/07/13 16:48:48 jmc Exp $ |
2 |
adcroft |
1.15 |
C $Name: $ |
3 |
adcroft |
1.1 |
|
4 |
edhill |
1.64 |
#include "PACKAGES_CONFIG.h" |
5 |
adcroft |
1.1 |
#include "CPP_OPTIONS.h" |
6 |
edhill |
1.64 |
|
7 |
stephd |
1.55 |
cswdptr -- add -- |
8 |
heimbach |
1.56 |
#ifdef ALLOW_GCHEM |
9 |
|
|
# include "GCHEM_OPTIONS.h" |
10 |
stephd |
1.55 |
#endif |
11 |
|
|
cswdptr -- end add --- |
12 |
adcroft |
1.1 |
|
13 |
cnh |
1.22 |
CBOP |
14 |
|
|
C !ROUTINE: FORWARD_STEP |
15 |
|
|
C !INTERFACE: |
16 |
adcroft |
1.13 |
SUBROUTINE FORWARD_STEP( iloop, myTime, myIter, myThid ) |
17 |
heimbach |
1.12 |
|
18 |
cnh |
1.22 |
C !DESCRIPTION: \bv |
19 |
|
|
C *================================================================== |
20 |
|
|
C | SUBROUTINE forward_step |
21 |
|
|
C | o Run the ocean model and, optionally, evaluate a cost function. |
22 |
|
|
C *================================================================== |
23 |
|
|
C | |
24 |
|
|
C | THE_MAIN_LOOP is the toplevel routine for the Tangent Linear and |
25 |
|
|
C | Adjoint Model Compiler (TAMC). For this purpose the initialization |
26 |
|
|
C | of the model was split into two parts. Those parameters that do |
27 |
|
|
C | not depend on a specific model run are set in INITIALISE_FIXED, |
28 |
|
|
C | whereas those that do depend on the specific realization are |
29 |
|
|
C | initialized in INITIALISE_VARIA. |
30 |
|
|
C | |
31 |
|
|
C *================================================================== |
32 |
|
|
C \ev |
33 |
adcroft |
1.1 |
|
34 |
cnh |
1.22 |
C !USES: |
35 |
|
|
IMPLICIT NONE |
36 |
|
|
C == Global variables == |
37 |
adcroft |
1.1 |
#include "SIZE.h" |
38 |
|
|
#include "EEPARAMS.h" |
39 |
|
|
#include "PARAMS.h" |
40 |
|
|
#include "DYNVARS.h" |
41 |
|
|
|
42 |
jmc |
1.27 |
#ifdef ALLOW_SHAP_FILT |
43 |
jmc |
1.91 |
# include "SHAP_FILT.h" |
44 |
jmc |
1.27 |
#endif |
45 |
|
|
#ifdef ALLOW_ZONAL_FILT |
46 |
jmc |
1.91 |
# include "ZONAL_FILT.h" |
47 |
jmc |
1.27 |
#endif |
48 |
jmc |
1.93 |
#ifdef COMPONENT_MODULE |
49 |
|
|
# include "CPL_PARAMS.h" |
50 |
|
|
#endif |
51 |
jmc |
1.27 |
|
52 |
heimbach |
1.12 |
#ifdef ALLOW_AUTODIFF_TAMC |
53 |
jmc |
1.91 |
# include "FFIELDS.h" |
54 |
|
|
|
55 |
|
|
# ifdef ALLOW_NONHYDROSTATIC |
56 |
|
|
# include "CG3D.h" |
57 |
|
|
# endif |
58 |
|
|
|
59 |
heimbach |
1.30 |
# include "tamc.h" |
60 |
|
|
# include "ctrl.h" |
61 |
|
|
# include "ctrl_dummy.h" |
62 |
|
|
# include "cost.h" |
63 |
heimbach |
1.37 |
# include "EOS.h" |
64 |
edhill |
1.69 |
# ifdef ALLOW_EXF |
65 |
heimbach |
1.30 |
# include "exf_fields.h" |
66 |
heimbach |
1.85 |
# include "exf_clim_fields.h" |
67 |
jmc |
1.63 |
# ifdef ALLOW_BULKFORMULAE |
68 |
heimbach |
1.30 |
# include "exf_constants.h" |
69 |
|
|
# endif |
70 |
|
|
# endif |
71 |
|
|
# ifdef ALLOW_OBCS |
72 |
|
|
# include "OBCS.h" |
73 |
|
|
# endif |
74 |
heimbach |
1.56 |
# ifdef ALLOW_PTRACERS |
75 |
jmc |
1.99 |
# include "PTRACERS_SIZE.h" |
76 |
heimbach |
1.56 |
# include "PTRACERS.h" |
77 |
heimbach |
1.82 |
# endif |
78 |
|
|
# ifdef ALLOW_CD_CODE |
79 |
|
|
# include "CD_CODE_VARS.h" |
80 |
heimbach |
1.56 |
# endif |
81 |
heimbach |
1.92 |
# ifdef ALLOW_EBM |
82 |
|
|
# include "EBM.h" |
83 |
|
|
# endif |
84 |
heimbach |
1.56 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
85 |
heimbach |
1.12 |
|
86 |
cnh |
1.22 |
C !LOCAL VARIABLES: |
87 |
|
|
C == Routine arguments == |
88 |
adcroft |
1.13 |
C note: under the multi-threaded model myiter and |
89 |
|
|
C mytime are local variables passed around as routine |
90 |
|
|
C arguments. Although this is fiddly it saves the need to |
91 |
|
|
C impose additional synchronisation points when they are |
92 |
|
|
C updated. |
93 |
jmc |
1.93 |
C myIter - iteration counter for this thread |
94 |
|
|
C myTime - time counter for this thread |
95 |
|
|
C myThid - thread number for this instance of the routine. |
96 |
|
|
INTEGER iloop |
97 |
|
|
INTEGER myThid |
98 |
|
|
INTEGER myIter |
99 |
|
|
_RL myTime |
100 |
molod |
1.83 |
|
101 |
jmc |
1.93 |
C == Local variables == |
102 |
|
|
INTEGER myItP1 |
103 |
cnh |
1.22 |
CEOP |
104 |
heimbach |
1.12 |
|
105 |
edhill |
1.71 |
#ifdef ALLOW_DEBUG |
106 |
heimbach |
1.57 |
IF ( debugLevel .GE. debLevB ) |
107 |
|
|
& CALL DEBUG_ENTER('FORWARD_STEP',myThid) |
108 |
adcroft |
1.53 |
#endif |
109 |
|
|
|
110 |
heimbach |
1.12 |
#ifdef ALLOW_AUTODIFF_TAMC |
111 |
dimitri |
1.45 |
C-- Reset the model iteration counter and the model time. |
112 |
|
|
myiter = nIter0 + (iloop-1) |
113 |
|
|
mytime = startTime + float(iloop-1)*deltaTclock |
114 |
heimbach |
1.12 |
#endif |
115 |
|
|
|
116 |
heimbach |
1.32 |
#if (defined (ALLOW_AUTODIFF_TAMC) && defined (ALLOW_AUTODIFF_MONITOR)) |
117 |
dimitri |
1.45 |
C Include call to a dummy routine. Its adjoint will be |
118 |
|
|
C called at the proper place in the adjoint code. |
119 |
|
|
C The adjoint routine will print out adjoint values |
120 |
|
|
C if requested. The location of the call is important, |
121 |
|
|
C it has to be after the adjoint of the exchanges |
122 |
|
|
C (DO_GTERM_BLOCKING_EXCHANGES). |
123 |
|
|
CALL DUMMY_IN_STEPPING( myTime, myIter, myThid ) |
124 |
heimbach |
1.46 |
cph I've commented this line since it may conflict with MITgcm's adjoint |
125 |
|
|
cph However, need to check whether that's still consistent |
126 |
|
|
cph with the ecco-branch (it should). |
127 |
|
|
cph CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid ) |
128 |
heimbach |
1.16 |
#endif |
129 |
|
|
|
130 |
heimbach |
1.28 |
#ifdef ALLOW_AUTODIFF_TAMC |
131 |
|
|
c************************************** |
132 |
|
|
#include "checkpoint_lev1_directives.h" |
133 |
|
|
c************************************** |
134 |
heimbach |
1.23 |
#endif |
135 |
cheisey |
1.38 |
|
136 |
heimbach |
1.37 |
C-- Call external forcing package |
137 |
cheisey |
1.40 |
#ifdef ALLOW_BULK_FORCE |
138 |
jmc |
1.76 |
IF ( useBulkForce ) THEN |
139 |
edhill |
1.71 |
#ifdef ALLOW_DEBUG |
140 |
jmc |
1.58 |
IF ( debugLevel .GE. debLevB ) |
141 |
heimbach |
1.57 |
& CALL DEBUG_CALL('BULKF_FIELDS_LOAD',myThid) |
142 |
adcroft |
1.53 |
#endif |
143 |
jmc |
1.76 |
CALL TIMER_START('BULKF_FORCING [FORWARD_STEP]',mythid) |
144 |
|
|
C- load all forcing fields at current time |
145 |
|
|
CALL BULKF_FIELDS_LOAD( myTime, myIter, myThid ) |
146 |
|
|
C- calculate qnet and empmr (and wind stress) |
147 |
|
|
CALL BULKF_FORCING( myTime, myIter, myThid ) |
148 |
|
|
CALL TIMER_STOP ('BULKF_FORCING [FORWARD_STEP]',mythid) |
149 |
jmc |
1.63 |
ELSE |
150 |
jmc |
1.58 |
#endif /* ALLOW_BULK_FORCE */ |
151 |
jmc |
1.63 |
|
152 |
edhill |
1.64 |
# ifdef ALLOW_EXF |
153 |
heimbach |
1.72 |
# ifdef ALLOW_DEBUG |
154 |
heimbach |
1.57 |
IF ( debugLevel .GE. debLevB ) |
155 |
|
|
& CALL DEBUG_CALL('EXF_GETFORCING',myThid) |
156 |
heimbach |
1.72 |
# endif |
157 |
dimitri |
1.45 |
CALL TIMER_START('EXF_GETFORCING [FORWARD_STEP]',mythid) |
158 |
|
|
CALL EXF_GETFORCING( mytime, myiter, mythid ) |
159 |
|
|
CALL TIMER_STOP ('EXF_GETFORCING [FORWARD_STEP]',mythid) |
160 |
edhill |
1.64 |
# else /* ALLOW_EXF undef */ |
161 |
heimbach |
1.49 |
cph The following IF-statement creates an additional dependency |
162 |
|
|
cph for the forcing fields requiring additional storing. |
163 |
|
|
cph Therefore, the IF-statement will be put between CPP-OPTIONS, |
164 |
|
|
cph assuming that ALLOW_SEAICE has not yet been differentiated. |
165 |
heimbach |
1.92 |
# if (defined (ALLOW_SEAICE) || defined (ALLOW_EBM)) |
166 |
|
|
IF ( .NOT. useSEAICE .AND. .NOT. useEBM ) THEN |
167 |
heimbach |
1.49 |
# endif |
168 |
edhill |
1.71 |
#ifdef ALLOW_DEBUG |
169 |
heimbach |
1.57 |
IF ( debugLevel .GE. debLevB ) |
170 |
|
|
& CALL DEBUG_CALL('EXTERNAL_FIELDS_LOAD',myThid) |
171 |
adcroft |
1.53 |
#endif |
172 |
dimitri |
1.45 |
CALL TIMER_START('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid) |
173 |
|
|
CALL EXTERNAL_FIELDS_LOAD( mytime, myiter, mythid ) |
174 |
|
|
CALL TIMER_STOP ('EXTERNAL_FIELDS_LOAD[FORWARD_STEP]',mythid) |
175 |
heimbach |
1.92 |
# if (defined (ALLOW_SEAICE) || defined (ALLOW_EBM)) |
176 |
dimitri |
1.45 |
ENDIF |
177 |
heimbach |
1.49 |
# endif |
178 |
edhill |
1.64 |
# endif /* ALLOW_EXF */ |
179 |
jmc |
1.63 |
#ifdef ALLOW_BULK_FORCE |
180 |
|
|
C-- end of if/else block useBulfforce -- |
181 |
|
|
ENDIF |
182 |
|
|
#endif /* ALLOW_BULK_FORCE */ |
183 |
heimbach |
1.49 |
|
184 |
heimbach |
1.68 |
#ifdef ALLOW_AUTODIFF |
185 |
heimbach |
1.49 |
c-- Add control vector for forcing and parameter fields |
186 |
|
|
if ( myiter .EQ. nIter0 ) |
187 |
|
|
& CALL CTRL_MAP_FORCING (mythid) |
188 |
|
|
#endif |
189 |
cheisey |
1.38 |
|
190 |
heimbach |
1.49 |
# ifdef ALLOW_SEAICE |
191 |
dimitri |
1.45 |
C-- Call sea ice model to compute forcing/external data fields. In |
192 |
|
|
C addition to computing prognostic sea-ice variables and diagnosing the |
193 |
|
|
C forcing/external data fields that drive the ocean model, SEAICE_MODEL |
194 |
|
|
C also sets theta to the freezing point under sea-ice. The implied |
195 |
|
|
C surface heat flux is then stored in variable surfaceTendencyTice, |
196 |
|
|
C which is needed by KPP package (kpp_calc.F and kpp_transport_t.F) |
197 |
|
|
C to diagnose surface buoyancy fluxes and for the non-local transport |
198 |
|
|
C term. Because this call precedes model thermodynamics, temperature |
199 |
|
|
C under sea-ice may not be "exactly" at the freezing point by the time |
200 |
|
|
C theta is dumped or time-averaged. |
201 |
|
|
IF ( useSEAICE ) THEN |
202 |
edhill |
1.71 |
#ifdef ALLOW_DEBUG |
203 |
heimbach |
1.57 |
IF ( debugLevel .GE. debLevB ) |
204 |
|
|
& CALL DEBUG_CALL('SEAICE_MODEL',myThid) |
205 |
adcroft |
1.53 |
#endif |
206 |
heimbach |
1.36 |
CALL TIMER_START('SEAICE_MODEL [FORWARD_STEP]',myThid) |
207 |
jmc |
1.41 |
CALL SEAICE_MODEL( myTime, myIter, myThid ) |
208 |
heimbach |
1.36 |
CALL TIMER_STOP ('SEAICE_MODEL [FORWARD_STEP]',myThid) |
209 |
dimitri |
1.45 |
ENDIF |
210 |
dimitri |
1.50 |
# endif /* ALLOW_SEAICE */ |
211 |
dimitri |
1.73 |
|
212 |
heimbach |
1.56 |
#ifdef ALLOW_AUTODIFF_TAMC |
213 |
|
|
# ifdef ALLOW_PTRACERS |
214 |
|
|
cph this replaces _bibj storing of ptracer within thermodynamics |
215 |
|
|
CADJ STORE ptracer = comlev1, key = ikey_dynamics |
216 |
|
|
# endif |
217 |
|
|
#endif |
218 |
stephd |
1.62 |
|
219 |
|
|
#ifdef ALLOW_PTRACERS |
220 |
|
|
# ifdef ALLOW_GCHEM |
221 |
|
|
CALL GCHEM_FIELDS_LOAD( mytime, myiter, mythid ) |
222 |
|
|
# endif |
223 |
|
|
#endif |
224 |
jmc |
1.78 |
|
225 |
|
|
#ifdef COMPONENT_MODULE |
226 |
jmc |
1.93 |
IF ( useCoupler .AND. cpl_earlyExpImpCall ) THEN |
227 |
jmc |
1.78 |
C Post coupling data that I export. |
228 |
|
|
C Read in coupling data that I import. |
229 |
|
|
CALL TIMER_START('CPL_EXPORT-IMPORT [FORWARD_STEP]',myThid) |
230 |
|
|
CALL CPL_EXPORT_MY_DATA( myIter, myTime, myThid ) |
231 |
|
|
CALL CPL_IMPORT_EXTERNAL_DATA( myIter, myTime, myThid ) |
232 |
|
|
CALL TIMER_STOP ('CPL_EXPORT-IMPORT [FORWARD_STEP]',myThid) |
233 |
|
|
ENDIF |
234 |
|
|
#endif /* COMPONENT_MODULE */ |
235 |
stephd |
1.62 |
|
236 |
heimbach |
1.92 |
#ifdef ALLOW_EBM |
237 |
|
|
IF ( useEBM ) THEN |
238 |
|
|
# ifdef ALLOW_DEBUG |
239 |
|
|
IF ( debugLevel .GE. debLevB ) |
240 |
|
|
& CALL DEBUG_CALL('EBM',myThid) |
241 |
|
|
# endif |
242 |
|
|
CALL TIMER_START('EBM [FORWARD_STEP]',mythid) |
243 |
|
|
CALL EBM_DRIVER ( myTime, myIter, myThid ) |
244 |
|
|
CALL TIMER_STOP ('EBM [FORWARD_STEP]',mythid) |
245 |
|
|
ENDIF |
246 |
|
|
#endif |
247 |
molod |
1.79 |
|
248 |
jmc |
1.97 |
C-- Step forward fields and calculate time tendency terms. |
249 |
|
|
|
250 |
|
|
#ifdef ALLOW_DEBUG |
251 |
|
|
IF ( debugLevel .GE. debLevB ) |
252 |
|
|
& CALL DEBUG_CALL('DO_ATMOSPHERIC_PHYS',myThid) |
253 |
|
|
#endif |
254 |
|
|
CALL TIMER_START('DO_ATMOSPHERIC_PHYS [FORWARD_STEP]',mythid) |
255 |
|
|
CALL DO_ATMOSPHERIC_PHYS( myTime, myIter, myThid ) |
256 |
|
|
CALL TIMER_STOP ('DO_ATMOSPHERIC_PHYS [FORWARD_STEP]',mythid) |
257 |
|
|
|
258 |
edhill |
1.71 |
#ifdef ALLOW_DEBUG |
259 |
jmc |
1.96 |
IF ( debugLevel .GE. debLevB ) |
260 |
|
|
& CALL DEBUG_CALL('DO_OCEANIC_PHYS',myThid) |
261 |
|
|
#endif |
262 |
|
|
CALL TIMER_START('DO_OCEANIC_PHYS [FORWARD_STEP]',mythid) |
263 |
|
|
CALL DO_OCEANIC_PHYS( myTime, myIter, myThid ) |
264 |
|
|
CALL TIMER_STOP ('DO_OCEANIC_PHYS [FORWARD_STEP]',mythid) |
265 |
|
|
|
266 |
|
|
IF ( .NOT.staggerTimeStep ) THEN |
267 |
|
|
#ifdef ALLOW_DEBUG |
268 |
|
|
IF ( debugLevel .GE. debLevB ) |
269 |
heimbach |
1.57 |
& CALL DEBUG_CALL('THERMODYNAMICS',myThid) |
270 |
adcroft |
1.53 |
#endif |
271 |
heimbach |
1.36 |
CALL TIMER_START('THERMODYNAMICS [FORWARD_STEP]',mythid) |
272 |
adcroft |
1.15 |
CALL THERMODYNAMICS( myTime, myIter, myThid ) |
273 |
heimbach |
1.36 |
CALL TIMER_STOP ('THERMODYNAMICS [FORWARD_STEP]',mythid) |
274 |
jmc |
1.96 |
C-- if not staggerTimeStep: end |
275 |
dimitri |
1.45 |
ENDIF |
276 |
jmc |
1.93 |
|
277 |
|
|
#ifdef COMPONENT_MODULE |
278 |
|
|
IF ( useCoupler .AND. .NOT.cpl_earlyExpImpCall ) THEN |
279 |
|
|
C Post coupling data that I export. |
280 |
|
|
C Read in coupling data that I import. |
281 |
|
|
myItP1 = myIter + 1 |
282 |
|
|
CALL TIMER_START('CPL_EXPORT-IMPORT [FORWARD_STEP]',myThid) |
283 |
|
|
CALL CPL_EXPORT_MY_DATA( myItP1, myTime, myThid ) |
284 |
|
|
CALL CPL_IMPORT_EXTERNAL_DATA( myItP1, myTime, myThid ) |
285 |
|
|
CALL TIMER_STOP ('CPL_EXPORT-IMPORT [FORWARD_STEP]',myThid) |
286 |
|
|
# ifndef ALLOW_AIM |
287 |
|
|
IF ( useRealFreshWaterFlux ) THEN |
288 |
|
|
CALL OCN_APPLY_IMPORT( .FALSE., myTime, myIter, myThid ) |
289 |
|
|
ENDIF |
290 |
|
|
# endif |
291 |
|
|
ENDIF |
292 |
|
|
#endif /* COMPONENT_MODULE */ |
293 |
heimbach |
1.12 |
|
294 |
dimitri |
1.45 |
C-- Step forward fields and calculate time tendency terms. |
295 |
heimbach |
1.61 |
#ifndef ALLOW_AUTODIFF_TAMC |
296 |
dimitri |
1.45 |
IF ( momStepping ) THEN |
297 |
heimbach |
1.61 |
#endif |
298 |
edhill |
1.71 |
#ifdef ALLOW_DEBUG |
299 |
heimbach |
1.57 |
IF ( debugLevel .GE. debLevB ) |
300 |
|
|
& CALL DEBUG_CALL('DYNAMICS',myThid) |
301 |
adcroft |
1.53 |
#endif |
302 |
heimbach |
1.36 |
CALL TIMER_START('DYNAMICS [FORWARD_STEP]',mythid) |
303 |
heimbach |
1.12 |
CALL DYNAMICS( myTime, myIter, myThid ) |
304 |
heimbach |
1.36 |
CALL TIMER_STOP ('DYNAMICS [FORWARD_STEP]',mythid) |
305 |
heimbach |
1.61 |
#ifndef ALLOW_AUTODIFF_TAMC |
306 |
dimitri |
1.45 |
ENDIF |
307 |
heimbach |
1.61 |
#endif |
308 |
heimbach |
1.12 |
|
309 |
adcroft |
1.1 |
#ifdef ALLOW_NONHYDROSTATIC |
310 |
|
|
C-- Step forward W field in N-H algorithm |
311 |
dimitri |
1.45 |
IF ( momStepping .AND. nonHydrostatic ) THEN |
312 |
edhill |
1.71 |
#ifdef ALLOW_DEBUG |
313 |
heimbach |
1.57 |
IF ( debugLevel .GE. debLevB ) |
314 |
|
|
& CALL DEBUG_CALL('CALC_GW',myThid) |
315 |
adcroft |
1.53 |
#endif |
316 |
dimitri |
1.45 |
CALL TIMER_START('CALC_GW [FORWARD_STEP]',myThid) |
317 |
|
|
CALL CALC_GW(myThid) |
318 |
|
|
CALL TIMER_STOP ('CALC_GW [FORWARD_STEP]',myThid) |
319 |
|
|
ENDIF |
320 |
adcroft |
1.1 |
#endif |
321 |
jmc |
1.18 |
|
322 |
jmc |
1.96 |
C-- Update time-counter |
323 |
|
|
myIter = nIter0 + iLoop |
324 |
|
|
myTime = startTime + deltaTClock * float(iLoop) |
325 |
|
|
|
326 |
|
|
C-- Update geometric factors: |
327 |
jmc |
1.18 |
#ifdef NONLIN_FRSURF |
328 |
jmc |
1.96 |
C- update hfacC,W,S and recip_hFac according to etaH(n+1) : |
329 |
jmc |
1.18 |
IF ( nonlinFreeSurf.GT.0) THEN |
330 |
jmc |
1.48 |
IF ( select_rStar.GT.0 ) THEN |
331 |
|
|
CALL TIMER_START('UPDATE_R_STAR [FORWARD_STEP]',myThid) |
332 |
|
|
CALL UPDATE_R_STAR( myTime, myIter, myThid ) |
333 |
|
|
CALL TIMER_STOP ('UPDATE_R_STAR [FORWARD_STEP]',myThid) |
334 |
|
|
ELSE |
335 |
dimitri |
1.45 |
CALL TIMER_START('UPDATE_SURF_DR [FORWARD_STEP]',myThid) |
336 |
jmc |
1.18 |
CALL UPDATE_SURF_DR( myTime, myIter, myThid ) |
337 |
heimbach |
1.36 |
CALL TIMER_STOP ('UPDATE_SURF_DR [FORWARD_STEP]',myThid) |
338 |
jmc |
1.48 |
ENDIF |
339 |
jmc |
1.18 |
ENDIF |
340 |
|
|
C- update also CG2D matrix (and preconditioner) |
341 |
jmc |
1.33 |
IF ( momStepping .AND. nonlinFreeSurf.GT.2 ) THEN |
342 |
dimitri |
1.45 |
CALL TIMER_START('UPDATE_CG2D [FORWARD_STEP]',myThid) |
343 |
jmc |
1.18 |
CALL UPDATE_CG2D( myTime, myIter, myThid ) |
344 |
jmc |
1.47 |
CALL TIMER_STOP ('UPDATE_CG2D [FORWARD_STEP]',myThid) |
345 |
adcroft |
1.19 |
ENDIF |
346 |
jmc |
1.18 |
#endif |
347 |
adcroft |
1.1 |
|
348 |
jmc |
1.27 |
C-- Apply Filters to u*,v* before SOLVE_FOR_PRESSURE |
349 |
|
|
#ifdef ALLOW_SHAP_FILT |
350 |
|
|
IF (useSHAP_FILT .AND. shap_filt_uvStar) THEN |
351 |
heimbach |
1.36 |
CALL TIMER_START('SHAP_FILT [FORWARD_STEP]',myThid) |
352 |
jmc |
1.27 |
IF (implicDiv2Dflow.LT.1.) THEN |
353 |
|
|
C-- Explicit+Implicit part of the Barotropic Flow Divergence |
354 |
|
|
C => Filtering of uVel,vVel is necessary |
355 |
jmc |
1.59 |
CALL SHAP_FILT_APPLY_UV( uVel,vVel, |
356 |
jmc |
1.96 |
& myTime, myIter, myThid ) |
357 |
jmc |
1.27 |
ENDIF |
358 |
jmc |
1.96 |
CALL SHAP_FILT_APPLY_UV( gU,gV,myTime,myIter,myThid) |
359 |
heimbach |
1.36 |
CALL TIMER_STOP ('SHAP_FILT [FORWARD_STEP]',myThid) |
360 |
jmc |
1.27 |
ENDIF |
361 |
|
|
#endif |
362 |
|
|
#ifdef ALLOW_ZONAL_FILT |
363 |
|
|
IF (useZONAL_FILT .AND. zonal_filt_uvStar) THEN |
364 |
heimbach |
1.36 |
CALL TIMER_START('ZONAL_FILT_APPLY [FORWARD_STEP]',myThid) |
365 |
jmc |
1.27 |
IF (implicDiv2Dflow.LT.1.) THEN |
366 |
|
|
C-- Explicit+Implicit part of the Barotropic Flow Divergence |
367 |
|
|
C => Filtering of uVel,vVel is necessary |
368 |
|
|
CALL ZONAL_FILT_APPLY_UV( uVel, vVel, myThid ) |
369 |
|
|
ENDIF |
370 |
jmc |
1.59 |
CALL ZONAL_FILT_APPLY_UV( gU, gV, myThid ) |
371 |
heimbach |
1.36 |
CALL TIMER_STOP ('ZONAL_FILT_APPLY [FORWARD_STEP]',myThid) |
372 |
jmc |
1.27 |
ENDIF |
373 |
|
|
#endif |
374 |
heimbach |
1.12 |
|
375 |
adcroft |
1.1 |
C-- Solve elliptic equation(s). |
376 |
|
|
C Two-dimensional only for conventional hydrostatic or |
377 |
|
|
C three-dimensional for non-hydrostatic and/or IGW scheme. |
378 |
adcroft |
1.19 |
IF ( momStepping ) THEN |
379 |
jmc |
1.96 |
CALL TIMER_START('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid) |
380 |
|
|
CALL SOLVE_FOR_PRESSURE(myTime, myIter, myThid) |
381 |
|
|
CALL TIMER_STOP ('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid) |
382 |
|
|
ENDIF |
383 |
|
|
|
384 |
|
|
C-- Correct divergence in flow field and cycle time-stepping momentum |
385 |
|
|
c IF ( momStepping ) THEN |
386 |
|
|
CALL TIMER_START('UV_CORRECTION_STEP [FORWARD_STEP]',myThid) |
387 |
|
|
CALL MOMENTUM_CORRECTION_STEP(myTime, myIter, myThid) |
388 |
|
|
CALL TIMER_STOP ('UV_CORRECTION_STEP [FORWARD_STEP]',myThid) |
389 |
|
|
c ENDIF |
390 |
|
|
|
391 |
|
|
#ifdef EXACT_CONSERV |
392 |
|
|
IF (exactConserv) THEN |
393 |
|
|
C-- Update etaH(n+1) : |
394 |
|
|
CALL TIMER_START('UPDATE_ETAH [FORWARD_STEP]',mythid) |
395 |
|
|
CALL UPDATE_ETAH( myTime, myIter, myThid ) |
396 |
|
|
CALL TIMER_STOP ('UPDATE_ETAH [FORWARD_STEP]',mythid) |
397 |
adcroft |
1.19 |
ENDIF |
398 |
jmc |
1.96 |
#endif /* EXACT_CONSERV */ |
399 |
|
|
|
400 |
|
|
#ifdef NONLIN_FRSURF |
401 |
|
|
IF ( select_rStar.NE.0 ) THEN |
402 |
|
|
C-- r* : compute the future level thickness according to etaH(n+1) |
403 |
|
|
CALL TIMER_START('CALC_R_STAR [FORWARD_STEP]',mythid) |
404 |
|
|
CALL CALC_R_STAR(etaH, myTime, myIter, myThid ) |
405 |
|
|
CALL TIMER_STOP ('CALC_R_STAR [FORWARD_STEP]',mythid) |
406 |
|
|
ELSEIF ( nonlinFreeSurf.GT.0) THEN |
407 |
|
|
C-- compute the future surface level thickness according to etaH(n+1) |
408 |
|
|
CALL TIMER_START('CALC_SURF_DR [FORWARD_STEP]',mythid) |
409 |
|
|
CALL CALC_SURF_DR(etaH, myTime, myIter, myThid ) |
410 |
|
|
CALL TIMER_STOP ('CALC_SURF_DR [FORWARD_STEP]',mythid) |
411 |
|
|
ENDIF |
412 |
|
|
#endif /* NONLIN_FRSURF */ |
413 |
|
|
|
414 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
415 |
|
|
IF ( staggerTimeStep ) THEN |
416 |
jmc |
1.98 |
C-- do exchanges of U,V (needed for multiDim) when using stagger time-step : |
417 |
|
|
#ifdef ALLOW_DEBUG |
418 |
|
|
IF ( debugLevel .GE. debLevB ) |
419 |
|
|
& CALL DEBUG_CALL('DO_STAGGER_FIELDS_EXCH.',myThid) |
420 |
|
|
#endif |
421 |
|
|
CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
422 |
|
|
CALL DO_STAGGER_FIELDS_EXCHANGES( myTime, myIter, myThid ) |
423 |
|
|
CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
424 |
jmc |
1.96 |
|
425 |
|
|
#ifdef ALLOW_DEBUG |
426 |
|
|
IF ( debugLevel .GE. debLevB ) |
427 |
|
|
& CALL DEBUG_CALL('THERMODYNAMICS',myThid) |
428 |
|
|
#endif |
429 |
|
|
CALL TIMER_START('THERMODYNAMICS [FORWARD_STEP]',mythid) |
430 |
|
|
CALL THERMODYNAMICS( myTime, myIter, myThid ) |
431 |
|
|
CALL TIMER_STOP ('THERMODYNAMICS [FORWARD_STEP]',mythid) |
432 |
|
|
|
433 |
|
|
C-- if staggerTimeStep: end |
434 |
|
|
ENDIF |
435 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
436 |
adcroft |
1.1 |
|
437 |
heimbach |
1.37 |
#ifdef ALLOW_AUTODIFF_TAMC |
438 |
|
|
cph This is needed because convective_adjustment calls |
439 |
|
|
cph find_rho which may use pressure() |
440 |
heimbach |
1.51 |
CADJ STORE totphihyd = comlev1, key = ikey_dynamics |
441 |
heimbach |
1.37 |
#endif |
442 |
jmc |
1.96 |
C-- Cycle time-stepping Tracers arrays (T,S,+pTracers) |
443 |
|
|
CALL TIMER_START('TS_CORRECTION_STEP [FORWARD_STEP]',myThid) |
444 |
|
|
CALL TRACERS_CORRECTION_STEP(myTime, myIter, myThid) |
445 |
|
|
CALL TIMER_STOP ('TS_CORRECTION_STEP [FORWARD_STEP]',myThid) |
446 |
adcroft |
1.5 |
|
447 |
adcroft |
1.1 |
C-- Do "blocking" sends and receives for tendency "overlap" terms |
448 |
heimbach |
1.36 |
c CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
449 |
jmc |
1.7 |
c CALL DO_GTERM_BLOCKING_EXCHANGES( myThid ) |
450 |
heimbach |
1.36 |
c CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
451 |
adcroft |
1.5 |
|
452 |
|
|
C-- Do "blocking" sends and receives for field "overlap" terms |
453 |
heimbach |
1.36 |
CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
454 |
adcroft |
1.5 |
CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid ) |
455 |
heimbach |
1.36 |
CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
456 |
stephd |
1.54 |
|
457 |
|
|
cswdptr -- add for seperate timestepping of chemical/biological/forcing |
458 |
|
|
cswdptr of ptracers --- |
459 |
heimbach |
1.56 |
#ifdef ALLOW_GCHEM |
460 |
edhill |
1.64 |
ceh3 This is broken -- this ifdef should not be visible! |
461 |
stephd |
1.62 |
#ifdef PTRACERS_SEPARATE_FORCING |
462 |
edhill |
1.64 |
ceh3 needs an IF ( use GCHEM ) THEN |
463 |
stephd |
1.62 |
call GCHEM_FORCING_SEP( myTime,myIter,myThid ) |
464 |
edhill |
1.64 |
#endif /* PTRACERS_SEPARATE_FORCING */ |
465 |
|
|
#endif /* ALLOW_GCHEM */ |
466 |
stephd |
1.54 |
cswdptr -- end add --- |
467 |
molod |
1.83 |
|
468 |
|
|
C AMM |
469 |
|
|
#ifdef ALLOW_GRIDALT |
470 |
molod |
1.88 |
if (useGRIDALT) then |
471 |
|
|
CALL GRIDALT_UPDATE(myThid) |
472 |
molod |
1.89 |
endif |
473 |
molod |
1.83 |
#endif |
474 |
|
|
C AMM |
475 |
stephd |
1.54 |
|
476 |
molod |
1.79 |
C AMM |
477 |
|
|
#ifdef ALLOW_FIZHI |
478 |
molod |
1.88 |
if( useFIZHI) then |
479 |
molod |
1.90 |
CALL TIMER_START('FIZHI [FORWARD_STEP]',mythid) |
480 |
molod |
1.88 |
CALL STEP_FIZHI_CORR ( myTime, myIter, myThid ) |
481 |
molod |
1.90 |
CALL TIMER_STOP('FIZHI [FORWARD_STEP]',mythid) |
482 |
molod |
1.88 |
endif |
483 |
molod |
1.79 |
#endif |
484 |
|
|
C AMM |
485 |
adcroft |
1.20 |
|
486 |
|
|
#ifdef ALLOW_FLT |
487 |
|
|
C-- Calculate float trajectories |
488 |
|
|
IF (useFLT) THEN |
489 |
heimbach |
1.36 |
CALL TIMER_START('FLOATS [FORWARD_STEP]',myThid) |
490 |
adcroft |
1.20 |
CALL FLT_MAIN(myIter,myTime, myThid) |
491 |
heimbach |
1.36 |
CALL TIMER_STOP ('FLOATS [FORWARD_STEP]',myThid) |
492 |
adcroft |
1.20 |
ENDIF |
493 |
|
|
#endif |
494 |
heimbach |
1.12 |
|
495 |
jmc |
1.97 |
C-- State-variables statistics (time-aver, diagnostics ...) |
496 |
|
|
CALL TIMER_START('DO_STATEVARS_DIAGS [FORWARD_STEP]',myThid) |
497 |
|
|
CALL DO_STATEVARS_DIAGS( myTime, myIter, myThid ) |
498 |
|
|
CALL TIMER_STOP ('DO_STATEVARS_DIAGS [FORWARD_STEP]',myThid) |
499 |
|
|
|
500 |
edhill |
1.70 |
#ifdef ALLOW_MONITOR |
501 |
heimbach |
1.12 |
C-- Check status of solution (statistics, cfl, etc...) |
502 |
dimitri |
1.45 |
CALL TIMER_START('MONITOR [FORWARD_STEP]',myThid) |
503 |
heimbach |
1.12 |
CALL MONITOR( myIter, myTime, myThid ) |
504 |
heimbach |
1.36 |
CALL TIMER_STOP ('MONITOR [FORWARD_STEP]',myThid) |
505 |
edhill |
1.70 |
#endif /* ALLOW_MONITOR */ |
506 |
molod |
1.86 |
|
507 |
jmc |
1.7 |
C-- Do IO if needed. |
508 |
heimbach |
1.36 |
CALL TIMER_START('DO_THE_MODEL_IO [FORWARD_STEP]',myThid) |
509 |
heimbach |
1.12 |
CALL DO_THE_MODEL_IO( myTime, myIter, myThid ) |
510 |
heimbach |
1.36 |
CALL TIMER_STOP ('DO_THE_MODEL_IO [FORWARD_STEP]',myThid) |
511 |
adcroft |
1.1 |
|
512 |
|
|
C-- Save state for restarts |
513 |
heimbach |
1.36 |
CALL TIMER_START('WRITE_CHECKPOINT [FORWARD_STEP]',myThid) |
514 |
jmc |
1.77 |
CALL PACKAGES_WRITE_PICKUP( |
515 |
|
|
I .FALSE., myTime, myIter, myThid ) |
516 |
adcroft |
1.1 |
CALL WRITE_CHECKPOINT( |
517 |
jmc |
1.77 |
I .FALSE., myTime, myIter, myThid ) |
518 |
heimbach |
1.36 |
CALL TIMER_STOP ('WRITE_CHECKPOINT [FORWARD_STEP]',myThid) |
519 |
adcroft |
1.53 |
|
520 |
edhill |
1.71 |
#ifdef ALLOW_DEBUG |
521 |
heimbach |
1.57 |
IF ( debugLevel .GE. debLevB ) |
522 |
|
|
& CALL DEBUG_LEAVE('FORWARD_STEP',myThid) |
523 |
adcroft |
1.53 |
#endif |
524 |
adcroft |
1.1 |
|
525 |
jmc |
1.77 |
RETURN |
526 |
adcroft |
1.1 |
END |