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