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