1 |
C $Header: /CVS/people/chenze/ECCO/code-async/initialise_fixed.F,v 1.1 2013/08/21 21:18:32 chenze Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_OPTIONS.h" |
6 |
|
7 |
CBOP |
8 |
C !ROUTINE: INITIALISE_FIXED |
9 |
C !INTERFACE: |
10 |
SUBROUTINE INITIALISE_FIXED( myThid ) |
11 |
|
12 |
C !DESCRIPTION: \bv |
13 |
C *==========================================================* |
14 |
C | SUBROUTINE INITIALISE_FIXED |
15 |
C | o Routine for setting fixed model arrays such as |
16 |
C | topography, grid, solver matrices, etc. |
17 |
C *==========================================================* |
18 |
C | INITIALISE_FIXED is invoked at the start of the model to |
19 |
C | set fixed model arrays. It reads data from an input file |
20 |
C | and from various binary files. |
21 |
C | Each thread invokes an instance of this routine as does |
22 |
C | each process in a multi-process parallel environment like |
23 |
C | MPI. |
24 |
C *==========================================================* |
25 |
C \ev |
26 |
|
27 |
C !CALLING SEQUENCE: |
28 |
C INITIALISE_FIXED |
29 |
C | |
30 |
C |-- INI_PARMS |
31 |
C | |
32 |
C |-- PACKAGES_BOOT |
33 |
C | |
34 |
C |-- PACKAGES_READPARMS |
35 |
C | |- ${PKG}_READPARMS |
36 |
C | |
37 |
C |-- SET_PARMS |
38 |
C | |
39 |
C |-- INI_MODEL_IO |
40 |
C | |- MNC_INIT + MNC_CW_INIT |
41 |
C | |- MON_INIT |
42 |
C | |
43 |
C |-- INI_GRID |
44 |
C | |
45 |
C |-- LOAD_REF_FILES |
46 |
C | |
47 |
C |-- INI_EOS |
48 |
C | |
49 |
C |-- SET_REF_STATE |
50 |
C | |
51 |
C |-- SET_GRID_FACTORS |
52 |
C | |
53 |
C |-- INI_DEPTHS |
54 |
C | |
55 |
C |-- INI_MASKS_ETC |
56 |
C | |
57 |
C |-- PACKAGES_INIT_FIXED |
58 |
C | |- ${PKG}_INIT_FIXED |
59 |
C | |
60 |
C |-- INI_GLOBAL_DOMAIN |
61 |
C | |
62 |
C |-- INI_LINEAR_PHISURF |
63 |
C | |
64 |
C |-- INI_CORI |
65 |
C | |
66 |
C |-- INI_CG2D |
67 |
C | |
68 |
C |-- INI_CG3D |
69 |
C | |
70 |
C |-- CONFIG_SUMMARY |
71 |
C | |
72 |
C |-- PACKAGES_CHECK |
73 |
C | |- ${PKG}_CHECK |
74 |
C | |
75 |
C |-- CONFIG_CHECK |
76 |
C | |
77 |
C |-- WRITE_GRID |
78 |
C | |
79 |
C |-- CPL_EXCH_CONFIGS |
80 |
|
81 |
C !USES: |
82 |
IMPLICIT NONE |
83 |
C == Global variables == |
84 |
#include "SIZE.h" |
85 |
#include "EEPARAMS.h" |
86 |
#include "PARAMS.h" |
87 |
|
88 |
C !INPUT/OUTPUT PARAMETERS: |
89 |
C == Routine arguments == |
90 |
INTEGER myThid |
91 |
CEOP |
92 |
|
93 |
#ifdef ALLOW_DEBUG |
94 |
IF (debugMode) CALL DEBUG_ENTER('INITIALISE_FIXED',myThid) |
95 |
#endif |
96 |
|
97 |
C- here is a way to deliberately break the barrier syncronization |
98 |
C by adding a BARRIER on thread XXX only ; Used to test BAR_CHECK. |
99 |
c IF ( myThid.EQ.XXX ) THEN |
100 |
c _BARRIER |
101 |
c CALL SYSTEM('sleep 1') |
102 |
c ENDIF |
103 |
C-- Check barrier synchronization: |
104 |
CALL BAR_CHECK( 2, myThid ) |
105 |
|
106 |
C-- Set model parameters. |
107 |
C Parameters are set to defaults and then updates are read from |
108 |
C an input file called data. |
109 |
#ifdef ALLOW_DEBUG |
110 |
IF (debugMode) CALL DEBUG_CALL('INI_PARMS',myThid) |
111 |
#endif |
112 |
CALL INI_PARMS( myThid ) |
113 |
|
114 |
C-- Configure packages |
115 |
#ifdef ALLOW_DEBUG |
116 |
IF (debugMode) CALL DEBUG_CALL('PACKAGES_BOOT',myThid) |
117 |
#endif |
118 |
CALL PACKAGES_BOOT( myThid ) |
119 |
|
120 |
C-- Read configuration parameters for packages |
121 |
#ifdef ALLOW_DEBUG |
122 |
IF (debugMode) CALL DEBUG_CALL('PACKAGES_READPARMS',myThid) |
123 |
#endif |
124 |
CALL PACKAGES_READPARMS( myThid ) |
125 |
|
126 |
C-- Set (or reset) parameters (at this point, know which packages are used); |
127 |
C after this call, main model parameters are not supposed to be modified. |
128 |
#ifdef ALLOW_DEBUG |
129 |
IF (debugMode) CALL DEBUG_CALL('SET_PARMS',myThid) |
130 |
#endif |
131 |
CALL SET_PARMS( myThid ) |
132 |
|
133 |
C-- Write units/set precision/etc for I/O (pickup, MDS/RW, MNC, MONITOR): |
134 |
#ifdef ALLOW_DEBUG |
135 |
IF (debugMode) CALL DEBUG_CALL('INI_MODEL_IO',myThid) |
136 |
#endif |
137 |
CALL INI_MODEL_IO( myThid ) |
138 |
|
139 |
C-- Set model grid. |
140 |
C Variables defining model grid spacing are defined. |
141 |
#ifdef ALLOW_DEBUG |
142 |
IF (debugMode) CALL DEBUG_CALL('INI_GRID',myThid) |
143 |
#endif |
144 |
#ifdef ALLOW_AUTODIFF_OPENAD |
145 |
CALL OpenAD_INI_GRID( myThid ) |
146 |
#else |
147 |
CALL INI_GRID( myThid ) |
148 |
#endif |
149 |
|
150 |
C-- Load reference profiles from files |
151 |
#ifdef ALLOW_DEBUG |
152 |
IF (debugMode) CALL DEBUG_CALL('LOAD_REF_FILES',myThid) |
153 |
#endif |
154 |
CALL LOAD_REF_FILES( myThid ) |
155 |
|
156 |
C-- Set equation of state parameters. |
157 |
#ifdef ALLOW_DEBUG |
158 |
IF (debugMode) CALL DEBUG_CALL('INI_EOS',myThid) |
159 |
#endif |
160 |
CALL INI_EOS( myThid ) |
161 |
|
162 |
C-- Set reference state (vertical reference profiles) |
163 |
#ifdef ALLOW_DEBUG |
164 |
IF (debugMode) CALL DEBUG_CALL('SET_REF_STATE',myThid) |
165 |
#endif |
166 |
CALL SET_REF_STATE( myThid ) |
167 |
|
168 |
C-- Set remaining grid factors |
169 |
#ifdef ALLOW_DEBUG |
170 |
IF (debugMode) CALL DEBUG_CALL('SET_GRID_FACTORS',myThid) |
171 |
#endif |
172 |
CALL SET_GRID_FACTORS( myThid ) |
173 |
|
174 |
C-- Initialise map of depths |
175 |
#ifdef ALLOW_DEBUG |
176 |
IF (debugMode) CALL DEBUG_CALL('INI_DEPTHS',myThid) |
177 |
#endif |
178 |
#ifdef ALLOW_AUTODIFF_OPENAD |
179 |
CALL OpenAD_INI_DEPTHS( myThid ) |
180 |
#else |
181 |
CALL INI_DEPTHS( myThid ) |
182 |
#endif |
183 |
|
184 |
C-- Derive masks, lopping factors and recipricols of quantities. |
185 |
C Volumes and areas are set according to grid and depth map. |
186 |
#ifdef ALLOW_DEBUG |
187 |
IF (debugMode) CALL DEBUG_CALL('INI_MASKS_ETC',myThid) |
188 |
#endif |
189 |
#ifdef ALLOW_AUTODIFF_OPENAD |
190 |
CALL OpenAD_INI_MASKS_ETC( myThid ) |
191 |
#else |
192 |
CALL INI_MASKS_ETC( myThid ) |
193 |
#endif |
194 |
|
195 |
C-- Synchronize all threads after setting masks and before pkgs init. |
196 |
_BARRIER |
197 |
|
198 |
C-- Call fixed data initialization phase of packages |
199 |
#ifdef ALLOW_DEBUG |
200 |
IF (debugMode) CALL DEBUG_CALL('PACKAGES_INIT_FIXED',myThid) |
201 |
#endif |
202 |
CALL PACKAGES_INIT_FIXED( myThid ) |
203 |
|
204 |
C-- Set some domain-dependent (global) constant (e.g., globalArea) |
205 |
#ifdef ALLOW_DEBUG |
206 |
IF (debugMode) CALL DEBUG_CALL('INI_GLOBAL_DOMAIN',myThid) |
207 |
#endif |
208 |
CALL INI_GLOBAL_DOMAIN( myThid ) |
209 |
|
210 |
C-- Set Bo_surf => define the Linear Relation: Phi_surf(eta) |
211 |
#ifdef ALLOW_DEBUG |
212 |
IF (debugMode) CALL DEBUG_CALL('INI_LINEAR_PHISURF',myThid) |
213 |
#endif |
214 |
#ifdef ALLOW_AUTODIFF_OPENAD |
215 |
CALL OpenAD_INI_LINEAR_PHISURF( myThid ) |
216 |
#else |
217 |
CALL INI_LINEAR_PHISURF( myThid ) |
218 |
#endif |
219 |
|
220 |
C-- Set coriolis operators |
221 |
#ifdef ALLOW_DEBUG |
222 |
IF (debugMode) CALL DEBUG_CALL('INI_CORI',myThid) |
223 |
#endif |
224 |
#ifdef ALLOW_AUTODIFF_OPENAD |
225 |
CALL OpenAD_INI_CORI( myThid ) |
226 |
#else |
227 |
CALL INI_CORI( myThid ) |
228 |
#endif |
229 |
|
230 |
C-- Set laplace operators for use in 2D conjugate gradient solver. |
231 |
#ifdef ALLOW_DEBUG |
232 |
IF (debugMode) CALL DEBUG_CALL('INI_CG2D',myThid) |
233 |
#endif |
234 |
#ifdef ALLOW_AUTODIFF_OPENAD |
235 |
CALL OpenAD_INI_CG2D( myThid ) |
236 |
#else |
237 |
CALL INI_CG2D( myThid ) |
238 |
#endif |
239 |
|
240 |
#ifdef ALLOW_NONHYDROSTATIC |
241 |
C-- Set laplace operators for use in 3D conjugate gradient solver. |
242 |
#ifdef ALLOW_DEBUG |
243 |
IF (debugMode) CALL DEBUG_CALL('INI_CG3D',myThid) |
244 |
#endif |
245 |
CALL INI_CG3D( myThid ) |
246 |
#endif |
247 |
|
248 |
C-- Finally summarise the model configuration |
249 |
#ifdef ALLOW_DEBUG |
250 |
IF (debugMode) CALL DEBUG_CALL('CONFIG_SUMMARY',myThid) |
251 |
#endif |
252 |
CALL CONFIG_SUMMARY( myThid ) |
253 |
|
254 |
C-- Check packages configuration (& print summary) |
255 |
#ifdef ALLOW_DEBUG |
256 |
IF (debugMode) CALL DEBUG_CALL('PACKAGES_CHECK',myThid) |
257 |
#endif |
258 |
CALL PACKAGES_CHECK( myThid ) |
259 |
|
260 |
C-- Check parameters and model configuration |
261 |
#ifdef ALLOW_DEBUG |
262 |
IF (debugMode) CALL DEBUG_CALL('CONFIG_CHECK',myThid) |
263 |
#endif |
264 |
CALL CONFIG_CHECK( myThid ) |
265 |
|
266 |
C-- Write grid data and geometry arrays |
267 |
IF ( debugLevel.GE.debLevA .OR. startTime.EQ.baseTime ) THEN |
268 |
#ifdef ALLOW_DEBUG |
269 |
IF (debugMode) CALL DEBUG_CALL('WRITE_GRID',myThid) |
270 |
#endif |
271 |
ch CALL WRITE_GRID( myThid ) |
272 |
ENDIF |
273 |
|
274 |
#ifdef COMPONENT_MODULE |
275 |
C-- Post component-model configuration information to coupler |
276 |
C and get config. info for other component(s). |
277 |
IF ( useCoupler ) THEN |
278 |
# ifdef ALLOW_DEBUG |
279 |
IF (debugMode) CALL DEBUG_CALL('CPL_EXCH_CONFIGS',myThid) |
280 |
# endif |
281 |
CALL CPL_EXCH_CONFIGS( myThid ) |
282 |
ENDIF |
283 |
#endif /* COMPONENT_MODULE */ |
284 |
|
285 |
C-- Check barrier synchronization: |
286 |
CALL BAR_CHECK( 3, myThid ) |
287 |
|
288 |
#ifdef ALLOW_DEBUG |
289 |
IF (debugMode) CALL DEBUG_LEAVE('INITIALISE_FIXED',myThid) |
290 |
#endif |
291 |
|
292 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
293 |
|
294 |
RETURN |
295 |
END |