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 | |
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 | |
C | |
43 |
C |-- INI_GRID |
C |-- INI_GRID |
44 |
C | |
C | |
45 |
|
C |-- LOAD_REF_FILES |
46 |
|
C | |
47 |
C |-- INI_EOS |
C |-- INI_EOS |
48 |
C | |
C | |
49 |
C |-- INI_DEPTHS |
C |-- SET_REF_STATE |
50 |
C | |
C | |
51 |
C |-- INI_MASKS_ETC |
C |-- SET_GRID_FACTORS |
52 |
C | |
C | |
53 |
C |-- PACKAGES_BOOT |
C |-- INI_DEPTHS |
54 |
C | |
C | |
55 |
C |-- PACKAGES_READPARMS |
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 |-- PACKAGES_CHECK |
C |-- INI_LINEAR_PHISURF |
|
C | |
|
|
C |-- INI_LINEAR_PHSURF |
|
61 |
C | |
C | |
62 |
C |-- INI_CORI |
C |-- INI_CORI |
63 |
C | |
C | |
65 |
C | |
C | |
66 |
C |-- INI_CG3D |
C |-- INI_CG3D |
67 |
C | |
C | |
68 |
|
C |-- CONFIG_SUMMARY |
69 |
|
C | |
70 |
|
C |-- PACKAGES_CHECK |
71 |
|
C | |- ${PKG}_CHECK |
72 |
|
C | |
73 |
C |-- CONFIG_CHECK |
C |-- CONFIG_CHECK |
74 |
C | |
C | |
75 |
C |-- CONFIG_SUMMARY |
C |-- WRITE_GRID |
76 |
|
C | |
77 |
|
C |-- CPL_EXCH_CONFIGS |
78 |
|
|
79 |
C !USES: |
C !USES: |
80 |
IMPLICIT NONE |
IMPLICIT NONE |
88 |
INTEGER myThid |
INTEGER myThid |
89 |
CEOP |
CEOP |
90 |
|
|
91 |
|
#ifdef ALLOW_DEBUG |
92 |
|
IF (debugMode) CALL DEBUG_ENTER('INITIALISE_FIXED',myThid) |
93 |
|
#endif |
94 |
|
|
95 |
|
C- here is a way to deliberately break the barrier syncronization |
96 |
|
C by adding a BARRIER on thread XXX only ; Used to test BAR_CHECK. |
97 |
|
c IF ( myThid.EQ.XXX ) THEN |
98 |
|
c _BARRIER |
99 |
|
c CALL SYSTEM('sleep 1') |
100 |
|
c ENDIF |
101 |
|
C-- Check barrier synchronization: |
102 |
|
CALL BAR_CHECK( 2, myThid ) |
103 |
|
|
104 |
C-- Set model parameters. |
C-- Set model parameters. |
105 |
C Parameters are set to defaults and then updates are read from |
C Parameters are set to defaults and then updates are read from |
106 |
C an input file called data. |
C an input file called data. |
107 |
|
#ifdef ALLOW_DEBUG |
108 |
|
IF (debugMode) CALL DEBUG_CALL('INI_PARMS',myThid) |
109 |
|
#endif |
110 |
CALL INI_PARMS( myThid ) |
CALL INI_PARMS( myThid ) |
|
_BARRIER |
|
111 |
|
|
112 |
#ifdef ALLOW_MNC |
C-- Configure packages |
113 |
C Initialize MNC look-up tables |
#ifdef ALLOW_DEBUG |
114 |
write(*,*) 'INITIALISE_FIXED: useMNC = ',useMNC |
IF (debugMode) CALL DEBUG_CALL('PACKAGES_BOOT',myThid) |
|
IF (useMNC) THEN |
|
|
CALL MNC_INIT(myThid) |
|
|
CALL MNC_CW_INIT(sNx,sNy,OLx,OLy,nSx,nSy,nPx,nPy,Nr, myThid) |
|
|
CALL INI_MNC_IO(myThid) |
|
|
IF ( mnc_echo_gtypes ) THEN |
|
|
CALL MNC_CW_DUMP( myThid ) |
|
|
ENDIF |
|
|
ENDIF |
|
115 |
#endif |
#endif |
116 |
|
CALL PACKAGES_BOOT( myThid ) |
117 |
|
|
118 |
#ifdef ALLOW_MONITOR |
C-- Read configuration parameters for packages |
119 |
C-- Initialise MONITOR I/O streams so we can report config. info |
#ifdef ALLOW_DEBUG |
120 |
CALL MON_INIT( myThid ) |
IF (debugMode) CALL DEBUG_CALL('PACKAGES_READPARMS',myThid) |
|
_BARRIER |
|
121 |
#endif |
#endif |
122 |
|
CALL PACKAGES_READPARMS( myThid ) |
123 |
|
|
124 |
|
C-- Set (or reset) parameters (at this point, know which packages are used); |
125 |
|
C after this call, main model parameters are not supposed to be modified. |
126 |
|
#ifdef ALLOW_DEBUG |
127 |
|
IF (debugMode) CALL DEBUG_CALL('SET_PARMS',myThid) |
128 |
|
#endif |
129 |
|
CALL SET_PARMS( myThid ) |
130 |
|
|
131 |
|
C-- Write units/set precision/etc for I/O (pickup, MDS/RW, MNC, MONITOR): |
132 |
|
#ifdef ALLOW_DEBUG |
133 |
|
IF (debugMode) CALL DEBUG_CALL('INI_MODEL_IO',myThid) |
134 |
|
#endif |
135 |
|
CALL INI_MODEL_IO( myThid ) |
136 |
|
|
137 |
C-- Set model grid. |
C-- Set model grid. |
138 |
C Variables defining model grid spacing are defined. |
C Variables defining model grid spacing are defined. |
139 |
|
#ifdef ALLOW_DEBUG |
140 |
|
IF (debugMode) CALL DEBUG_CALL('INI_GRID',myThid) |
141 |
|
#endif |
142 |
CALL INI_GRID( myThid ) |
CALL INI_GRID( myThid ) |
143 |
_BARRIER |
|
144 |
|
C-- Load reference profiles from files |
145 |
|
#ifdef ALLOW_DEBUG |
146 |
|
IF (debugMode) CALL DEBUG_CALL('LOAD_REF_FILES',myThid) |
147 |
|
#endif |
148 |
|
CALL LOAD_REF_FILES( myThid ) |
149 |
|
|
150 |
C-- Set equation of state parameters. |
C-- Set equation of state parameters. |
151 |
|
#ifdef ALLOW_DEBUG |
152 |
|
IF (debugMode) CALL DEBUG_CALL('INI_EOS',myThid) |
153 |
|
#endif |
154 |
CALL INI_EOS( myThid ) |
CALL INI_EOS( myThid ) |
155 |
_BARRIER |
|
156 |
|
C-- Set reference state (vertical reference profiles) |
157 |
|
#ifdef ALLOW_DEBUG |
158 |
|
IF (debugMode) CALL DEBUG_CALL('SET_REF_STATE',myThid) |
159 |
|
#endif |
160 |
|
CALL SET_REF_STATE( myThid ) |
161 |
|
|
162 |
|
C-- Set remaining grid factors |
163 |
|
#ifdef ALLOW_DEBUG |
164 |
|
IF (debugMode) CALL DEBUG_CALL('SET_GRID_FACTORS',myThid) |
165 |
|
#endif |
166 |
|
CALL SET_GRID_FACTORS( myThid ) |
167 |
|
|
168 |
C-- Initialise map of depths |
C-- Initialise map of depths |
169 |
|
#ifdef ALLOW_DEBUG |
170 |
|
IF (debugMode) CALL DEBUG_CALL('INI_DEPTHS',myThid) |
171 |
|
#endif |
172 |
CALL INI_DEPTHS( myThid ) |
CALL INI_DEPTHS( myThid ) |
|
_BARRIER |
|
173 |
|
|
174 |
C-- Derive masks, lopping factors and recipricols of quantities. |
C-- Derive masks, lopping factors and recipricols of quantities. |
175 |
C Volumes and areas are set according to grid and depth map. |
C Volumes and areas are set according to grid and depth map. |
176 |
|
#ifdef ALLOW_DEBUG |
177 |
|
IF (debugMode) CALL DEBUG_CALL('INI_MASKS_ETC',myThid) |
178 |
|
#endif |
179 |
CALL INI_MASKS_ETC( myThid ) |
CALL INI_MASKS_ETC( myThid ) |
|
_BARRIER |
|
180 |
|
|
181 |
C-- Configure packages |
C-- Synchronize all threads after setting masks and before pkgs init. |
182 |
CALL PACKAGES_BOOT( myThid ) |
_BARRIER |
|
|
|
|
C-- Read configuration parameters for packages |
|
|
CALL PACKAGES_READPARMS( myThid ) |
|
183 |
|
|
184 |
C-- Call fixed data initialization phase of packages |
C-- Call fixed data initialization phase of packages |
185 |
|
#ifdef ALLOW_DEBUG |
186 |
|
IF (debugMode) CALL DEBUG_CALL('PACKAGES_INIT_FIXED',myThid) |
187 |
|
#endif |
188 |
CALL PACKAGES_INIT_FIXED( myThid ) |
CALL PACKAGES_INIT_FIXED( myThid ) |
189 |
|
|
|
C-- Check dependances between packages |
|
|
CALL PACKAGES_CHECK( myThid ) |
|
|
|
|
190 |
C-- Set Bo_surf => define the Linear Relation: Phi_surf(eta) |
C-- Set Bo_surf => define the Linear Relation: Phi_surf(eta) |
191 |
|
#ifdef ALLOW_DEBUG |
192 |
|
IF (debugMode) CALL DEBUG_CALL('INI_LINEAR_PHISURF',myThid) |
193 |
|
#endif |
194 |
CALL INI_LINEAR_PHISURF( myThid ) |
CALL INI_LINEAR_PHISURF( myThid ) |
195 |
|
|
196 |
C-- Set coriolis operators |
C-- Set coriolis operators |
197 |
|
#ifdef ALLOW_DEBUG |
198 |
|
IF (debugMode) CALL DEBUG_CALL('INI_CORI',myThid) |
199 |
|
#endif |
200 |
CALL INI_CORI( myThid ) |
CALL INI_CORI( myThid ) |
201 |
|
|
202 |
C-- Set laplace operators for use in 2D conjugate gradient solver. |
C-- Set laplace operators for use in 2D conjugate gradient solver. |
203 |
|
#ifdef ALLOW_DEBUG |
204 |
|
IF (debugMode) CALL DEBUG_CALL('INI_CG2D',myThid) |
205 |
|
#endif |
206 |
CALL INI_CG2D( myThid ) |
CALL INI_CG2D( myThid ) |
207 |
|
|
208 |
#ifdef ALLOW_NONHYDROSTATIC |
#ifdef ALLOW_NONHYDROSTATIC |
209 |
C-- Set laplace operators for use in 3D conjugate gradient solver. |
C-- Set laplace operators for use in 3D conjugate gradient solver. |
210 |
ceh3 needs an IF ( useNONHYDROSTATIC ) THEN |
#ifdef ALLOW_DEBUG |
211 |
|
IF (debugMode) CALL DEBUG_CALL('INI_CG3D',myThid) |
212 |
|
#endif |
213 |
CALL INI_CG3D( myThid ) |
CALL INI_CG3D( myThid ) |
214 |
#endif |
#endif |
215 |
|
|
216 |
C-- Check parameters and model cofiguration |
C-- Finally summarise the model configuration |
217 |
|
#ifdef ALLOW_DEBUG |
218 |
|
IF (debugMode) CALL DEBUG_CALL('CONFIG_SUMMARY',myThid) |
219 |
|
#endif |
220 |
|
CALL CONFIG_SUMMARY( myThid ) |
221 |
|
|
222 |
|
C-- Check packages configuration (& print summary) |
223 |
|
#ifdef ALLOW_DEBUG |
224 |
|
IF (debugMode) CALL DEBUG_CALL('PACKAGES_CHECK',myThid) |
225 |
|
#endif |
226 |
|
CALL PACKAGES_CHECK( myThid ) |
227 |
|
|
228 |
|
C-- Check parameters and model configuration |
229 |
|
#ifdef ALLOW_DEBUG |
230 |
|
IF (debugMode) CALL DEBUG_CALL('CONFIG_CHECK',myThid) |
231 |
|
#endif |
232 |
CALL CONFIG_CHECK( myThid ) |
CALL CONFIG_CHECK( myThid ) |
233 |
|
|
234 |
C-- Finally summarise the model cofiguration |
C-- Write grid data and geometry arrays |
235 |
CALL CONFIG_SUMMARY( myThid ) |
IF ( debugLevel.GE.debLevA .OR. startTime.EQ.baseTime ) THEN |
236 |
|
#ifdef ALLOW_DEBUG |
237 |
|
IF (debugMode) CALL DEBUG_CALL('WRITE_GRID',myThid) |
238 |
|
#endif |
239 |
|
CALL WRITE_GRID( myThid ) |
240 |
|
ENDIF |
241 |
|
|
242 |
#ifdef COMPONENT_MODULE |
#ifdef COMPONENT_MODULE |
243 |
C-- Post component-model configuration information to coupler |
C-- Post component-model configuration information to coupler |
244 |
C and get config. info for other component(s). |
C and get config. info for other component(s). |
245 |
IF ( useCoupler ) CALL CPL_EXCH_CONFIGS( myThid ) |
IF ( useCoupler ) THEN |
246 |
|
# ifdef ALLOW_DEBUG |
247 |
|
IF (debugMode) CALL DEBUG_CALL('CPL_EXCH_CONFIGS',myThid) |
248 |
|
# endif |
249 |
|
CALL CPL_EXCH_CONFIGS( myThid ) |
250 |
|
ENDIF |
251 |
|
#endif /* COMPONENT_MODULE */ |
252 |
|
|
253 |
|
C-- Check barrier synchronization: |
254 |
|
CALL BAR_CHECK( 3, myThid ) |
255 |
|
|
256 |
|
#ifdef ALLOW_DEBUG |
257 |
|
IF (debugMode) CALL DEBUG_LEAVE('INITIALISE_FIXED',myThid) |
258 |
#endif |
#endif |
259 |
|
|
260 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |