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

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

Bugfix for removing non-extendable files in case of non-parallel I/O

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