22 |
C | C*P* comments indicating place holders for which code is | |
C | C*P* comments indicating place holders for which code is | |
23 |
C | presently being developed. | |
C | presently being developed. | |
24 |
C \==========================================================/ |
C \==========================================================/ |
25 |
|
IMPLICIT NONE |
26 |
C |
C |
27 |
C Call Tree |
C Call Tree |
28 |
C ========= |
C ========= |
87 |
#include "PARAMS.h" |
#include "PARAMS.h" |
88 |
#include "CG2D.h" |
#include "CG2D.h" |
89 |
#include "DYNVARS.h" |
#include "DYNVARS.h" |
|
#include "AVER.h" |
|
90 |
|
|
91 |
C == Routine arguments == |
C == Routine arguments == |
92 |
C myThid - Thread number for this instance of the routine. |
C myThid - Thread number for this instance of the routine. |
104 |
INTEGER I, myCurrentIter |
INTEGER I, myCurrentIter |
105 |
REAL myCurrentTime |
REAL myCurrentTime |
106 |
|
|
107 |
|
C-- This timer encompasses the whole code |
108 |
|
CALL TIMER_START('ALL',myThid) |
109 |
|
|
110 |
|
CALL TIMER_START('SPIN-UP',myThid) |
111 |
|
|
112 |
C-- Set model initial conditions |
C-- Set model initial conditions |
113 |
|
CALL TIMER_START('INITIALISE [SPIN-UP]',myThid) |
114 |
CALL INITIALISE( myThid ) |
CALL INITIALISE( myThid ) |
115 |
myCurrentTime = startTime |
myCurrentTime = startTime |
116 |
myCurrentIter = nIter0 |
myCurrentIter = nIter0 |
117 |
|
CALL TIMER_STOP ('INITIALISE [SPIN-UP]',myThid) |
118 |
|
|
119 |
C-- Dump for start state |
C-- Dump for start state |
120 |
|
CALL TIMER_START('I/O (WRITE) [SPIN-UP]',myThid) |
121 |
CALL WRITE_STATE( .TRUE., myCurrentTime, myCurrentIter, myThid ) |
CALL WRITE_STATE( .TRUE., myCurrentTime, myCurrentIter, myThid ) |
122 |
|
CALL TIMER_STOP ('I/O (WRITE) [SPIN-UP]',myThid) |
123 |
|
|
124 |
|
CALL TIMER_STOP ('SPIN-UP',myThid) |
125 |
|
|
126 |
C-- Begin time stepping loop |
C-- Begin time stepping loop |
127 |
|
CALL TIMER_START('MAIN LOOP',myThid) |
128 |
DO I=1, nTimeSteps |
DO I=1, nTimeSteps |
129 |
|
|
130 |
C-- Load forcing/external data fields |
C-- Load forcing/external data fields |
131 |
|
CALL TIMER_START('I/O (READ) [MAIN LOOP]',myThid) |
132 |
CALL LOAD_EXTERNAL_FIELDS( myCurrentTime, myCurrentIter, myThid ) |
CALL LOAD_EXTERNAL_FIELDS( myCurrentTime, myCurrentIter, myThid ) |
133 |
|
CALL TIMER_STOP ('I/O (READ) [MAIN LOOP]',myThid) |
134 |
|
|
135 |
|
#ifdef INCLUDE_SHAPIRO_FILTER_CODE |
136 |
|
C-- Step forward all tiles, filter and exchange. |
137 |
|
CALL TIMER_START('SHAP_FILT [MAIN LOOP]',myThid) |
138 |
|
CALL SHAP_FILT( myCurrentTime, myCurrentIter, myThid ) |
139 |
|
CALL TIMER_STOP ('SHAP_FILT [MAIN LOOP]',myThid) |
140 |
|
#endif |
141 |
|
|
142 |
|
C-- Set Open Boundaries Values |
143 |
|
IF (openBoundaries) THEN |
144 |
|
CALL TIMER_START('OBCS [MAIN LOOP]',myThid) |
145 |
|
CALL SET_OBCS( myCurrentTime, myThid ) |
146 |
|
CALL TIMER_STOP ('OBCS [MAIN LOOP]',myThid) |
147 |
|
ENDIF |
148 |
|
|
149 |
C-- Step forward fields and calculate time tendency terms |
C-- Step forward fields and calculate time tendency terms |
150 |
|
CALL TIMER_START('DYNAMICS [MAIN LOOP]',myThid) |
151 |
CALL DYNAMICS( myCurrentTime, myCurrentIter, myThid ) |
CALL DYNAMICS( myCurrentTime, myCurrentIter, myThid ) |
152 |
|
CALL TIMER_STOP ('DYNAMICS [MAIN LOOP]',myThid) |
153 |
|
|
154 |
C-- Do time averages |
C-- Do time averages |
155 |
#ifdef ALLOW_DIAGNOSTICS |
#ifdef INCLUDE_DIAGNOSTICS_INTERFACE_CODE |
156 |
|
CALL TIMER_START('I/O (WRITE) [MAIN LOOP]',myThid) |
157 |
IF (taveFreq.GT.0.) THEN |
IF (taveFreq.GT.0.) THEN |
158 |
CALL WRITE_TIME_AVERAGES( myCurrentTime, myCurrentIter, myThid ) |
CALL WRITE_TIME_AVERAGES( myCurrentTime, myCurrentIter, myThid ) |
159 |
ENDIF |
ENDIF |
160 |
|
CALL TIMER_STOP ('I/O (WRITE) [MAIN LOOP]',myThid) |
161 |
#endif |
#endif |
162 |
|
|
163 |
C-- Do IO if needed. |
C-- Do IO if needed. |
166 |
C At this point model arrays hold U,V,T,S at "time-level" N |
C At this point model arrays hold U,V,T,S at "time-level" N |
167 |
C and cg2d_x at "time-level" N-1/2 where N = I+timeLevBase-1. |
C and cg2d_x at "time-level" N-1/2 where N = I+timeLevBase-1. |
168 |
C By convention this is taken to be the model "state". |
C By convention this is taken to be the model "state". |
169 |
|
CALL TIMER_START('I/O (WRITE) [MAIN LOOP]',myThid) |
170 |
CALL DO_THE_MODEL_IO( myCurrentTime, myCurrentIter, myThid ) |
CALL DO_THE_MODEL_IO( myCurrentTime, myCurrentIter, myThid ) |
171 |
|
CALL TIMER_STOP ('I/O (WRITE) [MAIN LOOP]',myThid) |
172 |
|
|
173 |
C-- Solve elliptic equation(s). |
C-- Solve elliptic equation(s). |
174 |
C Two-dimensional only for conventional hydrostatic or |
C Two-dimensional only for conventional hydrostatic or |
175 |
C three-dimensional for non-hydrostatic and/or IGW scheme. |
C three-dimensional for non-hydrostatic and/or IGW scheme. |
176 |
|
CALL TIMER_START('SOLVE_FOR_PRESSURE [MAIN LOOP]',myThid) |
177 |
CALL SOLVE_FOR_PRESSURE( myThid ) |
CALL SOLVE_FOR_PRESSURE( myThid ) |
178 |
|
CALL TIMER_STOP ('SOLVE_FOR_PRESSURE [MAIN LOOP]',myThid) |
179 |
|
|
180 |
C-- Do "blocking" sends and receives for tendency "overlap" terms |
C-- Do "blocking" sends and receives for tendency "overlap" terms |
181 |
|
CALL TIMER_START('BLOCKING_EXCHANGES [MAIN LOOP]',myThid) |
182 |
CALL DO_GTERM_BLOCKING_EXCHANGES( myThid ) |
CALL DO_GTERM_BLOCKING_EXCHANGES( myThid ) |
183 |
|
CALL TIMER_STOP ('BLOCKING_EXCHANGES [MAIN LOOP]',myThid) |
184 |
|
|
185 |
myCurrentIter = myCurrentIter + 1 |
myCurrentIter = myCurrentIter + 1 |
186 |
myCurrentTime = myCurrentTime + deltaTClock |
myCurrentTime = myCurrentTime + deltaTClock |
198 |
C cg2d_x.0000000001 in the indexing scheme used for the model |
C cg2d_x.0000000001 in the indexing scheme used for the model |
199 |
C "state" files. This example is referred to as a checkpoint |
C "state" files. This example is referred to as a checkpoint |
200 |
C at time level 1 |
C at time level 1 |
201 |
CALL WRITE_CHECKPOINT( .FALSE., myCurrentTime, myCurrentIter, myThid ) |
CALL TIMER_START('I/O (WRITE) [MAIN LOOP]',myThid) |
202 |
|
CALL |
203 |
|
& WRITE_CHECKPOINT( .FALSE., myCurrentTime, myCurrentIter, myThid ) |
204 |
|
CALL TIMER_STOP ('I/O (WRITE) [MAIN LOOP]',myThid) |
205 |
|
|
206 |
ENDDO |
ENDDO |
207 |
|
CALL TIMER_STOP ('MAIN LOOP',myThid) |
208 |
|
CALL TIMER_START('SPIN-DOWN',myThid) |
209 |
|
|
210 |
C-- Final checkpoint (incase the in-loop checkpoint was missed) |
C-- Final checkpoint (incase the in-loop checkpoint was missed) |
211 |
CALL WRITE_CHECKPOINT( .TRUE., myCurrentTime, myCurrentIter, myThid ) |
CALL TIMER_START('I/O (WRITE) [SPIN-DOWN]',myThid) |
212 |
|
CALL |
213 |
|
& WRITE_CHECKPOINT( .TRUE., myCurrentTime, myCurrentIter, myThid ) |
214 |
|
CALL TIMER_STOP ('I/O (WRITE) [SPIN-DOWN]',myThid) |
215 |
|
|
216 |
|
C-- Set Open Boundaries Values |
217 |
|
IF (openBoundaries) THEN |
218 |
|
CALL TIMER_START('OBCS [SPIN_DOWN]',myThid) |
219 |
|
CALL SET_OBCS( myCurrentTime, myThid ) |
220 |
|
CALL TIMER_STOP ('OBCS [SPIN_DOWN]',myThid) |
221 |
|
ENDIF |
222 |
|
|
223 |
C-- Step-forward U/V/Theta/Salt for purposes of final I/O dump |
C-- Step-forward U/V/Theta/Salt for purposes of final I/O dump |
224 |
|
CALL TIMER_START('DYNAMICS [SPIN-DOWN]',myThid) |
225 |
CALL DYNAMICS( myCurrentTime, myCurrentIter, myThid ) |
CALL DYNAMICS( myCurrentTime, myCurrentIter, myThid ) |
226 |
|
CALL TIMER_STOP ('DYNAMICS [SPIN-DOWN]',myThid) |
227 |
|
|
228 |
C-- Do time averages |
C-- Do time averages |
229 |
#ifdef ALLOW_DIAGNOSTICS |
#ifdef ALLOW_DIAGNOSTICS |
230 |
IF (taveFreq.GT.0.) THEN |
IF (taveFreq.GT.0.) THEN |
231 |
CALL WRITE_TIME_AVERAGES( myCurrentTime, myCurrentIter, myThid ) |
CALL TIMER_START('I/O (WRITE) [SPIN-DOWN]',myThid) |
232 |
|
CALL WRITE_TIME_AVERAGES( myCurrentTime, myCurrentIter, myThid ) |
233 |
|
CALL TIMER_STOP ('I/O (WRITE) [SPIN-DOWN]',myThid) |
234 |
ENDIF |
ENDIF |
235 |
#endif |
#endif |
236 |
|
|
237 |
C-- Dump for end state |
C-- Dump for end state |
238 |
|
CALL TIMER_START('I/O (WRITE) [SPIN-DOWN]',myThid) |
239 |
CALL WRITE_STATE( .FALSE., myCurrentTime, myCurrentIter, myThid ) |
CALL WRITE_STATE( .FALSE., myCurrentTime, myCurrentIter, myThid ) |
240 |
|
CALL TIMER_STOP ('I/O (WRITE) [SPIN-DOWN]',myThid) |
241 |
|
|
242 |
|
CALL TIMER_STOP ('SPIN-DOWN',myThid) |
243 |
|
CALL TIMER_STOP ('ALL',myThid) |
244 |
|
|
245 |
|
C-- Write timer statistics |
246 |
|
IF ( myThid .EQ. 1 ) THEN |
247 |
|
CALL TIMER_PRINTALL( myThid ) |
248 |
|
CALL COMM_STATS |
249 |
|
ENDIF |
250 |
|
|
251 |
RETURN |
RETURN |
252 |
END |
END |