35 |
INTEGER myThid |
INTEGER myThid |
36 |
|
|
37 |
C == Local variables == |
C == Local variables == |
38 |
C Note: Under the multi-threaded model myCurrentIter and myCurrentTime |
C Note: Under the multi-threaded model myCurrentIter and |
39 |
C are local variables passed around as routine arguments. Although |
C myCurrentTime are local variables passed around as routine |
40 |
C this is fiddly it saves the need to impose additional synchronisation |
C arguments. Although this is fiddly it saves the need to |
41 |
C points when they are updated. |
C impose additional synchronisation points when they are |
42 |
|
C updated. |
43 |
C myCurrentIter - Iteration counter for this thread |
C myCurrentIter - Iteration counter for this thread |
44 |
C myCurrentTime - Time counter for this thread |
C myCurrentTime - Time counter for this thread |
45 |
C I - Loop counter |
C I - Loop counter |
54 |
C-- Begin time stepping loop |
C-- Begin time stepping loop |
55 |
DO I=1, nTimeSteps |
DO I=1, nTimeSteps |
56 |
|
|
|
C-- Do IO if needed. |
|
|
CALL DO_THE_MODEL_IO( myCurrentIter, myThid ) |
|
|
|
|
57 |
C-- Load offline tracer fields |
C-- Load offline tracer fields |
58 |
IF ( MOD(myCurrentIter,numStepsPerPickup) .EQ. 1 ) THEN |
IF ( MOD(myCurrentIter,numStepsPerPickup) .EQ. 1 ) THEN |
59 |
C I/O |
C I/O |
66 |
C-- Step forward fields and calculate time tendency terms |
C-- Step forward fields and calculate time tendency terms |
67 |
CALL DYNAMICS( myThid ) |
CALL DYNAMICS( myThid ) |
68 |
|
|
69 |
|
C-- Do IO if needed. |
70 |
|
C Note: |
71 |
|
C ===== |
72 |
|
C At this point model arrays hold U,V,T,S at "time-level" N |
73 |
|
C and cg2d_x at "time-level" N-1/2 where N = I+timeLevBase-1. |
74 |
|
C By convention this is taken to be the model "state". |
75 |
|
CALL DO_THE_MODEL_IO( myCurrentTime, myCurrentIter, myThid ) |
76 |
|
|
77 |
C-- Solve elliptic equation(s). |
C-- Solve elliptic equation(s). |
78 |
C Two-dimensional only for conventional hydrostatic or three-dimensional |
C Two-dimensional only for conventional hydrostatic or |
79 |
C for non-hydrostatic and/or IGW scheme. |
C three-dimensional for non-hydrostatic and/or IGW scheme. |
80 |
CALL SOLVE_FOR_PRESSURE( myThid ) |
CALL SOLVE_FOR_PRESSURE( myThid ) |
81 |
|
|
82 |
C-- Do "blocking" sends and receives for tendency "overlap" terms |
C-- Do "blocking" sends and receives for tendency "overlap" terms |
83 |
CALL DO_GTERM_BLOCKING_EXCHANGES( myThid ) |
CALL DO_GTERM_BLOCKING_EXCHANGES( myThid ) |
84 |
|
|
85 |
myCurrentIter = myCurrentIter + 1 |
myCurrentIter = myCurrentIter + 1 |
86 |
myCurrentTime = myCurrentTime + deltaTtracer |
myCurrentTime = myCurrentTime + deltaTClock |
87 |
|
|
88 |
C-- Save state for restarts |
C-- Save state for restarts |
89 |
C*P* CALL CHECKPOINT( myThid ) |
C Note: |
90 |
|
C ===== |
91 |
|
C Because of the ordereing of the timestepping code and |
92 |
|
C tendency term code at end of loop model arrays hold |
93 |
|
C U,V,T,S at "time-level" N but gu, gv, gs, gt, guNM1,... |
94 |
|
C at "time-level" N+1/2 (guNM1 at "time-level" N+1/2 is |
95 |
|
C gu at "time-level" N-1/2) and cg2d_x at "time-level" N+1/2. |
96 |
|
C where N = I+timeLevBase-1 |
97 |
|
C Thus a checkpoint contains U.0000000000, GU.0000000001 and |
98 |
|
C cg2d_x.0000000001 in the indexing scheme used for the model |
99 |
|
C "state" files. This example is referred to as a checkpoint |
100 |
|
C at time level 1 |
101 |
|
CALL WRITE_CHECKPOINT( .FALSE., myCurrentTime, myCurrentIter, myThid ) |
102 |
|
|
103 |
ENDDO |
ENDDO |
104 |
|
|
105 |
|
C-- Dump for end state and final checkpoint |
106 |
|
CALL WRITE_STATE( myCurrentTime, myCurrentIter, myThid ) |
107 |
|
CALL WRITE_CHECKPOINT( .TRUE., myCurrentTime, myCurrentIter, myThid ) |
108 |
|
|
109 |
|
|
110 |
RETURN |
RETURN |
111 |
END |
END |