source: palm/trunk/SOURCE/read_3d_binary.f90 @ 48

Last change on this file since 48 was 39, checked in by raasch, 17 years ago

comments prepared for 3.1c

  • Property svn:keywords set to Id
File size: 16.8 KB
Line 
1 SUBROUTINE read_3d_binary
2
3!------------------------------------------------------------------------------!
4! Actual revisions:
5! -----------------
6!
7!
8! Former revisions:
9! -----------------
10! $Id: read_3d_binary.f90 39 2007-03-01 12:46:59Z raasch $
11! +qswst, qswst_m, tswst, tswst_m
12!
13! 19 2007-02-23 04:53:48Z raasch
14!
15! RCS Log replace by Id keyword, revision history cleaned up
16!
17! Revision 1.4  2006/08/04 15:02:32  raasch
18! +iran, iran_part
19!
20! Revision 1.1  2004/04/30 12:47:27  raasch
21! Initial revision
22!
23!
24! Description:
25! ------------
26! Binary input of variables and arrays from restart file
27!------------------------------------------------------------------------------!
28
29    USE arrays_3d
30    USE averaging
31    USE control_parameters
32    USE cpulog
33    USE indices
34    USE interfaces
35    USE particle_attributes
36    USE pegrid
37    USE profil_parameter
38    USE random_function_mod
39    USE statistics
40
41    IMPLICIT NONE
42
43    CHARACTER (LEN=10) ::  binary_version, version_on_file
44    CHARACTER (LEN=20) ::  field_chr
45    CHARACTER (LEN=10),  DIMENSION(:), ALLOCATABLE ::  chdum10
46    CHARACTER (LEN=40),  DIMENSION(:), ALLOCATABLE ::  chdum40
47    CHARACTER (LEN=100), DIMENSION(:), ALLOCATABLE ::  chdum100
48
49    INTEGER ::  idum1, myid_on_file, numprocs_on_file, nxl_on_file, &
50                nxr_on_file, nyn_on_file, nys_on_file, nzb_on_file, nzt_on_file
51
52    INTEGER, DIMENSION(:), ALLOCATABLE ::  idum
53
54    REAL, DIMENSION(:), ALLOCATABLE ::  rdum
55
56!
57!-- Read data from previous model run. unit 13 already opened in parin
58    CALL cpu_log( log_point_s(14), 'read_3d_binary', 'start' )
59
60!
61!-- First compare the version numbers
62    READ ( 13 )  version_on_file
63    binary_version = '3.0'
64    IF ( TRIM( version_on_file ) /= TRIM( binary_version ) )  THEN
65       IF ( myid == 0 )  THEN
66          PRINT*, '+++ init_3d_model: version mismatch concerning data ', &
67                  'from prior run'
68          PRINT*, '        version on file    = "', TRIM( version_on_file ),&
69                  '"'
70          PRINT*, '        version in program = "', TRIM( binary_version ), &
71                  '"'
72       ENDIF
73       CALL local_stop
74    ENDIF
75
76!
77!-- Read and compare number of processors, processor-id and array ranges
78    READ ( 13 )  numprocs_on_file, myid_on_file, nxl_on_file, nxr_on_file, &
79                 nys_on_file, nyn_on_file, nzb_on_file, nzt_on_file
80
81    IF ( numprocs_on_file /= numprocs )  THEN
82       PRINT*, '+++ init_3d_model: mismatch between actual data and data '
83       PRINT*, '                   from prior run on PE ', myid
84       PRINT*, '                   numprocs on file = ', numprocs_on_file
85       PRINT*, '                   numprocs         = ', numprocs
86       CALL local_stop
87    ENDIF
88
89    IF ( myid_on_file /= myid )  THEN
90       PRINT*, '+++ init_3d_model: mismatch between actual data and data '
91       PRINT*, '                   from prior run'
92       PRINT*, '                   myid_on_file = ', myid_on_file
93       PRINT*, '                   myid         = ', myid
94#if defined( __parallel )
95       CALL MPI_ABORT( comm2d, 9999, ierr )
96#else
97       CALL local_stop
98#endif
99    ENDIF
100
101    IF ( nxl_on_file /= nxl )  THEN
102       PRINT*, '+++ init_3d_model: mismatch between actual data and data '
103       PRINT*, '                   from prior run on PE ', myid
104       PRINT*, '                   nxl on file = ', nxl_on_file
105       PRINT*, '                   nxl         = ', nxl
106#if defined( __parallel )
107       CALL MPI_ABORT( comm2d, 9999, ierr )
108#else
109       CALL local_stop
110#endif
111    ENDIF
112
113    IF ( nxr_on_file /= nxr )  THEN
114       PRINT*, '+++ init_3d_model: mismatch between actual data and data '
115       PRINT*, '                   from prior run on PE ', myid
116       PRINT*, '                   nxr on file = ', nxr_on_file
117       PRINT*, '                   nxr         = ', nxr
118#if defined( __parallel )
119       CALL MPI_ABORT( comm2d, 9999, ierr )
120#else
121       CALL local_stop
122#endif
123    ENDIF
124
125    IF ( nys_on_file /= nys )  THEN
126       PRINT*, '+++ init_3d_model: mismatch between actual data and data '
127       PRINT*, '                   from prior run on PE ', myid
128       PRINT*, '                   nys on file = ', nys_on_file
129       PRINT*, '                   nys         = ', nys
130#if defined( __parallel )
131       CALL MPI_ABORT( comm2d, 9999, ierr )
132#else
133       CALL local_stop
134#endif
135    ENDIF
136
137    IF ( nyn_on_file /= nyn )  THEN
138       PRINT*, '+++ init_3d_model: mismatch between actual data and data '
139       PRINT*, '                   from prior run on PE ', myid
140       PRINT*, '                   nyn on file = ', nyn_on_file
141       PRINT*, '                   nyn         = ', nyn
142#if defined( __parallel )
143       CALL MPI_ABORT( comm2d, 9999, ierr )
144#else
145       CALL local_stop
146#endif
147    ENDIF
148
149    IF ( nzb_on_file /= nzb )  THEN
150       PRINT*, '+++ init_3d_model: mismatch between actual data and data '
151       PRINT*, '                   from prior run on PE ', myid
152       PRINT*, '                   nzb on file = ', nzb_on_file
153       PRINT*, '                   nzb         = ', nzb
154       CALL local_stop
155    ENDIF
156
157    IF ( nzt_on_file /= nzt )  THEN
158       PRINT*, '+++ init_3d_model: mismatch between actual data and data '
159       PRINT*, '                   from prior run on PE ', myid
160       PRINT*, '                   nzt on file = ', nzt_on_file
161       PRINT*, '                   nzt         = ', nzt
162       CALL local_stop
163    ENDIF
164
165!
166!-- Local arrays that may be required for possible temporary information
167!-- storage in the following
168    ALLOCATE( chdum10(crmax), chdum40(crmax), chdum100(crmax), &
169              idum(100*crmax), rdum(100*crmax) )
170
171!
172!-- Initialize spectra (for the case of just starting spectra computation
173!-- in continuation runs)
174    IF ( dt_dosp /= 9999999.9 )  THEN
175       spectrum_x = 0.0
176       spectrum_y = 0.0
177    ENDIF
178
179!
180!-- Read arrays
181!-- ATTENTION: If the following read commands have been altered, the
182!-- ---------- version number of the variable binary_version must be altered,
183!--            too. Furthermore, the output list of arrays in write_3d_binary
184!--            must also be altered accordingly.
185    READ ( 13 )  field_chr
186    DO  WHILE ( TRIM( field_chr ) /= '*** end ***' )
187
188       SELECT CASE ( TRIM( field_chr ) )
189
190          CASE ( 'e' )
191             READ ( 13 )  e
192          CASE ( 'e_av' )
193             ALLOCATE( e_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
194             READ ( 13 )  e_av
195          CASE ( 'e_m' )
196             READ ( 13 )  e_m
197          CASE ( 'iran' )
198             READ ( 13 )  iran, iran_part
199          CASE ( 'kh' )
200             READ ( 13 )  kh
201          CASE ( 'kh_m' )
202             READ ( 13 )  kh_m
203          CASE ( 'km' )
204             READ ( 13 )  km
205          CASE ( 'km_m' )
206             READ ( 13 )  km_m
207          CASE ( 'lwp_av' )
208             ALLOCATE( lwp_av(nys-1:nyn+1,nxl-1:nxr+1) )
209             READ ( 13 )  lwp_av
210          CASE ( 'p' )
211             READ ( 13 )  p
212          CASE ( 'p_av' )
213             ALLOCATE( p_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
214             READ ( 13 )  p_av
215          CASE ( 'pc_av' )
216             ALLOCATE( pc_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
217             READ ( 13 )  pc_av
218          CASE ( 'pr_av' )
219             ALLOCATE( pr_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
220             READ ( 13 )  pr_av
221          CASE ( 'pt' )
222             READ ( 13 )  pt
223          CASE ( 'pt_av' )
224             ALLOCATE( pt_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
225             READ ( 13 )  pt_av
226          CASE ( 'pt_m' )
227             READ ( 13 )  pt_m
228          CASE ( 'q' )
229             READ ( 13 )  q
230          CASE ( 'q_av' )
231             ALLOCATE( q_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
232             READ ( 13 )  q_av
233          CASE ( 'q_m' )
234             READ ( 13 )  q_m
235          CASE ( 'ql' )
236             READ ( 13 )  ql
237          CASE ( 'ql_av' )
238             ALLOCATE( ql_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
239             READ ( 13 )  ql_av
240          CASE ( 'ql_c_av' )
241             ALLOCATE( ql_c_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
242             READ ( 13 )  ql_c_av
243          CASE ( 'ql_v_av' )
244             ALLOCATE( ql_v_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
245             READ ( 13 )  ql_v_av
246          CASE ( 'ql_vp_av' )
247             ALLOCATE( ql_vp_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
248             READ ( 13 )  ql_vp_av
249          CASE ( 'qs' )
250             READ ( 13 )  qs
251          CASE ( 'qsws' )
252             READ ( 13 )  qsws
253          CASE ( 'qsws_m' )
254             READ ( 13 )  qsws_m
255          CASE ( 'qswst' )
256             READ ( 13 )  qswst
257          CASE ( 'qswst_m' )
258             READ ( 13 )  qswst_m
259          CASE ( 'qv_av' )
260             ALLOCATE( qv_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
261             READ ( 13 )  qv_av
262          CASE ( 'random_iv' )
263             READ ( 13 )  random_iv
264             READ ( 13 )  random_iy
265          CASE ( 'rif' )
266             READ ( 13 )  rif
267          CASE ( 'rif_m' )
268             READ ( 13 )  rif_m
269          CASE ( 's_av' )
270             ALLOCATE( s_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
271             READ ( 13 )  s_av
272          CASE ( 'shf' )
273             READ ( 13 )  shf
274          CASE ( 'shf_m' )
275             READ ( 13 )  shf_m
276          CASE ( 'tswst' )
277             READ ( 13 )  tswst
278          CASE ( 'tswst_m' )
279             READ ( 13 )  tswst_m
280          CASE ( 'spectrum_x' )
281             READ ( 13 )  spectrum_x
282          CASE ( 'spectrum_y' )
283             READ ( 13 )  spectrum_y
284          CASE ( 'ts' )
285             READ ( 13 )  ts
286          CASE ( 'ts_av' )
287             ALLOCATE( ts_av(nys-1:nyn+1,nxl-1:nxr+1) )
288             READ ( 13 )  ts_av
289          CASE ( 'u' )
290             READ ( 13 )  u
291          CASE ( 'u_av' )
292             ALLOCATE( u_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
293             READ ( 13 )  u_av
294          CASE ( 'u_m' )
295             READ ( 13 )  u_m
296          CASE ( 'us' )
297             READ ( 13 )  us
298          CASE ( 'usws' )
299             READ ( 13 )  usws
300          CASE ( 'usws_m' )
301             READ ( 13 )  usws_m
302          CASE ( 'us_av' )
303             ALLOCATE( us_av(nys-1:nyn+1,nxl-1:nxr+1) )
304             READ ( 13 )  us_av
305          CASE ( 'v' )
306             READ ( 13 )  v
307          CASE ( 'volume_flow_area' )
308             READ ( 13 )  volume_flow_area
309          CASE ( 'volume_flow_initial' )
310             READ ( 13 )  volume_flow_initial
311          CASE ( 'v_av' )
312             ALLOCATE( v_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
313             READ ( 13 )  v_av
314          CASE ( 'v_m' )
315             READ (13 )   v_m
316          CASE ( 'vpt' )
317             READ ( 13 )  vpt
318          CASE ( 'vpt_av' )
319             ALLOCATE( vpt_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
320             READ ( 13 )  vpt_av
321          CASE ( 'vpt_m' )
322             READ ( 13 )  vpt_m
323          CASE ( 'vsws' )
324             READ ( 13 )  vsws
325          CASE ( 'vsws_m' )
326             READ ( 13 )  vsws_m
327          CASE ( 'w' )
328             READ ( 13 )  w
329          CASE ( 'w_av' )
330             ALLOCATE( w_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
331             READ ( 13 )  w_av
332          CASE ( 'w_m' )
333             READ ( 13 )  w_m
334          CASE ( 'z0' )
335             READ ( 13 )  z0
336
337          CASE ( 'cross_linecolors' )
338             IF ( use_prior_plot1d_parameters )  THEN
339                READ ( 13 )  cross_linecolors
340             ELSE
341                READ ( 13 )  idum
342             ENDIF
343          CASE ( 'cross_linestyles' )
344             IF ( use_prior_plot1d_parameters )  THEN
345                READ ( 13 )  cross_linestyles
346             ELSE
347                READ ( 13 )  idum
348             ENDIF
349          CASE ( 'cross_normalized_x' )
350             IF ( use_prior_plot1d_parameters )  THEN
351                READ ( 13 )  cross_normalized_x
352             ELSE
353                READ ( 13 )  chdum10
354             ENDIF
355          CASE ( 'cross_normalized_y' )
356             IF ( use_prior_plot1d_parameters )  THEN
357                READ ( 13 )  cross_normalized_y
358             ELSE
359                READ ( 13 )  chdum10
360             ENDIF
361          CASE ( 'cross_normx_factor' )
362             IF ( use_prior_plot1d_parameters )  THEN
363                READ ( 13 )  cross_normx_factor
364             ELSE
365                READ ( 13 )  rdum
366             ENDIF
367          CASE ( 'cross_normy_factor' )
368             IF ( use_prior_plot1d_parameters )  THEN
369                READ ( 13 )  cross_normy_factor
370             ELSE
371                READ ( 13 )  rdum
372             ENDIF
373          CASE ( 'cross_profiles' )
374             IF ( use_prior_plot1d_parameters )  THEN
375                READ ( 13 )  cross_profiles
376             ELSE
377                READ ( 13 )  chdum100
378             ENDIF
379          CASE ( 'cross_profile_n_coun' )
380             IF ( use_prior_plot1d_parameters )  THEN
381                READ ( 13 )  cross_profile_number_count
382             ELSE
383                READ ( 13 )  idum(1:crmax)
384             ENDIF
385          CASE ( 'cross_profile_number' )
386             IF ( use_prior_plot1d_parameters )  THEN
387                READ ( 13 )  cross_profile_numbers
388             ELSE
389                READ ( 13 )  idum
390             ENDIF
391          CASE ( 'cross_uxmax' )
392             IF ( use_prior_plot1d_parameters )  THEN
393                READ ( 13 )  cross_uxmax
394             ELSE
395                READ ( 13 )  rdum(1:crmax)
396             ENDIF
397          CASE ( 'cross_uxmax_computed' )
398             IF ( use_prior_plot1d_parameters )  THEN
399                READ ( 13 )  cross_uxmax_computed
400             ELSE
401                READ ( 13 )  rdum(1:crmax)
402             ENDIF
403          CASE ( 'cross_uxmax_normaliz' )
404             IF ( use_prior_plot1d_parameters )  THEN
405                READ ( 13 )  cross_uxmax_normalized
406             ELSE
407                READ ( 13 )  rdum(1:crmax)
408             ENDIF
409          CASE ( 'cross_uxmax_norm_com' )
410             IF ( use_prior_plot1d_parameters )  THEN
411                READ ( 13 )  cross_uxmax_normalized_computed
412             ELSE
413                READ ( 13 )  rdum(1:crmax)
414             ENDIF
415          CASE ( 'cross_uxmin' )
416             IF ( use_prior_plot1d_parameters )  THEN
417                READ ( 13 )  cross_uxmin
418             ELSE
419                READ ( 13 )  rdum(1:crmax)
420             ENDIF
421          CASE ( 'cross_uxmin_computed' )
422             IF ( use_prior_plot1d_parameters )  THEN
423                READ ( 13 )  cross_uxmin_computed
424             ELSE
425                READ ( 13 )  rdum(1:crmax)
426             ENDIF
427          CASE ( 'cross_uxmin_normaliz' )
428             IF ( use_prior_plot1d_parameters )  THEN
429                READ ( 13 )  cross_uxmin_normalized
430             ELSE
431                READ ( 13 )  rdum(1:crmax)
432             ENDIF
433          CASE ( 'cross_uxmin_norm_com' )
434             IF ( use_prior_plot1d_parameters )  THEN
435                READ ( 13 )  cross_uxmin_normalized_computed
436             ELSE
437                READ ( 13 )  rdum(1:crmax)
438             ENDIF
439          CASE ( 'cross_uymax' )
440             IF ( use_prior_plot1d_parameters )  THEN
441                READ ( 13 )  cross_uymax
442             ELSE
443                READ ( 13 )  rdum(1:crmax)
444             ENDIF
445          CASE ( 'cross_uymin' )
446             IF ( use_prior_plot1d_parameters )  THEN
447                READ ( 13 )  cross_uymin
448             ELSE
449                READ ( 13 )  rdum(1:crmax)
450             ENDIF
451          CASE ( 'cross_xtext' )
452             IF ( use_prior_plot1d_parameters )  THEN
453                READ ( 13 )  cross_xtext
454             ELSE
455                READ ( 13 )  chdum40
456             ENDIF
457          CASE ( 'dopr_crossindex' )
458             IF ( use_prior_plot1d_parameters )  THEN
459                READ ( 13 )  dopr_crossindex
460             ELSE
461                READ ( 13 )  idum(1:100)
462             ENDIF
463          CASE ( 'dopr_time_count' )
464             IF ( use_prior_plot1d_parameters )  THEN
465                READ ( 13 )  dopr_time_count
466             ELSE
467                READ ( 13 )  idum1
468             ENDIF
469          CASE ( 'hom_sum' )
470             READ ( 13 )  hom_sum
471          CASE ( 'profile_columns' )
472             IF ( use_prior_plot1d_parameters )  THEN
473                READ ( 13 )  profile_columns
474             ELSE
475                READ ( 13 )  idum1
476             ENDIF
477          CASE ( 'profile_number' )
478             IF ( use_prior_plot1d_parameters )  THEN
479                READ ( 13 )  profile_number
480             ELSE
481                READ ( 13 )  idum1
482             ENDIF
483          CASE ( 'profile_rows' )
484             IF ( use_prior_plot1d_parameters )  THEN
485                READ ( 13 )  profile_rows
486             ELSE
487                READ ( 13 )  idum1
488             ENDIF
489
490          CASE DEFAULT
491             PRINT*, '+++ init_3d_model: unknown field named "', &
492                     TRIM( field_chr ), '" found in'
493             PRINT*, '                   data from prior run on PE ', myid
494             CALL local_stop
495
496       END SELECT
497!
498!--    Read next character string
499       READ ( 13 )  field_chr
500
501    ENDDO
502
503    DEALLOCATE( chdum10, chdum40, chdum100, idum, rdum )
504
505!
506!-- End of time measuring for reading binary data
507    CALL cpu_log( log_point_s(14), 'read_3d_binary', 'stop' )
508
509 END SUBROUTINE read_3d_binary
Note: See TracBrowser for help on using the repository browser.