/[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.31 by adcroft, Mon Aug 30 18:29:27 1999 UTC revision 1.32 by adcroft, Wed Apr 5 19:04:14 2000 UTC
# Line 43  C       |  |               of this codes Line 43  C       |  |               of this codes
43  C       |  |               and/or instance. Each instance manages  C       |  |               and/or instance. Each instance manages
44  C       |  |               a specifc set of tiles.                C       |  |               a specifc set of tiles.              
45  C       |  |  C       |  |
46  C       |  |--INITIALISE  C       |  |--INITIALISE_FIXED
47  C       |  |   o Set initial conditions and model configuration  C       |  |   o Set model configuration (fixed arrays)
48  C       |  |     Topography, hydrography, timestep, grid, etc..  C       |  |     Topography, hydrography, timestep, grid, etc..
49  C       |  |  C       |  |
50  C  ==>  |  | ** Time stepping loop starts here **  C       |  |--THE_MAIN_LOOP
51  C  |    |  |  C       |  |  |
52  C /|\   |  |  C       |  |  |--INITIALISE_VARIA
53  C  |    |  |--LOAD_EXTERNAL_DATA  C       |  |  |   o Set initial conditions (variable arrays)
54  C /|\   |  |   o Load and/or set time dependent forcing fields  C       |  |  |
55  C  |    |  |  C  ==>  |  |  | ** Time stepping loop starts here **
56  C /|\   |  |--DYNAMICS  C  |    |  |  |
57  C  |    |  |   o Evaluate "forward" terms  C /|\   |  |  |
58  C /|\   |  |  C  |    |  |  |--FORWARD_STEP
59  C  |    |  |--DO_THE_MODEL_IO  C /|\   |  |  |  |  o Does a single forward step of the model
60  C /|\   |  |   o Write model state  C  |    |  |  |  |
61  C  |    |  |  C /|\   |  |  |  |
62  C /|\   |  |--SOLVE_FOR_PRESSURE  C  |    |  |  |  |--LOAD_EXTERNAL_DATA
63  C  |    |  |   o Find pressure field to keep flow non-divergent  C /|\   |  |  |  |   o Load and/or set time dependent forcing fields
64  C /|\   |  |  C  |    |  |  |  |
65  C  |    |  |--DO_GTERM_BLOCKING_EXCHANGES  C /|\   |  |  |  |--DYNAMICS
66  C /|\   |  |   o Update overlap regions  C  |    |  |  |  |   o Evaluate "forward" terms
67  C  |    |  |  C /|\   |  |  |  |
68  C /|\   |  |--WRITE_CHECKPOINT  C  |    |  |  |  |--DO_THE_MODEL_IO
69  C  |    |  |   o Write restart file(s)  C /|\   |  |  |  |   o Write model state
70  C /|\   |  |  C  |    |  |  |  |
71  C  |    |  |  C /|\   |  |  |  |--SOLVE_FOR_PRESSURE
72  C  |<== |  | ** Time stepping loop finishes here **  C  |    |  |  |  |   o Find pressure field to keep flow non-divergent
73    C /|\   |  |  |  |
74    C  |    |  |  |  |--DO_GTERM_BLOCKING_EXCHANGES
75    C /|\   |  |  |  |   o Update overlap regions
76    C  |    |  |  |  |
77    C /|\   |  |  |  |--WRITE_CHECKPOINT
78    C  |    |  |  |  |   o Write restart file(s)
79    C /|\   |  |  |
80    C  |    |  |  |
81    C  |<== |  |  | ** Time stepping loop finishes here **
82    C       |  |  |
83    C       |  |  |--
84  C       |  |  C       |  |
85  C       |  |--WRITE_STATE  C       |  |--WRITE_STATE
86  C       |  |--WRITE_CHECKPOINT  C       |  |--WRITE_CHECKPOINT
# Line 101  C           myCurrentTime are local vari Line 112  C           myCurrentTime are local vari
112  C           arguments. Although this is fiddly it saves the need to  C           arguments. Although this is fiddly it saves the need to
113  C           impose additional synchronisation points when they are  C           impose additional synchronisation points when they are
114  C           updated.  C           updated.
 C     myCurrentIter - Iteration counter for this thread  
 C     myCurrentTime - Time counter for this thread  
 C     I             - Loop counter  
       INTEGER I, myCurrentIter  
       _RL     myCurrentTime  
115    
116  C--   This timer encompasses the whole code  C--   This timer encompasses the whole code
117        CALL TIMER_START('ALL',myThid)        CALL TIMER_START('ALL                [THE_MODEL_MAIN]',myThid)
118    
       CALL TIMER_START('SPIN-UP',myThid)  
119    
120  C--   Set model initial conditions  C--   Set model configuration (fixed arrays)
121        CALL TIMER_START('INITIALISE          [SPIN-UP]',myThid)        CALL TIMER_START('INITIALISE_FIXED   [THE_MODEL_MAIN]',myThid)
122        CALL INITIALISE( myThid )        CALL INITIALISE_FIXED( myThid )
123        myCurrentTime = startTime        CALL TIMER_STOP ('INITIALISE_FIXED   [THE_MODEL_MAIN]',myThid)
       myCurrentIter = nIter0  
       CALL TIMER_STOP ('INITIALISE          [SPIN-UP]',myThid)  
   
 C--   Dump for start state  
       CALL TIMER_START('I/O (WRITE)         [SPIN-UP]',myThid)  
       CALL WRITE_STATE( .TRUE., myCurrentTime, myCurrentIter, myThid )  
       CALL TIMER_STOP ('I/O (WRITE)         [SPIN-UP]',myThid)  
   
       CALL TIMER_STOP ('SPIN-UP',myThid)  
   
 C--   Begin time stepping loop  
       CALL TIMER_START('MAIN LOOP',myThid)  
       DO I=1, nTimeSteps  
   
 C--    Load forcing/external data fields  
        CALL TIMER_START('I/O (READ)         [MAIN LOOP]',myThid)  
        CALL LOAD_EXTERNAL_FIELDS( myCurrentTime, myCurrentIter, myThid )  
        CALL TIMER_STOP ('I/O (READ)         [MAIN LOOP]',myThid)  
   
 #ifdef INCLUDE_SHAPIRO_FILTER_CODE  
 C--    Step forward all tiles, filter and exchange.  
        CALL TIMER_START('SHAP_FILT          [MAIN LOOP]',myThid)  
        CALL SHAP_FILT( myCurrentTime, myCurrentIter, myThid )  
        CALL TIMER_STOP ('SHAP_FILT          [MAIN LOOP]',myThid)  
 #endif  
   
 C--    Step forward fields and calculate time tendency terms  
        CALL TIMER_START('DYNAMICS           [MAIN LOOP]',myThid)  
        CALL DYNAMICS( myCurrentTime, myCurrentIter, myThid )  
        CALL TIMER_STOP ('DYNAMICS           [MAIN LOOP]',myThid)  
   
 #ifdef ALLOW_NONHYDROSTATIC  
 C--    Step forward W field in N-H algorithm  
        IF ( nonHydrostatic ) THEN  
         CALL TIMER_START('CALC_GW            [MAIN LOOP]',myThid)  
         CALL CALC_GW( myThid)  
         CALL TIMER_STOP ('CALC_GW            [MAIN LOOP]',myThid)  
        ENDIF  
 #endif  
124    
 C--    Do time averages  
 #ifdef INCLUDE_DIAGNOSTICS_INTERFACE_CODE  
        CALL TIMER_START('I/O (WRITE)        [MAIN LOOP]',myThid)  
        IF (taveFreq.GT.0.) THEN  
         CALL WRITE_TIME_AVERAGES( myCurrentTime, myCurrentIter, myThid )  
        ENDIF  
        CALL TIMER_STOP ('I/O (WRITE)        [MAIN LOOP]',myThid)  
 #endif  
125    
126  C--    Do IO if needed.  C--   Call time stepping loop of full model
127  C      Note:        CALL TIMER_START('THE_MAIN_LOOP      [THE_MODEL_MAIN]',myThid)
128  C      =====        CALL THE_MAIN_LOOP( myThid )
129  C      At this point model arrays hold U,V,T,S  at "time-level" N        CALL TIMER_STOP ('THE_MAIN_LOOP      [THE_MODEL_MAIN]',myThid)
 C      and cg2d_x at "time-level" N-1/2 where N = I+timeLevBase-1.  
 C      By convention this is taken to be the model "state".  
        CALL TIMER_START('I/O (WRITE)        [MAIN LOOP]',myThid)  
        CALL DO_THE_MODEL_IO( myCurrentTime, myCurrentIter, myThid )  
        CALL TIMER_STOP ('I/O (WRITE)        [MAIN LOOP]',myThid)  
   
 C--    Solve elliptic equation(s).  
 C      Two-dimensional only for conventional hydrostatic or  
 C      three-dimensional for non-hydrostatic and/or IGW scheme.  
        CALL TIMER_START('SOLVE_FOR_PRESSURE [MAIN LOOP]',myThid)  
        CALL SOLVE_FOR_PRESSURE( myThid )  
        CALL TIMER_STOP ('SOLVE_FOR_PRESSURE [MAIN LOOP]',myThid)  
   
 C--    Do "blocking" sends and receives for tendency "overlap" terms  
        CALL TIMER_START('BLOCKING_EXCHANGES [MAIN LOOP]',myThid)  
        CALL DO_GTERM_BLOCKING_EXCHANGES( myThid )  
        CALL TIMER_STOP ('BLOCKING_EXCHANGES [MAIN LOOP]',myThid)  
   
        myCurrentIter = myCurrentIter + 1  
        myCurrentTime = myCurrentTime + deltaTClock  
   
 C--    Save state for restarts  
 C      Note:  
 C      =====  
 C      Because of the ordering of the timestepping code and  
 C      tendency term code at end of loop model arrays hold  
 C      U,V,T,S  at "time-level" N but gu, gv, gs, gt, guNM1,...  
 C      at "time-level" N+1/2 (guNM1 at "time-level" N+1/2 is  
 C      gu at "time-level" N-1/2) and cg2d_x at "time-level" N+1/2.  
 C       where N = I+timeLevBase-1  
 C      Thus a checkpoint contains U.0000000000, GU.0000000001 and  
 C      cg2d_x.0000000001 in the indexing scheme used for the model  
 C      "state" files. This example is referred to as a checkpoint  
 C      at time level 1  
        CALL TIMER_START('I/O (WRITE)        [MAIN LOOP]',myThid)  
        CALL  
      & WRITE_CHECKPOINT( .FALSE., myCurrentTime, myCurrentIter, myThid )  
        CALL TIMER_STOP ('I/O (WRITE)        [MAIN LOOP]',myThid)  
   
       ENDDO  
       CALL TIMER_STOP ('MAIN LOOP',myThid)  
       CALL TIMER_START('SPIN-DOWN',myThid)  
   
 C--   Final checkpoint (incase the in-loop checkpoint was missed)  
       CALL TIMER_START('I/O (WRITE)         [SPIN-DOWN]',myThid)  
       CALL  
      & WRITE_CHECKPOINT( .TRUE., myCurrentTime, myCurrentIter, myThid )  
       CALL TIMER_STOP ('I/O (WRITE)         [SPIN-DOWN]',myThid)  
   
 C--   Step-forward U/V/Theta/Salt for purposes of final I/O dump  
       CALL TIMER_START('DYNAMICS            [SPIN-DOWN]',myThid)  
       CALL DYNAMICS( myCurrentTime, myCurrentIter, myThid )  
       CALL TIMER_STOP ('DYNAMICS            [SPIN-DOWN]',myThid)  
   
 #ifdef ALLOW_NONHYDROSTATIC  
       IF ( nonHydrostatic ) THEN  
 C--    Step forward W field in N-H algorithm  
        CALL TIMER_START('CALC_GW            [SPIN-DOWN]',myThid)  
        CALL CALC_GW( myThid)  
        CALL TIMER_STOP ('CALC_GW            [SPIN-DOWN]',myThid)  
       ENDIF  
 #endif  
   
 C--   Do time averages  
 #ifdef INCLUDE_DIAGNOSTICS_INTERFACE_CODE  
       IF (taveFreq.GT.0.) THEN  
        CALL TIMER_START('I/O (WRITE)        [SPIN-DOWN]',myThid)  
        CALL WRITE_TIME_AVERAGES( myCurrentTime, myCurrentIter, myThid )  
        CALL TIMER_STOP ('I/O (WRITE)        [SPIN-DOWN]',myThid)  
       ENDIF  
 #endif  
130    
 C--   Dump for end state  
       CALL TIMER_START('I/O (WRITE)         [SPIN-DOWN]',myThid)  
       CALL WRITE_STATE( .FALSE., myCurrentTime, myCurrentIter, myThid )  
       CALL TIMER_STOP ('I/O (WRITE)         [SPIN-DOWN]',myThid)  
131    
132        CALL TIMER_STOP ('SPIN-DOWN',myThid)        CALL TIMER_STOP ('ALL                [THE_MODEL_MAIN]',myThid)
       CALL TIMER_STOP ('ALL',myThid)  
133    
134  C--   Write timer statistics  C--   Write timer statistics
135        IF ( myThid .EQ. 1 ) THEN        IF ( myThid .EQ. 1 ) THEN

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32

  ViewVC Help
Powered by ViewVC 1.1.22