/[MITgcm]/MITgcm/model/src/the_model_main.F
ViewVC logotype

Diff of /MITgcm/model/src/the_model_main.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.13 by adcroft, Wed Jun 17 21:07:02 1998 UTC revision 1.21 by cnh, Wed Oct 28 03:11:38 1998 UTC
# Line 1  Line 1 
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     /==========================================================\
# Line 86  C     == Global variables === Line 86  C     == Global variables ===
86  #include "PARAMS.h"  #include "PARAMS.h"
87  #include "CG2D.h"  #include "CG2D.h"
88  #include "DYNVARS.h"  #include "DYNVARS.h"
89    #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.
# Line 103  C     I             - Loop counter Line 104  C     I             - Loop counter
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
120          CALL TIMER_START('I/O (WRITE)         [SPIN-UP]',myThid)
121          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  C--    Step forward fields and calculate time tendency terms  C--    Step forward fields and calculate time tendency terms
136           CALL TIMER_START('DYNAMICS           [MAIN LOOP]',myThid)
137         CALL DYNAMICS( myCurrentTime, myCurrentIter, myThid )         CALL DYNAMICS( myCurrentTime, myCurrentIter, myThid )
138           CALL TIMER_STOP ('DYNAMICS           [MAIN LOOP]',myThid)
139    
140    C--    Do time averages
141    #ifdef ALLOW_DIAGNOSTICS
142           CALL TIMER_START('I/O (WRITE)        [MAIN LOOP]',myThid)
143           IF (taveFreq.GT.0.) THEN
144            CALL WRITE_TIME_AVERAGES( myCurrentTime, myCurrentIter, myThid )
145           ENDIF
146           CALL TIMER_STOP ('I/O (WRITE)        [MAIN LOOP]',myThid)
147    #endif
148    
149  C--    Do IO if needed.  C--    Do IO if needed.
150  C      Note:  C      Note:
# Line 123  C      ===== Line 152  C      =====
152  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
153  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.
154  C      By convention this is taken to be the model "state".  C      By convention this is taken to be the model "state".
155           CALL TIMER_START('I/O (WRITE)        [MAIN LOOP]',myThid)
156         CALL DO_THE_MODEL_IO( myCurrentTime, myCurrentIter, myThid )         CALL DO_THE_MODEL_IO( myCurrentTime, myCurrentIter, myThid )
157           CALL TIMER_STOP ('I/O (WRITE)        [MAIN LOOP]',myThid)
158    
159  C--    Solve elliptic equation(s).  C--    Solve elliptic equation(s).
160  C      Two-dimensional only for conventional hydrostatic or  C      Two-dimensional only for conventional hydrostatic or
161  C      three-dimensional for non-hydrostatic and/or IGW scheme.  C      three-dimensional for non-hydrostatic and/or IGW scheme.
162           CALL TIMER_START('SOLVE_FOR_PRESSURE [MAIN LOOP]',myThid)
163         CALL SOLVE_FOR_PRESSURE( myThid )         CALL SOLVE_FOR_PRESSURE( myThid )
164           CALL TIMER_STOP ('SOLVE_FOR_PRESSURE [MAIN LOOP]',myThid)
165    
166  C--    Do "blocking" sends and receives for tendency "overlap" terms  C--    Do "blocking" sends and receives for tendency "overlap" terms
167           CALL TIMER_START('BLOCKING_EXCHANGES [MAIN LOOP]',myThid)
168         CALL DO_GTERM_BLOCKING_EXCHANGES( myThid )         CALL DO_GTERM_BLOCKING_EXCHANGES( myThid )
169           CALL TIMER_STOP ('BLOCKING_EXCHANGES [MAIN LOOP]',myThid)
170    
171         myCurrentIter = myCurrentIter + 1         myCurrentIter = myCurrentIter + 1
172         myCurrentTime = myCurrentTime + deltaTClock         myCurrentTime = myCurrentTime + deltaTClock
# Line 149  C      Thus a checkpoint contains U.0000 Line 184  C      Thus a checkpoint contains U.0000
184  C      cg2d_x.0000000001 in the indexing scheme used for the model  C      cg2d_x.0000000001 in the indexing scheme used for the model
185  C      "state" files. This example is referred to as a checkpoint  C      "state" files. This example is referred to as a checkpoint
186  C      at time level 1  C      at time level 1
187         CALL WRITE_CHECKPOINT( .FALSE., myCurrentTime, myCurrentIter, myThid )         CALL TIMER_START('I/O (WRITE)        [MAIN LOOP]',myThid)
188           CALL
189         & WRITE_CHECKPOINT( .FALSE., myCurrentTime, myCurrentIter, myThid )
190           CALL TIMER_STOP ('I/O (WRITE)        [MAIN LOOP]',myThid)
191    
        write(0,*) maxval(abs(uVel)),maxval(abs(vVel))  
        if (maxval(abs(uVel)).gt.10.) goto 911  
        if (maxval(abs(vVel)).gt.10.) goto 911  
        if (maxval(abs(theta)).gt.40.) goto 911  
192        ENDDO        ENDDO
193          CALL TIMER_STOP ('MAIN LOOP',myThid)
194   911  continue        CALL TIMER_START('SPIN-DOWN',myThid)
195    
196  C--   Final checkpoint (incase the in-loop checkpoint was missed)  C--   Final checkpoint (incase the in-loop checkpoint was missed)
197        CALL WRITE_CHECKPOINT( .TRUE., myCurrentTime, myCurrentIter, myThid )        CALL TIMER_START('I/O (WRITE)         [SPIN-DOWN]',myThid)
198          CALL
199         & WRITE_CHECKPOINT( .TRUE., myCurrentTime, myCurrentIter, myThid )
200          CALL TIMER_STOP ('I/O (WRITE)         [SPIN-DOWN]',myThid)
201    
202  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
203          CALL TIMER_START('DYNAMICS            [SPIN-DOWN]',myThid)
204        CALL DYNAMICS( myCurrentTime, myCurrentIter, myThid )        CALL DYNAMICS( myCurrentTime, myCurrentIter, myThid )
205          CALL TIMER_STOP ('DYNAMICS            [SPIN-DOWN]',myThid)
206    
207  C--   Dump for end state  C--   Do time averages
208        CALL WRITE_STATE( myCurrentTime, myCurrentIter, myThid )  #ifdef ALLOW_DIAGNOSTICS
209          IF (taveFreq.GT.0.) THEN
210           CALL TIMER_START('I/O (WRITE)        [SPIN-DOWN]',myThid)
211           CALL WRITE_TIME_AVERAGES( myCurrentTime, myCurrentIter, myThid )
212           CALL TIMER_STOP ('I/O (WRITE)        [SPIN-DOWN]',myThid)
213          ENDIF
214    #endif
215    
216    C--   Dump for end state
217          CALL TIMER_START('I/O (WRITE)         [SPIN-DOWN]',myThid)
218          CALL WRITE_STATE( .FALSE., myCurrentTime, myCurrentIter, myThid )
219          CALL TIMER_STOP ('I/O (WRITE)         [SPIN-DOWN]',myThid)
220    
221          CALL TIMER_STOP ('SPIN-DOWN',myThid)
222          CALL TIMER_STOP ('ALL',myThid)
223    
224    C--   Write timer statistics
225          IF ( myThid .EQ. 1 ) THEN
226           CALL TIMER_PRINTALL( myThid )
227           CALL COMM_STATS
228          ENDIF
229    
230        RETURN        RETURN
231        END        END

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.22