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

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

NEC related code partly removed, host variable partly removed, host specific code completely removed, default values for host, loop_optimization and termination time_needed changed

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