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

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

preliminary uncomplete changes for ocean version

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