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