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