source: palm/trunk/SOURCE/check_open.f90 @ 2039

Last change on this file since 2039 was 2039, checked in by gronemeier, 7 years ago

Increased the number of possible statistic regions to 99

  • Property svn:keywords set to Id
File size: 44.3 KB
Line 
1!> @file check_open.f90
2!------------------------------------------------------------------------------!
3! This file is part of PALM.
4!
5! PALM is free software: you can redistribute it and/or modify it under the
6! terms of the GNU General Public License as published by the Free Software
7! Foundation, either version 3 of the License, or (at your option) any later
8! version.
9!
10! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
11! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13!
14! You should have received a copy of the GNU fGeneral Public License along with
15! PALM. If not, see <http://www.gnu.org/licenses/>.
16!
17! Copyright 1997-2016 Leibniz Universitaet Hannover
18!------------------------------------------------------------------------------!
19!
20! Current revisions:
21! -----------------
22! Removed open of file 'PLOTTS_DATA' ( CASE(50:59) ) as it is no longer needed
23!
24! Former revisions:
25! -----------------
26! $Id: check_open.f90 2039 2016-10-26 16:53:23Z gronemeier $
27!
28! 2000 2016-08-20 18:09:15Z knoop
29! Forced header and separation lines into 80 columns
30!
31! 1988 2016-08-10 14:49:06Z gronemeier
32! informative message added if files cannot be opened in newly created directory
33!
34! 1986 2016-08-10 14:07:17Z gronemeier
35! Bugfix: check if output can be opened in newly created directory. If not
36! wait one second and try again.
37!
38! 1974 2016-07-26 08:43:25Z gronemeier
39! Bugfix: MPI barriers after deleting non-extendable files must only be called
40! in case of parallel I/O
41!
42! 1957 2016-07-07 10:43:48Z suehring
43! flight module added
44!
45! 1804 2016-04-05 16:30:18Z maronga
46! Removed code for parameter file check (__check)
47!
48! 1783 2016-03-06 18:36:17Z raasch
49! name change of netcdf routines and module + related changes
50!
51! 1779 2016-03-03 08:01:28Z raasch
52! coupling_char is trimmed at every place it occurs, because it can have
53! different length now
54!
55! 1745 2016-02-05 13:06:51Z gronemeier
56! Bugfix: added MPI barrier after deleting existing non-extendable file by PE0
57!
58! 1682 2015-10-07 23:56:08Z knoop
59! Code annotations made doxygen readable
60!
61! 1551 2015-03-03 14:18:16Z maronga
62! Removed redundant output for combine_plot_fields
63!
64! 1468 2014-09-24 14:06:57Z maronga
65! Adapted for use on up to 6-digit processor cores
66! Added file unit 117 (PROGRESS)
67!
68! 1359 2014-04-11 17:15:14Z hoffmann
69! Format of particle exchange statistics extended to reasonable numbers of     
70! particles.
71!
72! 1353 2014-04-08 15:21:23Z heinze
73! REAL constants provided with KIND-attribute,
74! declaration for unused variables xkoor, ykoor, zkoor removed
75!
76! 1327 2014-03-21 11:00:16Z raasch
77! parts concerning iso2d and avs output removed
78!
79! 1320 2014-03-20 08:40:49Z raasch
80! ONLY-attribute added to USE-statements,
81! kind-parameters added to all INTEGER and REAL declaration statements,
82! kinds are defined in new module kinds,
83! old module precision_kind is removed,
84! revision history before 2012 removed,
85! comment fields (!:) to be used for variable explanations added to
86! all variable declaration statements
87!
88! 1106 2013-03-04 05:31:38Z raasch
89! array_kind renamed precision_kind
90!
91! 1092 2013-02-02 11:24:22Z raasch
92! unused variables removed
93!
94! 1036 2012-10-22 13:43:42Z raasch
95! code put under GPL (PALM 3.9)
96!
97! 1031 2012-10-19 14:35:30Z raasch
98! netCDF4 without parallel file support implemented,
99! opening of netCDF files are done by new routines create_netcdf_file and
100! open_write_netcdf_file
101!
102! 964 2012-07-26 09:14:24Z raasch
103! old profil-units (40:49) removed,
104! append feature removed from unit 14
105!
106! 849 2012-03-15 10:35:09Z raasch
107! comment changed
108!
109! 809 2012-01-30 13:32:58Z maronga
110! Bugfix: replaced .AND. and .NOT. with && and ! in the preprocessor directives
111!
112! 807 2012-01-25 11:53:51Z maronga
113! New cpp directive "__check" implemented which is used by check_namelist_files
114!
115! Revision 1.1  1997/08/11 06:10:55  raasch
116! Initial revision
117!
118!
119! Description:
120! ------------
121!> Check if file unit is open. If not, open file and, if necessary, write a
122!> header or start other initializing actions, respectively.
123!------------------------------------------------------------------------------!
124SUBROUTINE check_open( file_id )
125 
126
127    USE arrays_3d,                                                             &
128        ONLY:  zu
129
130    USE control_parameters,                                                    &
131        ONLY:  avs_data_file, coupling_char, data_output_2d_on_each_pe, host,  &
132               max_masks, message_string, mid, nz_do3d, openfile,              &
133               return_addres, return_username, run_description_header, runnr
134
135    USE grid_variables,                                                        &
136        ONLY:  dx, dy
137
138    USE indices,                                                               &
139        ONLY:  nbgp, nx, nxl, nxr, ny, nyn, nyng, nys, nysg, nz, nzb, nzt 
140
141    USE kinds
142
143#if defined( __netcdf )
144    USE NETCDF
145#endif
146
147    USE netcdf_interface,                                                      &
148        ONLY:  id_set_fl, id_set_mask, id_set_pr, id_set_prt, id_set_pts,      &
149               id_set_sp, id_set_ts, id_set_xy, id_set_xz, id_set_yz,          &
150               id_set_3d, nc_stat, netcdf_create_file, netcdf_data_format,     &
151               netcdf_define_header, netcdf_handle_error, netcdf_open_write_file
152
153    USE particle_attributes,                                                   &
154        ONLY:  max_number_of_particle_groups, number_of_particle_groups,       &
155               particle_groups
156
157    USE pegrid
158
159    USE posix_calls_from_fortran,                                              &
160        ONLY:  fortran_sleep
161
162    USE profil_parameter,                                                      &
163        ONLY:  cross_ts_numbers, cross_ts_number_count
164
165
166    IMPLICIT NONE
167
168    CHARACTER (LEN=2)   ::  mask_char               !<
169    CHARACTER (LEN=2)   ::  suffix                  !<
170    CHARACTER (LEN=20)  ::  xtext = 'time in s'     !<
171    CHARACTER (LEN=30)  ::  filename                !<
172    CHARACTER (LEN=40)  ::  avs_coor_file           !<
173    CHARACTER (LEN=40)  ::  avs_coor_file_localname !<
174    CHARACTER (LEN=40)  ::  avs_data_file_localname !<
175    CHARACTER (LEN=80)  ::  rtext                   !<
176    CHARACTER (LEN=100) ::  avs_coor_file_catalog   !<
177    CHARACTER (LEN=100) ::  avs_data_file_catalog   !<
178    CHARACTER (LEN=100) ::  batch_scp               !<
179    CHARACTER (LEN=100) ::  line                    !<
180    CHARACTER (LEN=400) ::  command                 !<
181
182    INTEGER(iwp) ::  av          !<
183    INTEGER(iwp) ::  numline = 1 !<
184    INTEGER(iwp) ::  cranz       !<
185    INTEGER(iwp) ::  file_id     !<
186    INTEGER(iwp) ::  i           !<
187    INTEGER(iwp) ::  iaddres     !<
188    INTEGER(iwp) ::  ioerr       !< IOSTAT flag for IO-commands ( 0 = no error )
189    INTEGER(iwp) ::  iusern      !<
190    INTEGER(iwp) ::  j           !<
191    INTEGER(iwp) ::  k           !<
192    INTEGER(iwp) ::  legpos = 1  !<
193    INTEGER(iwp) ::  timodex = 1 !<
194   
195    INTEGER(iwp), DIMENSION(10) ::  klist !<
196
197    LOGICAL ::  avs_coor_file_found = .FALSE. !<
198    LOGICAL ::  avs_data_file_found = .FALSE. !<
199    LOGICAL ::  datleg = .TRUE.               !<
200    LOGICAL ::  get_filenames                 !<
201    LOGICAL ::  grid = .TRUE.                 !<
202    LOGICAL ::  netcdf_extend                 !<
203    LOGICAL ::  rand = .TRUE.                 !<
204    LOGICAL ::  swap = .TRUE.                 !<
205    LOGICAL ::  twoxa = .TRUE.                !<
206    LOGICAL ::  twoya = .TRUE.                !<
207
208    REAL(wp) ::  ansx = -999.999_wp !<
209    REAL(wp) ::  ansy = -999.999_wp !<
210    REAL(wp) ::  gwid = 0.1_wp      !<
211    REAL(wp) ::  rlegfak = 1.5_wp   !<
212    REAL(wp) ::  sizex = 250.0_wp   !<
213    REAL(wp) ::  sizey = 40.0_wp    !<
214    REAL(wp) ::  texfac = 1.5_wp    !<
215
216    REAL(wp), DIMENSION(:), ALLOCATABLE      ::  eta !<
217    REAL(wp), DIMENSION(:), ALLOCATABLE      ::  ho  !<
218    REAL(wp), DIMENSION(:), ALLOCATABLE      ::  hu  !<
219 
220
221
222    NAMELIST /RAHMEN/  numline, cranz, datleg, rtext, swap
223    NAMELIST /CROSS/   ansx, ansy, grid, gwid, klist, legpos,                  &
224                       rand, rlegfak, sizex, sizey, texfac,                    &
225                       timodex, twoxa, twoya, xtext
226                       
227
228!
229!-- Immediate return if file already open
230    IF ( openfile(file_id)%opened )  RETURN
231
232!
233!-- Only certain files are allowed to be re-opened
234!-- NOTE: some of the other files perhaps also could be re-opened, but it
235!--       has not been checked so far, if it works!
236    IF ( openfile(file_id)%opened_before )  THEN
237       SELECT CASE ( file_id )
238          CASE ( 13, 14, 21, 22, 23, 80:85, 117 )
239             IF ( file_id == 14 .AND. openfile(file_id)%opened_before )  THEN
240                message_string = 're-open of unit ' //                         &
241                                 '14 is not verified. Please check results!'
242                CALL message( 'check_open', 'PA0165', 0, 1, 0, 6, 0 )       
243             ENDIF
244
245          CASE DEFAULT
246             WRITE( message_string, * ) 're-opening of file-id ', file_id,     &
247                                        ' is not allowed'
248             CALL message( 'check_open', 'PA0166', 0, 1, 0, 6, 0 )   
249               
250             RETURN
251
252       END SELECT
253    ENDIF
254
255!
256!-- Check if file may be opened on the relevant PE
257    SELECT CASE ( file_id )
258
259       CASE ( 15, 16, 17, 18, 19, 50:59, 81:84, 104:105, 107, 109, 117 )
260             
261          IF ( myid /= 0 )  THEN
262             WRITE( message_string, * ) 'opening file-id ',file_id,            &
263                                        ' not allowed for PE ',myid
264             CALL message( 'check_open', 'PA0167', 2, 2, -1, 6, 1 )
265          ENDIF
266
267       CASE ( 101:103, 106, 111:113, 116, 201:200+2*max_masks )
268
269          IF ( netcdf_data_format < 5 )  THEN
270         
271             IF ( myid /= 0 )  THEN
272                WRITE( message_string, * ) 'opening file-id ',file_id,         &
273                                           ' not allowed for PE ',myid
274                CALL message( 'check_open', 'PA0167', 2, 2, -1, 6, 1 )
275             ENDIF
276             
277          ENDIF
278
279       CASE ( 21, 22, 23 )
280
281          IF ( .NOT.  data_output_2d_on_each_pe )  THEN
282             IF ( myid /= 0 )  THEN
283                WRITE( message_string, * ) 'opening file-id ',file_id,         &
284                                           ' not allowed for PE ',myid
285                CALL message( 'check_open', 'PA0167', 2, 2, -1, 6, 1 )
286             END IF
287          ENDIF
288
289       CASE ( 27, 28, 29, 31, 33, 71:73, 90:99 )
290
291!
292!--       File-ids that are used temporarily in other routines
293          WRITE( message_string, * ) 'opening file-id ',file_id,               &
294                                    ' is not allowed since it is used otherwise'
295          CALL message( 'check_open', 'PA0168', 0, 1, 0, 6, 0 ) 
296         
297    END SELECT
298
299!
300!-- Open relevant files
301    SELECT CASE ( file_id )
302
303       CASE ( 11 )
304
305          OPEN ( 11, FILE='PARIN'//TRIM( coupling_char ), FORM='FORMATTED',    &
306                     STATUS='OLD' )
307
308       CASE ( 13 )
309
310          IF ( myid_char == '' )  THEN
311             OPEN ( 13, FILE='BININ'//TRIM( coupling_char )//myid_char,        &
312                        FORM='UNFORMATTED', STATUS='OLD' )
313          ELSE
314!
315!--          First opening of unit 13 openes file _000000 on all PEs because
316!--          only this file contains the global variables
317             IF ( .NOT. openfile(file_id)%opened_before )  THEN
318                OPEN ( 13, FILE='BININ'//TRIM( coupling_char )//'/_000000',    &
319                           FORM='UNFORMATTED', STATUS='OLD' )
320             ELSE
321                OPEN ( 13, FILE='BININ'//TRIM( coupling_char )//'/'//          &
322                           myid_char, FORM='UNFORMATTED', STATUS='OLD' )
323             ENDIF
324          ENDIF
325
326       CASE ( 14 )
327
328          IF ( myid_char == '' )  THEN
329             OPEN ( 14, FILE='BINOUT'//TRIM( coupling_char )//myid_char,       &
330                        FORM='UNFORMATTED', POSITION='APPEND' )
331          ELSE
332             IF ( myid == 0  .AND. .NOT. openfile(file_id)%opened_before )  THEN
333                CALL local_system( 'mkdir  BINOUT' // TRIM( coupling_char ) )
334             ENDIF
335#if defined( __parallel )
336!
337!--          Set a barrier in order to allow that all other processors in the
338!--          directory created by PE0 can open their file
339             CALL MPI_BARRIER( comm2d, ierr )
340#endif
341             ioerr = 1
342             DO WHILE ( ioerr /= 0 )
343                OPEN ( 14, FILE='BINOUT'//TRIM(coupling_char)//'/'//myid_char, &
344                           FORM='UNFORMATTED', IOSTAT=ioerr )
345                IF ( ioerr /= 0 )  THEN
346                   WRITE( 9, * )  '*** could not open "BINOUT'//         &
347                                  TRIM(coupling_char)//'/'//myid_char//  &
348                                  '"! Trying again in 1 sec.'
349                   CALL fortran_sleep( 1 )
350                ENDIF
351             ENDDO
352
353          ENDIF
354
355       CASE ( 15 )
356
357          OPEN ( 15, FILE='RUN_CONTROL'//TRIM( coupling_char ),                &
358                     FORM='FORMATTED' )
359
360       CASE ( 16 )
361
362          OPEN ( 16, FILE='LIST_PROFIL'//TRIM( coupling_char ),                &
363                     FORM='FORMATTED' )
364
365       CASE ( 17 )
366
367          OPEN ( 17, FILE='LIST_PROFIL_1D'//TRIM( coupling_char ),             &
368                     FORM='FORMATTED' )
369
370       CASE ( 18 )
371
372          OPEN ( 18, FILE='CPU_MEASURES'//TRIM( coupling_char ),               &
373                     FORM='FORMATTED' )
374
375       CASE ( 19 )
376
377          OPEN ( 19, FILE='HEADER'//TRIM( coupling_char ), FORM='FORMATTED' )
378
379       CASE ( 20 )
380
381          IF ( myid == 0  .AND. .NOT. openfile(file_id)%opened_before )  THEN
382             CALL local_system( 'mkdir  DATA_LOG' // TRIM( coupling_char ) )
383          ENDIF
384          IF ( myid_char == '' )  THEN
385             OPEN ( 20, FILE='DATA_LOG'//TRIM( coupling_char )//'/_000000',    &
386                        FORM='UNFORMATTED', POSITION='APPEND' )
387          ELSE
388#if defined( __parallel )
389!
390!--          Set a barrier in order to allow that all other processors in the
391!--          directory created by PE0 can open their file
392             CALL MPI_BARRIER( comm2d, ierr )
393#endif
394             ioerr = 1
395             DO WHILE ( ioerr /= 0 )
396                OPEN ( 20, FILE='DATA_LOG'//TRIM( coupling_char )//'/'//       &
397                           myid_char, FORM='UNFORMATTED', POSITION='APPEND',   &
398                           IOSTAT=ioerr )
399                IF ( ioerr /= 0 )  THEN
400                   WRITE( 9, * )  '*** could not open "DATA_LOG'//         &
401                                  TRIM( coupling_char )//'/'//myid_char//  &
402                                  '"! Trying again in 1 sec.'
403                   CALL fortran_sleep( 1 )
404                ENDIF
405             ENDDO
406
407          ENDIF
408
409       CASE ( 21 )
410
411          IF ( data_output_2d_on_each_pe )  THEN
412             OPEN ( 21, FILE='PLOT2D_XY'//TRIM( coupling_char )//myid_char,    &
413                        FORM='UNFORMATTED', POSITION='APPEND' )
414          ELSE
415             OPEN ( 21, FILE='PLOT2D_XY'//TRIM( coupling_char ),                       &
416                        FORM='UNFORMATTED', POSITION='APPEND' )
417          ENDIF
418
419          IF ( myid == 0  .AND.  .NOT. openfile(file_id)%opened_before )  THEN
420!
421!--          Output for combine_plot_fields
422             IF ( data_output_2d_on_each_pe  .AND.  myid_char /= '' )  THEN
423                WRITE (21)  -nbgp, nx+nbgp, -nbgp, ny+nbgp    ! total array size
424                WRITE (21)   0, nx+1,  0, ny+1    ! output part
425             ENDIF
426!
427!--          Determine and write ISO2D coordiante header
428             ALLOCATE( eta(0:ny+1), ho(0:nx+1), hu(0:nx+1) )
429             hu = 0.0_wp
430             ho = (ny+1) * dy
431             DO  i = 1, ny
432                eta(i) = REAL( i ) / ( ny + 1.0_wp )
433             ENDDO
434             eta(0)    = 0.0_wp
435             eta(ny+1) = 1.0_wp
436
437             WRITE (21)  dx,eta,hu,ho
438             DEALLOCATE( eta, ho, hu )
439
440          ENDIF
441
442       CASE ( 22 )
443
444          IF ( data_output_2d_on_each_pe )  THEN
445             OPEN ( 22, FILE='PLOT2D_XZ'//TRIM( coupling_char )//myid_char,    &
446                        FORM='UNFORMATTED', POSITION='APPEND' )
447          ELSE
448             OPEN ( 22, FILE='PLOT2D_XZ'//TRIM( coupling_char ),               &
449                        FORM='UNFORMATTED', POSITION='APPEND' )
450          ENDIF
451
452          IF ( myid == 0  .AND.  .NOT. openfile(file_id)%opened_before )  THEN
453!
454!--          Output for combine_plot_fields
455             IF ( data_output_2d_on_each_pe  .AND.  myid_char /= '' )  THEN
456                WRITE (22)  -nbgp, nx+nbgp, 0, nz+1    ! total array size
457                WRITE (22)   0, nx+1, 0, nz+1    ! output part
458             ENDIF
459!
460!--          Determine and write ISO2D coordinate header
461             ALLOCATE( eta(0:nz+1), ho(0:nx+1), hu(0:nx+1) )
462             hu = 0.0_wp
463             ho = zu(nz+1)
464             DO  i = 1, nz
465                eta(i) = REAL( zu(i) ) / zu(nz+1)
466             ENDDO
467             eta(0)    = 0.0_wp
468             eta(nz+1) = 1.0_wp
469
470             WRITE (22)  dx,eta,hu,ho
471             DEALLOCATE( eta, ho, hu )
472
473          ENDIF
474
475       CASE ( 23 )
476
477          IF ( data_output_2d_on_each_pe )  THEN
478             OPEN ( 23, FILE='PLOT2D_YZ'//TRIM( coupling_char )//myid_char,    &
479                        FORM='UNFORMATTED', POSITION='APPEND' )
480          ELSE
481             OPEN ( 23, FILE='PLOT2D_YZ'//TRIM( coupling_char ),               &
482                        FORM='UNFORMATTED', POSITION='APPEND' )
483          ENDIF
484
485          IF ( myid == 0  .AND.  .NOT. openfile(file_id)%opened_before )  THEN
486!
487!--          Output for combine_plot_fields
488             IF ( data_output_2d_on_each_pe  .AND.  myid_char /= '' )  THEN
489                WRITE (23)  -nbgp, ny+nbgp, 0, nz+1    ! total array size
490                WRITE (23)   0, ny+1, 0, nz+1    ! output part
491             ENDIF
492!
493!--          Determine and write ISO2D coordiante header
494             ALLOCATE( eta(0:nz+1), ho(0:ny+1), hu(0:ny+1) )
495             hu = 0.0_wp
496             ho = zu(nz+1)
497             DO  i = 1, nz
498                eta(i) = REAL( zu(i) ) / zu(nz+1)
499             ENDDO
500             eta(0)    = 0.0_wp
501             eta(nz+1) = 1.0_wp
502
503             WRITE (23)  dx,eta,hu,ho
504             DEALLOCATE( eta, ho, hu )
505
506          ENDIF
507
508       CASE ( 30 )
509
510          OPEN ( 30, FILE='PLOT3D_DATA'//TRIM( coupling_char )//myid_char,     &
511                     FORM='UNFORMATTED' )
512!
513!--       Write coordinate file for AVS
514          IF ( myid == 0 )  THEN
515#if defined( __parallel )
516!
517!--          Specifications for combine_plot_fields
518             WRITE ( 30 )  -nbgp,nx+nbgp,-nbgp,ny+nbgp
519             WRITE ( 30 )  0,nx+1,0,ny+1,0,nz_do3d
520#endif
521          ENDIF
522
523       CASE ( 80 )
524
525          IF ( myid_char == '' )  THEN
526             OPEN ( 80, FILE='PARTICLE_INFOS'//TRIM(coupling_char)//myid_char, &
527                        FORM='FORMATTED', POSITION='APPEND' )
528          ELSE
529             IF ( myid == 0  .AND.  .NOT. openfile(80)%opened_before )  THEN
530                CALL local_system( 'mkdir  PARTICLE_INFOS' //                  &
531                                   TRIM( coupling_char ) )
532             ENDIF
533#if defined( __parallel )
534!
535!--          Set a barrier in order to allow that thereafter all other
536!--          processors in the directory created by PE0 can open their file.
537!--          WARNING: The following barrier will lead to hanging jobs, if
538!--                   check_open is first called from routine
539!--                   allocate_prt_memory!
540             IF ( .NOT. openfile(80)%opened_before )  THEN
541                CALL MPI_BARRIER( comm2d, ierr )
542             ENDIF
543#endif
544             OPEN ( 80, FILE='PARTICLE_INFOS'//TRIM( coupling_char )//'/'//    &
545                             myid_char,                                        &
546                        FORM='FORMATTED', POSITION='APPEND' )
547          ENDIF
548
549          IF ( .NOT. openfile(80)%opened_before )  THEN
550             WRITE ( 80, 8000 )  TRIM( run_description_header )
551          ENDIF
552
553       CASE ( 81 )
554
555             OPEN ( 81, FILE='PLOTSP_X_PAR'//TRIM( coupling_char ),            &
556                        FORM='FORMATTED', DELIM='APOSTROPHE', RECL=1500,       &
557                        POSITION='APPEND' )
558
559       CASE ( 82 )
560
561             OPEN ( 82, FILE='PLOTSP_X_DATA'//TRIM( coupling_char ),           &
562                        FORM='FORMATTED', POSITION = 'APPEND' )
563
564       CASE ( 83 )
565
566             OPEN ( 83, FILE='PLOTSP_Y_PAR'//TRIM( coupling_char ),            &
567                        FORM='FORMATTED', DELIM='APOSTROPHE', RECL=1500,       &
568                        POSITION='APPEND' )
569
570       CASE ( 84 )
571
572             OPEN ( 84, FILE='PLOTSP_Y_DATA'//TRIM( coupling_char ),           &
573                        FORM='FORMATTED', POSITION='APPEND' )
574
575       CASE ( 85 )
576
577          IF ( myid_char == '' )  THEN
578             OPEN ( 85, FILE='PARTICLE_DATA'//TRIM(coupling_char)//myid_char,  &
579                        FORM='UNFORMATTED', POSITION='APPEND' )
580          ELSE
581             IF ( myid == 0  .AND.  .NOT. openfile(85)%opened_before )  THEN
582                CALL local_system( 'mkdir  PARTICLE_DATA' //                   &
583                                   TRIM( coupling_char ) )
584             ENDIF
585#if defined( __parallel )
586!
587!--          Set a barrier in order to allow that thereafter all other
588!--          processors in the directory created by PE0 can open their file
589             CALL MPI_BARRIER( comm2d, ierr )
590#endif
591             ioerr = 1
592             DO WHILE ( ioerr /= 0 )
593                OPEN ( 85, FILE='PARTICLE_DATA'//TRIM( coupling_char )//'/'//  &
594                           myid_char,                                          &
595                           FORM='UNFORMATTED', POSITION='APPEND', IOSTAT=ioerr )
596                IF ( ioerr /= 0 )  THEN
597                   WRITE( 9, * )  '*** could not open "PARTICLE_DATA'//    &
598                                  TRIM( coupling_char )//'/'//myid_char//  &
599                                  '"! Trying again in 1 sec.'
600                   CALL fortran_sleep( 1 )
601                ENDIF
602             ENDDO
603
604          ENDIF
605
606          IF ( .NOT. openfile(85)%opened_before )  THEN
607             WRITE ( 85 )  run_description_header
608!
609!--          Attention: change version number whenever the output format on
610!--                     unit 85 is changed (see also in routine
611!--                     lpm_data_output_particles)
612             rtext = 'data format version 3.1'
613             WRITE ( 85 )  rtext
614             WRITE ( 85 )  number_of_particle_groups,                          &
615                           max_number_of_particle_groups
616             WRITE ( 85 )  particle_groups
617             WRITE ( 85 )  nxl, nxr, nys, nyn, nzb, nzt, nbgp
618          ENDIF
619
620#if defined( __netcdf )
621       CASE ( 101, 111 )
622!
623!--       Set filename depending on unit number
624          IF ( file_id == 101 )  THEN
625             filename = 'DATA_2D_XY_NETCDF' // TRIM( coupling_char )
626             av = 0
627          ELSE
628             filename = 'DATA_2D_XY_AV_NETCDF' // TRIM( coupling_char )
629             av = 1
630          ENDIF
631!
632!--       Inquire, if there is a netCDF file from a previuos run. This should
633!--       be opened for extension, if its dimensions and variables match the
634!--       actual run.
635          INQUIRE( FILE=filename, EXIST=netcdf_extend )
636          IF ( netcdf_extend )  THEN
637!
638!--          Open an existing netCDF file for output
639             CALL netcdf_open_write_file( filename, id_set_xy(av), .TRUE., 20 )
640!
641!--          Read header information and set all ids. If there is a mismatch
642!--          between the previuos and the actual run, netcdf_extend is returned
643!--          as .FALSE.
644             CALL netcdf_define_header( 'xy', netcdf_extend, av )
645
646!
647!--          Remove the local file, if it can not be extended
648             IF ( .NOT. netcdf_extend )  THEN
649                nc_stat = NF90_CLOSE( id_set_xy(av) )
650                CALL netcdf_handle_error( 'check_open', 21 )
651                IF ( myid == 0 )  CALL local_system( 'rm ' // TRIM( filename ) )
652#if defined( __parallel )
653!
654!--             Set a barrier in order to assure that PE0 deleted the old file
655!--             before any other processor tries to open a new file.
656!--             Barrier is only needed in case of parallel I/O
657                IF ( netcdf_data_format > 4 )  CALL MPI_BARRIER( comm2d, ierr )
658#endif
659             ENDIF
660
661          ENDIF
662
663          IF ( .NOT. netcdf_extend )  THEN
664!
665!--          Create a new netCDF output file with requested netCDF format
666             CALL netcdf_create_file( filename, id_set_xy(av), .TRUE., 22 )
667
668!
669!--          Define the header
670             CALL netcdf_define_header( 'xy', netcdf_extend, av )
671
672!
673!--          In case of parallel netCDF output, create flag file which tells
674!--          combine_plot_fields that nothing is to do.
675             IF ( myid == 0  .AND.  netcdf_data_format > 4 )  THEN
676                OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_XY' )
677                WRITE ( 99, '(A)' )  'no combine_plot_fields.x neccessary'
678                CLOSE( 99 )
679             ENDIF
680
681          ENDIF
682
683       CASE ( 102, 112 )
684!
685!--       Set filename depending on unit number
686          IF ( file_id == 102 )  THEN
687             filename = 'DATA_2D_XZ_NETCDF' // TRIM( coupling_char )
688             av = 0
689          ELSE
690             filename = 'DATA_2D_XZ_AV_NETCDF' // TRIM( coupling_char )
691             av = 1
692          ENDIF
693!
694!--       Inquire, if there is a netCDF file from a previuos run. This should
695!--       be opened for extension, if its dimensions and variables match the
696!--       actual run.
697          INQUIRE( FILE=filename, EXIST=netcdf_extend )
698
699          IF ( netcdf_extend )  THEN
700!
701!--          Open an existing netCDF file for output
702             CALL netcdf_open_write_file( filename, id_set_xz(av), .TRUE., 23 )
703!
704!--          Read header information and set all ids. If there is a mismatch
705!--          between the previuos and the actual run, netcdf_extend is returned
706!--          as .FALSE.
707             CALL netcdf_define_header( 'xz', netcdf_extend, av )
708
709!
710!--          Remove the local file, if it can not be extended
711             IF ( .NOT. netcdf_extend )  THEN
712                nc_stat = NF90_CLOSE( id_set_xz(av) )
713                CALL netcdf_handle_error( 'check_open', 24 )
714                IF ( myid == 0 )  CALL local_system( 'rm ' // TRIM( filename ) )
715#if defined( __parallel )
716!
717!--             Set a barrier in order to assure that PE0 deleted the old file
718!--             before any other processor tries to open a new file
719!--             Barrier is only needed in case of parallel I/O
720                IF ( netcdf_data_format > 4 )  CALL MPI_BARRIER( comm2d, ierr )
721#endif
722             ENDIF
723
724          ENDIF
725
726          IF ( .NOT. netcdf_extend )  THEN
727!
728!--          Create a new netCDF output file with requested netCDF format
729             CALL netcdf_create_file( filename, id_set_xz(av), .TRUE., 25 )
730
731!
732!--          Define the header
733             CALL netcdf_define_header( 'xz', netcdf_extend, av )
734
735!
736!--          In case of parallel netCDF output, create flag file which tells
737!--          combine_plot_fields that nothing is to do.
738             IF ( myid == 0  .AND.  netcdf_data_format > 4 )  THEN
739                OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_XZ' )
740                WRITE ( 99, '(A)' )  'no combine_plot_fields.x neccessary'
741                CLOSE( 99 )
742             ENDIF
743
744          ENDIF
745
746       CASE ( 103, 113 )
747!
748!--       Set filename depending on unit number
749          IF ( file_id == 103 )  THEN
750             filename = 'DATA_2D_YZ_NETCDF' // TRIM( coupling_char )
751             av = 0
752          ELSE
753             filename = 'DATA_2D_YZ_AV_NETCDF' // TRIM( coupling_char )
754             av = 1
755          ENDIF
756!
757!--       Inquire, if there is a netCDF file from a previuos run. This should
758!--       be opened for extension, if its dimensions and variables match the
759!--       actual run.
760          INQUIRE( FILE=filename, EXIST=netcdf_extend )
761
762          IF ( netcdf_extend )  THEN
763!
764!--          Open an existing netCDF file for output
765             CALL netcdf_open_write_file( filename, id_set_yz(av), .TRUE., 26 )
766!
767!--          Read header information and set all ids. If there is a mismatch
768!--          between the previuos and the actual run, netcdf_extend is returned
769!--          as .FALSE.
770             CALL netcdf_define_header( 'yz', netcdf_extend, av )
771
772!
773!--          Remove the local file, if it can not be extended
774             IF ( .NOT. netcdf_extend )  THEN
775                nc_stat = NF90_CLOSE( id_set_yz(av) )
776                CALL netcdf_handle_error( 'check_open', 27 )
777                IF ( myid == 0 )  CALL local_system( 'rm ' // TRIM( filename ) )
778#if defined( __parallel )
779!
780!--             Set a barrier in order to assure that PE0 deleted the old file
781!--             before any other processor tries to open a new file
782!--             Barrier is only needed in case of parallel I/O
783                IF ( netcdf_data_format > 4 )  CALL MPI_BARRIER( comm2d, ierr )
784#endif
785             ENDIF
786
787          ENDIF
788
789          IF ( .NOT. netcdf_extend )  THEN
790!
791!--          Create a new netCDF output file with requested netCDF format
792             CALL netcdf_create_file( filename, id_set_yz(av), .TRUE., 28 )
793
794!
795!--          Define the header
796             CALL netcdf_define_header( 'yz', netcdf_extend, av )
797
798!
799!--          In case of parallel netCDF output, create flag file which tells
800!--          combine_plot_fields that nothing is to do.
801             IF ( myid == 0  .AND.  netcdf_data_format > 4 )  THEN
802                OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_YZ' )
803                WRITE ( 99, '(A)' )  'no combine_plot_fields.x neccessary'
804                CLOSE( 99 )
805             ENDIF
806
807          ENDIF
808
809       CASE ( 104 )
810!
811!--       Set filename
812          filename = 'DATA_1D_PR_NETCDF' // TRIM( coupling_char )
813
814!
815!--       Inquire, if there is a netCDF file from a previuos run. This should
816!--       be opened for extension, if its variables match the actual run.
817          INQUIRE( FILE=filename, EXIST=netcdf_extend )
818
819          IF ( netcdf_extend )  THEN
820!
821!--          Open an existing netCDF file for output
822             CALL netcdf_open_write_file( filename, id_set_pr, .FALSE., 29 )
823!
824!--          Read header information and set all ids. If there is a mismatch
825!--          between the previuos and the actual run, netcdf_extend is returned
826!--          as .FALSE.
827             CALL netcdf_define_header( 'pr', netcdf_extend, 0 )
828
829!
830!--          Remove the local file, if it can not be extended
831             IF ( .NOT. netcdf_extend )  THEN
832                nc_stat = NF90_CLOSE( id_set_pr )
833                CALL netcdf_handle_error( 'check_open', 30 )
834                CALL local_system( 'rm ' // TRIM( filename ) )
835             ENDIF
836
837          ENDIF         
838
839          IF ( .NOT. netcdf_extend )  THEN
840!
841!--          Create a new netCDF output file with requested netCDF format
842             CALL netcdf_create_file( filename, id_set_pr, .FALSE., 31 )
843!
844!--          Define the header
845             CALL netcdf_define_header( 'pr', netcdf_extend, 0 )
846
847          ENDIF
848
849       CASE ( 105 )
850!
851!--       Set filename
852          filename = 'DATA_1D_TS_NETCDF' // TRIM( coupling_char )
853
854!
855!--       Inquire, if there is a netCDF file from a previuos run. This should
856!--       be opened for extension, if its variables match the actual run.
857          INQUIRE( FILE=filename, EXIST=netcdf_extend )
858
859          IF ( netcdf_extend )  THEN
860!
861!--          Open an existing netCDF file for output
862             CALL netcdf_open_write_file( filename, id_set_ts, .FALSE., 32 )
863!
864!--          Read header information and set all ids. If there is a mismatch
865!--          between the previuos and the actual run, netcdf_extend is returned
866!--          as .FALSE.
867             CALL netcdf_define_header( 'ts', netcdf_extend, 0 )
868
869!
870!--          Remove the local file, if it can not be extended
871             IF ( .NOT. netcdf_extend )  THEN
872                nc_stat = NF90_CLOSE( id_set_ts )
873                CALL netcdf_handle_error( 'check_open', 33 )
874                CALL local_system( 'rm ' // TRIM( filename ) )
875             ENDIF
876
877          ENDIF         
878
879          IF ( .NOT. netcdf_extend )  THEN
880!
881!--          Create a new netCDF output file with requested netCDF format
882             CALL netcdf_create_file( filename, id_set_ts, .FALSE., 34 )
883!
884!--          Define the header
885             CALL netcdf_define_header( 'ts', netcdf_extend, 0 )
886
887          ENDIF
888
889
890       CASE ( 106, 116 )
891!
892!--       Set filename depending on unit number
893          IF ( file_id == 106 )  THEN
894             filename = 'DATA_3D_NETCDF' // TRIM( coupling_char )
895             av = 0
896          ELSE
897             filename = 'DATA_3D_AV_NETCDF' // TRIM( coupling_char )
898             av = 1
899          ENDIF
900!
901!--       Inquire, if there is a netCDF file from a previous run. This should
902!--       be opened for extension, if its dimensions and variables match the
903!--       actual run.
904          INQUIRE( FILE=filename, EXIST=netcdf_extend )
905
906          IF ( netcdf_extend )  THEN
907!
908!--          Open an existing netCDF file for output
909             CALL netcdf_open_write_file( filename, id_set_3d(av), .TRUE., 35 )
910!
911!--          Read header information and set all ids. If there is a mismatch
912!--          between the previuos and the actual run, netcdf_extend is returned
913!--          as .FALSE.
914             CALL netcdf_define_header( '3d', netcdf_extend, av )
915
916!
917!--          Remove the local file, if it can not be extended
918             IF ( .NOT. netcdf_extend )  THEN
919                nc_stat = NF90_CLOSE( id_set_3d(av) )
920                CALL netcdf_handle_error( 'check_open', 36 )
921                IF ( myid == 0 )  CALL local_system( 'rm ' // TRIM( filename ) )
922#if defined( __parallel )
923!
924!--             Set a barrier in order to assure that PE0 deleted the old file
925!--             before any other processor tries to open a new file
926!--             Barrier is only needed in case of parallel I/O
927                IF ( netcdf_data_format > 4 )  CALL MPI_BARRIER( comm2d, ierr )
928#endif
929             ENDIF
930
931          ENDIF
932
933          IF ( .NOT. netcdf_extend )  THEN
934!
935!--          Create a new netCDF output file with requested netCDF format
936             CALL netcdf_create_file( filename, id_set_3d(av), .TRUE., 37 )
937
938!
939!--          Define the header
940             CALL netcdf_define_header( '3d', netcdf_extend, av )
941
942!
943!--          In case of parallel netCDF output, create flag file which tells
944!--          combine_plot_fields that nothing is to do.
945             IF ( myid == 0  .AND.  netcdf_data_format > 4 )  THEN
946                OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_3D' )
947                WRITE ( 99, '(A)' )  'no combine_plot_fields.x neccessary'
948                CLOSE( 99 )
949             ENDIF
950
951          ENDIF
952
953
954       CASE ( 107 )
955!
956!--       Set filename
957          filename = 'DATA_1D_SP_NETCDF' // TRIM( coupling_char )
958
959!
960!--       Inquire, if there is a netCDF file from a previuos run. This should
961!--       be opened for extension, if its variables match the actual run.
962          INQUIRE( FILE=filename, EXIST=netcdf_extend )
963
964          IF ( netcdf_extend )  THEN
965!
966!--          Open an existing netCDF file for output
967             CALL netcdf_open_write_file( filename, id_set_sp, .FALSE., 38 )
968
969!
970!--          Read header information and set all ids. If there is a mismatch
971!--          between the previuos and the actual run, netcdf_extend is returned
972!--          as .FALSE.
973             CALL netcdf_define_header( 'sp', netcdf_extend, 0 )
974
975!
976!--          Remove the local file, if it can not be extended
977             IF ( .NOT. netcdf_extend )  THEN
978                nc_stat = NF90_CLOSE( id_set_sp )
979                CALL netcdf_handle_error( 'check_open', 39 )
980                CALL local_system( 'rm ' // TRIM( filename ) )
981             ENDIF
982
983          ENDIF         
984
985          IF ( .NOT. netcdf_extend )  THEN
986!
987!--          Create a new netCDF output file with requested netCDF format
988             CALL netcdf_create_file( filename, id_set_sp, .FALSE., 40 )
989!
990!--          Define the header
991             CALL netcdf_define_header( 'sp', netcdf_extend, 0 )
992
993          ENDIF
994
995
996       CASE ( 108 )
997
998          IF ( myid_char == '' )  THEN
999             filename = 'DATA_PRT_NETCDF' // TRIM( coupling_char )
1000          ELSE
1001             filename = 'DATA_PRT_NETCDF' // TRIM( coupling_char ) // '/' //   &
1002                        myid_char
1003          ENDIF
1004!
1005!--       Inquire, if there is a netCDF file from a previuos run. This should
1006!--       be opened for extension, if its variables match the actual run.
1007          INQUIRE( FILE=filename, EXIST=netcdf_extend )
1008
1009          IF ( netcdf_extend )  THEN
1010!
1011!--          Open an existing netCDF file for output
1012             CALL netcdf_open_write_file( filename, id_set_prt, .FALSE., 41 )
1013!
1014!--          Read header information and set all ids. If there is a mismatch
1015!--          between the previuos and the actual run, netcdf_extend is returned
1016!--          as .FALSE.
1017             CALL netcdf_define_header( 'pt', netcdf_extend, 0 )
1018
1019!
1020!--          Remove the local file, if it can not be extended
1021             IF ( .NOT. netcdf_extend )  THEN
1022                nc_stat = NF90_CLOSE( id_set_prt )
1023                CALL netcdf_handle_error( 'check_open', 42 )
1024                CALL local_system( 'rm ' // TRIM( filename ) )
1025             ENDIF
1026
1027          ENDIF         
1028
1029          IF ( .NOT. netcdf_extend )  THEN
1030
1031!
1032!--          For runs on multiple processors create the subdirectory
1033             IF ( myid_char /= '' )  THEN
1034                IF ( myid == 0  .AND. .NOT. openfile(file_id)%opened_before )  &
1035                THEN    ! needs modification in case of non-extendable sets
1036                   CALL local_system( 'mkdir  DATA_PRT_NETCDF' //              &
1037                                       TRIM( coupling_char ) // '/' )
1038                ENDIF
1039#if defined( __parallel )
1040!
1041!--             Set a barrier in order to allow that all other processors in the
1042!--             directory created by PE0 can open their file
1043                CALL MPI_BARRIER( comm2d, ierr )
1044#endif
1045             ENDIF
1046
1047!
1048!--          Create a new netCDF output file with requested netCDF format
1049             CALL netcdf_create_file( filename, id_set_prt, .FALSE., 43 )
1050
1051!
1052!--          Define the header
1053             CALL netcdf_define_header( 'pt', netcdf_extend, 0 )
1054
1055          ENDIF
1056
1057       CASE ( 109 )
1058!
1059!--       Set filename
1060          filename = 'DATA_1D_PTS_NETCDF' // TRIM( coupling_char )
1061
1062!
1063!--       Inquire, if there is a netCDF file from a previuos run. This should
1064!--       be opened for extension, if its variables match the actual run.
1065          INQUIRE( FILE=filename, EXIST=netcdf_extend )
1066
1067          IF ( netcdf_extend )  THEN
1068!
1069!--          Open an existing netCDF file for output
1070             CALL netcdf_open_write_file( filename, id_set_pts, .FALSE., 393 )
1071!
1072!--          Read header information and set all ids. If there is a mismatch
1073!--          between the previuos and the actual run, netcdf_extend is returned
1074!--          as .FALSE.
1075             CALL netcdf_define_header( 'ps', netcdf_extend, 0 )
1076
1077!
1078!--          Remove the local file, if it can not be extended
1079             IF ( .NOT. netcdf_extend )  THEN
1080                nc_stat = NF90_CLOSE( id_set_pts )
1081                CALL netcdf_handle_error( 'check_open', 394 )
1082                CALL local_system( 'rm ' // TRIM( filename ) )
1083             ENDIF
1084
1085          ENDIF         
1086
1087          IF ( .NOT. netcdf_extend )  THEN
1088!
1089!--          Create a new netCDF output file with requested netCDF format
1090             CALL netcdf_create_file( filename, id_set_pts, .FALSE., 395 )
1091!
1092!--          Define the header
1093             CALL netcdf_define_header( 'ps', netcdf_extend, 0 )
1094
1095          ENDIF
1096
1097
1098!
1099!--    Progress file that is used by the PALM watchdog
1100       CASE ( 117 )
1101
1102          OPEN ( 117, FILE='PROGRESS'//TRIM( coupling_char ),                  &
1103                      STATUS='REPLACE', FORM='FORMATTED' )
1104!
1105!--    nc-file for virtual flight measurements
1106       CASE ( 199 )
1107!
1108!--       Set filename
1109          filename = 'DATA_1D_FL_NETCDF' // TRIM( coupling_char )
1110
1111!
1112!--       Inquire, if there is a netCDF file from a previuos run. This should
1113!--       be opened for extension, if its variables match the actual run.
1114          INQUIRE( FILE=filename, EXIST=netcdf_extend )
1115
1116          IF ( netcdf_extend )  THEN
1117!
1118!--          Open an existing netCDF file for output
1119             CALL netcdf_open_write_file( filename, id_set_fl, .FALSE., 532 )
1120!
1121!--          Read header information and set all ids. If there is a mismatch
1122!--          between the previuos and the actual run, netcdf_extend is returned
1123!--          as .FALSE.
1124             CALL netcdf_define_header( 'fl', netcdf_extend, 0 )
1125
1126!
1127!--          Remove the local file, if it can not be extended
1128             IF ( .NOT. netcdf_extend )  THEN
1129                nc_stat = NF90_CLOSE( id_set_fl )
1130                CALL netcdf_handle_error( 'check_open', 533 )
1131                CALL local_system( 'rm ' // TRIM( filename ) )
1132             ENDIF
1133
1134          ENDIF         
1135
1136          IF ( .NOT. netcdf_extend )  THEN
1137!
1138!--          Create a new netCDF output file with requested netCDF format
1139             CALL netcdf_create_file( filename, id_set_fl, .FALSE., 534 )
1140!
1141!--          Define the header
1142             CALL netcdf_define_header( 'fl', netcdf_extend, 0 )
1143
1144          ENDIF
1145
1146
1147       CASE ( 201:200+2*max_masks )
1148!
1149!--       Set filename depending on unit number
1150          IF ( file_id <= 200+max_masks )  THEN
1151             mid = file_id - 200
1152             WRITE ( mask_char,'(I2.2)')  mid
1153             filename = 'DATA_MASK_' // mask_char // '_NETCDF' //              &
1154                        TRIM( coupling_char )
1155             av = 0
1156          ELSE
1157             mid = file_id - (200+max_masks)
1158             WRITE ( mask_char,'(I2.2)')  mid
1159             filename = 'DATA_MASK_' // mask_char // '_AV_NETCDF' //           &
1160                        TRIM( coupling_char )
1161             av = 1
1162          ENDIF
1163!
1164!--       Inquire, if there is a netCDF file from a previuos run. This should
1165!--       be opened for extension, if its dimensions and variables match the
1166!--       actual run.
1167          INQUIRE( FILE=filename, EXIST=netcdf_extend )
1168
1169          IF ( netcdf_extend )  THEN
1170!
1171!--          Open an existing netCDF file for output
1172             CALL netcdf_open_write_file( filename, id_set_mask(mid,av),       &
1173                                          .TRUE., 456 )
1174!
1175!--          Read header information and set all ids. If there is a mismatch
1176!--          between the previuos and the actual run, netcdf_extend is returned
1177!--          as .FALSE.
1178             CALL netcdf_define_header( 'ma', netcdf_extend, file_id )
1179
1180!
1181!--          Remove the local file, if it can not be extended
1182             IF ( .NOT. netcdf_extend )  THEN
1183                nc_stat = NF90_CLOSE( id_set_mask(mid,av) )
1184                CALL netcdf_handle_error( 'check_open', 457 )
1185                CALL local_system('rm ' // TRIM( filename ) )
1186             ENDIF
1187
1188          ENDIF         
1189
1190          IF ( .NOT. netcdf_extend )  THEN
1191!
1192!--          Create a new netCDF output file with requested netCDF format
1193             CALL netcdf_create_file( filename, id_set_mask(mid,av), .TRUE., 458 )
1194!
1195!--          Define the header
1196             CALL netcdf_define_header( 'ma', netcdf_extend, file_id )
1197
1198          ENDIF
1199
1200
1201#else
1202
1203       CASE ( 101:109, 111:113, 116, 201:200+2*max_masks )
1204
1205!
1206!--       Nothing is done in case of missing netcdf support
1207          RETURN
1208
1209#endif
1210
1211       CASE DEFAULT
1212
1213          WRITE( message_string, * ) 'no OPEN-statement for file-id ',file_id
1214          CALL message( 'check_open', 'PA0172', 2, 2, -1, 6, 1 )
1215
1216    END SELECT
1217
1218!
1219!-- Set open flag
1220    openfile(file_id)%opened = .TRUE.
1221
1222!
1223!-- Formats
12243300 FORMAT ('#'/                                                              &
1225             'coord 1  file=',A,'  filetype=unformatted'/                      &
1226             'coord 2  file=',A,'  filetype=unformatted  skip=',I6/            &
1227             'coord 3  file=',A,'  filetype=unformatted  skip=',I6/            &
1228             '#')
12294000 FORMAT ('# ',A)
12305000 FORMAT ('# ',A/                                                           &
1231             '#1 E'/'#2 E*'/'#3 dt'/'#4 u*'/'#5 th*'/'#6 umax'/'#7 vmax'/      &
1232             '#8 wmax'/'#9 div_new'/'#10 div_old'/'#11 z_i_wpt'/'#12 z_i_pt'/  &
1233             '#13 w*'/'#14 w''pt''0'/'#15 w''pt'''/'#16 wpt'/'#17 pt(0)'/      &
1234             '#18 pt(zp)'/'#19 splptx'/'#20 splpty'/'#21 splptz')
12358000 FORMAT (A/                                                                &
1236             '  step    time    # of parts     lPE sent/recv  rPE sent/recv  ',&
1237             'sPE sent/recv  nPE sent/recv    max # of parts  '/               &
1238             109('-'))
1239
1240 END SUBROUTINE check_open
Note: See TracBrowser for help on using the repository browser.