Changeset 493 for palm/trunk/UTIL


Ignore:
Timestamp:
Mar 1, 2010 8:30:24 AM (14 years ago)
Author:
raasch
Message:

New:
---
Output in NetCDF4-format. New d3par-parameter netcdf_data_format.

(check_open, check_parameters, close_file, data_output_2d, data_output_3d, header, modules, netcdf, parin)

Modules to be loaded for compilation (mbuild) or job execution (mrun)
can be given in the configuration file using variable modules. Example:

%modules ifort/11.0.069:netcdf lcsgih parallel

This method replaces the (undocumented) mpilib-variable.

WARNING: All fixed settings of modules in the scripts mbuild, mrun, and subjob
have been removed! Please set the modules variable appropriately in your
configuration file. (mbuild, mrun, subjob)

Changed:


Parameters netcdf_64bit and netcdf_64bit_3d have been removed. Use
netcdf_data_format = 2 for choosing the classic 64bit-offset format (this is
the default). The offset-format can not be set independently for the
3d-output-data any more.

Parameters netcdf_format_mask, netcdf_format_mask_av, and variables
nc_format_mask, format_parallel_io removed. They are replaced by the new
parameter netcdf_data_format. (check_open, close_file,
data_output_mask, header, init_masks, modules, parin)

Errors:


bugfix in trunk/UTIL/Makefile: forgot to compile for interpret_config

Bugfix: timeseries data have to be collected by PE0 (user_statistics)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/UTIL/combine_plot_fields.f90

    r226 r493  
    44! Actual revisions:
    55! -----------------
    6 !
     6! Exit in case of already complete NetCDF data (due to parallel output in PALM)
     7! cpu measurements included
    78!
    89! Former revisions:
     
    4748! Output format is NetCDF. Additionally, a data are output in a binary format
    4849! readable by ISO2D-software (cross-sections) and by AVS (3D-data).
    49 !
    50 ! This routine must be compiled with:
    51 ! decalpha:
    52 !    f95 -cpp -D__netcdf -fast -r8 -I/usr/local/netcdf-3.5.1/include
    53 !    -L/usr/local/netcdf-3.5.1/lib -lnetcdf
    54 ! IBM-Regatta:
    55 !    xlf95 -qsuffix=cpp=f90 -WF,-D__netcdf -qrealsize=8 -q64 -qmaxmem=-1 -Q
    56 !    -I /aws/dataformats/netcdf-3.6.0-p1/64-32/include-64
    57 !    -L/aws/dataformats/netcdf-3.6.0-p1/64-32/lib -lnetcdf -O3
    58 ! IBM-Regatta KISTI:
    59 !    xlf95 -qsuffix=cpp=f90 -WF,-D__netcdf -qrealsize=8 -q64 -qmaxmem=-1 -Q
    60 !    -I /applic/netcdf64/src/f90
    61 !    -L/applic/lib/NETCDF64 -lnetcdf -O3
    62 ! IBM-Regatta Yonsei (gfdl5):
    63 !    xlf95 -qsuffix=cpp=f90 -WF,-D__netcdf -qrealsize=8 -q64 -qmaxmem=-1 -Q
    64 !    -I /usr1/users/raasch/pub/netcdf-3.6.0-p1/include
    65 !    -L/usr1/users/raasch/pub/netcdf-3.6.0-p1/lib -lnetcdf -O3
    66 ! IMUK:
    67 !    ifort combine...f90 -o combine...x
    68 !    -cpp -D__netcdf -I /muksoft/packages/netcdf/linux/include -axW -r8 -nbs
    69 !    -Vaxlib -L /muksoft/packages/netcdf/linux/lib -lnetcdf
    70 ! NEC-SX6:
    71 !    sxf90 combine...f90 -o combine...x
    72 !    -I /pool/SX-6/netcdf/netcdf-3.6.0-p1/include  -C hopt -Wf '-A idbl4'
    73 !    -D__netcdf -L/pool/SX-6/netcdf/netcdf-3.6.0-p1/lib -lnetcdf
    74 ! Sun Fire X4600
    75 !    pgf95 combine...f90 -o combine...x
    76 !    -Mpreprocess -D__netcdf -I /home/usr5/mkanda/netcdf-3.6.1/src/f90 -r8
    77 !    -fast -L/home/usr5/mkanda/netcdf-3.6.1/src/libsrc -lnetcdf
    78 ! FIMM:
    79 !    ifort combine...f90 -o combine...x
    80 !    -axW -cpp -openmp -r8 -nbs -convert little_endian -D__netcdf
    81 !    -I /local/netcdf/include -Vaxlib -L/local/netcdf/lib -lnetcdf
    8250!------------------------------------------------------------------------------!
    8351
     
    10472                xxa, xxe, ya, ye, yya, yye, za, ze, zza, zze
    10573
     74#if defined( __lc ) || defined( __decalpha )
     75    INTEGER(8)                  ::  count, count_rate
     76#elif defined( __nec )
     77    INTEGER                     ::  count, count_rate
     78#elif defined( __ibm )
     79    INTEGER(8)                  ::  IRTC
     80#endif
     81
    10682    INTEGER, DIMENSION(0:1) ::  current_level, current_var, fanz, id_set, &
    10783         id_var_time, num_var
     
    11490
    11591    LOGICAL ::  avs_output, compressed, found, iso2d_output, netcdf_output, &
    116                 netcdf_0, netcdf_1
    117 
    118     REAL ::  dx, simulated_time
     92                netcdf_parallel, netcdf_0, netcdf_1
     93
     94    REAL ::  cpu_start_time, cpu_end_time, dx, simulated_time
    11995    REAL, DIMENSION(:),   ALLOCATABLE   ::  eta, ho, hu
    12096    REAL, DIMENSION(:,:), ALLOCATABLE   ::  pf, pf_tmp
     
    162138       DO  WHILE ( modus == 'XY'  .OR.  modus == 'XZ'  .OR.  modus == 'YZ' )
    163139!
     140!--       Take current time
     141#if defined( __lc ) || defined( __decalpha ) || defined( __nec )
     142          CALL SYSTEM_CLOCK( count, count_rate )
     143          cpu_start_time = REAL( count ) / REAL( count_rate )
     144#elif defined( __ibm )
     145          cpu_start_time = IRTC( ) * 1E-9
     146#else
     147          PRINT*,  '+++ INFORMATIVE: no time measurement defined on this host'
     148#endif
     149
     150          netcdf_parallel = .FALSE.
     151!
    164152!--       Check, if file from PE0 exists. If it does not exist, PALM did not
    165153!--       create any output for this cross-section.
     
    202190          IF ( netcdf_0  .OR.  netcdf_1 )  THEN
    203191             netcdf_output = .TRUE.
     192!
     193!--          Inquire whether the NetCDF file is already complete (parallel
     194!--          output)
     195             INQUIRE( FILE='NO_COMBINE_PLOT_FIELDS_'//modus, &
     196                      EXIST=netcdf_parallel )
     197             IF ( netcdf_parallel )  THEN
     198                netcdf_parallel = .TRUE.
     199             ELSE
     200                netcdf_parallel = .FALSE.
     201             ENDIF
    204202          ELSE
    205203             netcdf_output = .FALSE.
     
    211209          PRINT*, '*** combine_plot_fields ***'
    212210#if defined( __netcdf )
    213           IF ( netcdf_output )  PRINT*, '    NetCDF output enabled'
     211          IF ( netcdf_output )  THEN
     212             IF ( netcdf_parallel )  THEN
     213             PRINT*, '    NetCDF ' // modus // '-data are in one file ', &
     214                          '(NetCDF4-format) - merging not neccessary'
     215             ELSE
     216                PRINT*, '    NetCDF output enabled'
     217             ENDIF
     218          ENDIF
    214219#else
    215220          IF ( netcdf_output )  THEN
     
    218223          ENDIF
    219224#endif
    220           IF ( danz /= 0 )  THEN
    221              PRINT*, '    ',modus,'-section:  ', danz, ' file(s) found'
    222           ELSE
    223              PRINT*, '    no ', modus, '-section data available'
    224           ENDIF
    225 
    226           IF ( netcdf_output  .AND.  danz /= 0 )  THEN
     225          IF ( .NOT. netcdf_parallel )  THEN
     226             IF ( danz /= 0 )  THEN
     227                PRINT*, '    ',modus,'-section:  ', danz, ' file(s) found'
     228             ELSE
     229                PRINT*, '    no ', modus, '-section data available'
     230             ENDIF
     231          ENDIF
     232
     233          IF ( netcdf_output  .AND. .NOT. netcdf_parallel  .AND.  danz /= 0 ) &
     234          THEN
    227235#if defined( __netcdf )
    228236             DO  av = 0, 1
     
    312320!
    313321!--       Read the arrays, as long as the end of the file is reached
    314           fanz          =         0
    315           current_level =         1
    316           current_var   = 999999999
    317 
    318           DO  WHILE ( danz /= 0 )
    319 
    320 !
    321 !--          Loop over all files (reading data of the subdomains)
    322              DO  id = 0, danz-1
    323 !
    324 !--             File from PE0 contains special information at the beginning,
    325 !--             concerning the lower and upper indices of the total-domain used
    326 !--             in PALM (nxag, nxeg, nyag, nyeg) and the lower and upper indices
    327 !--             of the array to be writte by this routine (nxa, nxe, nya,
    328 !--             nye). Usually in the horizontal directions nxag=-1 and nxa=0
    329 !--             while all other variables have the same value (i.e. nxeg=nxe).
    330 !--             Allocate necessary arrays, open the output file and write
    331 !--             the coordinate informations needed by ISO2D.
    332                 IF ( id == 0  .AND.  fanz(0) == 0  .AND.  fanz(1) == 0 )  THEN
    333                    READ ( id+110 )  nxag, nxeg, nyag, nyeg
    334                    READ ( id+110 )  nxa, nxe, nya, nye
    335                    ALLOCATE ( eta(nya:nye), ho(nxa:nxe), hu(nxa:nxe), &
    336                         pf(nxag:nxeg,nyag:nyeg) )
    337                    READ ( id+110 )  dx, eta, hu, ho
    338 
    339                    IF ( iso2d_output )  THEN
    340                       OPEN ( 2, FILE='PLOT2D_'//modus//TRIM( model_string ), &
    341                            FORM='UNFORMATTED' )
    342                       WRITE ( 2 )  dx, eta, hu, ho
     322          IF ( .NOT. netcdf_parallel )  THEN
     323
     324             fanz          =         0
     325             current_level =         1
     326             current_var   = 999999999
     327
     328             DO  WHILE ( danz /= 0 )
     329
     330!
     331!--             Loop over all files (reading data of the subdomains)
     332                DO  id = 0, danz-1
     333!
     334!--                File from PE0 contains special information at the beginning,
     335!--                concerning the lower and upper indices of the total-domain
     336!--                used in PALM (nxag, nxeg, nyag, nyeg) and the lower and
     337!--                upper indices of the array to be writte by this routine
     338!--                (nxa, nxe, nya, nye). Usually in the horizontal directions
     339!--                nxag=-1 and nxa=0 while all other variables have the same
     340!--                value (i.e. nxeg=nxe).
     341!--                Allocate necessary arrays, open the output file and write
     342!--                the coordinate informations needed by ISO2D.
     343                   IF ( id == 0  .AND.  fanz(0) == 0  .AND.  fanz(1) == 0 ) THEN
     344                      READ ( id+110 )  nxag, nxeg, nyag, nyeg
     345                      READ ( id+110 )  nxa, nxe, nya, nye
     346                      ALLOCATE ( eta(nya:nye), ho(nxa:nxe), hu(nxa:nxe), &
     347                                 pf(nxag:nxeg,nyag:nyeg) )
     348                      READ ( id+110 )  dx, eta, hu, ho
     349
     350                      IF ( iso2d_output )  THEN
     351                         OPEN ( 2, FILE='PLOT2D_'//modus//TRIM( model_string ),&
     352                                   FORM='UNFORMATTED' )
     353                         WRITE ( 2 )  dx, eta, hu, ho
     354                      ENDIF
    343355                   ENDIF
    344                 ENDIF
    345 !
    346 !--             Read output time
    347                 IF ( netcdf_output  .AND.  id == 0 )  THEN
    348                    IF ( netcdf_1 )  THEN
    349                       READ ( id+110, END=998 )  simulated_time, time_step, av
    350                    ELSE
    351 !
    352 !--                   For compatibility with earlier PALM versions
    353                       READ ( id+110, END=998 )  simulated_time, time_step
    354                       av = 0
     356!
     357!--                Read output time
     358                   IF ( netcdf_output  .AND.  id == 0 )  THEN
     359                      IF ( netcdf_1 )  THEN
     360                         READ ( id+110, END=998 )  simulated_time, time_step, av
     361                      ELSE
     362!
     363!--                      For compatibility with earlier PALM versions
     364                         READ ( id+110, END=998 )  simulated_time, time_step
     365                         av = 0
     366                      ENDIF
    355367                   ENDIF
    356                 ENDIF
    357 !
    358 !--             Read subdomain indices
    359                 READ ( id+110, END=998 )  xa, xe, ya, ye
    360 !
    361 !--             IF the PE made no output (in case that no part of the
    362 !--             cross-section is situated on this PE), indices have the
    363 !--             value -1
    364                 IF ( .NOT. ( xa == -1  .AND.  xe == -1  .AND. &
    365                              ya == -1  .AND.  ye == -1 ) )  THEN
    366 !
    367 !--                Read the subdomain grid-point values
    368                    ALLOCATE( pf_tmp(xa:xe,ya:ye) )
    369                    READ ( id+110 )  pf_tmp
    370                    pf(xa:xe,ya:ye) = pf_tmp
    371                    DEALLOCATE( pf_tmp )
    372                 ENDIF
    373                 IF ( id == 0 )  fanz(av) = fanz(av) + 1
    374 
    375              ENDDO
    376 !
    377 !--          Write the data of the total domain cross-section
    378              IF ( iso2d_output )  WRITE ( 2 )  pf(nxa:nxe,nya:nye)
     368!
     369!--                Read subdomain indices
     370                   READ ( id+110, END=998 )  xa, xe, ya, ye
     371!
     372!--                IF the PE made no output (in case that no part of the
     373!--                cross-section is situated on this PE), indices have the
     374!--                value -1
     375                   IF ( .NOT. ( xa == -1  .AND.  xe == -1  .AND. &
     376                                ya == -1  .AND.  ye == -1 ) )  THEN
     377!
     378!--                   Read the subdomain grid-point values
     379                      ALLOCATE( pf_tmp(xa:xe,ya:ye) )
     380                      READ ( id+110 )  pf_tmp
     381                      pf(xa:xe,ya:ye) = pf_tmp
     382                      DEALLOCATE( pf_tmp )
     383                   ENDIF
     384                   IF ( id == 0 )  fanz(av) = fanz(av) + 1
     385
     386                ENDDO
     387!
     388!--             Write the data of the total domain cross-section
     389                IF ( iso2d_output )  WRITE ( 2 )  pf(nxa:nxe,nya:nye)
    379390       
    380391!
    381 !--          Write same data in NetCDF format
    382              IF ( netcdf_output )  THEN
    383 #if defined( __netcdf )
    384 !
    385 !--             Check if a new time step has begun; if yes write data to time
    386 !--             axis
    387                 IF ( current_var(av) > num_var(av) )  THEN
    388                    current_var(av) = 1
    389                    nc_stat = NF90_PUT_VAR( id_set(av), id_var_time(av), &
    390                         (/ simulated_time /),        &
    391                         start = (/ time_step /),     &
    392                         count = (/ 1 /) )
    393                    IF ( nc_stat /= NF90_NOERR ) CALL handle_netcdf_error( 7 )
    394                 ENDIF
    395 
    396 !
    397 !--             Now write the data; this is mode dependent
    398                 SELECT CASE ( modus )
    399 
    400                    CASE ( 'XY' )
    401                       nc_stat = NF90_PUT_VAR( id_set(av),                      &
     392!--             Write same data in NetCDF format
     393                IF ( netcdf_output )  THEN
     394#if defined( __netcdf )
     395!
     396!--                Check if a new time step has begun; if yes write data to
     397!--                time axis
     398                   IF ( current_var(av) > num_var(av) )  THEN
     399                      current_var(av) = 1
     400                      nc_stat = NF90_PUT_VAR( id_set(av), id_var_time(av), &
     401                                              (/ simulated_time /),        &
     402                                              start = (/ time_step /),     &
     403                                              count = (/ 1 /) )
     404                      IF ( nc_stat /= NF90_NOERR ) CALL handle_netcdf_error( 7 )
     405                   ENDIF
     406
     407!
     408!--                Now write the data; this is mode dependent
     409                   SELECT CASE ( modus )
     410
     411                      CASE ( 'XY' )
     412                         nc_stat = NF90_PUT_VAR( id_set(av),                   &
    402413                                           id_var(av,current_var(av)),         &
    403414                                           pf(nxa:nxe,nya:nye),                &
    404415                             start = (/ 1, 1, current_level(av), time_step /), &
    405416                                      count = (/ nxe-nxa+1, nye-nya+1, 1, 1 /) )
    406                       IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 8)
     417                         IF ( nc_stat /= NF90_NOERR )  THEN
     418                            CALL handle_netcdf_error( 8 )
     419                         ENDIF
    407420                 
    408                    CASE ( 'XZ' )
    409                       nc_stat = NF90_PUT_VAR( id_set(av),                      &
     421                      CASE ( 'XZ' )
     422                         nc_stat = NF90_PUT_VAR( id_set(av),                   &
    410423                                           id_var(av,current_var(av)),         &
    411424                                           pf(nxa:nxe,nya:nye),                &
    412425                             start = (/ 1, current_level(av), 1, time_step /), &
    413426                                      count = (/ nxe-nxa+1, 1, nye-nya+1, 1 /) )
    414                       IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 9)
    415 
    416                    CASE ( 'YZ' )
    417                       nc_stat = NF90_PUT_VAR( id_set(av),                      &
     427                         IF ( nc_stat /= NF90_NOERR )  THEN
     428                            CALL handle_netcdf_error( 9 )
     429                         ENDIF
     430
     431                      CASE ( 'YZ' )
     432                         nc_stat = NF90_PUT_VAR( id_set(av),                   &
    418433                                           id_var(av,current_var(av)),         &
    419434                                           pf(nxa:nxe,nya:nye),                &
    420435                             start = (/ current_level(av), 1, 1, time_step /), &
    421436                                      count = (/ 1, nxe-nxa+1, nye-nya+1, 1 /) )
    422                       IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error(10)
    423 
    424                 END SELECT
    425 
    426 !
    427 !--             Data is written, check if max level is reached
    428                 current_level(av) = current_level(av) + 1
    429                 IF ( current_level(av) > levels(av,current_var(av)) )  THEN
    430                    current_level(av) = 1
    431                    current_var(av)   = current_var(av) + 1
     437                         IF ( nc_stat /= NF90_NOERR )  THEN
     438                            CALL handle_netcdf_error( 10 )
     439                         ENDIF
     440
     441                   END SELECT
     442
     443!
     444!--                Data is written, check if max level is reached
     445                   current_level(av) = current_level(av) + 1
     446                   IF ( current_level(av) > levels(av,current_var(av)) )  THEN
     447                      current_level(av) = 1
     448                      current_var(av)   = current_var(av) + 1
     449                   ENDIF
     450
     451#endif
    432452                ENDIF
    433453
    434 #endif
    435              ENDIF
    436 
    437           ENDDO
    438 
    439 998       IF ( danz /= 0 )  THEN
     454             ENDDO
     455
     456          ENDIF
     457
     458998       IF ( danz /= 0  .AND.  .NOT. netcdf_parallel )  THEN
    440459!
    441460!--          Print the number of the arrays processed
     
    452471             CLOSE ( 2 )
    453472             DEALLOCATE ( eta, ho, hu, pf )
    454           ENDIF
    455 
    456 !
    457 !--       Close the NetCDF file
    458           IF ( netcdf_output  .AND.  danz /= 0 )  THEN
    459 #if defined( __netcdf )
    460              IF ( netcdf_0 )  THEN
    461                 nc_stat = NF90_CLOSE( id_set(0) )
    462                 IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 11 )
     473
     474!
     475!--          Close the NetCDF file
     476             IF ( netcdf_output )  THEN
     477#if defined( __netcdf )
     478                IF ( netcdf_0 )  THEN
     479                   nc_stat = NF90_CLOSE( id_set(0) )
     480                   IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 11 )
     481                ENDIF
     482                IF ( netcdf_1 )  THEN
     483                   nc_stat = NF90_CLOSE( id_set(1) )
     484                   IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 12 )
     485                ENDIF
     486#endif
    463487             ENDIF
    464              IF ( netcdf_1 )  THEN
    465                 nc_stat = NF90_CLOSE( id_set(1) )
    466                 IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 12 )
    467              ENDIF
     488          ENDIF
     489
     490!
     491!--       Output required cpu time
     492          IF ( danz /= 0  .AND.  .NOT. netcdf_parallel )  THEN
     493#if defined( __lc ) || defined( __decalpha ) || defined( __nec )
     494             CALL SYSTEM_CLOCK( count, count_rate )
     495             cpu_end_time = REAL( count ) / REAL( count_rate )
     496             WRITE (*,'(5X,A,F9.3,A)')  'Required cpu-time: ', &
     497                                        cpu_end_time-cpu_start_time, ' sec'
     498#elif defined( __ibm )
     499             cpu_end_time = IRTC( ) * 1E-9
     500             WRITE (*,'(5X,A,F9.3,A)')  'Required cpu-time: ', &
     501                                        cpu_end_time-cpu_start_time, ' sec'
     502#else
     503             CONTINUE
    468504#endif
    469505          ENDIF
     
    485521!
    486522!--    Combine the 3D-arrays
     523       netcdf_parallel = .FALSE.
     524
     525!
     526!--    Info-output
     527       PRINT*, ' '
     528       PRINT*, '*** combine_plot_fields ***'
     529
     530!
     531!--    Take current time
     532#if defined( __lc ) || defined( __decalpha ) || defined( __nec )
     533       CALL SYSTEM_CLOCK( count, count_rate )
     534       cpu_start_time = REAL( count ) / REAL( count_rate )
     535#elif defined( __ibm )
     536       cpu_start_time = IRTC( ) * 1E-9
     537#else
     538       PRINT*,  '+++ INFORMATIVE: no time measurement defined on this host'
     539#endif
    487540
    488541!
     
    500553       IF ( netcdf_0  .OR.  netcdf_1 )  THEN
    501554          netcdf_output = .TRUE.
     555!
     556!--       Inquire whether the NetCDF file is already complete (parallel output)
     557          INQUIRE( FILE='NO_COMBINE_PLOT_FIELDS_3D', EXIST=netcdf_parallel )
     558          IF ( netcdf_parallel )  THEN
     559             netcdf_parallel = .TRUE.
     560          ELSE
     561             netcdf_parallel = .FALSE.
     562          ENDIF
    502563       ELSE
    503564          netcdf_output = .FALSE.
     
    505566
    506567!
    507 !--    Check, if file from PE0 exists
    508        danz = 0
    509        WRITE (id_string,'(I4.4)')  danz
    510        INQUIRE ( &
    511             FILE='PLOT3D_DATA'//TRIM( model_string )//'_'//TRIM( id_string ),  &
    512             EXIST=found )
     568!--    Check, if file from PE0 exists; not neccessary in case of parallel
     569!--    PALM output
     570       IF ( .NOT. netcdf_parallel )  THEN
     571          danz = 0
     572          WRITE (id_string,'(I4.4)')  danz
     573          INQUIRE ( &
     574               FILE='PLOT3D_DATA'//TRIM( model_string )//'_'//TRIM( id_string ),  &
     575               EXIST=found )
     576       ELSE
     577          found = .FALSE.
     578       ENDIF
    513579
    514580!
     
    533599       ENDDO
    534600
    535 !
    536 !--    Info-output
    537        PRINT*, ' '
    538        PRINT*, '*** combine_plot_fields ***'
    539 #if defined( __netcdf )
    540        IF ( netcdf_output )  PRINT*, '    NetCDF output enabled'
     601#if defined( __netcdf )
     602       IF ( netcdf_output )  THEN
     603          IF ( netcdf_parallel )  THEN
     604             PRINT*, '    NetCDF data are in one file (NetCDF4-format)', &
     605                          ' - merging not neccessary'
     606          ELSE
     607             PRINT*, '    NetCDF output enabled'
     608          ENDIF
     609       ENDIF
    541610#else
    542611       IF ( netcdf_output )  THEN
     
    545614       ENDIF
    546615#endif
    547        IF ( danz /= 0 )  THEN
    548           PRINT*, '    3D-data:     ', danz, ' file(s) found'
    549        ELSE
    550           IF ( found .AND. compressed )  THEN
    551              PRINT*, '+++ no 3D-data processing, since data are compressed'
     616       IF ( .NOT. netcdf_parallel )  THEN
     617          IF ( danz /= 0 )  THEN
     618             PRINT*, '    3D-data:     ', danz, ' file(s) found'
    552619          ELSE
    553              PRINT*, '    no 3D-data file available'
    554           ENDIF
    555        ENDIF
    556 
    557        IF ( netcdf_output  .AND.  danz /= 0 )  THEN
     620             IF ( found .AND. compressed )  THEN
     621                PRINT*, '+++ no 3D-data processing, since data are compressed'
     622             ELSE
     623                PRINT*, '    no 3D-data file available'
     624             ENDIF
     625          ENDIF
     626       ENDIF
     627
     628       IF ( netcdf_output  .AND. .NOT. netcdf_parallel  .AND.  danz /= 0 )  THEN
    558629#if defined( __netcdf )
    559630          DO  av = 0, 1
     
    623694!
    624695!--    Read arrays, until the end of the file is reached
    625        current_var = 999999999
    626        fanz = 0
    627        DO  WHILE ( danz /= 0 )
    628 
    629 !
    630 !--       Loop over all files
    631           DO  id = 0, danz-1
    632 !
    633 !--          File from PE0 contains special information at the beginning,
    634 !--          concerning the lower and upper indices of the total-domain used in
    635 !--          PALM (nxag, nxeg, nyag, nyeg, nzag, nzeg) and the lower and upper
    636 !--          indices of the array to be written by this routine (nxa, nxe, nya,
    637 !--          nye, nza, nze). Usually nxag=-1 and nxa=0, nyag=-1 and nya=0,
    638 !--          nzeg=nz and nze=nz_plot3d.
    639 !--          Allocate necessary array and open the output file.
    640              IF ( id == 0  .AND.  fanz(0) == 0  .AND.  fanz(1) == 0 )  THEN
    641                 READ ( id+110 )  nxag, nxeg, nyag, nyeg, nzag, nzeg
    642                 READ ( id+110 )  nxa, nxe, nya, nye, nza, nze
    643                 ALLOCATE ( pf3d(nxa:nxe,nya:nye,nza:nze) )
    644                 IF ( avs_output )  THEN
    645                    OPEN ( 2, FILE='PLOT3D_DATA'//TRIM( model_string ), &
    646                         FORM='UNFORMATTED' )
     696       IF ( .NOT. netcdf_parallel )  THEN
     697
     698          current_var = 999999999
     699          fanz = 0
     700          DO  WHILE ( danz /= 0 )
     701
     702!
     703!--          Loop over all files
     704             DO  id = 0, danz-1
     705!
     706!--             File from PE0 contains special information at the beginning,
     707!--             concerning the lower and upper indices of the total-domain used
     708!--             in PALM (nxag, nxeg, nyag, nyeg, nzag, nzeg) and the lower and
     709!--             upper indices of the array to be written by this routine (nxa,
     710!--             nxe, nya, nye, nza, nze). Usually nxag=-1 and nxa=0, nyag=-1
     711!--             and nya=0, nzeg=nz and nze=nz_plot3d.
     712!--             Allocate necessary array and open the output file.
     713                IF ( id == 0  .AND.  fanz(0) == 0  .AND.  fanz(1) == 0 )  THEN
     714                   READ ( id+110 )  nxag, nxeg, nyag, nyeg, nzag, nzeg
     715                   READ ( id+110 )  nxa, nxe, nya, nye, nza, nze
     716                   ALLOCATE ( pf3d(nxa:nxe,nya:nye,nza:nze) )
     717                   IF ( avs_output )  THEN
     718                      OPEN ( 2, FILE='PLOT3D_DATA'//TRIM( model_string ), &
     719                             FORM='UNFORMATTED' )
     720                   ENDIF
    647721                ENDIF
    648              ENDIF
    649 
    650 !
    651 !--          Read output time
    652              IF ( netcdf_output  .AND.  id == 0 )  THEN
    653                 IF ( netcdf_1 )  THEN
    654                    READ ( id+110, END=999 )  simulated_time, time_step, av
    655                 ELSE
    656 !
    657 !--                For compatibility with earlier PALM versions
    658                    READ ( id+110, END=999 )  simulated_time, time_step
    659                    av = 0
     722
     723!
     724!--             Read output time
     725                IF ( netcdf_output  .AND.  id == 0 )  THEN
     726                   IF ( netcdf_1 )  THEN
     727                      READ ( id+110, END=999 )  simulated_time, time_step, av
     728                   ELSE
     729!
     730!--                   For compatibility with earlier PALM versions
     731                      READ ( id+110, END=999 )  simulated_time, time_step
     732                      av = 0
     733                   ENDIF
    660734                ENDIF
    661              ENDIF
    662 
    663 !
    664 !--          Read subdomain indices and grid point values
    665              READ ( id+110, END=999 )  xa, xe, ya, ye, za, ze
    666              ALLOCATE( pf3d_tmp(xa:xe,ya:ye,za:ze) )
    667              READ ( id+110 )  pf3d_tmp
    668 
    669              xxa = MAX( nxa, xa )
    670              xxe = MIN( nxe, xe )
    671              yya = MAX( nya, ya )
    672              yye = MIN( nye, ye )
    673              zza = MAX( nza, za )
    674              zze = MIN( nze, ze )
    675              DO  k = zza, zze
    676                 DO  j = yya, yye
    677                    DO  i = xxa, xxe
    678                       pf3d(i,j,k) = pf3d_tmp(i,j,k)
     735
     736!
     737!--             Read subdomain indices and grid point values
     738                READ ( id+110, END=999 )  xa, xe, ya, ye, za, ze
     739                ALLOCATE( pf3d_tmp(xa:xe,ya:ye,za:ze) )
     740                READ ( id+110 )  pf3d_tmp
     741
     742                xxa = MAX( nxa, xa )
     743                xxe = MIN( nxe, xe )
     744                yya = MAX( nya, ya )
     745                yye = MIN( nye, ye )
     746                zza = MAX( nza, za )
     747                zze = MIN( nze, ze )
     748                DO  k = zza, zze
     749                   DO  j = yya, yye
     750                      DO  i = xxa, xxe
     751                         pf3d(i,j,k) = pf3d_tmp(i,j,k)
     752                      ENDDO
    679753                   ENDDO
    680754                ENDDO
     755
     756                DEALLOCATE( pf3d_tmp )
     757                IF ( id == 0 )  fanz(av) = fanz(av) + 1
     758
    681759             ENDDO
    682760
    683              DEALLOCATE( pf3d_tmp )
    684              IF ( id == 0 )  fanz(av) = fanz(av) + 1
     761!
     762!--          Write data of the total domain
     763             IF ( avs_output )  WRITE ( 2 )  pf3d(nxa:nxe,nya:nye,nza:nze)
     764       
     765!
     766!--          Write same data in NetCDF format
     767             IF ( netcdf_output )  THEN
     768#if defined( __netcdf )
     769!
     770!--             Check if a new time step has begun; if yes write data to time
     771!--             axis
     772                IF ( current_var(av) > num_var(av) )  THEN
     773                   current_var(av) = 1
     774                   nc_stat = NF90_PUT_VAR( id_set(av), id_var_time(av), &
     775                                      (/ simulated_time /),&
     776                                      start = (/ time_step /), count = (/ 1 /) )
     777                   IF ( nc_stat /= NF90_NOERR ) CALL handle_netcdf_error( 17 )
     778                ENDIF
     779
     780!
     781!--             Now write the data
     782                nc_stat = NF90_PUT_VAR( id_set(av), id_var(av,current_var(av)),&
     783                                        pf3d, start = (/ 1, 1, 1, time_step /),&
     784                              count = (/ nxe-nxa+1, nye-nya+1, nze-nza+1, 1 /) )
     785                IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 18 )
     786
     787                current_var(av) = current_var(av) + 1
     788
     789#endif
     790             ENDIF
    685791
    686792          ENDDO
    687793
    688 !
    689 !--       Write data of the total domain
    690           IF ( avs_output )  WRITE ( 2 )  pf3d(nxa:nxe,nya:nye,nza:nze)
    691        
    692 !
    693 !--       Write same data in NetCDF format
    694           IF ( netcdf_output )  THEN
    695 #if defined( __netcdf )
    696 !
    697 !--          Check if a new time step has begun; if yes write data to time axis
    698              IF ( current_var(av) > num_var(av) )  THEN
    699                 current_var(av) = 1
    700                 nc_stat = NF90_PUT_VAR( id_set(av), id_var_time(av), &
    701                                      (/ simulated_time /),&
    702                                      start = (/ time_step /), count = (/ 1 /) )
    703                 IF ( nc_stat /= NF90_NOERR ) CALL handle_netcdf_error( 17 )
    704              ENDIF
    705 
    706 !
    707 !--          Now write the data
    708              nc_stat = NF90_PUT_VAR( id_set(av), id_var(av,current_var(av)), &
    709                                      pf3d, start = (/ 1, 1, 1, time_step /), &
    710                               count = (/ nxe-nxa+1, nye-nya+1, nze-nza+1, 1 /) )
    711              IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 18 )
    712 
    713              current_var(av) = current_var(av) + 1
    714 
    715 #endif
    716           ENDIF
    717 
    718        ENDDO
    719 
    720 999    IF ( danz /= 0 )  THEN
     794       ENDIF
     795
     796999    IF ( danz /= 0  .AND.  .NOT. netcdf_parallel )  THEN
    721797!
    722798!--       Print the number of arrays processed
     
    746822#endif
    747823          ENDIF
     824
     825!
     826!--       Output required cpu time
     827#if defined( __lc ) || defined( __decalpha ) || defined( __nec )
     828          CALL SYSTEM_CLOCK( count, count_rate )
     829          cpu_end_time = REAL( count ) / REAL( count_rate )
     830          WRITE (*,'(5X,A,F9.3,A)')  'Required cpu-time: ', &
     831                                     cpu_end_time-cpu_start_time, ' sec'
     832#elif defined( __ibm )
     833          cpu_end_time = IRTC( ) * 1E-9
     834          WRITE (*,'(5X,A,F9.3,A)')  'Required cpu-time: ', &
     835                                     cpu_end_time-cpu_start_time, ' sec'
     836#endif
     837
    748838       ENDIF
    749839
Note: See TracChangeset for help on using the changeset viewer.