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

Last change on this file since 1975 was 1975, checked in by gronemeier, 8 years ago

last commit documented

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