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

Last change on this file since 2298 was 2298, checked in by raasch, 7 years ago

write_binary is of type LOGICAL now, MPI2-related code removed, obsolete variables removed, sendrecv_in_background related parts removed, missing variable descriptions added

  • Property svn:keywords set to Id
File size: 44.1 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-2017 Leibniz Universitaet Hannover
18!------------------------------------------------------------------------------!
19!
20! Current revisions:
21! -----------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: check_open.f90 2298 2017-06-29 09:28:18Z raasch $
27! -return_addres, return_username, avs_coor_file_..., avs_data_file_...,
28! cross_ts_numbers, cross_ts_number_count
29!
30! 2101 2017-01-05 16:42:31Z suehring
31!
32! 2063 2016-11-10 17:14:35Z raasch
33! bugfix: opening of PROGRESS file moved out of the NetCDF block
34!
35! 2040 2016-10-26 16:58:09Z gronemeier
36! Removed open of file 'PLOTTS_DATA' ( CASE(50:59) ) as it is no longer needed
37!
38! 2000 2016-08-20 18:09:15Z knoop
39! Forced header and separation lines into 80 columns
40!
41! 1988 2016-08-10 14:49:06Z gronemeier
42! informative message added if files cannot be opened in newly created directory
43!
44! 1986 2016-08-10 14:07:17Z gronemeier
45! Bugfix: check if output can be opened in newly created directory. If not
46! wait one second and try again.
47!
48! 1974 2016-07-26 08:43:25Z gronemeier
49! Bugfix: MPI barriers after deleting non-extendable files must only be called
50! in case of parallel I/O
51!
52! 1957 2016-07-07 10:43:48Z suehring
53! flight module added
54!
55! 1804 2016-04-05 16:30:18Z maronga
56! Removed code for parameter file check (__check)
57!
58! 1783 2016-03-06 18:36:17Z raasch
59! name change of netcdf routines and module + related changes
60!
61! 1779 2016-03-03 08:01:28Z raasch
62! coupling_char is trimmed at every place it occurs, because it can have
63! different length now
64!
65! 1745 2016-02-05 13:06:51Z gronemeier
66! Bugfix: added MPI barrier after deleting existing non-extendable file by PE0
67!
68! 1682 2015-10-07 23:56:08Z knoop
69! Code annotations made doxygen readable
70!
71! 1551 2015-03-03 14:18:16Z maronga
72! Removed redundant output for combine_plot_fields
73!
74! 1468 2014-09-24 14:06:57Z maronga
75! Adapted for use on up to 6-digit processor cores
76! Added file unit 117 (PROGRESS)
77!
78! 1359 2014-04-11 17:15:14Z hoffmann
79! Format of particle exchange statistics extended to reasonable numbers of     
80! particles.
81!
82! 1353 2014-04-08 15:21:23Z heinze
83! REAL constants provided with KIND-attribute,
84! declaration for unused variables xkoor, ykoor, zkoor removed
85!
86! 1327 2014-03-21 11:00:16Z raasch
87! parts concerning iso2d and avs output removed
88!
89! 1320 2014-03-20 08:40:49Z raasch
90! ONLY-attribute added to USE-statements,
91! kind-parameters added to all INTEGER and REAL declaration statements,
92! kinds are defined in new module kinds,
93! old module precision_kind is removed,
94! revision history before 2012 removed,
95! comment fields (!:) to be used for variable explanations added to
96! all variable declaration statements
97!
98! 1106 2013-03-04 05:31:38Z raasch
99! array_kind renamed precision_kind
100!
101! 1092 2013-02-02 11:24:22Z raasch
102! unused variables removed
103!
104! 1036 2012-10-22 13:43:42Z raasch
105! code put under GPL (PALM 3.9)
106!
107! 1031 2012-10-19 14:35:30Z raasch
108! netCDF4 without parallel file support implemented,
109! opening of netCDF files are done by new routines create_netcdf_file and
110! open_write_netcdf_file
111!
112! 964 2012-07-26 09:14:24Z raasch
113! old profil-units (40:49) removed,
114! append feature removed from unit 14
115!
116! 849 2012-03-15 10:35:09Z raasch
117! comment changed
118!
119! 809 2012-01-30 13:32:58Z maronga
120! Bugfix: replaced .AND. and .NOT. with && and ! in the preprocessor directives
121!
122! 807 2012-01-25 11:53:51Z maronga
123! New cpp directive "__check" implemented which is used by check_namelist_files
124!
125! Revision 1.1  1997/08/11 06:10:55  raasch
126! Initial revision
127!
128!
129! Description:
130! ------------
131!> Check if file unit is open. If not, open file and, if necessary, write a
132!> header or start other initializing actions, respectively.
133!------------------------------------------------------------------------------!
134SUBROUTINE check_open( file_id )
135 
136
137    USE arrays_3d,                                                             &
138        ONLY:  zu
139
140    USE control_parameters,                                                    &
141        ONLY:  coupling_char, data_output_2d_on_each_pe, host, max_masks,      &
142               message_string, mid, nz_do3d, openfile, run_description_header, &
143               runnr
144
145    USE grid_variables,                                                        &
146        ONLY:  dx, dy
147
148    USE indices,                                                               &
149        ONLY:  nbgp, nx, nxl, nxr, ny, nyn, nyng, nys, nysg, nz, nzb, nzt 
150
151    USE kinds
152
153#if defined( __netcdf )
154    USE NETCDF
155#endif
156
157    USE netcdf_interface,                                                      &
158        ONLY:  id_set_fl, id_set_mask, id_set_pr, id_set_prt, id_set_pts,      &
159               id_set_sp, id_set_ts, id_set_xy, id_set_xz, id_set_yz,          &
160               id_set_3d, nc_stat, netcdf_create_file, netcdf_data_format,     &
161               netcdf_define_header, netcdf_handle_error, netcdf_open_write_file
162
163    USE particle_attributes,                                                   &
164        ONLY:  max_number_of_particle_groups, number_of_particle_groups,       &
165               particle_groups
166
167    USE pegrid
168
169    USE posix_calls_from_fortran,                                              &
170        ONLY:  fortran_sleep
171
172
173    IMPLICIT NONE
174
175    CHARACTER (LEN=2)   ::  mask_char               !<
176    CHARACTER (LEN=2)   ::  suffix                  !<
177    CHARACTER (LEN=20)  ::  xtext = 'time in s'     !<
178    CHARACTER (LEN=30)  ::  filename                !<
179    CHARACTER (LEN=80)  ::  rtext                   !<
180    CHARACTER (LEN=100) ::  batch_scp               !<
181    CHARACTER (LEN=100) ::  line                    !<
182    CHARACTER (LEN=400) ::  command                 !<
183
184    INTEGER(iwp) ::  av          !<
185    INTEGER(iwp) ::  numline = 1 !<
186    INTEGER(iwp) ::  cranz       !<
187    INTEGER(iwp) ::  file_id     !<
188    INTEGER(iwp) ::  i           !<
189    INTEGER(iwp) ::  iaddres     !<
190    INTEGER(iwp) ::  ioerr       !< IOSTAT flag for IO-commands ( 0 = no error )
191    INTEGER(iwp) ::  iusern      !<
192    INTEGER(iwp) ::  j           !<
193    INTEGER(iwp) ::  k           !<
194    INTEGER(iwp) ::  legpos = 1  !<
195    INTEGER(iwp) ::  timodex = 1 !<
196   
197    INTEGER(iwp), DIMENSION(10) ::  klist !<
198
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!
621!--    Progress file that is used by the PALM watchdog
622       CASE ( 117 )
623
624          OPEN ( 117, FILE='PROGRESS'//TRIM( coupling_char ),                  &
625                      STATUS='REPLACE', FORM='FORMATTED' )
626
627#if defined( __netcdf )
628       CASE ( 101, 111 )
629!
630!--       Set filename depending on unit number
631          IF ( file_id == 101 )  THEN
632             filename = 'DATA_2D_XY_NETCDF' // TRIM( coupling_char )
633             av = 0
634          ELSE
635             filename = 'DATA_2D_XY_AV_NETCDF' // TRIM( coupling_char )
636             av = 1
637          ENDIF
638!
639!--       Inquire, if there is a netCDF file from a previuos run. This should
640!--       be opened for extension, if its dimensions and variables match the
641!--       actual run.
642          INQUIRE( FILE=filename, EXIST=netcdf_extend )
643          IF ( netcdf_extend )  THEN
644!
645!--          Open an existing netCDF file for output
646             CALL netcdf_open_write_file( filename, id_set_xy(av), .TRUE., 20 )
647!
648!--          Read header information and set all ids. If there is a mismatch
649!--          between the previuos and the actual run, netcdf_extend is returned
650!--          as .FALSE.
651             CALL netcdf_define_header( 'xy', netcdf_extend, av )
652
653!
654!--          Remove the local file, if it can not be extended
655             IF ( .NOT. netcdf_extend )  THEN
656                nc_stat = NF90_CLOSE( id_set_xy(av) )
657                CALL netcdf_handle_error( 'check_open', 21 )
658                IF ( myid == 0 )  CALL local_system( 'rm ' // TRIM( filename ) )
659#if defined( __parallel )
660!
661!--             Set a barrier in order to assure that PE0 deleted the old file
662!--             before any other processor tries to open a new file.
663!--             Barrier is only needed in case of parallel I/O
664                IF ( netcdf_data_format > 4 )  CALL MPI_BARRIER( comm2d, ierr )
665#endif
666             ENDIF
667
668          ENDIF
669
670          IF ( .NOT. netcdf_extend )  THEN
671!
672!--          Create a new netCDF output file with requested netCDF format
673             CALL netcdf_create_file( filename, id_set_xy(av), .TRUE., 22 )
674
675!
676!--          Define the header
677             CALL netcdf_define_header( 'xy', netcdf_extend, av )
678
679!
680!--          In case of parallel netCDF output, create flag file which tells
681!--          combine_plot_fields that nothing is to do.
682             IF ( myid == 0  .AND.  netcdf_data_format > 4 )  THEN
683                OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_XY' )
684                WRITE ( 99, '(A)' )  'no combine_plot_fields.x neccessary'
685                CLOSE( 99 )
686             ENDIF
687
688          ENDIF
689
690       CASE ( 102, 112 )
691!
692!--       Set filename depending on unit number
693          IF ( file_id == 102 )  THEN
694             filename = 'DATA_2D_XZ_NETCDF' // TRIM( coupling_char )
695             av = 0
696          ELSE
697             filename = 'DATA_2D_XZ_AV_NETCDF' // TRIM( coupling_char )
698             av = 1
699          ENDIF
700!
701!--       Inquire, if there is a netCDF file from a previuos run. This should
702!--       be opened for extension, if its dimensions and variables match the
703!--       actual run.
704          INQUIRE( FILE=filename, EXIST=netcdf_extend )
705
706          IF ( netcdf_extend )  THEN
707!
708!--          Open an existing netCDF file for output
709             CALL netcdf_open_write_file( filename, id_set_xz(av), .TRUE., 23 )
710!
711!--          Read header information and set all ids. If there is a mismatch
712!--          between the previuos and the actual run, netcdf_extend is returned
713!--          as .FALSE.
714             CALL netcdf_define_header( 'xz', netcdf_extend, av )
715
716!
717!--          Remove the local file, if it can not be extended
718             IF ( .NOT. netcdf_extend )  THEN
719                nc_stat = NF90_CLOSE( id_set_xz(av) )
720                CALL netcdf_handle_error( 'check_open', 24 )
721                IF ( myid == 0 )  CALL local_system( 'rm ' // TRIM( filename ) )
722#if defined( __parallel )
723!
724!--             Set a barrier in order to assure that PE0 deleted the old file
725!--             before any other processor tries to open a new file
726!--             Barrier is only needed in case of parallel I/O
727                IF ( netcdf_data_format > 4 )  CALL MPI_BARRIER( comm2d, ierr )
728#endif
729             ENDIF
730
731          ENDIF
732
733          IF ( .NOT. netcdf_extend )  THEN
734!
735!--          Create a new netCDF output file with requested netCDF format
736             CALL netcdf_create_file( filename, id_set_xz(av), .TRUE., 25 )
737
738!
739!--          Define the header
740             CALL netcdf_define_header( 'xz', netcdf_extend, av )
741
742!
743!--          In case of parallel netCDF output, create flag file which tells
744!--          combine_plot_fields that nothing is to do.
745             IF ( myid == 0  .AND.  netcdf_data_format > 4 )  THEN
746                OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_XZ' )
747                WRITE ( 99, '(A)' )  'no combine_plot_fields.x neccessary'
748                CLOSE( 99 )
749             ENDIF
750
751          ENDIF
752
753       CASE ( 103, 113 )
754!
755!--       Set filename depending on unit number
756          IF ( file_id == 103 )  THEN
757             filename = 'DATA_2D_YZ_NETCDF' // TRIM( coupling_char )
758             av = 0
759          ELSE
760             filename = 'DATA_2D_YZ_AV_NETCDF' // TRIM( coupling_char )
761             av = 1
762          ENDIF
763!
764!--       Inquire, if there is a netCDF file from a previuos run. This should
765!--       be opened for extension, if its dimensions and variables match the
766!--       actual run.
767          INQUIRE( FILE=filename, EXIST=netcdf_extend )
768
769          IF ( netcdf_extend )  THEN
770!
771!--          Open an existing netCDF file for output
772             CALL netcdf_open_write_file( filename, id_set_yz(av), .TRUE., 26 )
773!
774!--          Read header information and set all ids. If there is a mismatch
775!--          between the previuos and the actual run, netcdf_extend is returned
776!--          as .FALSE.
777             CALL netcdf_define_header( 'yz', netcdf_extend, av )
778
779!
780!--          Remove the local file, if it can not be extended
781             IF ( .NOT. netcdf_extend )  THEN
782                nc_stat = NF90_CLOSE( id_set_yz(av) )
783                CALL netcdf_handle_error( 'check_open', 27 )
784                IF ( myid == 0 )  CALL local_system( 'rm ' // TRIM( filename ) )
785#if defined( __parallel )
786!
787!--             Set a barrier in order to assure that PE0 deleted the old file
788!--             before any other processor tries to open a new file
789!--             Barrier is only needed in case of parallel I/O
790                IF ( netcdf_data_format > 4 )  CALL MPI_BARRIER( comm2d, ierr )
791#endif
792             ENDIF
793
794          ENDIF
795
796          IF ( .NOT. netcdf_extend )  THEN
797!
798!--          Create a new netCDF output file with requested netCDF format
799             CALL netcdf_create_file( filename, id_set_yz(av), .TRUE., 28 )
800
801!
802!--          Define the header
803             CALL netcdf_define_header( 'yz', netcdf_extend, av )
804
805!
806!--          In case of parallel netCDF output, create flag file which tells
807!--          combine_plot_fields that nothing is to do.
808             IF ( myid == 0  .AND.  netcdf_data_format > 4 )  THEN
809                OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_YZ' )
810                WRITE ( 99, '(A)' )  'no combine_plot_fields.x neccessary'
811                CLOSE( 99 )
812             ENDIF
813
814          ENDIF
815
816       CASE ( 104 )
817!
818!--       Set filename
819          filename = 'DATA_1D_PR_NETCDF' // TRIM( coupling_char )
820
821!
822!--       Inquire, if there is a netCDF file from a previuos run. This should
823!--       be opened for extension, if its variables match the actual run.
824          INQUIRE( FILE=filename, EXIST=netcdf_extend )
825
826          IF ( netcdf_extend )  THEN
827!
828!--          Open an existing netCDF file for output
829             CALL netcdf_open_write_file( filename, id_set_pr, .FALSE., 29 )
830!
831!--          Read header information and set all ids. If there is a mismatch
832!--          between the previuos and the actual run, netcdf_extend is returned
833!--          as .FALSE.
834             CALL netcdf_define_header( 'pr', netcdf_extend, 0 )
835
836!
837!--          Remove the local file, if it can not be extended
838             IF ( .NOT. netcdf_extend )  THEN
839                nc_stat = NF90_CLOSE( id_set_pr )
840                CALL netcdf_handle_error( 'check_open', 30 )
841                CALL local_system( 'rm ' // TRIM( filename ) )
842             ENDIF
843
844          ENDIF         
845
846          IF ( .NOT. netcdf_extend )  THEN
847!
848!--          Create a new netCDF output file with requested netCDF format
849             CALL netcdf_create_file( filename, id_set_pr, .FALSE., 31 )
850!
851!--          Define the header
852             CALL netcdf_define_header( 'pr', netcdf_extend, 0 )
853
854          ENDIF
855
856       CASE ( 105 )
857!
858!--       Set filename
859          filename = 'DATA_1D_TS_NETCDF' // TRIM( coupling_char )
860
861!
862!--       Inquire, if there is a netCDF file from a previuos run. This should
863!--       be opened for extension, if its variables match the actual run.
864          INQUIRE( FILE=filename, EXIST=netcdf_extend )
865
866          IF ( netcdf_extend )  THEN
867!
868!--          Open an existing netCDF file for output
869             CALL netcdf_open_write_file( filename, id_set_ts, .FALSE., 32 )
870!
871!--          Read header information and set all ids. If there is a mismatch
872!--          between the previuos and the actual run, netcdf_extend is returned
873!--          as .FALSE.
874             CALL netcdf_define_header( 'ts', netcdf_extend, 0 )
875
876!
877!--          Remove the local file, if it can not be extended
878             IF ( .NOT. netcdf_extend )  THEN
879                nc_stat = NF90_CLOSE( id_set_ts )
880                CALL netcdf_handle_error( 'check_open', 33 )
881                CALL local_system( 'rm ' // TRIM( filename ) )
882             ENDIF
883
884          ENDIF         
885
886          IF ( .NOT. netcdf_extend )  THEN
887!
888!--          Create a new netCDF output file with requested netCDF format
889             CALL netcdf_create_file( filename, id_set_ts, .FALSE., 34 )
890!
891!--          Define the header
892             CALL netcdf_define_header( 'ts', netcdf_extend, 0 )
893
894          ENDIF
895
896
897       CASE ( 106, 116 )
898!
899!--       Set filename depending on unit number
900          IF ( file_id == 106 )  THEN
901             filename = 'DATA_3D_NETCDF' // TRIM( coupling_char )
902             av = 0
903          ELSE
904             filename = 'DATA_3D_AV_NETCDF' // TRIM( coupling_char )
905             av = 1
906          ENDIF
907!
908!--       Inquire, if there is a netCDF file from a previous run. This should
909!--       be opened for extension, if its dimensions and variables match the
910!--       actual run.
911          INQUIRE( FILE=filename, EXIST=netcdf_extend )
912
913          IF ( netcdf_extend )  THEN
914!
915!--          Open an existing netCDF file for output
916             CALL netcdf_open_write_file( filename, id_set_3d(av), .TRUE., 35 )
917!
918!--          Read header information and set all ids. If there is a mismatch
919!--          between the previuos and the actual run, netcdf_extend is returned
920!--          as .FALSE.
921             CALL netcdf_define_header( '3d', netcdf_extend, av )
922
923!
924!--          Remove the local file, if it can not be extended
925             IF ( .NOT. netcdf_extend )  THEN
926                nc_stat = NF90_CLOSE( id_set_3d(av) )
927                CALL netcdf_handle_error( 'check_open', 36 )
928                IF ( myid == 0 )  CALL local_system( 'rm ' // TRIM( filename ) )
929#if defined( __parallel )
930!
931!--             Set a barrier in order to assure that PE0 deleted the old file
932!--             before any other processor tries to open a new file
933!--             Barrier is only needed in case of parallel I/O
934                IF ( netcdf_data_format > 4 )  CALL MPI_BARRIER( comm2d, ierr )
935#endif
936             ENDIF
937
938          ENDIF
939
940          IF ( .NOT. netcdf_extend )  THEN
941!
942!--          Create a new netCDF output file with requested netCDF format
943             CALL netcdf_create_file( filename, id_set_3d(av), .TRUE., 37 )
944
945!
946!--          Define the header
947             CALL netcdf_define_header( '3d', netcdf_extend, av )
948
949!
950!--          In case of parallel netCDF output, create flag file which tells
951!--          combine_plot_fields that nothing is to do.
952             IF ( myid == 0  .AND.  netcdf_data_format > 4 )  THEN
953                OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_3D' )
954                WRITE ( 99, '(A)' )  'no combine_plot_fields.x neccessary'
955                CLOSE( 99 )
956             ENDIF
957
958          ENDIF
959
960
961       CASE ( 107 )
962!
963!--       Set filename
964          filename = 'DATA_1D_SP_NETCDF' // TRIM( coupling_char )
965
966!
967!--       Inquire, if there is a netCDF file from a previuos run. This should
968!--       be opened for extension, if its variables match the actual run.
969          INQUIRE( FILE=filename, EXIST=netcdf_extend )
970
971          IF ( netcdf_extend )  THEN
972!
973!--          Open an existing netCDF file for output
974             CALL netcdf_open_write_file( filename, id_set_sp, .FALSE., 38 )
975
976!
977!--          Read header information and set all ids. If there is a mismatch
978!--          between the previuos and the actual run, netcdf_extend is returned
979!--          as .FALSE.
980             CALL netcdf_define_header( 'sp', netcdf_extend, 0 )
981
982!
983!--          Remove the local file, if it can not be extended
984             IF ( .NOT. netcdf_extend )  THEN
985                nc_stat = NF90_CLOSE( id_set_sp )
986                CALL netcdf_handle_error( 'check_open', 39 )
987                CALL local_system( 'rm ' // TRIM( filename ) )
988             ENDIF
989
990          ENDIF         
991
992          IF ( .NOT. netcdf_extend )  THEN
993!
994!--          Create a new netCDF output file with requested netCDF format
995             CALL netcdf_create_file( filename, id_set_sp, .FALSE., 40 )
996!
997!--          Define the header
998             CALL netcdf_define_header( 'sp', netcdf_extend, 0 )
999
1000          ENDIF
1001
1002
1003       CASE ( 108 )
1004
1005          IF ( myid_char == '' )  THEN
1006             filename = 'DATA_PRT_NETCDF' // TRIM( coupling_char )
1007          ELSE
1008             filename = 'DATA_PRT_NETCDF' // TRIM( coupling_char ) // '/' //   &
1009                        myid_char
1010          ENDIF
1011!
1012!--       Inquire, if there is a netCDF file from a previuos run. This should
1013!--       be opened for extension, if its variables match the actual run.
1014          INQUIRE( FILE=filename, EXIST=netcdf_extend )
1015
1016          IF ( netcdf_extend )  THEN
1017!
1018!--          Open an existing netCDF file for output
1019             CALL netcdf_open_write_file( filename, id_set_prt, .FALSE., 41 )
1020!
1021!--          Read header information and set all ids. If there is a mismatch
1022!--          between the previuos and the actual run, netcdf_extend is returned
1023!--          as .FALSE.
1024             CALL netcdf_define_header( 'pt', netcdf_extend, 0 )
1025
1026!
1027!--          Remove the local file, if it can not be extended
1028             IF ( .NOT. netcdf_extend )  THEN
1029                nc_stat = NF90_CLOSE( id_set_prt )
1030                CALL netcdf_handle_error( 'check_open', 42 )
1031                CALL local_system( 'rm ' // TRIM( filename ) )
1032             ENDIF
1033
1034          ENDIF         
1035
1036          IF ( .NOT. netcdf_extend )  THEN
1037
1038!
1039!--          For runs on multiple processors create the subdirectory
1040             IF ( myid_char /= '' )  THEN
1041                IF ( myid == 0  .AND. .NOT. openfile(file_id)%opened_before )  &
1042                THEN    ! needs modification in case of non-extendable sets
1043                   CALL local_system( 'mkdir  DATA_PRT_NETCDF' //              &
1044                                       TRIM( coupling_char ) // '/' )
1045                ENDIF
1046#if defined( __parallel )
1047!
1048!--             Set a barrier in order to allow that all other processors in the
1049!--             directory created by PE0 can open their file
1050                CALL MPI_BARRIER( comm2d, ierr )
1051#endif
1052             ENDIF
1053
1054!
1055!--          Create a new netCDF output file with requested netCDF format
1056             CALL netcdf_create_file( filename, id_set_prt, .FALSE., 43 )
1057
1058!
1059!--          Define the header
1060             CALL netcdf_define_header( 'pt', netcdf_extend, 0 )
1061
1062          ENDIF
1063
1064       CASE ( 109 )
1065!
1066!--       Set filename
1067          filename = 'DATA_1D_PTS_NETCDF' // TRIM( coupling_char )
1068
1069!
1070!--       Inquire, if there is a netCDF file from a previuos run. This should
1071!--       be opened for extension, if its variables match the actual run.
1072          INQUIRE( FILE=filename, EXIST=netcdf_extend )
1073
1074          IF ( netcdf_extend )  THEN
1075!
1076!--          Open an existing netCDF file for output
1077             CALL netcdf_open_write_file( filename, id_set_pts, .FALSE., 393 )
1078!
1079!--          Read header information and set all ids. If there is a mismatch
1080!--          between the previuos and the actual run, netcdf_extend is returned
1081!--          as .FALSE.
1082             CALL netcdf_define_header( 'ps', netcdf_extend, 0 )
1083
1084!
1085!--          Remove the local file, if it can not be extended
1086             IF ( .NOT. netcdf_extend )  THEN
1087                nc_stat = NF90_CLOSE( id_set_pts )
1088                CALL netcdf_handle_error( 'check_open', 394 )
1089                CALL local_system( 'rm ' // TRIM( filename ) )
1090             ENDIF
1091
1092          ENDIF         
1093
1094          IF ( .NOT. netcdf_extend )  THEN
1095!
1096!--          Create a new netCDF output file with requested netCDF format
1097             CALL netcdf_create_file( filename, id_set_pts, .FALSE., 395 )
1098!
1099!--          Define the header
1100             CALL netcdf_define_header( 'ps', netcdf_extend, 0 )
1101
1102          ENDIF
1103
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.