1 |
C $Header: /u/gcmpack/models/MITgcmUV/model/src/the_model_main.F,v 1.32 2000/04/05 19:04:14 adcroft Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CPP_OPTIONS.h" |
5 |
|
6 |
SUBROUTINE THE_MODEL_MAIN(myThid) |
7 |
C /==========================================================\ |
8 |
C | SUBROUTINE THE_MODEL_MAIN | |
9 |
C | o Master controlling routine for model using the MITgcm | |
10 |
C | UV parallel wrapper. | |
11 |
C |==========================================================| |
12 |
C | THE_MODEL_MAIN is invoked by the MITgcm UV parallel | |
13 |
C | wrapper with a single integer argument "myThid". This | |
14 |
C | variable identifies the thread number of an instance of | |
15 |
C | THE_MODEL_MAIN. Each instance of THE_MODEL_MAIN works | |
16 |
C | on a particular region of the models domain and | |
17 |
C | synchronises with other instances as necessary. The | |
18 |
C | routine has to "understand" the MITgcm parallel | |
19 |
C | environment and the numerical algorithm. Editing this | |
20 |
C | routine is best done with some knowledge of both aspects.| |
21 |
C | Notes | |
22 |
C | ===== | |
23 |
C | C*P* comments indicating place holders for which code is | |
24 |
C | presently being developed. | |
25 |
C \==========================================================/ |
26 |
IMPLICIT NONE |
27 |
C |
28 |
C Call Tree |
29 |
C ========= |
30 |
C |
31 |
C main ( eesupp ) |
32 |
C | |
33 |
C . |
34 |
C . |
35 |
C . Generic environment initialisation ( see eesupp/src and |
36 |
C . eesupp/inc ) |
37 |
C . multiple threads and/or processes are created in here |
38 |
C . |
39 |
C . |
40 |
C . |
41 |
C | |
42 |
C |-THE_MODEL_MAIN - Begin specific model. One instance |
43 |
C | | of this codes exists for each thread |
44 |
C | | and/or instance. Each instance manages |
45 |
C | | a specifc set of tiles. |
46 |
C | | |
47 |
C | |--INITIALISE_FIXED |
48 |
C | | o Set model configuration (fixed arrays) |
49 |
C | | Topography, hydrography, timestep, grid, etc.. |
50 |
C | | |
51 |
C | |--THE_MAIN_LOOP |
52 |
C | | | |
53 |
C | | |--INITIALISE_VARIA |
54 |
C | | | o Set initial conditions (variable arrays) |
55 |
C | | | |
56 |
C ==> | | | ** Time stepping loop starts here ** |
57 |
C | | | | |
58 |
C /|\ | | | |
59 |
C | | | |--FORWARD_STEP |
60 |
C /|\ | | | | o Does a single forward step of the model |
61 |
C | | | | | |
62 |
C /|\ | | | | |
63 |
C | | | | |--LOAD_EXTERNAL_DATA |
64 |
C /|\ | | | | o Load and/or set time dependent forcing fields |
65 |
C | | | | | |
66 |
C /|\ | | | |--DYNAMICS |
67 |
C | | | | | o Evaluate "forward" terms |
68 |
C /|\ | | | | |
69 |
C | | | | |--DO_THE_MODEL_IO |
70 |
C /|\ | | | | o Write model state |
71 |
C | | | | | |
72 |
C /|\ | | | |--SOLVE_FOR_PRESSURE |
73 |
C | | | | | o Find pressure field to keep flow non-divergent |
74 |
C /|\ | | | | |
75 |
C | | | | |--DO_GTERM_BLOCKING_EXCHANGES |
76 |
C /|\ | | | | o Update overlap regions |
77 |
C | | | | | |
78 |
C /|\ | | | |--WRITE_CHECKPOINT |
79 |
C | | | | | o Write restart file(s) |
80 |
C /|\ | | | |
81 |
C | | | | |
82 |
C |<== | | | ** Time stepping loop finishes here ** |
83 |
C | | | |
84 |
C | | |-- |
85 |
C | | |
86 |
C | |--WRITE_STATE |
87 |
C | |--WRITE_CHECKPOINT |
88 |
C | |
89 |
C . |
90 |
C . |
91 |
C . Generic environment termination ( see eesupp/src and |
92 |
C . eesupp/inc ) |
93 |
C . |
94 |
C . |
95 |
|
96 |
C == Global variables === |
97 |
#include "SIZE.h" |
98 |
#include "EEPARAMS.h" |
99 |
#include "PARAMS.h" |
100 |
#include "DYNVARS.h" |
101 |
#include "CG2D.h" |
102 |
#ifdef ALLOW_NONHYDROSTATIC |
103 |
#include "CG3D.h" |
104 |
#endif |
105 |
|
106 |
C == Routine arguments == |
107 |
C myThid - Thread number for this instance of the routine. |
108 |
INTEGER myThid |
109 |
|
110 |
C == Local variables == |
111 |
C Note: Under the multi-threaded model myCurrentIter and |
112 |
C myCurrentTime are local variables passed around as routine |
113 |
C arguments. Although this is fiddly it saves the need to |
114 |
C impose additional synchronisation points when they are |
115 |
C updated. |
116 |
|
117 |
C-- This timer encompasses the whole code |
118 |
CALL TIMER_START('ALL [THE_MODEL_MAIN]',myThid) |
119 |
|
120 |
|
121 |
C-- Set model configuration (fixed arrays) |
122 |
CALL TIMER_START('INITIALISE_FIXED [THE_MODEL_MAIN]',myThid) |
123 |
CALL INITIALISE_FIXED( myThid ) |
124 |
CALL TIMER_STOP ('INITIALISE_FIXED [THE_MODEL_MAIN]',myThid) |
125 |
|
126 |
|
127 |
C-- Call time stepping loop of full model |
128 |
CALL TIMER_START('THE_MAIN_LOOP [THE_MODEL_MAIN]',myThid) |
129 |
CALL THE_MAIN_LOOP( myThid ) |
130 |
CALL TIMER_STOP ('THE_MAIN_LOOP [THE_MODEL_MAIN]',myThid) |
131 |
|
132 |
|
133 |
CALL TIMER_STOP ('ALL [THE_MODEL_MAIN]',myThid) |
134 |
|
135 |
C-- Write timer statistics |
136 |
IF ( myThid .EQ. 1 ) THEN |
137 |
CALL TIMER_PRINTALL( myThid ) |
138 |
CALL COMM_STATS |
139 |
ENDIF |
140 |
|
141 |
RETURN |
142 |
END |