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 |-- PACKAGES_READPARMS |
35 |
|
C | |- ${PKG}_READPARMS |
36 |
C | |
C | |
37 |
C |-- INI_DEPTHS |
C |-- SET_PARMS |
38 |
C | |
C | |
39 |
C |-- INI_MASKS_ETC |
C |-- INI_MODEL_IO |
40 |
|
C | |- MNC_INIT + MNC_CW_INIT |
41 |
|
C | |- MON_INIT |
42 |
C | |
C | |
43 |
C |-- INI_LINEAR_PHSURF |
C |-- INI_GRID |
44 |
C | |
C | |
45 |
C |-- INI_CORI |
C |-- LOAD_REF_FILES |
46 |
C | |
C | |
47 |
C |-- PACKAGES_BOOT |
C |-- INI_EOS |
48 |
C | |
C | |
49 |
C |-- PACKAGES_READPARMS |
C |-- SET_REF_STATE |
50 |
C | |
C | |
51 |
C |-- PACKAGES_CHECK |
C |-- SET_GRID_FACTORS |
52 |
|
C | |
53 |
|
C |-- INI_DEPTHS |
54 |
|
C | |
55 |
|
C |-- INI_MASKS_ETC |
56 |
C | |
C | |
57 |
C |-- PACKAGES_INIT_FIXED |
C |-- PACKAGES_INIT_FIXED |
58 |
|
C | |- ${PKG}_INIT_FIXED |
59 |
C | |
C | |
60 |
C |-- ZONAL_FILT_INIT |
C |-- INI_GLOBAL_DOMAIN |
61 |
|
C | |
62 |
|
C |-- INI_LINEAR_PHISURF |
63 |
|
C | |
64 |
|
C |-- INI_CORI |
65 |
C | |
C | |
66 |
C |-- INI_CG2D |
C |-- INI_CG2D |
67 |
C | |
C | |
68 |
C |-- INI_CG3D |
C |-- INI_CG3D |
69 |
C | |
C | |
70 |
C |-- CONFIG_SUMMARY |
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: |
C !USES: |
82 |
IMPLICIT NONE |
IMPLICIT NONE |
90 |
INTEGER myThid |
INTEGER myThid |
91 |
CEOP |
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. |
C-- Set model parameters. |
107 |
C Parameters are set to defaults and then updates are read from |
C Parameters are set to defaults and then updates are read from |
108 |
C an input file called data. |
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 ) |
CALL INI_PARMS( myThid ) |
|
_BARRIER |
|
113 |
|
|
114 |
#ifndef EXCLUDE_MONITOR |
C-- Configure packages |
115 |
C-- Initialise MONITOR I/O streams so we can report config. info |
#ifdef ALLOW_DEBUG |
116 |
CALL MON_INIT( myThid ) |
IF (debugMode) CALL DEBUG_CALL('PACKAGES_BOOT',myThid) |
|
_BARRIER |
|
117 |
#endif |
#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. |
C-- Set model grid. |
140 |
C Variables defining model grid spacing are defined. |
C Variables defining model grid spacing are defined. |
141 |
|
#ifdef ALLOW_DEBUG |
142 |
|
IF (debugMode) CALL DEBUG_CALL('INI_GRID',myThid) |
143 |
|
#endif |
144 |
CALL INI_GRID( myThid ) |
CALL INI_GRID( myThid ) |
145 |
_BARRIER |
|
146 |
|
C-- Load reference profiles from files |
147 |
|
#ifdef ALLOW_DEBUG |
148 |
|
IF (debugMode) CALL DEBUG_CALL('LOAD_REF_FILES',myThid) |
149 |
|
#endif |
150 |
|
CALL LOAD_REF_FILES( myThid ) |
151 |
|
|
152 |
|
C-- Set equation of state parameters. |
153 |
|
#ifdef ALLOW_DEBUG |
154 |
|
IF (debugMode) CALL DEBUG_CALL('INI_EOS',myThid) |
155 |
|
#endif |
156 |
|
CALL INI_EOS( myThid ) |
157 |
|
|
158 |
|
C-- Set reference state (vertical reference profiles) |
159 |
|
#ifdef ALLOW_DEBUG |
160 |
|
IF (debugMode) CALL DEBUG_CALL('SET_REF_STATE',myThid) |
161 |
|
#endif |
162 |
|
CALL SET_REF_STATE( myThid ) |
163 |
|
|
164 |
|
C-- Set remaining grid factors |
165 |
|
#ifdef ALLOW_DEBUG |
166 |
|
IF (debugMode) CALL DEBUG_CALL('SET_GRID_FACTORS',myThid) |
167 |
|
#endif |
168 |
|
CALL SET_GRID_FACTORS( myThid ) |
169 |
|
|
170 |
C-- Initialise map of depths |
C-- Initialise map of depths |
171 |
|
#ifdef ALLOW_DEBUG |
172 |
|
IF (debugMode) CALL DEBUG_CALL('INI_DEPTHS',myThid) |
173 |
|
#endif |
174 |
CALL INI_DEPTHS( myThid ) |
CALL INI_DEPTHS( myThid ) |
|
_BARRIER |
|
175 |
|
|
176 |
C-- Derive masks, lopping factors and recipricols of quantities. |
C-- Derive masks, lopping factors and recipricols of quantities. |
177 |
C Volumes and areas are set according to grid and depth map. |
C Volumes and areas are set according to grid and depth map. |
178 |
|
#ifdef ALLOW_DEBUG |
179 |
|
IF (debugMode) CALL DEBUG_CALL('INI_MASKS_ETC',myThid) |
180 |
|
#endif |
181 |
CALL INI_MASKS_ETC( myThid ) |
CALL INI_MASKS_ETC( myThid ) |
182 |
|
|
183 |
|
C-- Synchronize all threads after setting masks and before pkgs init. |
184 |
_BARRIER |
_BARRIER |
185 |
|
|
186 |
|
C-- Call fixed data initialization phase of packages |
187 |
|
#ifdef ALLOW_DEBUG |
188 |
|
IF (debugMode) CALL DEBUG_CALL('PACKAGES_INIT_FIXED',myThid) |
189 |
|
#endif |
190 |
|
CALL PACKAGES_INIT_FIXED( myThid ) |
191 |
|
|
192 |
|
C-- Set some domain-dependent (global) constant (e.g., globalArea) |
193 |
|
#ifdef ALLOW_DEBUG |
194 |
|
IF (debugMode) CALL DEBUG_CALL('INI_GLOBAL_DOMAIN',myThid) |
195 |
|
#endif |
196 |
|
CALL INI_GLOBAL_DOMAIN( myThid ) |
197 |
|
|
198 |
C-- Set Bo_surf => define the Linear Relation: Phi_surf(eta) |
C-- Set Bo_surf => define the Linear Relation: Phi_surf(eta) |
199 |
|
#ifdef ALLOW_DEBUG |
200 |
|
IF (debugMode) CALL DEBUG_CALL('INI_LINEAR_PHISURF',myThid) |
201 |
|
#endif |
202 |
CALL INI_LINEAR_PHISURF( myThid ) |
CALL INI_LINEAR_PHISURF( myThid ) |
203 |
|
|
204 |
C-- Set coriolis operators |
C-- Set coriolis operators |
205 |
|
#ifdef ALLOW_DEBUG |
206 |
|
IF (debugMode) CALL DEBUG_CALL('INI_CORI',myThid) |
207 |
|
#endif |
208 |
CALL INI_CORI( myThid ) |
CALL INI_CORI( myThid ) |
209 |
|
|
210 |
C-- Configure packages |
C-- Set laplace operators for use in 2D conjugate gradient solver. |
211 |
CALL PACKAGES_BOOT( myThid ) |
#ifdef ALLOW_DEBUG |
212 |
|
IF (debugMode) CALL DEBUG_CALL('INI_CG2D',myThid) |
213 |
|
#endif |
214 |
|
CALL INI_CG2D( myThid ) |
215 |
|
|
216 |
C-- Read configuration parameters for packages |
#ifdef ALLOW_NONHYDROSTATIC |
217 |
CALL PACKAGES_READPARMS( myThid ) |
C-- Set laplace operators for use in 3D conjugate gradient solver. |
218 |
|
#ifdef ALLOW_DEBUG |
219 |
|
IF (debugMode) CALL DEBUG_CALL('INI_CG3D',myThid) |
220 |
|
#endif |
221 |
|
CALL INI_CG3D( myThid ) |
222 |
|
#endif |
223 |
|
|
224 |
C-- Check dependances between packages |
C-- Finally summarise the model configuration |
225 |
|
#ifdef ALLOW_DEBUG |
226 |
|
IF (debugMode) CALL DEBUG_CALL('CONFIG_SUMMARY',myThid) |
227 |
|
#endif |
228 |
|
CALL CONFIG_SUMMARY( myThid ) |
229 |
|
|
230 |
|
C-- Check packages configuration (& print summary) |
231 |
|
#ifdef ALLOW_DEBUG |
232 |
|
IF (debugMode) CALL DEBUG_CALL('PACKAGES_CHECK',myThid) |
233 |
|
#endif |
234 |
CALL PACKAGES_CHECK( myThid ) |
CALL PACKAGES_CHECK( myThid ) |
235 |
|
|
236 |
C-- Call fixed data initialization phase of packages |
C-- Check parameters and model configuration |
237 |
CALL PACKAGES_INIT_FIXED( myThid ) |
#ifdef ALLOW_DEBUG |
238 |
|
IF (debugMode) CALL DEBUG_CALL('CONFIG_CHECK',myThid) |
239 |
|
#endif |
240 |
|
CALL CONFIG_CHECK( myThid ) |
241 |
|
|
242 |
#ifdef ALLOW_ZONAL_FILT |
C-- Write grid data and geometry arrays |
243 |
C-- Latitude circle filter initialisation |
IF ( debugLevel.GE.debLevA .OR. startTime.EQ.baseTime ) THEN |
244 |
CALL ZONAL_FILT_INIT(myThid) |
#ifdef ALLOW_DEBUG |
245 |
_BARRIER |
IF (debugMode) CALL DEBUG_CALL('WRITE_GRID',myThid) |
246 |
#endif |
#endif |
247 |
|
CALL WRITE_GRID( myThid ) |
248 |
|
ENDIF |
249 |
|
|
250 |
C-- Set laplace operators for use in 2D conjugate gradient solver. |
#ifdef COMPONENT_MODULE |
251 |
CALL INI_CG2D( myThid ) |
C-- Post component-model configuration information to coupler |
252 |
|
C and get config. info for other component(s). |
253 |
|
IF ( useCoupler ) THEN |
254 |
|
# ifdef ALLOW_DEBUG |
255 |
|
IF (debugMode) CALL DEBUG_CALL('CPL_EXCH_CONFIGS',myThid) |
256 |
|
# endif |
257 |
|
CALL CPL_EXCH_CONFIGS( myThid ) |
258 |
|
ENDIF |
259 |
|
#endif /* COMPONENT_MODULE */ |
260 |
|
|
261 |
#ifdef ALLOW_NONHYDROSTATIC |
C-- Check barrier synchronization: |
262 |
C-- Set laplace operators for use in 3D conjugate gradient solver. |
CALL BAR_CHECK( 3, myThid ) |
263 |
CALL INI_CG3D( myThid ) |
|
264 |
|
#ifdef ALLOW_DEBUG |
265 |
|
IF (debugMode) CALL DEBUG_LEAVE('INITIALISE_FIXED',myThid) |
266 |
#endif |
#endif |
267 |
|
|
268 |
C-- Finally summarise the model cofiguration |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
|
CALL CONFIG_SUMMARY( myThid ) |
|
269 |
|
|
270 |
|
RETURN |
271 |
END |
END |