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

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

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


Revision 1.7 - (show annotations) (download)
Thu May 21 18:25:49 1998 UTC (26 years ago) by cnh
Branch: MAIN
CVS Tags: checkpoint2
Changes since 1.6: +35 -12 lines
Added support for binary IO of model fields for restart and/or
postprocessing

1 C $Header: /u/gcmpack/models/MITgcmUV/model/src/the_model_main.F,v 1.6 1998/04/24 03:45:12 cnh Exp $
2
3 #include "CPP_EEOPTIONS.h"
4
5 SUBROUTINE THE_MODEL_MAIN(myThid)
6 C /==========================================================\
7 C | SUBROUTINE THE_MODEL_MAIN |
8 C | o Master controlling routine for model using the MITgcm |
9 C | UV parallel wrapper. |
10 C |==========================================================|
11 C | THE_MODEL_MAIN is invoked by the MITgcm UV parallel |
12 C | wrapper with a single integer argument "myThid". This |
13 C | variable identifies the thread number of an instance of |
14 C | THE_MODEL_MAIN. Each instance of THE_MODEL_MAIN works |
15 C | on a particular region of the models domain and |
16 C | synchronises with other instances as necessary. The |
17 C | routine has to "understand" the MITgcm parallel |
18 C | environment and the numerical algorithm. Editing this |
19 C | routine is best done with some knowledge of both aspects.|
20 C | Notes |
21 C | ===== |
22 C | C*P* comments indicating place holders for which code is |
23 C | presently being developed. |
24 C \==========================================================/
25
26 C == Global variables ===
27 #include "SIZE.h"
28 #include "EEPARAMS.h"
29 #include "PARAMS.h"
30 #include "CG2D.h"
31 #include "DYNVARS.h"
32
33 C == Routine arguments ==
34 C myThid - Thread number for this instance of the routine.
35 INTEGER myThid
36
37 C == Local variables ==
38 C Note: Under the multi-threaded model myCurrentIter and
39 C myCurrentTime are local variables passed around as routine
40 C arguments. Although this is fiddly it saves the need to
41 C impose additional synchronisation points when they are
42 C updated.
43 C myCurrentIter - Iteration counter for this thread
44 C myCurrentTime - Time counter for this thread
45 C I - Loop counter
46 INTEGER I, myCurrentIter
47 REAL myCurrentTime
48
49 C-- Set model initial conditions
50 CALL INITIALISE( myThid )
51 myCurrentTime = startTime
52 myCurrentIter = nIter0
53
54 C-- Begin time stepping loop
55 DO I=1, nTimeSteps
56
57 C-- Load offline tracer fields
58 IF ( MOD(myCurrentIter,numStepsPerPickup) .EQ. 1 ) THEN
59 C I/O
60 C o Writes to arrays are performed by their own thread (to ensure
61 C physical memory allocation will pair with thread).
62 C o Thread 1 reads into a buffer.
63 C CALL LOAD_OFFLINE_FIELDS( myCurrentTime, myCurrentIter, myThid )
64 ENDIF
65
66 C-- Step forward fields and calculate time tendency terms
67 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).
78 C Two-dimensional only for conventional hydrostatic or
79 C three-dimensional for non-hydrostatic and/or IGW scheme.
80 CALL SOLVE_FOR_PRESSURE( myThid )
81
82 C-- Do "blocking" sends and receives for tendency "overlap" terms
83 CALL DO_GTERM_BLOCKING_EXCHANGES( myThid )
84
85 myCurrentIter = myCurrentIter + 1
86 myCurrentTime = myCurrentTime + deltaTClock
87
88 C-- Save state for restarts
89 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
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
111 END

  ViewVC Help
Powered by ViewVC 1.1.22