1 |
C $Header$ |
C $Header$ |
2 |
|
|
3 |
#include "CPP_EEOPTIONS.h" |
#include "CPP_OPTIONS.h" |
4 |
|
|
5 |
SUBROUTINE THE_MODEL_MAIN(myThid) |
SUBROUTINE THE_MODEL_MAIN(myThid) |
6 |
C /==========================================================\ |
C /==========================================================\ |
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 ========= |
85 |
#include "SIZE.h" |
#include "SIZE.h" |
86 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
87 |
#include "PARAMS.h" |
#include "PARAMS.h" |
|
#include "CG2D.h" |
|
88 |
#include "DYNVARS.h" |
#include "DYNVARS.h" |
89 |
#include "AVER.h" |
#include "CG2D.h" |
90 |
|
#ifdef ALLOW_NONHYDROSTATIC |
91 |
|
#include "CG3D.h" |
92 |
|
#endif |
93 |
|
|
94 |
C == Routine arguments == |
C == Routine arguments == |
95 |
C myThid - Thread number for this instance of the routine. |
C myThid - Thread number for this instance of the routine. |
105 |
C myCurrentTime - Time counter for this thread |
C myCurrentTime - Time counter for this thread |
106 |
C I - Loop counter |
C I - Loop counter |
107 |
INTEGER I, myCurrentIter |
INTEGER I, myCurrentIter |
108 |
REAL myCurrentTime |
_RL myCurrentTime |
109 |
|
|
110 |
|
C-- This timer encompasses the whole code |
111 |
|
CALL TIMER_START('ALL',myThid) |
112 |
|
|
113 |
|
CALL TIMER_START('SPIN-UP',myThid) |
114 |
|
|
115 |
C-- Set model initial conditions |
C-- Set model initial conditions |
116 |
|
CALL TIMER_START('INITIALISE [SPIN-UP]',myThid) |
117 |
CALL INITIALISE( myThid ) |
CALL INITIALISE( myThid ) |
118 |
myCurrentTime = startTime |
myCurrentTime = startTime |
119 |
myCurrentIter = nIter0 |
myCurrentIter = nIter0 |
120 |
|
CALL TIMER_STOP ('INITIALISE [SPIN-UP]',myThid) |
121 |
|
|
122 |
C-- Dump for start state |
C-- Dump for start state |
123 |
|
CALL TIMER_START('I/O (WRITE) [SPIN-UP]',myThid) |
124 |
CALL WRITE_STATE( .TRUE., myCurrentTime, myCurrentIter, myThid ) |
CALL WRITE_STATE( .TRUE., myCurrentTime, myCurrentIter, myThid ) |
125 |
|
CALL TIMER_STOP ('I/O (WRITE) [SPIN-UP]',myThid) |
126 |
|
|
127 |
|
CALL TIMER_STOP ('SPIN-UP',myThid) |
128 |
|
|
129 |
C-- Begin time stepping loop |
C-- Begin time stepping loop |
130 |
|
CALL TIMER_START('MAIN LOOP',myThid) |
131 |
DO I=1, nTimeSteps |
DO I=1, nTimeSteps |
132 |
|
|
133 |
C-- Load forcing/external data fields |
C-- Load forcing/external data fields |
134 |
|
CALL TIMER_START('I/O (READ) [MAIN LOOP]',myThid) |
135 |
CALL LOAD_EXTERNAL_FIELDS( myCurrentTime, myCurrentIter, myThid ) |
CALL LOAD_EXTERNAL_FIELDS( myCurrentTime, myCurrentIter, myThid ) |
136 |
|
CALL TIMER_STOP ('I/O (READ) [MAIN LOOP]',myThid) |
137 |
|
|
138 |
|
#ifdef INCLUDE_SHAPIRO_FILTER_CODE |
139 |
|
C-- Step forward all tiles, filter and exchange. |
140 |
|
CALL TIMER_START('SHAP_FILT [MAIN LOOP]',myThid) |
141 |
|
CALL SHAP_FILT( myCurrentTime, myCurrentIter, myThid ) |
142 |
|
CALL TIMER_STOP ('SHAP_FILT [MAIN LOOP]',myThid) |
143 |
|
#endif |
144 |
|
|
145 |
C-- Step forward fields and calculate time tendency terms |
C-- Step forward fields and calculate time tendency terms |
146 |
|
CALL TIMER_START('DYNAMICS [MAIN LOOP]',myThid) |
147 |
CALL DYNAMICS( myCurrentTime, myCurrentIter, myThid ) |
CALL DYNAMICS( myCurrentTime, myCurrentIter, myThid ) |
148 |
|
CALL TIMER_STOP ('DYNAMICS [MAIN LOOP]',myThid) |
149 |
|
|
150 |
|
#ifdef ALLOW_NONHYDROSTATIC |
151 |
|
C-- Step forward W field in N-H algorithm |
152 |
|
IF ( nonHydrostatic ) THEN |
153 |
|
CALL TIMER_START('CALC_GW [MAIN LOOP]',myThid) |
154 |
|
CALL CALC_GW( myThid) |
155 |
|
CALL TIMER_STOP ('CALC_GW [MAIN LOOP]',myThid) |
156 |
|
ENDIF |
157 |
|
#endif |
158 |
|
|
159 |
C-- Do time averages |
C-- Do time averages |
160 |
|
#ifdef INCLUDE_DIAGNOSTICS_INTERFACE_CODE |
161 |
|
CALL TIMER_START('I/O (WRITE) [MAIN LOOP]',myThid) |
162 |
IF (taveFreq.GT.0.) THEN |
IF (taveFreq.GT.0.) THEN |
163 |
CALL DO_TIME_AVERAGES( myCurrentTime, myCurrentIter, myThid ) |
CALL WRITE_TIME_AVERAGES( myCurrentTime, myCurrentIter, myThid ) |
164 |
ENDIF |
ENDIF |
165 |
|
CALL TIMER_STOP ('I/O (WRITE) [MAIN LOOP]',myThid) |
166 |
|
#endif |
167 |
|
|
168 |
C-- Do IO if needed. |
C-- Do IO if needed. |
169 |
C Note: |
C Note: |
171 |
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 |
172 |
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. |
173 |
C By convention this is taken to be the model "state". |
C By convention this is taken to be the model "state". |
174 |
|
CALL TIMER_START('I/O (WRITE) [MAIN LOOP]',myThid) |
175 |
CALL DO_THE_MODEL_IO( myCurrentTime, myCurrentIter, myThid ) |
CALL DO_THE_MODEL_IO( myCurrentTime, myCurrentIter, myThid ) |
176 |
|
CALL TIMER_STOP ('I/O (WRITE) [MAIN LOOP]',myThid) |
177 |
|
|
178 |
C-- Solve elliptic equation(s). |
C-- Solve elliptic equation(s). |
179 |
C Two-dimensional only for conventional hydrostatic or |
C Two-dimensional only for conventional hydrostatic or |
180 |
C three-dimensional for non-hydrostatic and/or IGW scheme. |
C three-dimensional for non-hydrostatic and/or IGW scheme. |
181 |
|
CALL TIMER_START('SOLVE_FOR_PRESSURE [MAIN LOOP]',myThid) |
182 |
CALL SOLVE_FOR_PRESSURE( myThid ) |
CALL SOLVE_FOR_PRESSURE( myThid ) |
183 |
|
CALL TIMER_STOP ('SOLVE_FOR_PRESSURE [MAIN LOOP]',myThid) |
184 |
|
|
185 |
C-- Do "blocking" sends and receives for tendency "overlap" terms |
C-- Do "blocking" sends and receives for tendency "overlap" terms |
186 |
|
CALL TIMER_START('BLOCKING_EXCHANGES [MAIN LOOP]',myThid) |
187 |
CALL DO_GTERM_BLOCKING_EXCHANGES( myThid ) |
CALL DO_GTERM_BLOCKING_EXCHANGES( myThid ) |
188 |
|
CALL TIMER_STOP ('BLOCKING_EXCHANGES [MAIN LOOP]',myThid) |
189 |
|
|
190 |
myCurrentIter = myCurrentIter + 1 |
myCurrentIter = myCurrentIter + 1 |
191 |
myCurrentTime = myCurrentTime + deltaTClock |
myCurrentTime = myCurrentTime + deltaTClock |
203 |
C cg2d_x.0000000001 in the indexing scheme used for the model |
C cg2d_x.0000000001 in the indexing scheme used for the model |
204 |
C "state" files. This example is referred to as a checkpoint |
C "state" files. This example is referred to as a checkpoint |
205 |
C at time level 1 |
C at time level 1 |
206 |
CALL WRITE_CHECKPOINT( .FALSE., myCurrentTime, myCurrentIter, myThid ) |
CALL TIMER_START('I/O (WRITE) [MAIN LOOP]',myThid) |
207 |
|
CALL |
208 |
|
& WRITE_CHECKPOINT( .FALSE., myCurrentTime, myCurrentIter, myThid ) |
209 |
|
CALL TIMER_STOP ('I/O (WRITE) [MAIN LOOP]',myThid) |
210 |
|
|
211 |
ENDDO |
ENDDO |
212 |
|
CALL TIMER_STOP ('MAIN LOOP',myThid) |
213 |
|
CALL TIMER_START('SPIN-DOWN',myThid) |
214 |
|
|
215 |
C-- Final checkpoint (incase the in-loop checkpoint was missed) |
C-- Final checkpoint (incase the in-loop checkpoint was missed) |
216 |
CALL WRITE_CHECKPOINT( .TRUE., myCurrentTime, myCurrentIter, myThid ) |
CALL TIMER_START('I/O (WRITE) [SPIN-DOWN]',myThid) |
217 |
|
CALL |
218 |
|
& WRITE_CHECKPOINT( .TRUE., myCurrentTime, myCurrentIter, myThid ) |
219 |
|
CALL TIMER_STOP ('I/O (WRITE) [SPIN-DOWN]',myThid) |
220 |
|
|
221 |
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 |
222 |
|
CALL TIMER_START('DYNAMICS [SPIN-DOWN]',myThid) |
223 |
CALL DYNAMICS( myCurrentTime, myCurrentIter, myThid ) |
CALL DYNAMICS( myCurrentTime, myCurrentIter, myThid ) |
224 |
|
CALL TIMER_STOP ('DYNAMICS [SPIN-DOWN]',myThid) |
225 |
|
|
226 |
|
#ifdef ALLOW_NONHYDROSTATIC |
227 |
|
IF ( nonHydrostatic ) THEN |
228 |
|
C-- Step forward W field in N-H algorithm |
229 |
|
CALL TIMER_START('CALC_GW [SPIN-DOWN]',myThid) |
230 |
|
CALL CALC_GW( myThid) |
231 |
|
CALL TIMER_STOP ('CALC_GW [SPIN-DOWN]',myThid) |
232 |
|
ENDIF |
233 |
|
#endif |
234 |
|
|
235 |
C-- Do time averages |
C-- Do time averages |
236 |
|
#ifdef INCLUDE_DIAGNOSTICS_INTERFACE_CODE |
237 |
IF (taveFreq.GT.0.) THEN |
IF (taveFreq.GT.0.) THEN |
238 |
CALL DO_TIME_AVERAGES( myCurrentTime, myCurrentIter, myThid ) |
CALL TIMER_START('I/O (WRITE) [SPIN-DOWN]',myThid) |
239 |
|
CALL WRITE_TIME_AVERAGES( myCurrentTime, myCurrentIter, myThid ) |
240 |
|
CALL TIMER_STOP ('I/O (WRITE) [SPIN-DOWN]',myThid) |
241 |
ENDIF |
ENDIF |
242 |
|
#endif |
243 |
|
|
244 |
C-- Dump for end state |
C-- Dump for end state |
245 |
|
CALL TIMER_START('I/O (WRITE) [SPIN-DOWN]',myThid) |
246 |
CALL WRITE_STATE( .FALSE., myCurrentTime, myCurrentIter, myThid ) |
CALL WRITE_STATE( .FALSE., myCurrentTime, myCurrentIter, myThid ) |
247 |
|
CALL TIMER_STOP ('I/O (WRITE) [SPIN-DOWN]',myThid) |
248 |
|
|
249 |
|
CALL TIMER_STOP ('SPIN-DOWN',myThid) |
250 |
|
CALL TIMER_STOP ('ALL',myThid) |
251 |
|
|
252 |
|
C-- Write timer statistics |
253 |
|
IF ( myThid .EQ. 1 ) THEN |
254 |
|
CALL TIMER_PRINTALL( myThid ) |
255 |
|
CALL COMM_STATS |
256 |
|
ENDIF |
257 |
|
|
258 |
RETURN |
RETURN |
259 |
END |
END |