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

Last change on this file since 102 was 102, checked in by raasch, 17 years ago

preliminary version for coupled runs

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