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

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

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


Revision 1.9 - (hide annotations) (download)
Mon Jun 1 20:36:13 1998 UTC (25 years, 11 months ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint5, checkpoint6
Changes since 1.8: +4 -1 lines
Swapped the time-stepping algorithm around (just a little bit).
We now officially use the predictor-corrector terminology.
We make the prediction step at the end of the dynamics() section
and store the result in the gUNm1, gVNm1, gTNm1 arrays.
The "tricky" part is that at the beginning of the dynamics section,
where the "correction" is made, theses arrays must be initialised
at the beginning of any run. A new routine init_predictor() does this.
This is "all" in preparation for implicit diffusion. Let's hope
it's enough...

1 adcroft 1.9 C $Header: /u/gcmpack/models/MITgcmUV/model/src/the_model_main.F,v 1.8 1998/05/25 20:05:55 cnh Exp $
2 cnh 1.1
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 cnh 1.6 INTEGER myThid
36 cnh 1.1
37     C == Local variables ==
38 cnh 1.7 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 cnh 1.1 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 adcroft 1.9
54     C-- Initialise time-stepping (predictor variables are carried in G)
55     CALL INIT_PREDICTOR( myThid )
56 cnh 1.1
57     C-- Begin time stepping loop
58     DO I=1, nTimeSteps
59 cnh 1.4
60 cnh 1.1 C-- Load offline tracer fields
61     IF ( MOD(myCurrentIter,numStepsPerPickup) .EQ. 1 ) THEN
62     C I/O
63     C o Writes to arrays are performed by their own thread (to ensure
64     C physical memory allocation will pair with thread).
65     C o Thread 1 reads into a buffer.
66     C CALL LOAD_OFFLINE_FIELDS( myCurrentTime, myCurrentIter, myThid )
67     ENDIF
68    
69     C-- Step forward fields and calculate time tendency terms
70 cnh 1.8 CALL DYNAMICS( myCurrentTime, myCurrentIter, myThid )
71 cnh 1.1
72 cnh 1.7 C-- Do IO if needed.
73     C Note:
74     C =====
75     C At this point model arrays hold U,V,T,S at "time-level" N
76     C and cg2d_x at "time-level" N-1/2 where N = I+timeLevBase-1.
77     C By convention this is taken to be the model "state".
78     CALL DO_THE_MODEL_IO( myCurrentTime, myCurrentIter, myThid )
79    
80 cnh 1.1 C-- Solve elliptic equation(s).
81 cnh 1.7 C Two-dimensional only for conventional hydrostatic or
82     C three-dimensional for non-hydrostatic and/or IGW scheme.
83 cnh 1.1 CALL SOLVE_FOR_PRESSURE( myThid )
84    
85     C-- Do "blocking" sends and receives for tendency "overlap" terms
86     CALL DO_GTERM_BLOCKING_EXCHANGES( myThid )
87    
88     myCurrentIter = myCurrentIter + 1
89 cnh 1.7 myCurrentTime = myCurrentTime + deltaTClock
90 cnh 1.1
91     C-- Save state for restarts
92 cnh 1.7 C Note:
93     C =====
94     C Because of the ordereing of the timestepping code and
95     C tendency term code at end of loop model arrays hold
96     C U,V,T,S at "time-level" N but gu, gv, gs, gt, guNM1,...
97     C at "time-level" N+1/2 (guNM1 at "time-level" N+1/2 is
98     C gu at "time-level" N-1/2) and cg2d_x at "time-level" N+1/2.
99     C where N = I+timeLevBase-1
100     C Thus a checkpoint contains U.0000000000, GU.0000000001 and
101     C cg2d_x.0000000001 in the indexing scheme used for the model
102     C "state" files. This example is referred to as a checkpoint
103     C at time level 1
104     CALL WRITE_CHECKPOINT( .FALSE., myCurrentTime, myCurrentIter, myThid )
105 cnh 1.1
106     ENDDO
107 cnh 1.7
108     C-- Dump for end state and final checkpoint
109     CALL WRITE_STATE( myCurrentTime, myCurrentIter, myThid )
110     CALL WRITE_CHECKPOINT( .TRUE., myCurrentTime, myCurrentIter, myThid )
111    
112 cnh 1.1
113     RETURN
114     END

  ViewVC Help
Powered by ViewVC 1.1.22