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