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