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