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