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

Last change on this file since 1958 was 1958, checked in by suehring, 8 years ago

last commit documented

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