1 | !> @file read_3d_binary.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of PALM. |
---|
4 | ! |
---|
5 | ! PALM is free software: you can redistribute it and/or modify it under the |
---|
6 | ! terms of the GNU General Public License as published by the Free Software |
---|
7 | ! Foundation, either version 3 of the License, or (at your option) any later |
---|
8 | ! version. |
---|
9 | ! |
---|
10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
13 | ! |
---|
14 | ! You should have received a copy of the GNU General Public License along with |
---|
15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
16 | ! |
---|
17 | ! Copyright 1997-2017 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: read_3d_binary.f90 2269 2017-06-09 11:57:32Z suehring $ |
---|
27 | ! Enable restart runs for urban_surface_mod |
---|
28 | ! |
---|
29 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
30 | ! |
---|
31 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
32 | ! Adjustments to new surface concept - move output of surface varariables |
---|
33 | ! to surface_mod |
---|
34 | ! |
---|
35 | ! 2031 2016-10-21 15:11:58Z knoop |
---|
36 | ! renamed variable rho_av to rho_ocean_av |
---|
37 | ! |
---|
38 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
39 | ! Forced header and separation lines into 80 columns |
---|
40 | ! |
---|
41 | ! 1976 2016-07-27 13:28:04Z maronga |
---|
42 | ! Bugfix: read of land surface data only when module is switched on. |
---|
43 | ! Radiation parts are now done in the respective module. |
---|
44 | ! Binary version increased to 4.5. |
---|
45 | ! |
---|
46 | ! 1972 2016-07-26 07:52:02Z maronga |
---|
47 | ! Land surface parts are now done in the respective module |
---|
48 | ! |
---|
49 | ! 1849 2016-04-08 11:33:18Z hoffmann |
---|
50 | ! prr, precipitation_amount moved to arrays_3d |
---|
51 | ! |
---|
52 | ! 1833 2016-04-07 14:23:03Z raasch |
---|
53 | ! statistics module replaced by spectra module |
---|
54 | ! |
---|
55 | ! 1808 2016-04-05 19:44:00Z raasch |
---|
56 | ! test output removed |
---|
57 | ! |
---|
58 | ! 1788 2016-03-10 11:01:04Z maronga |
---|
59 | ! Added z0q and z0q_av |
---|
60 | ! |
---|
61 | ! 1757 2016-02-22 15:49:32Z maronga |
---|
62 | ! Bugfix in allocation of radiative heating rates |
---|
63 | ! |
---|
64 | ! 1709 2015-11-04 14:47:01Z maronga |
---|
65 | ! Added rad_lw_out_change_0, increased binary_version |
---|
66 | ! |
---|
67 | ! 1691 2015-10-26 16:17:44Z maronga |
---|
68 | ! Added output of radiative heating rates and Obukhov length. Removed output of |
---|
69 | ! rif. |
---|
70 | ! |
---|
71 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
72 | ! Code annotations made doxygen readable |
---|
73 | ! |
---|
74 | ! 1585 2015-04-30 07:05:52Z maronga |
---|
75 | ! Adapted for RRTMG |
---|
76 | ! |
---|
77 | ! 1551 2015-03-03 14:18:16Z maronga |
---|
78 | ! Added support for binary input of land surface and radiation model data. In the |
---|
79 | ! course of this work, new temporary arrays tmp_3d_soil1, tmp_3d_soil2 were |
---|
80 | ! required. |
---|
81 | ! |
---|
82 | ! 1468 2014-09-24 14:06:57Z maronga |
---|
83 | ! Adapted for use on up to 6-digit processor cores |
---|
84 | ! |
---|
85 | ! 1400 2014-05-09 14:03:54Z knoop |
---|
86 | ! reading of arrays for random_generator_parallel added |
---|
87 | ! |
---|
88 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
89 | ! ONLY-attribute added to USE-statements, |
---|
90 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
91 | ! kinds are defined in new module kinds, |
---|
92 | ! old module precision_kind is removed, |
---|
93 | ! revision history before 2012 removed, |
---|
94 | ! comment fields (!:) to be used for variable explanations added to |
---|
95 | ! all variable declaration statements |
---|
96 | ! |
---|
97 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
98 | ! module interfaces removed |
---|
99 | ! |
---|
100 | ! 1115 2013-03-26 18:16:16Z hoffmann |
---|
101 | ! unused variables removed |
---|
102 | ! |
---|
103 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
104 | ! necessary expansions according to the two new prognostic equations (nr, qr) |
---|
105 | ! of the two-moment cloud physics scheme: |
---|
106 | ! +prr, prr_av, *, *_av, *s, *sws, *swst |
---|
107 | ! |
---|
108 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
109 | ! code put under GPL (PALM 3.9) |
---|
110 | ! |
---|
111 | ! 1001 2012-09-13 14:08:46Z raasch |
---|
112 | ! all actions concerning leapfrog scheme removed |
---|
113 | ! |
---|
114 | ! 978 2012-08-09 08:28:32Z fricke |
---|
115 | ! +z0h, z0h_av |
---|
116 | ! |
---|
117 | ! Revision 1.1 2004/04/30 12:47:27 raasch |
---|
118 | ! Initial revision |
---|
119 | ! |
---|
120 | ! |
---|
121 | ! Description: |
---|
122 | ! ------------ |
---|
123 | !> Binary input of variables and arrays from restart file |
---|
124 | !------------------------------------------------------------------------------! |
---|
125 | SUBROUTINE read_3d_binary |
---|
126 | |
---|
127 | |
---|
128 | USE arrays_3d, & |
---|
129 | ONLY: e, kh, km, p, pt, q, ql, qc, nr, prr, precipitation_amount, qr, & |
---|
130 | s, sa, u, u_m_l, u_m_n, u_m_r, u_m_s, v, v_m_l, v_m_n, v_m_r, & |
---|
131 | v_m_s, vpt, w, w_m_l, w_m_n, w_m_r, w_m_s |
---|
132 | |
---|
133 | USE averaging |
---|
134 | |
---|
135 | USE control_parameters, & |
---|
136 | ONLY: iran, land_surface, message_string, outflow_l, outflow_n, & |
---|
137 | outflow_r, outflow_s, urban_surface |
---|
138 | |
---|
139 | USE cpulog, & |
---|
140 | ONLY: cpu_log, log_point_s |
---|
141 | |
---|
142 | USE indices, & |
---|
143 | ONLY: nbgp, nx, nxl, nxlg, nxr, nxrg, nx_on_file, ny, nys, nysg, nyn, & |
---|
144 | nyng, ny_on_file, nzb, nzt |
---|
145 | |
---|
146 | USE kinds |
---|
147 | |
---|
148 | USE land_surface_model_mod, & |
---|
149 | ONLY: lsm_read_restart_data |
---|
150 | |
---|
151 | USE particle_attributes, & |
---|
152 | ONLY: iran_part |
---|
153 | |
---|
154 | USE pegrid |
---|
155 | |
---|
156 | USE radiation_model_mod, & |
---|
157 | ONLY: radiation, radiation_read_restart_data |
---|
158 | |
---|
159 | USE random_function_mod, & |
---|
160 | ONLY: random_iv, random_iy |
---|
161 | |
---|
162 | USE random_generator_parallel, & |
---|
163 | ONLY: id_random_array, seq_random_array |
---|
164 | |
---|
165 | USE spectra_mod, & |
---|
166 | ONLY: spectrum_x, spectrum_y |
---|
167 | |
---|
168 | USE surface_mod, & |
---|
169 | ONLY : surface_read_restart_data |
---|
170 | |
---|
171 | USE urban_surface_mod, & |
---|
172 | ONLY: usm_read_restart_data |
---|
173 | |
---|
174 | IMPLICIT NONE |
---|
175 | |
---|
176 | CHARACTER (LEN=7) :: myid_char_save |
---|
177 | CHARACTER (LEN=10) :: binary_version |
---|
178 | CHARACTER (LEN=10) :: version_on_file |
---|
179 | CHARACTER (LEN=20) :: field_chr |
---|
180 | |
---|
181 | INTEGER(iwp) :: files_to_be_opened !< |
---|
182 | INTEGER(iwp) :: i !< |
---|
183 | INTEGER(iwp) :: j !< |
---|
184 | INTEGER(iwp) :: k !< |
---|
185 | INTEGER(iwp) :: myid_on_file !< |
---|
186 | INTEGER(iwp) :: numprocs_on_file !< |
---|
187 | INTEGER(iwp) :: nxlc !< |
---|
188 | INTEGER(iwp) :: nxlf !< |
---|
189 | INTEGER(iwp) :: nxlpr !< |
---|
190 | INTEGER(iwp) :: nxl_on_file !< |
---|
191 | INTEGER(iwp) :: nxrc !< |
---|
192 | INTEGER(iwp) :: nxrf !< |
---|
193 | INTEGER(iwp) :: nxrpr !< |
---|
194 | INTEGER(iwp) :: nxr_on_file !< |
---|
195 | INTEGER(iwp) :: nync !< |
---|
196 | INTEGER(iwp) :: nynf !< |
---|
197 | INTEGER(iwp) :: nynpr !< |
---|
198 | INTEGER(iwp) :: nyn_on_file !< |
---|
199 | INTEGER(iwp) :: nysc !< |
---|
200 | INTEGER(iwp) :: nysf !< |
---|
201 | INTEGER(iwp) :: nyspr !< |
---|
202 | INTEGER(iwp) :: nys_on_file !< |
---|
203 | INTEGER(iwp) :: nzb_on_file !< |
---|
204 | INTEGER(iwp) :: nzt_on_file !< |
---|
205 | INTEGER(iwp) :: offset_x !< |
---|
206 | INTEGER(iwp) :: offset_y !< |
---|
207 | INTEGER(iwp) :: shift_x !< |
---|
208 | INTEGER(iwp) :: shift_y !< |
---|
209 | |
---|
210 | INTEGER(iwp), DIMENSION(numprocs_previous_run) :: file_list !< |
---|
211 | INTEGER(iwp), DIMENSION(numprocs_previous_run) :: overlap_count !< |
---|
212 | |
---|
213 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nxlfa !< |
---|
214 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nxrfa !< |
---|
215 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nynfa !< |
---|
216 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: nysfa !< |
---|
217 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: offset_xa !< |
---|
218 | INTEGER(iwp), DIMENSION(numprocs_previous_run,1000) :: offset_ya !< |
---|
219 | |
---|
220 | REAL(wp) :: rdummy |
---|
221 | |
---|
222 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: tmp_2d !< temporary array for storing 2D data |
---|
223 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: tmp_3d !< temporary array for storing 3D data |
---|
224 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: tmp_3dwul !< |
---|
225 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: tmp_3dwun !< |
---|
226 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: tmp_3dwur !< |
---|
227 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: tmp_3dwus !< |
---|
228 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: tmp_3dwvl !< |
---|
229 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: tmp_3dwvn !< |
---|
230 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: tmp_3dwvr !< |
---|
231 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: tmp_3dwvs !< |
---|
232 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: tmp_3dwwl !< |
---|
233 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: tmp_3dwwn !< |
---|
234 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: tmp_3dwwr !< |
---|
235 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: tmp_3dwws !< |
---|
236 | |
---|
237 | REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE :: tmp_4d !< |
---|
238 | |
---|
239 | |
---|
240 | ! |
---|
241 | !-- Read data from previous model run. |
---|
242 | CALL cpu_log( log_point_s(14), 'read_3d_binary', 'start' ) |
---|
243 | |
---|
244 | ! |
---|
245 | !-- Check which of the restart files contain data needed for the subdomain |
---|
246 | !-- of this PE |
---|
247 | files_to_be_opened = 0 |
---|
248 | |
---|
249 | DO i = 1, numprocs_previous_run |
---|
250 | ! |
---|
251 | !-- Store array bounds of the previous run ("pr") in temporary scalars |
---|
252 | nxlpr = hor_index_bounds_previous_run(1,i-1) |
---|
253 | nxrpr = hor_index_bounds_previous_run(2,i-1) |
---|
254 | nyspr = hor_index_bounds_previous_run(3,i-1) |
---|
255 | nynpr = hor_index_bounds_previous_run(4,i-1) |
---|
256 | |
---|
257 | ! |
---|
258 | !-- Determine the offsets. They may be non-zero in case that the total domain |
---|
259 | !-- on file is smaller than the current total domain. |
---|
260 | offset_x = ( nxl / ( nx_on_file + 1 ) ) * ( nx_on_file + 1 ) |
---|
261 | offset_y = ( nys / ( ny_on_file + 1 ) ) * ( ny_on_file + 1 ) |
---|
262 | |
---|
263 | ! |
---|
264 | !-- Start with this offset and then check, if the subdomain on file |
---|
265 | !-- matches another time(s) in the current subdomain by shifting it |
---|
266 | !-- for nx_on_file+1, ny_on_file+1 respectively |
---|
267 | |
---|
268 | shift_y = 0 |
---|
269 | j = 0 |
---|
270 | DO WHILE ( nyspr+shift_y <= nyn-offset_y ) |
---|
271 | |
---|
272 | IF ( nynpr+shift_y >= nys-offset_y ) THEN |
---|
273 | |
---|
274 | shift_x = 0 |
---|
275 | DO WHILE ( nxlpr+shift_x <= nxr-offset_x ) |
---|
276 | |
---|
277 | IF ( nxrpr+shift_x >= nxl-offset_x ) THEN |
---|
278 | j = j +1 |
---|
279 | IF ( j > 1000 ) THEN |
---|
280 | ! |
---|
281 | !-- Array bound exceeded |
---|
282 | message_string = 'data from subdomain of previous' // & |
---|
283 | ' run mapped more than 1000 times' |
---|
284 | CALL message( 'read_3d_binary', 'PA0284', 2, 2, -1, & |
---|
285 | 6, 1 ) |
---|
286 | ENDIF |
---|
287 | |
---|
288 | IF ( j == 1 ) THEN |
---|
289 | files_to_be_opened = files_to_be_opened + 1 |
---|
290 | file_list(files_to_be_opened) = i-1 |
---|
291 | ENDIF |
---|
292 | |
---|
293 | offset_xa(files_to_be_opened,j) = offset_x + shift_x |
---|
294 | offset_ya(files_to_be_opened,j) = offset_y + shift_y |
---|
295 | ! |
---|
296 | !-- Index bounds of overlapping data |
---|
297 | nxlfa(files_to_be_opened,j) = MAX( nxl-offset_x-shift_x, nxlpr ) |
---|
298 | nxrfa(files_to_be_opened,j) = MIN( nxr-offset_x-shift_x, nxrpr ) |
---|
299 | nysfa(files_to_be_opened,j) = MAX( nys-offset_y-shift_y, nyspr ) |
---|
300 | nynfa(files_to_be_opened,j) = MIN( nyn-offset_y-shift_y, nynpr ) |
---|
301 | |
---|
302 | ENDIF |
---|
303 | |
---|
304 | shift_x = shift_x + ( nx_on_file + 1 ) |
---|
305 | ENDDO |
---|
306 | |
---|
307 | ENDIF |
---|
308 | |
---|
309 | shift_y = shift_y + ( ny_on_file + 1 ) |
---|
310 | ENDDO |
---|
311 | |
---|
312 | IF ( j > 0 ) overlap_count(files_to_be_opened) = j |
---|
313 | |
---|
314 | ENDDO |
---|
315 | |
---|
316 | ! |
---|
317 | !-- Save the id-string of the current process, since myid_char may now be used |
---|
318 | !-- to open files created by PEs with other id. |
---|
319 | myid_char_save = myid_char |
---|
320 | |
---|
321 | IF ( files_to_be_opened /= 1 .OR. numprocs /= numprocs_previous_run ) & |
---|
322 | THEN |
---|
323 | WRITE( message_string, * ) 'number of PEs or virtual PE-grid changed ', & |
---|
324 | 'in restart run& PE', myid, ' will read from files ', & |
---|
325 | file_list(1:files_to_be_opened) |
---|
326 | CALL message( 'read_3d_binary', 'PA0285', 0, 0, 0, 6, 0 ) |
---|
327 | ENDIF |
---|
328 | |
---|
329 | ! |
---|
330 | !-- Read data from all restart files determined above |
---|
331 | DO i = 1, files_to_be_opened |
---|
332 | |
---|
333 | j = file_list(i) |
---|
334 | ! |
---|
335 | !-- Set the filename (underscore followed by four digit processor id) |
---|
336 | WRITE (myid_char,'(''_'',I6.6)') j |
---|
337 | |
---|
338 | ! |
---|
339 | !-- Open the restart file. If this file has been created by PE0 (_000000), |
---|
340 | !-- the global variables at the beginning of the file have to be skipped |
---|
341 | !-- first. |
---|
342 | CALL check_open( 13 ) |
---|
343 | IF ( j == 0 ) CALL skip_var_list |
---|
344 | |
---|
345 | ! |
---|
346 | !-- First compare the version numbers |
---|
347 | READ ( 13 ) version_on_file |
---|
348 | binary_version = '4.5' |
---|
349 | IF ( TRIM( version_on_file ) /= TRIM( binary_version ) ) THEN |
---|
350 | WRITE( message_string, * ) 'version mismatch concerning data ', & |
---|
351 | 'from prior run', & |
---|
352 | '&version on file = "', TRIM( version_on_file ), '"', & |
---|
353 | '&version in program = "', TRIM( binary_version ), '"' |
---|
354 | CALL message( 'read_3d_binary', 'PA0286', 1, 2, 0, 6, 0 ) |
---|
355 | ENDIF |
---|
356 | |
---|
357 | ! |
---|
358 | !-- Read number of processors, processor-id, and array ranges. |
---|
359 | !-- Compare the array ranges with those stored in the index bound array. |
---|
360 | READ ( 13 ) numprocs_on_file, myid_on_file, nxl_on_file, nxr_on_file, & |
---|
361 | nys_on_file, nyn_on_file, nzb_on_file, nzt_on_file |
---|
362 | |
---|
363 | IF ( nxl_on_file /= hor_index_bounds_previous_run(1,j) ) THEN |
---|
364 | WRITE( message_string, * ) 'problem with index bound nxl on ', & |
---|
365 | 'restart file "', myid_char, '"', & |
---|
366 | '&nxl = ', nxl_on_file, ' but it should be', & |
---|
367 | '&= ', hor_index_bounds_previous_run(1,j), & |
---|
368 | '&from the index bound information array' |
---|
369 | CALL message( 'read_3d_binary', 'PA0287', 2, 2, -1, 6, 1 ) |
---|
370 | ENDIF |
---|
371 | |
---|
372 | IF ( nxr_on_file /= hor_index_bounds_previous_run(2,j) ) THEN |
---|
373 | WRITE( message_string, * ) 'problem with index bound nxr on ', & |
---|
374 | 'restart file "', myid_char, '"' , & |
---|
375 | '&nxr = ', nxr_on_file, ' but it should be', & |
---|
376 | '&= ', hor_index_bounds_previous_run(2,j), & |
---|
377 | '&from the index bound information array' |
---|
378 | CALL message( 'read_3d_binary', 'PA0288', 2, 2, -1, 6, 1 ) |
---|
379 | |
---|
380 | ENDIF |
---|
381 | |
---|
382 | IF ( nys_on_file /= hor_index_bounds_previous_run(3,j) ) THEN |
---|
383 | WRITE( message_string, * ) 'problem with index bound nys on ', & |
---|
384 | 'restart file "', myid_char, '"', & |
---|
385 | '&nys = ', nys_on_file, ' but it should be', & |
---|
386 | '&= ', hor_index_bounds_previous_run(3,j), & |
---|
387 | '&from the index bound information array' |
---|
388 | CALL message( 'read_3d_binary', 'PA0289', 2, 2, -1, 6, 1 ) |
---|
389 | ENDIF |
---|
390 | |
---|
391 | IF ( nyn_on_file /= hor_index_bounds_previous_run(4,j) ) THEN |
---|
392 | WRITE( message_string, * ) 'problem with index bound nyn on ', & |
---|
393 | 'restart file "', myid_char, '"', & |
---|
394 | '&nyn = ', nyn_on_file, ' but it should be', & |
---|
395 | '&= ', hor_index_bounds_previous_run(4,j), & |
---|
396 | '&from the index bound information array' |
---|
397 | CALL message( 'read_3d_binary', 'PA0290', 2, 2, -1, 6, 1 ) |
---|
398 | ENDIF |
---|
399 | |
---|
400 | IF ( nzb_on_file /= nzb ) THEN |
---|
401 | WRITE( message_string, * ) 'mismatch between actual data and data ', & |
---|
402 | '&from prior run on PE ', myid, & |
---|
403 | '&nzb on file = ', nzb_on_file, & |
---|
404 | '&nzb = ', nzb |
---|
405 | CALL message( 'read_3d_binary', 'PA0291', 1, 2, 0, 6, 0 ) |
---|
406 | ENDIF |
---|
407 | |
---|
408 | IF ( nzt_on_file /= nzt ) THEN |
---|
409 | WRITE( message_string, * ) 'mismatch between actual data and data ', & |
---|
410 | '&from prior run on PE ', myid, & |
---|
411 | '&nzt on file = ', nzt_on_file, & |
---|
412 | '&nzt = ', nzt |
---|
413 | CALL message( 'read_3d_binary', 'PA0292', 1, 2, 0, 6, 0 ) |
---|
414 | ENDIF |
---|
415 | |
---|
416 | ! |
---|
417 | !-- Allocate temporary arrays sized as the arrays on the restart file |
---|
418 | ALLOCATE( tmp_2d(nys_on_file-nbgp:nyn_on_file+nbgp, & |
---|
419 | nxl_on_file-nbgp:nxr_on_file+nbgp), & |
---|
420 | tmp_3d(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp, & |
---|
421 | nxl_on_file-nbgp:nxr_on_file+nbgp) ) |
---|
422 | |
---|
423 | ! |
---|
424 | !-- Read arrays |
---|
425 | !-- ATTENTION: If the following read commands have been altered, the |
---|
426 | !-- ---------- version number of the variable binary_version must be altered, |
---|
427 | !-- too. Furthermore, the output list of arrays in write_3d_binary |
---|
428 | !-- must also be altered accordingly. |
---|
429 | READ ( 13 ) field_chr |
---|
430 | DO WHILE ( TRIM( field_chr ) /= '*** end ***' ) |
---|
431 | |
---|
432 | ! |
---|
433 | !-- Map data on file as often as needed (data are read only for k=1) |
---|
434 | DO k = 1, overlap_count(i) |
---|
435 | |
---|
436 | ! |
---|
437 | !-- Get the index range of the subdomain on file which overlap with the |
---|
438 | !-- current subdomain |
---|
439 | nxlf = nxlfa(i,k) |
---|
440 | nxlc = nxlfa(i,k) + offset_xa(i,k) |
---|
441 | nxrf = nxrfa(i,k) |
---|
442 | nxrc = nxrfa(i,k) + offset_xa(i,k) |
---|
443 | nysf = nysfa(i,k) |
---|
444 | nysc = nysfa(i,k) + offset_ya(i,k) |
---|
445 | nynf = nynfa(i,k) |
---|
446 | nync = nynfa(i,k) + offset_ya(i,k) |
---|
447 | |
---|
448 | write(9,*) "f", nxlf, nxrf, nysf, nynf |
---|
449 | write(9,*) "c", nxlc, nxrc, nysc, nync |
---|
450 | |
---|
451 | |
---|
452 | |
---|
453 | SELECT CASE ( TRIM( field_chr ) ) |
---|
454 | |
---|
455 | CASE ( 'e' ) |
---|
456 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
457 | e(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
458 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
459 | |
---|
460 | CASE ( 'e_av' ) |
---|
461 | IF ( .NOT. ALLOCATED( e_av ) ) THEN |
---|
462 | ALLOCATE( e_av(nzb:nzt+1,nys-nbgp:nyn+nbgp,nxl-nbgp:nxr+nbgp) ) |
---|
463 | ENDIF |
---|
464 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
465 | e_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
466 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
467 | |
---|
468 | CASE ( 'iran' ) ! matching random numbers is still unresolved |
---|
469 | ! issue |
---|
470 | IF ( k == 1 ) READ ( 13 ) iran, iran_part |
---|
471 | |
---|
472 | CASE ( 'kh' ) |
---|
473 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
474 | kh(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
475 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
476 | |
---|
477 | CASE ( 'km' ) |
---|
478 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
479 | km(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
480 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
481 | |
---|
482 | CASE ( 'lpt_av' ) |
---|
483 | IF ( .NOT. ALLOCATED( lpt_av ) ) THEN |
---|
484 | ALLOCATE( lpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg )) |
---|
485 | ENDIF |
---|
486 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
487 | lpt_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
488 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
489 | |
---|
490 | CASE ( 'lwp_av' ) |
---|
491 | IF ( .NOT. ALLOCATED( lwp_av ) ) THEN |
---|
492 | ALLOCATE( lwp_av(nysg:nyng,nxlg:nxrg) ) |
---|
493 | ENDIF |
---|
494 | IF ( k == 1 ) READ ( 13 ) tmp_2d |
---|
495 | lwp_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
496 | tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
497 | |
---|
498 | CASE ( 'nr' ) |
---|
499 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
500 | nr(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
501 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
502 | |
---|
503 | CASE ( 'nr_av' ) |
---|
504 | IF ( .NOT. ALLOCATED( nr_av ) ) THEN |
---|
505 | ALLOCATE( nr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
506 | ENDIF |
---|
507 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
508 | nr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
509 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
510 | |
---|
511 | CASE ( 'p' ) |
---|
512 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
513 | p(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
514 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
515 | |
---|
516 | CASE ( 'p_av' ) |
---|
517 | IF ( .NOT. ALLOCATED( p_av ) ) THEN |
---|
518 | ALLOCATE( p_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
519 | ENDIF |
---|
520 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
521 | p_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
522 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
523 | |
---|
524 | CASE ( 'pc_av' ) |
---|
525 | IF ( .NOT. ALLOCATED( pc_av ) ) THEN |
---|
526 | ALLOCATE( pc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
527 | ENDIF |
---|
528 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
529 | pc_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
530 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
531 | |
---|
532 | CASE ( 'pr_av' ) |
---|
533 | IF ( .NOT. ALLOCATED( pr_av ) ) THEN |
---|
534 | ALLOCATE( pr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
535 | ENDIF |
---|
536 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
537 | pr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
538 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
539 | |
---|
540 | CASE ( 'prr' ) |
---|
541 | IF ( .NOT. ALLOCATED( prr ) ) THEN |
---|
542 | ALLOCATE( prr(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
543 | ENDIF |
---|
544 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
545 | prr(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
546 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
547 | |
---|
548 | CASE ( 'prr_av' ) |
---|
549 | IF ( .NOT. ALLOCATED( prr_av ) ) THEN |
---|
550 | ALLOCATE( prr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
551 | ENDIF |
---|
552 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
553 | prr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
554 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
555 | |
---|
556 | CASE ( 'precipitation_amount' ) |
---|
557 | IF ( k == 1 ) READ ( 13 ) tmp_2d |
---|
558 | precipitation_amount(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
559 | tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
560 | |
---|
561 | CASE ( 'precipitation_rate_a' ) |
---|
562 | IF ( .NOT. ALLOCATED( precipitation_rate_av ) ) THEN |
---|
563 | ALLOCATE( precipitation_rate_av(nysg:nyng,nxlg:nxrg) ) |
---|
564 | ENDIF |
---|
565 | IF ( k == 1 ) READ ( 13 ) tmp_2d |
---|
566 | precipitation_rate_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
567 | tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
568 | |
---|
569 | CASE ( 'pt' ) |
---|
570 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
571 | pt(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
572 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
573 | |
---|
574 | CASE ( 'pt_av' ) |
---|
575 | IF ( .NOT. ALLOCATED( pt_av ) ) THEN |
---|
576 | ALLOCATE( pt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
577 | ENDIF |
---|
578 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
579 | pt_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
580 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
581 | |
---|
582 | CASE ( 'q' ) |
---|
583 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
584 | q(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
585 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
586 | |
---|
587 | CASE ( 'q_av' ) |
---|
588 | IF ( .NOT. ALLOCATED( q_av ) ) THEN |
---|
589 | ALLOCATE( q_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg )) |
---|
590 | ENDIF |
---|
591 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
592 | q_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
593 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
594 | |
---|
595 | CASE ( 'qc' ) |
---|
596 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
597 | qc(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
598 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
599 | |
---|
600 | CASE ( 'qc_av' ) |
---|
601 | IF ( .NOT. ALLOCATED( qc_av ) ) THEN |
---|
602 | ALLOCATE( qc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
603 | ENDIF |
---|
604 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
605 | qc_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
606 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
607 | |
---|
608 | CASE ( 'ql' ) |
---|
609 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
610 | ql(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
611 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
612 | |
---|
613 | CASE ( 'ql_av' ) |
---|
614 | IF ( .NOT. ALLOCATED( ql_av ) ) THEN |
---|
615 | ALLOCATE( ql_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
616 | ENDIF |
---|
617 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
618 | ql_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
619 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
620 | |
---|
621 | CASE ( 'qr' ) |
---|
622 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
623 | qr(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
624 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
625 | |
---|
626 | CASE ( 'qr_av' ) |
---|
627 | IF ( .NOT. ALLOCATED( qr_av ) ) THEN |
---|
628 | ALLOCATE( qr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
629 | ENDIF |
---|
630 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
631 | qr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
632 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
633 | |
---|
634 | CASE ( 'ql_c_av' ) |
---|
635 | IF ( .NOT. ALLOCATED( ql_c_av ) ) THEN |
---|
636 | ALLOCATE( ql_c_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
637 | ENDIF |
---|
638 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
639 | ql_c_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
640 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
641 | |
---|
642 | CASE ( 'ql_v_av' ) |
---|
643 | IF ( .NOT. ALLOCATED( ql_v_av ) ) THEN |
---|
644 | ALLOCATE( ql_v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
645 | ENDIF |
---|
646 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
647 | ql_v_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
648 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
649 | |
---|
650 | CASE ( 'ql_vp_av' ) |
---|
651 | IF ( .NOT. ALLOCATED( ql_vp_av ) ) THEN |
---|
652 | ALLOCATE( ql_vp_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
653 | ENDIF |
---|
654 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
655 | ql_vp_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
656 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
657 | |
---|
658 | CASE ( 'qsws_av' ) |
---|
659 | IF ( .NOT. ALLOCATED( qsws_av ) ) THEN |
---|
660 | ALLOCATE( qsws_av(nysg:nyng,nxlg:nxrg) ) |
---|
661 | ENDIF |
---|
662 | IF ( k == 1 ) READ ( 13 ) tmp_2d |
---|
663 | qsws_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
664 | tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
665 | |
---|
666 | CASE ( 'qv_av' ) |
---|
667 | IF ( .NOT. ALLOCATED( qv_av ) ) THEN |
---|
668 | ALLOCATE( qv_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
669 | ENDIF |
---|
670 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
671 | qv_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
672 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
673 | |
---|
674 | CASE ( 'random_iv' ) ! still unresolved issue |
---|
675 | IF ( k == 1 ) READ ( 13 ) random_iv |
---|
676 | IF ( k == 1 ) READ ( 13 ) random_iy |
---|
677 | |
---|
678 | CASE ( 'seq_random_array' ) ! still unresolved issue |
---|
679 | IF ( k == 1 ) READ ( 13 ) id_random_array |
---|
680 | IF ( k == 1 ) READ ( 13 ) seq_random_array |
---|
681 | |
---|
682 | CASE ( 'rho_ocean_av' ) |
---|
683 | IF ( .NOT. ALLOCATED( rho_ocean_av ) ) THEN |
---|
684 | ALLOCATE( rho_ocean_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
685 | ENDIF |
---|
686 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
687 | rho_ocean_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
688 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
689 | |
---|
690 | CASE ( 's' ) |
---|
691 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
692 | s(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
693 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
694 | |
---|
695 | CASE ( 's_av' ) |
---|
696 | IF ( .NOT. ALLOCATED( s_av ) ) THEN |
---|
697 | ALLOCATE( s_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg)) |
---|
698 | ENDIF |
---|
699 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
700 | s_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
701 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
702 | |
---|
703 | CASE ( 'sa' ) |
---|
704 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
705 | sa(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
706 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
707 | |
---|
708 | CASE ( 'sa_av' ) |
---|
709 | IF ( .NOT. ALLOCATED( sa_av ) ) THEN |
---|
710 | ALLOCATE( sa_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
711 | ENDIF |
---|
712 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
713 | sa_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
714 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
715 | |
---|
716 | CASE ( 'shf_av' ) |
---|
717 | IF ( .NOT. ALLOCATED( shf_av ) ) THEN |
---|
718 | ALLOCATE( shf_av(nysg:nyng,nxlg:nxrg) ) |
---|
719 | ENDIF |
---|
720 | IF ( k == 1 ) READ ( 13 ) tmp_2d |
---|
721 | shf_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
722 | tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
723 | |
---|
724 | CASE ( 'spectrum_x' ) |
---|
725 | IF ( k == 1 ) THEN |
---|
726 | IF ( nx_on_file /= nx ) THEN |
---|
727 | message_string = 'read_3d_binary: spectrum_x ' // & |
---|
728 | 'on restart file ignored because' // & |
---|
729 | '&total numbers of grid points (nx) ' // & |
---|
730 | 'do not match' |
---|
731 | CALL message( 'read_3d_binary', 'PA0293',& |
---|
732 | 0, 1, 0, 6, 0 ) |
---|
733 | READ ( 13 ) rdummy |
---|
734 | ELSE |
---|
735 | READ ( 13 ) spectrum_x |
---|
736 | ENDIF |
---|
737 | ENDIF |
---|
738 | |
---|
739 | CASE ( 'spectrum_y' ) |
---|
740 | IF ( k == 1 ) THEN |
---|
741 | IF ( ny_on_file /= ny ) THEN |
---|
742 | message_string = 'read_3d_binary: spectrum_y ' // & |
---|
743 | 'on restart file ignored because' // & |
---|
744 | '&total numbers of grid points (ny) '// & |
---|
745 | 'do not match' |
---|
746 | CALL message( 'read_3d_binary', 'PA0294', & |
---|
747 | 0, 1, 0, 6, 0 ) |
---|
748 | READ ( 13 ) rdummy |
---|
749 | ELSE |
---|
750 | READ ( 13 ) spectrum_y |
---|
751 | ENDIF |
---|
752 | ENDIF |
---|
753 | |
---|
754 | CASE ( 'ssws_av' ) |
---|
755 | IF ( .NOT. ALLOCATED( ssws_av ) ) THEN |
---|
756 | ALLOCATE( ssws_av(nysg:nyng,nxlg:nxrg) ) |
---|
757 | ENDIF |
---|
758 | IF ( k == 1 ) READ ( 13 ) tmp_2d |
---|
759 | ssws_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
760 | tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
761 | |
---|
762 | CASE ( 'ts_av' ) |
---|
763 | IF ( .NOT. ALLOCATED( ts_av ) ) THEN |
---|
764 | ALLOCATE( ts_av(nysg:nyng,nxlg:nxrg) ) |
---|
765 | ENDIF |
---|
766 | IF ( k == 1 ) READ ( 13 ) tmp_2d |
---|
767 | ts_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
768 | tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
769 | |
---|
770 | CASE ( 'u' ) |
---|
771 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
772 | u(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
773 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
774 | |
---|
775 | CASE ( 'u_av' ) |
---|
776 | IF ( .NOT. ALLOCATED( u_av ) ) THEN |
---|
777 | ALLOCATE( u_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
778 | ENDIF |
---|
779 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
780 | u_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
781 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
782 | |
---|
783 | CASE ( 'u_m_l' ) |
---|
784 | IF ( k == 1 ) THEN |
---|
785 | ALLOCATE( tmp_3dwul(nzb:nzt+1, & |
---|
786 | nys_on_file-nbgp:nyn_on_file+nbgp,1:2) ) |
---|
787 | READ ( 13 ) tmp_3dwul |
---|
788 | ENDIF |
---|
789 | IF ( outflow_l ) THEN |
---|
790 | u_m_l(:,nysc-nbgp:nync+nbgp,:) = tmp_3dwul(:,nysf-nbgp:nynf+nbgp,:) |
---|
791 | ENDIF |
---|
792 | |
---|
793 | CASE ( 'u_m_n' ) |
---|
794 | IF ( k == 1 ) THEN |
---|
795 | ALLOCATE( tmp_3dwun(nzb:nzt+1,ny-1:ny, & |
---|
796 | nxl_on_file-nbgp:nxr_on_file+nbgp) ) |
---|
797 | READ ( 13 ) tmp_3dwun |
---|
798 | ENDIF |
---|
799 | IF ( outflow_n ) THEN |
---|
800 | u_m_n(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3dwun(:,:,nxlf-nbgp:nxrf+nbgp) |
---|
801 | ENDIF |
---|
802 | |
---|
803 | CASE ( 'u_m_r' ) |
---|
804 | IF ( k == 1 ) THEN |
---|
805 | ALLOCATE( tmp_3dwur(nzb:nzt+1,& |
---|
806 | nys_on_file-nbgp:nyn_on_file+nbgp,nx-1:nx) ) |
---|
807 | READ ( 13 ) tmp_3dwur |
---|
808 | ENDIF |
---|
809 | IF ( outflow_r ) THEN |
---|
810 | u_m_r(:,nysc-nbgp:nync+nbgp,:) = tmp_3dwur(:,nysf-nbgp:nynf+nbgp,:) |
---|
811 | ENDIF |
---|
812 | |
---|
813 | CASE ( 'u_m_s' ) |
---|
814 | IF ( k == 1 ) THEN |
---|
815 | ALLOCATE( tmp_3dwus(nzb:nzt+1,0:1, & |
---|
816 | nxl_on_file-nbgp:nxr_on_file+nbgp) ) |
---|
817 | READ ( 13 ) tmp_3dwus |
---|
818 | ENDIF |
---|
819 | IF ( outflow_s ) THEN |
---|
820 | u_m_s(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3dwus(:,:,nxlf-nbgp:nxrf+nbgp) |
---|
821 | ENDIF |
---|
822 | |
---|
823 | CASE ( 'us_av' ) |
---|
824 | IF ( .NOT. ALLOCATED( us_av ) ) THEN |
---|
825 | ALLOCATE( us_av(nysg:nyng,nxlg:nxrg) ) |
---|
826 | ENDIF |
---|
827 | IF ( k == 1 ) READ ( 13 ) tmp_2d |
---|
828 | us_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
829 | tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
830 | |
---|
831 | CASE ( 'v' ) |
---|
832 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
833 | v(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
834 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
835 | |
---|
836 | CASE ( 'v_av' ) |
---|
837 | IF ( .NOT. ALLOCATED( v_av ) ) THEN |
---|
838 | ALLOCATE( v_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
839 | ENDIF |
---|
840 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
841 | v_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
842 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
843 | |
---|
844 | CASE ( 'v_m_l' ) |
---|
845 | IF ( k == 1 ) THEN |
---|
846 | ALLOCATE( tmp_3dwvl(nzb:nzt+1,& |
---|
847 | nys_on_file-nbgp:nyn_on_file+nbgp,0:1) ) |
---|
848 | READ ( 13 ) tmp_3dwvl |
---|
849 | ENDIF |
---|
850 | IF ( outflow_l ) THEN |
---|
851 | v_m_l(:,nysc-nbgp:nync+nbgp,:) = tmp_3dwvl(:,nysf-nbgp:nynf+nbgp,:) |
---|
852 | ENDIF |
---|
853 | |
---|
854 | CASE ( 'v_m_n' ) |
---|
855 | IF ( k == 1 ) THEN |
---|
856 | ALLOCATE( tmp_3dwvn(nzb:nzt+1,ny-1:ny, & |
---|
857 | nxl_on_file-nbgp:nxr_on_file+nbgp) ) |
---|
858 | READ ( 13 ) tmp_3dwvn |
---|
859 | ENDIF |
---|
860 | IF ( outflow_n ) THEN |
---|
861 | v_m_n(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3dwvn(:,:,nxlf-nbgp:nxrf+nbgp) |
---|
862 | ENDIF |
---|
863 | |
---|
864 | CASE ( 'v_m_r' ) |
---|
865 | IF ( k == 1 ) THEN |
---|
866 | ALLOCATE( tmp_3dwvr(nzb:nzt+1,& |
---|
867 | nys_on_file-nbgp:nyn_on_file+nbgp,nx-1:nx) ) |
---|
868 | READ ( 13 ) tmp_3dwvr |
---|
869 | ENDIF |
---|
870 | IF ( outflow_r ) THEN |
---|
871 | v_m_r(:,nysc-nbgp:nync+nbgp,:) = tmp_3dwvr(:,nysf-nbgp:nynf+nbgp,:) |
---|
872 | ENDIF |
---|
873 | |
---|
874 | CASE ( 'v_m_s' ) |
---|
875 | IF ( k == 1 ) THEN |
---|
876 | ALLOCATE( tmp_3dwvs(nzb:nzt+1,1:2, & |
---|
877 | nxl_on_file-nbgp:nxr_on_file+nbgp) ) |
---|
878 | READ ( 13 ) tmp_3dwvs |
---|
879 | ENDIF |
---|
880 | IF ( outflow_s ) THEN |
---|
881 | v_m_s(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3dwvs(:,:,nxlf-nbgp:nxrf+nbgp) |
---|
882 | ENDIF |
---|
883 | |
---|
884 | CASE ( 'vpt' ) |
---|
885 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
886 | vpt(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
887 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
888 | |
---|
889 | CASE ( 'vpt_av' ) |
---|
890 | IF ( .NOT. ALLOCATED( vpt_av ) ) THEN |
---|
891 | ALLOCATE( vpt_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
892 | ENDIF |
---|
893 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
894 | vpt_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
895 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
896 | |
---|
897 | CASE ( 'w' ) |
---|
898 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
899 | w(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
900 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
901 | |
---|
902 | CASE ( 'w_av' ) |
---|
903 | IF ( .NOT. ALLOCATED( w_av ) ) THEN |
---|
904 | ALLOCATE( w_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
905 | ENDIF |
---|
906 | IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
907 | w_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
908 | tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
909 | |
---|
910 | CASE ( 'w_m_l' ) |
---|
911 | IF ( k == 1 ) THEN |
---|
912 | ALLOCATE( tmp_3dwwl(nzb:nzt+1,& |
---|
913 | nys_on_file-nbgp:nyn_on_file+nbgp,0:1) ) |
---|
914 | READ ( 13 ) tmp_3dwwl |
---|
915 | ENDIF |
---|
916 | IF ( outflow_l ) THEN |
---|
917 | w_m_l(:,nysc-nbgp:nync+nbgp,:) = tmp_3dwwl(:,nysf-nbgp:nynf+nbgp,:) |
---|
918 | ENDIF |
---|
919 | |
---|
920 | CASE ( 'w_m_n' ) |
---|
921 | IF ( k == 1 ) THEN |
---|
922 | ALLOCATE( tmp_3dwwn(nzb:nzt+1,ny-1:ny, & |
---|
923 | nxl_on_file-nbgp:nxr_on_file+nbgp) ) |
---|
924 | READ ( 13 ) tmp_3dwwn |
---|
925 | ENDIF |
---|
926 | IF ( outflow_n ) THEN |
---|
927 | w_m_n(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3dwwn(:,:,nxlf-nbgp:nxrf+nbgp) |
---|
928 | ENDIF |
---|
929 | |
---|
930 | CASE ( 'w_m_r' ) |
---|
931 | IF ( k == 1 ) THEN |
---|
932 | ALLOCATE( tmp_3dwwr(nzb:nzt+1,& |
---|
933 | nys_on_file-nbgp:nyn_on_file+nbgp,nx-1:nx) ) |
---|
934 | READ ( 13 ) tmp_3dwwr |
---|
935 | ENDIF |
---|
936 | IF ( outflow_r ) THEN |
---|
937 | w_m_r(:,nysc-nbgp:nync+nbgp,:) = tmp_3dwwr(:,nysf-nbgp:nynf+nbgp,:) |
---|
938 | ENDIF |
---|
939 | |
---|
940 | CASE ( 'w_m_s' ) |
---|
941 | IF ( k == 1 ) THEN |
---|
942 | ALLOCATE( tmp_3dwws(nzb:nzt+1,0:1, & |
---|
943 | nxl_on_file-nbgp:nxr_on_file+nbgp) ) |
---|
944 | READ ( 13 ) tmp_3dwws |
---|
945 | ENDIF |
---|
946 | IF ( outflow_s ) THEN |
---|
947 | w_m_s(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3dwws(:,:,nxlf-nbgp:nxrf+nbgp) |
---|
948 | ENDIF |
---|
949 | DEALLOCATE( tmp_3dwws ) |
---|
950 | |
---|
951 | CASE ( 'z0_av' ) |
---|
952 | IF ( .NOT. ALLOCATED( z0_av ) ) THEN |
---|
953 | ALLOCATE( z0_av(nysg:nyng,nxlg:nxrg) ) |
---|
954 | ENDIF |
---|
955 | IF ( k == 1 ) READ ( 13 ) tmp_2d |
---|
956 | z0_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
957 | tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
958 | |
---|
959 | CASE ( 'z0h_av' ) |
---|
960 | IF ( .NOT. ALLOCATED( z0h_av ) ) THEN |
---|
961 | ALLOCATE( z0h_av(nysg:nyng,nxlg:nxrg) ) |
---|
962 | ENDIF |
---|
963 | IF ( k == 1 ) READ ( 13 ) tmp_2d |
---|
964 | z0h_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
965 | tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
966 | |
---|
967 | CASE ( 'z0q_av' ) |
---|
968 | IF ( .NOT. ALLOCATED( z0q_av ) ) THEN |
---|
969 | ALLOCATE( z0q_av(nysg:nyng,nxlg:nxrg) ) |
---|
970 | ENDIF |
---|
971 | IF ( k == 1 ) READ ( 13 ) tmp_2d |
---|
972 | z0q_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
973 | tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
974 | |
---|
975 | CASE DEFAULT |
---|
976 | WRITE( message_string, * ) 'unknown field named "', & |
---|
977 | TRIM( field_chr ), '" found in', & |
---|
978 | '&data from prior run on PE ',myid |
---|
979 | CALL message( 'read_3d_binary', 'PA0295', 1, 2, 0, 6, 0 ) |
---|
980 | |
---|
981 | END SELECT |
---|
982 | |
---|
983 | ENDDO ! overlap loop |
---|
984 | |
---|
985 | ! |
---|
986 | !-- Deallocate arrays needed for specific variables only |
---|
987 | IF ( ALLOCATED( tmp_3dwul ) ) DEALLOCATE( tmp_3dwul ) |
---|
988 | IF ( ALLOCATED( tmp_3dwun ) ) DEALLOCATE( tmp_3dwun ) |
---|
989 | IF ( ALLOCATED( tmp_3dwur ) ) DEALLOCATE( tmp_3dwur ) |
---|
990 | IF ( ALLOCATED( tmp_3dwus ) ) DEALLOCATE( tmp_3dwus ) |
---|
991 | IF ( ALLOCATED( tmp_3dwvl ) ) DEALLOCATE( tmp_3dwvl ) |
---|
992 | IF ( ALLOCATED( tmp_3dwvn ) ) DEALLOCATE( tmp_3dwvn ) |
---|
993 | IF ( ALLOCATED( tmp_3dwvr ) ) DEALLOCATE( tmp_3dwvr ) |
---|
994 | IF ( ALLOCATED( tmp_3dwvs ) ) DEALLOCATE( tmp_3dwvs ) |
---|
995 | IF ( ALLOCATED( tmp_3dwwl ) ) DEALLOCATE( tmp_3dwwl ) |
---|
996 | IF ( ALLOCATED( tmp_3dwwn ) ) DEALLOCATE( tmp_3dwwn ) |
---|
997 | IF ( ALLOCATED( tmp_3dwwr ) ) DEALLOCATE( tmp_3dwwr ) |
---|
998 | IF ( ALLOCATED( tmp_3dwws ) ) DEALLOCATE( tmp_3dwws ) |
---|
999 | IF ( ALLOCATED( tmp_4d ) ) DEALLOCATE( tmp_4d ) |
---|
1000 | |
---|
1001 | ! |
---|
1002 | !-- Read next character string |
---|
1003 | READ ( 13 ) field_chr |
---|
1004 | |
---|
1005 | ENDDO ! loop over variables |
---|
1006 | ! |
---|
1007 | !-- Read surface related variables |
---|
1008 | CALL surface_read_restart_data( i, nxlfa, nxl_on_file, nxrfa, & |
---|
1009 | nxr_on_file, nynfa, nyn_on_file, nysfa, & |
---|
1010 | nys_on_file, offset_xa, offset_ya, & |
---|
1011 | overlap_count(i) ) |
---|
1012 | |
---|
1013 | ! |
---|
1014 | !-- Read land surface restart data |
---|
1015 | IF ( land_surface ) THEN |
---|
1016 | CALL lsm_read_restart_data( i, nxlfa, nxl_on_file, nxrfa, & |
---|
1017 | nxr_on_file, nynfa, nyn_on_file, nysfa, & |
---|
1018 | nys_on_file, offset_xa, offset_ya, & |
---|
1019 | overlap_count(i), tmp_2d ) |
---|
1020 | |
---|
1021 | ENDIF |
---|
1022 | |
---|
1023 | ! |
---|
1024 | !-- Read land surface restart data |
---|
1025 | IF ( urban_surface ) THEN |
---|
1026 | CALL usm_read_restart_data( i, nxlfa, nxl_on_file, nxrfa, & |
---|
1027 | nxr_on_file, nynfa, nyn_on_file, nysfa, & |
---|
1028 | nys_on_file, offset_xa, offset_ya, & |
---|
1029 | overlap_count(i) ) |
---|
1030 | ENDIF |
---|
1031 | |
---|
1032 | ! |
---|
1033 | !-- Read radiation restart data |
---|
1034 | IF ( radiation ) THEN |
---|
1035 | CALL radiation_read_restart_data( i, nxlfa, nxl_on_file, nxrfa, & |
---|
1036 | nxr_on_file, nynfa, nyn_on_file, & |
---|
1037 | nysfa, nys_on_file, offset_xa, & |
---|
1038 | offset_ya, overlap_count(i), & |
---|
1039 | tmp_2d, tmp_3d ) |
---|
1040 | ENDIF |
---|
1041 | |
---|
1042 | ! |
---|
1043 | !-- Read user-defined restart data |
---|
1044 | CALL user_read_restart_data( i, nxlfa, nxl_on_file, nxrfa, nxr_on_file, & |
---|
1045 | nynfa, nyn_on_file, nysfa, nys_on_file, & |
---|
1046 | offset_xa, offset_ya, overlap_count(i), & |
---|
1047 | tmp_2d, tmp_3d ) |
---|
1048 | |
---|
1049 | ! |
---|
1050 | !-- Close the restart file |
---|
1051 | CALL close_file( 13 ) |
---|
1052 | |
---|
1053 | DEALLOCATE( tmp_2d, tmp_3d ) |
---|
1054 | |
---|
1055 | ENDDO ! loop over restart files |
---|
1056 | |
---|
1057 | |
---|
1058 | ! |
---|
1059 | !-- Restore the original filename for the restart file to be written |
---|
1060 | myid_char = myid_char_save |
---|
1061 | |
---|
1062 | |
---|
1063 | ! |
---|
1064 | !-- End of time measuring for reading binary data |
---|
1065 | CALL cpu_log( log_point_s(14), 'read_3d_binary', 'stop' ) |
---|
1066 | |
---|
1067 | END SUBROUTINE read_3d_binary |
---|