Changeset 1031


Ignore:
Timestamp:
Oct 19, 2012 2:35:30 PM (11 years ago)
Author:
raasch
Message:

netCDF4 without parallel file support implemented
additional define string netcdf4_parallel is required to switch on parallel file support

Location:
palm/trunk/SOURCE
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/check_open.f90

    r965 r1031  
    44! Current revisions:
    55! -----------------
    6 !
     6! netCDF4 without parallel file support implemented,
     7! opening of netCDF files are done by new routines create_netcdf_file and
     8! open_write_netcdf_file
    79!
    810! Former revisions:
     
    3739!
    3840! 519 2010-03-19 05:30:02Z raasch
    39 ! NetCDF4 support for particle data
     41! netCDF4 support for particle data
    4042!
    4143! 493 2010-03-01 08:30:24Z raasch
    42 ! NetCDF4 support (parallel output)
     44! netCDF4 support (parallel output)
    4345!
    4446! 410 2009-12-04 17:05:40Z letzel
     
    4648!
    4749! 277 2009-03-31 09:13:47Z heinze
    48 ! Output of NetCDF messages with aid of message handling routine.
     50! Output of netCDF messages with aid of message handling routine.
    4951! Output of messages replaced by message handling routine
    5052!
     
    5557!
    5658! 120 2007-10-17 11:54:43Z raasch
    57 ! Status of 3D-volume NetCDF data file only depends on switch netcdf_64bit_3d
     59! Status of 3D-volume netCDF data file only depends on switch netcdf_64bit_3d
    5860!
    5961! 105 2007-08-08 07:12:55Z raasch
     
    169171       CASE ( 101:103, 106, 111:113, 116, 201:200+2*max_masks )
    170172
    171           IF ( netcdf_data_format < 3 )  THEN
     173          IF ( netcdf_data_format < 5 )  THEN
    172174         
    173175             IF ( myid /= 0 )  THEN
     
    738740          ENDIF
    739741!
    740 !--       Inquire, if there is a NetCDF file from a previuos run. This should
     742!--       Inquire, if there is a netCDF file from a previuos run. This should
    741743!--       be opened for extension, if its dimensions and variables match the
    742744!--       actual run.
     
    745747          IF ( netcdf_extend )  THEN
    746748!
    747 !--          Open an existing NetCDF file for output
    748              IF ( netcdf_data_format < 3 )  THEN
    749                 nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_xy(av) )
    750              ELSE
    751 #if defined( __netcdf4 )
    752                 nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_xy(av), &
    753                                      COMM = comm2d, INFO = MPI_INFO_NULL )
    754 #endif
    755              ENDIF
    756 
    757              CALL handle_netcdf_error( 'check_open', 20 )
     749!--          Open an existing netCDF file for output
     750             CALL open_write_netcdf_file( filename, id_set_xy(av), .TRUE., 20 )
    758751!
    759752!--          Read header information and set all ids. If there is a mismatch
     
    774767          IF ( .NOT. netcdf_extend )  THEN
    775768!
    776 !--          Create a new NetCDF output file with requested NetCDF format
    777              IF ( netcdf_data_format == 1 )  THEN
    778 !
    779 !--             Classic NetCDF format
    780                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_xy(av) )
    781 
    782              ELSEIF ( netcdf_data_format == 2 )  THEN
    783 !
    784 !--             64bit-offset format
    785                 nc_stat = NF90_CREATE( filename,                               &
    786                                        OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),&
    787                                        id_set_xy(av) )
    788 
    789 #if defined( __netcdf4 )
    790              ELSEIF ( netcdf_data_format == 3 )  THEN
    791 !
    792 !--             NetCDF4/HDF5 format
    793                 nc_stat = NF90_CREATE( filename,                               &
    794                                        OR( NF90_NOCLOBBER, NF90_NETCDF4 ),     &
    795                                        id_set_xy(av), COMM = comm2d,           &
    796                                        INFO = MPI_INFO_NULL )
    797 
    798              ELSEIF ( netcdf_data_format == 4 )  THEN
    799 !
    800 !--             NetCDF4/HDF5 format with classic model flag
    801                 nc_stat = NF90_CREATE( filename,                               &
    802                                        OR( NF90_NOCLOBBER,                     &
    803                                         OR( NF90_CLASSIC_MODEL, NF90_HDF5 ) ), &
    804                                        id_set_xy(av), COMM = comm2d,           &
    805                                        INFO = MPI_INFO_NULL )
    806 #endif
    807              ENDIF
    808 
    809              CALL handle_netcdf_error( 'check_open', 22 )
     769!--          Create a new netCDF output file with requested netCDF format
     770             CALL create_netcdf_file( filename, id_set_xy(av), .TRUE., 22 )
    810771
    811772!
     
    814775
    815776!
    816 !--          In case of parallel NetCDF output, create flag file which tells
     777!--          In case of parallel netCDF output, create flag file which tells
    817778!--          combine_plot_fields that nothing is to do.
    818              IF ( myid == 0  .AND.  netcdf_data_format > 2 )  THEN
     779             IF ( myid == 0  .AND.  netcdf_data_format > 4 )  THEN
    819780                OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_XY' )
    820781                WRITE ( 99, '(A)' )  'no combine_plot_fields.x neccessary'
     
    835796          ENDIF
    836797!
    837 !--       Inquire, if there is a NetCDF file from a previuos run. This should
     798!--       Inquire, if there is a netCDF file from a previuos run. This should
    838799!--       be opened for extension, if its dimensions and variables match the
    839800!--       actual run.
     
    842803          IF ( netcdf_extend )  THEN
    843804!
    844 !--          Open an existing NetCDF file for output
    845              IF ( netcdf_data_format < 3 )  THEN
    846                 nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_xz(av) )
    847              ELSE
    848 #if defined( __netcdf4 )
    849                 nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_xz(av), &
    850                                      COMM = comm2d, INFO = MPI_INFO_NULL )
    851 #endif
    852              ENDIF
    853 
    854              CALL handle_netcdf_error( 'check_open', 23 )
     805!--          Open an existing netCDF file for output
     806             CALL open_write_netcdf_file( filename, id_set_xz(av), .TRUE., 23 )
    855807!
    856808!--          Read header information and set all ids. If there is a mismatch
     
    871823          IF ( .NOT. netcdf_extend )  THEN
    872824!
    873 !--          Create a new NetCDF output file with requested NetCDF format
    874              IF ( netcdf_data_format == 1 )  THEN
    875 !
    876 !--             Classic NetCDF format
    877                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_xz(av) )
    878 
    879              ELSEIF ( netcdf_data_format == 2 )  THEN
    880 !
    881 !--             64bit-offset format
    882                 nc_stat = NF90_CREATE( filename,                               &
    883                                        OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),&
    884                                        id_set_xz(av) )
    885 
    886 #if defined( __netcdf4 )
    887              ELSEIF ( netcdf_data_format == 3 )  THEN
    888 !
    889 !--             NetCDF4/HDF5 format
    890                 nc_stat = NF90_CREATE( filename,                               &
    891                                        OR( NF90_NOCLOBBER, NF90_NETCDF4 ),     &
    892                                        id_set_xz(av), COMM = comm2d,           &
    893                                        INFO = MPI_INFO_NULL )
    894 
    895              ELSEIF ( netcdf_data_format == 4 )  THEN
    896 !
    897 !--             NetCDF4/HDF5 format with classic model flag
    898                 nc_stat = NF90_CREATE( filename,                               &
    899                                        OR( NF90_NOCLOBBER,                     &
    900                                         OR( NF90_CLASSIC_MODEL, NF90_HDF5 ) ), &
    901                                        id_set_xz(av), COMM = comm2d,           &
    902                                        INFO = MPI_INFO_NULL )
    903 #endif
    904              ENDIF
    905 
    906              CALL handle_netcdf_error( 'check_open', 25 )
     825!--          Create a new netCDF output file with requested netCDF format
     826             CALL create_netcdf_file( filename, id_set_xz(av), .TRUE., 25 )
    907827
    908828!
     
    911831
    912832!
    913 !--          In case of parallel NetCDF output, create flag file which tells
     833!--          In case of parallel netCDF output, create flag file which tells
    914834!--          combine_plot_fields that nothing is to do.
    915              IF ( myid == 0  .AND.  netcdf_data_format > 2 )  THEN
     835             IF ( myid == 0  .AND.  netcdf_data_format > 4 )  THEN
    916836                OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_XZ' )
    917837                WRITE ( 99, '(A)' )  'no combine_plot_fields.x neccessary'
     
    932852          ENDIF
    933853!
    934 !--       Inquire, if there is a NetCDF file from a previuos run. This should
     854!--       Inquire, if there is a netCDF file from a previuos run. This should
    935855!--       be opened for extension, if its dimensions and variables match the
    936856!--       actual run.
     
    939859          IF ( netcdf_extend )  THEN
    940860!
    941 !--          Open an existing NetCDF file for output
    942              IF ( netcdf_data_format < 3 )  THEN
    943                 nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_yz(av) )
    944              ELSE
    945 #if defined( __netcdf4 )
    946                 nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_yz(av), &
    947                                      COMM = comm2d, INFO = MPI_INFO_NULL )
    948 #endif
    949              ENDIF
    950              
    951              CALL handle_netcdf_error( 'check_open', 26 )
     861!--          Open an existing netCDF file for output
     862             CALL open_write_netcdf_file( filename, id_set_yz(av), .TRUE., 26 )
    952863!
    953864!--          Read header information and set all ids. If there is a mismatch
     
    968879          IF ( .NOT. netcdf_extend )  THEN
    969880!
    970 !--          Create a new NetCDF output file with requested NetCDF format
    971              IF ( netcdf_data_format == 1 )  THEN
    972 !
    973 !--             Classic NetCDF format
    974                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_yz(av) )
    975 
    976              ELSEIF ( netcdf_data_format == 2 )  THEN
    977 !
    978 !--             64bit-offset format
    979                 nc_stat = NF90_CREATE( filename,                               &
    980                                        OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),&
    981                                        id_set_yz(av) )
    982 
    983 #if defined( __netcdf4 )
    984              ELSEIF ( netcdf_data_format == 3 )  THEN
    985 !
    986 !--             NetCDF4/HDF5 format
    987                 nc_stat = NF90_CREATE( filename,                               &
    988                                        OR( NF90_NOCLOBBER, NF90_NETCDF4 ),     &
    989                                        id_set_yz(av), COMM = comm2d,           &
    990                                        INFO = MPI_INFO_NULL )
    991 
    992              ELSEIF ( netcdf_data_format == 4 )  THEN
    993 !
    994 !--             NetCDF4/HDF5 format with classic model flag
    995                 nc_stat = NF90_CREATE( filename,                               &
    996                                        OR( NF90_NOCLOBBER,                     &
    997                                         OR( NF90_CLASSIC_MODEL, NF90_HDF5 ) ), &
    998                                        id_set_yz(av), COMM = comm2d,           &
    999                                        INFO = MPI_INFO_NULL )
    1000 #endif
    1001              ENDIF
    1002 
    1003              CALL handle_netcdf_error( 'check_open', 28 )
     881!--          Create a new netCDF output file with requested netCDF format
     882             CALL create_netcdf_file( filename, id_set_yz(av), .TRUE., 28 )
    1004883
    1005884!
     
    1008887
    1009888!
    1010 !--          In case of parallel NetCDF output, create flag file which tells
     889!--          In case of parallel netCDF output, create flag file which tells
    1011890!--          combine_plot_fields that nothing is to do.
    1012              IF ( myid == 0  .AND.  netcdf_data_format > 2 )  THEN
     891             IF ( myid == 0  .AND.  netcdf_data_format > 4 )  THEN
    1013892                OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_YZ' )
    1014893                WRITE ( 99, '(A)' )  'no combine_plot_fields.x neccessary'
     
    1024903
    1025904!
    1026 !--       Inquire, if there is a NetCDF file from a previuos run. This should
     905!--       Inquire, if there is a netCDF file from a previuos run. This should
    1027906!--       be opened for extension, if its variables match the actual run.
    1028907          INQUIRE( FILE=filename, EXIST=netcdf_extend )
     
    1030909          IF ( netcdf_extend )  THEN
    1031910!
    1032 !--          Open an existing NetCDF file for output
    1033              nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_pr )
    1034              CALL handle_netcdf_error( 'check_open', 29 )
     911!--          Open an existing netCDF file for output
     912             CALL open_write_netcdf_file( filename, id_set_pr, .FALSE., 29 )
    1035913!
    1036914!--          Read header information and set all ids. If there is a mismatch
     
    1051929          IF ( .NOT. netcdf_extend )  THEN
    1052930!
    1053 !--          Create a new NetCDF output file
    1054              IF ( netcdf_data_format > 1 )  THEN
    1055                 nc_stat = NF90_CREATE( filename,                               &
    1056                                        OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),&
    1057                                        id_set_pr )
    1058              ELSE
    1059                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_pr )
    1060              ENDIF
    1061              CALL handle_netcdf_error( 'check_open', 31 )
     931!--          Create a new netCDF output file with requested netCDF format
     932             CALL create_netcdf_file( filename, id_set_pr, .FALSE., 31 )
    1062933!
    1063934!--          Define the header
     
    1072943
    1073944!
    1074 !--       Inquire, if there is a NetCDF file from a previuos run. This should
     945!--       Inquire, if there is a netCDF file from a previuos run. This should
    1075946!--       be opened for extension, if its variables match the actual run.
    1076947          INQUIRE( FILE=filename, EXIST=netcdf_extend )
     
    1078949          IF ( netcdf_extend )  THEN
    1079950!
    1080 !--          Open an existing NetCDF file for output
    1081              nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_ts )
    1082              CALL handle_netcdf_error( 'check_open', 32 )
     951!--          Open an existing netCDF file for output
     952             CALL open_write_netcdf_file( filename, id_set_ts, .FALSE., 32 )
    1083953!
    1084954!--          Read header information and set all ids. If there is a mismatch
     
    1099969          IF ( .NOT. netcdf_extend )  THEN
    1100970!
    1101 !--          Create a new NetCDF output file
    1102              IF ( netcdf_data_format > 1 )  THEN
    1103                 nc_stat = NF90_CREATE( filename,                               &
    1104                                        OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),&
    1105                                        id_set_ts )
    1106              ELSE
    1107                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_ts )
    1108              ENDIF
    1109              CALL handle_netcdf_error( 'check_open', 34 )
     971!--          Create a new netCDF output file with requested netCDF format
     972             CALL create_netcdf_file( filename, id_set_ts, .FALSE., 34 )
    1110973!
    1111974!--          Define the header
     
    1126989          ENDIF
    1127990!
    1128 !--       Inquire, if there is a NetCDF file from a previous run. This should
     991!--       Inquire, if there is a netCDF file from a previous run. This should
    1129992!--       be opened for extension, if its dimensions and variables match the
    1130993!--       actual run.
     
    1133996          IF ( netcdf_extend )  THEN
    1134997!
    1135 !--          Open an existing NetCDF file for output
    1136              IF ( netcdf_data_format < 3 )  THEN
    1137                 nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_3d(av) )
    1138              ELSE
    1139 #if defined( __netcdf4 )
    1140                 nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_3d(av), &
    1141                                      COMM = comm2d, INFO = MPI_INFO_NULL )
    1142 #endif
    1143              ENDIF
    1144              CALL handle_netcdf_error( 'check_open', 35 )
     998!--          Open an existing netCDF file for output
     999             CALL open_write_netcdf_file( filename, id_set_3d(av), .TRUE., 35 )
    11451000!
    11461001!--          Read header information and set all ids. If there is a mismatch
     
    11611016          IF ( .NOT. netcdf_extend )  THEN
    11621017!
    1163 !--          Create a new NetCDF output file with requested NetCDF format
    1164              IF ( netcdf_data_format == 1 )  THEN
    1165 !
    1166 !--             Classic NetCDF format
    1167                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_3d(av) )
    1168 
    1169              ELSEIF ( netcdf_data_format == 2 )  THEN
    1170 !
    1171 !--             64bit-offset format
    1172                 nc_stat = NF90_CREATE( filename,                               &
    1173                                        OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),&
    1174                                        id_set_3d(av) )
    1175 
    1176 #if defined( __netcdf4 )
    1177              ELSEIF ( netcdf_data_format == 3 )  THEN
    1178 !
    1179 !--             NetCDF4/HDF5 format
    1180                 nc_stat = NF90_CREATE( filename,                               &
    1181                                        OR( NF90_NOCLOBBER, NF90_NETCDF4 ),     &
    1182                                        id_set_3d(av), COMM = comm2d,           &
    1183                                        INFO = MPI_INFO_NULL )
    1184 
    1185              ELSEIF ( netcdf_data_format == 4 )  THEN
    1186 !
    1187 !--             NetCDF4/HDF5 format with classic model flag
    1188                 nc_stat = NF90_CREATE( filename,                               &
    1189                                        OR( NF90_NOCLOBBER,                     &
    1190                                         OR( NF90_CLASSIC_MODEL, NF90_HDF5 ) ), &
    1191                                        id_set_3d(av), COMM = comm2d,           &
    1192                                        INFO = MPI_INFO_NULL )
    1193 #endif
    1194              ENDIF
    1195 
    1196              CALL handle_netcdf_error( 'check_open', 37 )
     1018!--          Create a new netCDF output file with requested netCDF format
     1019             CALL create_netcdf_file( filename, id_set_3d(av), .TRUE., 37 )
    11971020
    11981021!
     
    12011024
    12021025!
    1203 !--          In case of parallel NetCDF output, create flag file which tells
     1026!--          In case of parallel netCDF output, create flag file which tells
    12041027!--          combine_plot_fields that nothing is to do.
    1205              IF ( myid == 0  .AND.  netcdf_data_format > 2 )  THEN
     1028             IF ( myid == 0  .AND.  netcdf_data_format > 4 )  THEN
    12061029                OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_3D' )
    12071030                WRITE ( 99, '(A)' )  'no combine_plot_fields.x neccessary'
     
    12181041
    12191042!
    1220 !--       Inquire, if there is a NetCDF file from a previuos run. This should
     1043!--       Inquire, if there is a netCDF file from a previuos run. This should
    12211044!--       be opened for extension, if its variables match the actual run.
    12221045          INQUIRE( FILE=filename, EXIST=netcdf_extend )
     
    12241047          IF ( netcdf_extend )  THEN
    12251048!
    1226 !--          Open an existing NetCDF file for output
    1227              nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_sp )
    1228              CALL handle_netcdf_error( 'check_open', 38 )
     1049!--          Open an existing netCDF file for output
     1050             CALL open_write_netcdf_file( filename, id_set_sp, .FALSE., 38 )
    12291051
    12301052!
     
    12461068          IF ( .NOT. netcdf_extend )  THEN
    12471069!
    1248 !--          Create a new NetCDF output file
    1249              IF ( netcdf_data_format > 1 )  THEN
    1250                 nc_stat = NF90_CREATE( filename,                               &
    1251                                        OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),&
    1252                                        id_set_sp )
    1253              ELSE
    1254                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_sp )
    1255              ENDIF
    1256              CALL handle_netcdf_error( 'check_open', 40 )
     1070!--          Create a new netCDF output file with requested netCDF format
     1071             CALL create_netcdf_file( filename, id_set_sp, .FALSE., 40 )
    12571072!
    12581073!--          Define the header
     
    12711086          ENDIF
    12721087!
    1273 !--       Inquire, if there is a NetCDF file from a previuos run. This should
     1088!--       Inquire, if there is a netCDF file from a previuos run. This should
    12741089!--       be opened for extension, if its variables match the actual run.
    12751090          INQUIRE( FILE=filename, EXIST=netcdf_extend )
     
    12771092          IF ( netcdf_extend )  THEN
    12781093!
    1279 !--          Open an existing NetCDF file for output
    1280              nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_prt )
    1281              CALL handle_netcdf_error( 'check_open', 41 )
     1094!--          Open an existing netCDF file for output
     1095             CALL open_write_netcdf_file( filename, id_set_prt, .FALSE., 41 )
    12821096!
    12831097!--          Read header information and set all ids. If there is a mismatch
     
    13151129
    13161130!
    1317 !--          Create a new NetCDF output file with requested NetCDF format
    1318              IF ( netcdf_data_format == 1 )  THEN
    1319 !
    1320 !--             Classic NetCDF format
    1321                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_prt )
    1322 
    1323              ELSEIF ( netcdf_data_format == 2 )  THEN
    1324 !
    1325 !--             64bit-offset format
    1326                 nc_stat = NF90_CREATE( filename,                               &
    1327                                        OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),&
    1328                                        id_set_prt )
    1329 
    1330 #if defined( __netcdf4 )
    1331              ELSEIF ( netcdf_data_format == 3 )  THEN
    1332 !
    1333 !--             NetCDF4/HDF5 format, but no parallel output into a single file!
    1334                 nc_stat = NF90_CREATE( filename,                               &
    1335                                        OR( NF90_NOCLOBBER, NF90_NETCDF4 ),     &
    1336                                        id_set_prt )
    1337 
    1338              ELSEIF ( netcdf_data_format == 4 )  THEN
    1339 !
    1340 !--             NetCDF4/HDF5 format with classic model flag, but no parallel
    1341 !--             output into a single file!
    1342                 nc_stat = NF90_CREATE( filename,                               &
    1343                                        OR( NF90_NOCLOBBER,                     &
    1344                                         OR( NF90_CLASSIC_MODEL, NF90_HDF5 ) ), &
    1345                                        id_set_prt )
    1346 #endif
    1347              ENDIF
    1348              
    1349              CALL handle_netcdf_error( 'check_open', 43 ) 
     1131!--          Create a new netCDF output file with requested netCDF format
     1132             CALL create_netcdf_file( filename, id_set_prt, .FALSE., 43 )
    13501133
    13511134!
     
    13611144
    13621145!
    1363 !--       Inquire, if there is a NetCDF file from a previuos run. This should
     1146!--       Inquire, if there is a netCDF file from a previuos run. This should
    13641147!--       be opened for extension, if its variables match the actual run.
    13651148          INQUIRE( FILE=filename, EXIST=netcdf_extend )
     
    13671150          IF ( netcdf_extend )  THEN
    13681151!
    1369 !--          Open an existing NetCDF file for output
    1370              nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_pts )
    1371              CALL handle_netcdf_error( 'check_open', 393 )
     1152!--          Open an existing netCDF file for output
     1153             CALL open_write_netcdf_file( filename, id_set_pts, .FALSE., 393 )
    13721154!
    13731155!--          Read header information and set all ids. If there is a mismatch
     
    13881170          IF ( .NOT. netcdf_extend )  THEN
    13891171!
    1390 !--          Create a new NetCDF output file
    1391              IF ( netcdf_data_format > 1 )  THEN
    1392                 nc_stat = NF90_CREATE( filename,                               &
    1393                                        OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),&
    1394                                        id_set_pts )
    1395              ELSE
    1396                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_pts )
    1397              ENDIF
    1398              CALL handle_netcdf_error( 'check_open', 395 )
     1172!--          Create a new netCDF output file with requested netCDF format
     1173             CALL create_netcdf_file( filename, id_set_pts, .FALSE., 395 )
    13991174!
    14001175!--          Define the header
     
    14191194          ENDIF
    14201195!
    1421 !--       Inquire, if there is a NetCDF file from a previuos run. This should
     1196!--       Inquire, if there is a netCDF file from a previuos run. This should
    14221197!--       be opened for extension, if its dimensions and variables match the
    14231198!--       actual run.
     
    14261201          IF ( netcdf_extend )  THEN
    14271202!
    1428 !--          Open an existing NetCDF file for output
    1429 #if defined( __netcdf4 )
    1430              nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_mask(mid,av), &
    1431                                   COMM = comm2d, INFO = MPI_INFO_NULL )
    1432 #else
    1433              nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_mask(mid,av) )
    1434 #endif
    1435              CALL handle_netcdf_error( 'check_open', 456 )
     1203!--          Open an existing netCDF file for output
     1204             CALL open_write_netcdf_file( filename, id_set_mask(mid,av), &
     1205                                          .TRUE., 456 )
    14361206!
    14371207!--          Read header information and set all ids. If there is a mismatch
     
    14521222          IF ( .NOT. netcdf_extend )  THEN
    14531223!
    1454 !--          Create a new NetCDF output file with requested NetCDF format
    1455              IF ( netcdf_data_format == 1 )  THEN
    1456 !
    1457 !--             Classic NetCDF format
    1458                 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, &
    1459                                        id_set_mask(mid,av) )
    1460 
    1461              ELSEIF ( netcdf_data_format == 2 )  THEN
    1462 !
    1463 !--             64bit-offset format
    1464                 nc_stat = NF90_CREATE( filename,                               &
    1465                                        OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),&
    1466                                        id_set_mask(mid,av) )
    1467 
    1468 
    1469 #if defined( __netcdf4 )
    1470              ELSEIF ( netcdf_data_format == 3 )  THEN
    1471 !
    1472 !--             NetCDF4/HDF5 format
    1473                 nc_stat = NF90_CREATE( filename,                               &
    1474                                        OR( NF90_NOCLOBBER, NF90_NETCDF4 ),     &
    1475                                        id_set_mask(mid,av), COMM = comm2d,     &
    1476                                        INFO = MPI_INFO_NULL )
    1477 
    1478              ELSEIF ( netcdf_data_format == 4 )  THEN
    1479 !
    1480 !--             NetCDF4/HDF5 format with classic model flag
    1481                 nc_stat = NF90_CREATE( filename,                               &
    1482                                        OR( NF90_NOCLOBBER,                     &
    1483                                         OR( NF90_CLASSIC_MODEL, NF90_HDF5 ) ), &
    1484                                        id_set_mask(mid,av), COMM = comm2d,     &
    1485                                        INFO = MPI_INFO_NULL )
    1486 #endif
    1487              ENDIF
    1488 
    1489              CALL handle_netcdf_error( 'check_open', 458 )
     1224!--          Create a new netCDF output file with requested netCDF format
     1225             CALL create_netcdf_file( filename, id_set_mask(mid,av), .TRUE., 458 )
    14901226!
    14911227!--          Define the header
  • palm/trunk/SOURCE/check_parameters.f90

    r1020 r1031  
    44! Current revisions:
    55! -----------------
    6 !
     6! check of netcdf4 parallel file support
    77!
    88! Former revisions:
     
    28472847
    28482848       ENDDO
     2849    ENDIF
     2850
     2851!
     2852!-- Set output format string (used in header)
     2853    IF ( netcdf_output )  THEN
     2854
     2855       SELECT CASE ( netcdf_data_format )
     2856          CASE ( 1 )
     2857             output_format_netcdf = 'netCDF classic'
     2858          CASE ( 2 )
     2859             output_format_netcdf = 'netCDF 64bit offset'
     2860          CASE ( 3 )
     2861             output_format_netcdf = 'netCDF4/HDF5'
     2862          CASE ( 4 )
     2863             output_format_netcdf = 'netCDF4/HDF5 classic'
     2864          CASE ( 5 )
     2865             output_format_netcdf = 'parallel netCDF4/HDF5'
     2866          CASE ( 6 )
     2867             output_format_netcdf = 'parallel netCDF4/HDF5 classic'
     2868
     2869       END SELECT
    28492870
    28502871    ENDIF
     
    28822903!-- Check the NetCDF data format
    28832904#if ! defined ( __check )
    2884     IF ( netcdf_data_format > 2 )  THEN
     2905    IF ( netcdf_data_format > 2  .AND.  netcdf_data_format < 5 )  THEN
    28852906#if defined( __netcdf4 )
    28862907       CONTINUE
    28872908#else
    2888        message_string = 'NetCDF: NetCDF4 format requested but no ' // &
     2909       message_string = 'netCDF: netCDF4 format requested but no ' // &
    28892910                        'cpp-directive __netcdf4 given & switch '  // &
    28902911                        'back to 64-bit offset format'
     
    28932914#endif
    28942915    ENDIF
     2916    IF ( netcdf_data_format > 4 )  THEN
     2917#if defined( __netcdf4 ) && defined( __netcdf4_parallel )
     2918       CONTINUE
     2919#else
     2920       message_string = 'netCDF: netCDF4 parallel output requested but no ' // &
     2921                        'cpp-directive __netcdf4_parallel given & switch '  // &
     2922                        'back to netCDF4 non-parallel output'
     2923       CALL message( 'check_parameters', 'PA0099', 0, 1, 0, 6, 0 )
     2924       netcdf_data_format = netcdf_data_format - 2
    28952925#endif
    2896 !
     2926    ENDIF
     2927#endif
    28972928
    28982929#if ! defined( __check )
     2930!
    28992931!-- Check netcdf precison
    29002932    ldum = .FALSE.
  • palm/trunk/SOURCE/close_file.f90

    r965 r1031  
    44! Current revisions:
    55! -----------------
    6 !
     6! netCDF4 without parallel file support implemented
    77!
    88! Former revisions:
     
    189189
    190190                IF ( netcdf_output  .AND.  &
    191                      ( myid == 0  .OR.  netcdf_data_format > 2 ) )  THEN
     191                     ( myid == 0  .OR.  netcdf_data_format > 4 ) )  THEN
    192192                   nc_stat = NF90_CLOSE( id_set_xy(0) )
    193193                   CALL handle_netcdf_error( 'close_file', 44 )
     
    197197
    198198                IF ( netcdf_output  .AND.  &
    199                      ( myid == 0  .OR.  netcdf_data_format > 2 ) )  THEN
     199                     ( myid == 0  .OR.  netcdf_data_format > 4 ) )  THEN
    200200                   nc_stat = NF90_CLOSE( id_set_xz(0) )
    201201                   CALL handle_netcdf_error( 'close_file', 45 )
     
    205205
    206206                IF ( netcdf_output  .AND.  &
    207                      ( myid == 0  .OR.  netcdf_data_format > 2 ) )  THEN
     207                     ( myid == 0  .OR.  netcdf_data_format > 4 ) )  THEN
    208208                   nc_stat = NF90_CLOSE( id_set_yz(0) )
    209209                   CALL handle_netcdf_error( 'close_file', 46 )
     
    227227
    228228                IF ( netcdf_output  .AND.  &
    229                      ( myid == 0  .OR.  netcdf_data_format > 2 ) )  THEN
     229                     ( myid == 0  .OR.  netcdf_data_format > 4 ) )  THEN
    230230                   nc_stat = NF90_CLOSE( id_set_3d(0) )
    231231                   CALL handle_netcdf_error( 'close_file', 49 )
     
    256256
    257257                IF ( netcdf_output  .AND.  &
    258                      ( myid == 0  .OR.  netcdf_data_format > 2 ) )  THEN
     258                     ( myid == 0  .OR.  netcdf_data_format > 4 ) )  THEN
    259259                   nc_stat = NF90_CLOSE( id_set_xy(1) )
    260260                   CALL handle_netcdf_error( 'close_file', 52 )
     
    264264
    265265                IF ( netcdf_output  .AND.  &
    266                      ( myid == 0  .OR.  netcdf_data_format > 2 ) )  THEN
     266                     ( myid == 0  .OR.  netcdf_data_format > 4 ) )  THEN
    267267                   nc_stat = NF90_CLOSE( id_set_xz(1) )
    268268                   CALL handle_netcdf_error( 'close_file', 352 )
     
    272272
    273273                IF ( netcdf_output  .AND.  &
    274                      ( myid == 0  .OR.  netcdf_data_format > 2 ) )  THEN
     274                     ( myid == 0  .OR.  netcdf_data_format > 4 ) )  THEN
    275275                   nc_stat = NF90_CLOSE( id_set_yz(1) )
    276276                   CALL handle_netcdf_error( 'close_file', 353 )
     
    280280
    281281                IF ( netcdf_output  .AND.  &
    282                      ( myid == 0  .OR.  netcdf_data_format > 2 ) )  THEN
     282                     ( myid == 0  .OR.  netcdf_data_format > 4 ) )  THEN
    283283                   nc_stat = NF90_CLOSE( id_set_3d(1) )
    284284                   CALL handle_netcdf_error( 'close_file', 353 )
     
    288288             
    289289                IF ( netcdf_output  .AND.  &
    290                      ( myid == 0  .OR.  netcdf_data_format > 2 ) )  THEN
     290                     ( myid == 0  .OR.  netcdf_data_format > 4 ) )  THEN
    291291!
    292292!--                decompose fid into mid and av
  • palm/trunk/SOURCE/data_output_2d.f90

    r1008 r1031  
    44! Current revisions:
    55! -----------------
    6 !
     6! netCDF4 without parallel file support implemented
    77!
    88! Former revisions:
     
    4444!
    4545! 493 2010-03-01 08:30:24Z raasch
    46 ! NetCDF4 support (parallel output)
     46! netCDF4 support (parallel output)
    4747!
    4848! 367 2009-08-25 08:35:52Z maronga
    49 ! simulated_time in NetCDF output replaced by time_since_reference_point.
    50 ! Output of NetCDF messages with aid of message handling routine.
     49! simulated_time in netCDF output replaced by time_since_reference_point.
     50! Output of netCDF messages with aid of message handling routine.
    5151! Bugfix: averaging along z is not allowed for 2d quantities (e.g. u* and z0)
    5252! Output of messages replaced by message handling routine.
     
    8585! Description:
    8686! ------------
    87 ! Data output of horizontal cross-sections in NetCDF format or binary format
     87! Data output of horizontal cross-sections in netCDF format or binary format
    8888! compatible to old graphic software iso2d.
    8989! Attention: The position of the sectional planes is still not always computed
     
    146146
    147147!
    148 !--       Classic and 64bit offset NetCDF output is done only on PE0.
    149 !--       netCDF4/HDF5 output is done in parallel on all PEs.
    150           IF ( netcdf_output .AND. ( myid == 0 .OR. netcdf_data_format > 2 ) ) &
     148!--       Parallel netCDF4/HDF5 output is done on all PEs, all other on PE0 only
     149          IF ( netcdf_output .AND. ( myid == 0 .OR. netcdf_data_format > 4 ) ) &
    151150          THEN
    152151             CALL check_open( 101+av*10 )
     
    169168
    170169!
    171 !--       Classic and 64bit offset NetCDF output is done only on PE0.
    172 !--       netCDF4/HDF5 output may be done in parallel on all PEs.
    173           IF ( netcdf_output .AND. ( myid == 0 .OR. netcdf_data_format > 2 ) ) &
     170!--       Parallel netCDF4/HDF5 output is done on all PEs, all other on PE0 only
     171          IF ( netcdf_output .AND. ( myid == 0 .OR. netcdf_data_format > 4 ) ) &
    174172          THEN
    175173             CALL check_open( 102+av*10 )
     
    193191
    194192!
    195 !--       Classic and 64bit offset NetCDF output is done only on PE0.
    196 !--       netCDF4/HDF5 output may be done in parallel on all PEs.
    197           IF ( netcdf_output .AND. ( myid == 0 .OR. netcdf_data_format > 2 ) ) &
     193!--       Parallel netCDF4/HDF5 output is done on all PEs, all other on PE0 only
     194          IF ( netcdf_output .AND. ( myid == 0 .OR. netcdf_data_format > 4 ) ) &
    198195          THEN
    199196             CALL check_open( 103+av*10 )
     
    703700
    704701!
    705 !--                Update the NetCDF xy cross section time axis
    706                    IF ( myid == 0  .OR.  netcdf_data_format > 2 )  THEN
     702!--                Update the netCDF xy cross section time axis
     703                   IF ( myid == 0  .OR.  netcdf_data_format > 4 )  THEN
    707704                      IF ( simulated_time /= do2d_xy_last_time(av) )  THEN
    708705                         do2d_xy_time_count(av) = do2d_xy_time_count(av) + 1
    709706                         do2d_xy_last_time(av)  = simulated_time
    710707                         IF ( ( .NOT. data_output_2d_on_each_pe  .AND. &
    711                               netcdf_output )  .OR.  netcdf_data_format > 2 ) &
     708                              netcdf_output )  .OR.  netcdf_data_format > 4 ) &
    712709                         THEN
    713710#if defined( __netcdf )
     
    747744
    748745#if defined( __parallel )
    749                    IF ( netcdf_output  .AND.  netcdf_data_format > 2 )  THEN
    750 !
    751 !--                   Output in NetCDF4/HDF5 format.
     746                   IF ( netcdf_output  .AND.  netcdf_data_format > 4 )  THEN
     747!
     748!--                   Parallel output in netCDF4/HDF5 format.
    752749!--                   Do not output redundant ghost point data except for the
    753750!--                   boundaries of the total domain.
     
    951948                CASE ( 'xz' )
    952949!
    953 !--                Update the NetCDF xz cross section time axis
    954                    IF ( myid == 0  .OR.  netcdf_data_format > 2 )  THEN
     950!--                Update the netCDF xz cross section time axis
     951                   IF ( myid == 0  .OR.  netcdf_data_format > 4 )  THEN
    955952
    956953                      IF ( simulated_time /= do2d_xz_last_time(av) )  THEN
     
    958955                         do2d_xz_last_time(av)  = simulated_time
    959956                         IF ( ( .NOT. data_output_2d_on_each_pe  .AND.        &
    960                               netcdf_output )  .OR.  netcdf_data_format > 2 ) &
     957                              netcdf_output )  .OR.  netcdf_data_format > 4 ) &
    961958                         THEN
    962959#if defined( __netcdf )
     
    10161013
    10171014#if defined( __parallel )
    1018                    IF ( netcdf_output  .AND.  netcdf_data_format > 2 )  THEN
     1015                   IF ( netcdf_output  .AND.  netcdf_data_format > 4 )  THEN
    10191016!
    10201017!--                   ATTENTION: The following lines are a workaround, because
    10211018!--                              independet output does not work with the
    1022 !--                              current NetCDF4 installation. Therefore, data
     1019!--                              current netCDF4 installation. Therefore, data
    10231020!--                              are transferred from PEs having the cross
    10241021!--                              sections to other PEs along y having no cross
     
    10491046
    10501047!
    1051 !--                   Output in NetCDF4/HDF5 format.
     1048!--                   Output in netCDF4/HDF5 format.
    10521049!--                   Output only on those PEs where the respective cross
    10531050!--                   sections reside. Cross sections averaged along y are
     
    12611258                CASE ( 'yz' )
    12621259!
    1263 !--                Update the NetCDF yz cross section time axis
    1264                    IF ( myid == 0  .OR.  netcdf_data_format > 2 )  THEN
     1260!--                Update the netCDF yz cross section time axis
     1261                   IF ( myid == 0  .OR.  netcdf_data_format > 4 )  THEN
    12651262
    12661263                      IF ( simulated_time /= do2d_yz_last_time(av) )  THEN
     
    12681265                         do2d_yz_last_time(av)  = simulated_time
    12691266                         IF ( ( .NOT. data_output_2d_on_each_pe  .AND.        &
    1270                               netcdf_output )  .OR.  netcdf_data_format > 2 ) &
     1267                              netcdf_output )  .OR.  netcdf_data_format > 4 ) &
    12711268                         THEN
    12721269#if defined( __netcdf )
     
    13251322
    13261323#if defined( __parallel )
    1327                    IF ( netcdf_output  .AND.  netcdf_data_format > 2 )  THEN
     1324                   IF ( netcdf_output  .AND.  netcdf_data_format > 4 )  THEN
    13281325!
    13291326!--                   ATTENTION: The following lines are a workaround, because
    13301327!--                              independet output does not work with the
    1331 !--                              current NetCDF4 installation. Therefore, data
     1328!--                              current netCDF4 installation. Therefore, data
    13321329!--                              are transferred from PEs having the cross
    13331330!--                              sections to other PEs along y having no cross
     
    13581355
    13591356!
    1360 !--                   Output in NetCDF4/HDF5 format.
     1357!--                   Output in netCDF4/HDF5 format.
    13611358!--                   Output only on those PEs where the respective cross
    13621359!--                   sections reside. Cross sections averaged along x are
  • palm/trunk/SOURCE/data_output_3d.f90

    r1008 r1031  
    44! Current revisions:
    55! -----------------
    6 !
     6! netCDF4 without parallel file support implemented
    77!
    88! Former revisions:
     
    4545!
    4646! 493 2010-03-01 08:30:24Z raasch
    47 ! NetCDF4 support (parallel output)
     47! netCDF4 support (parallel output)
    4848!
    4949! 355 2009-07-17 01:03:01Z letzel
    50 ! simulated_time in NetCDF output replaced by time_since_reference_point.
    51 ! Output of NetCDF messages with aid of message handling routine.
     50! simulated_time in netCDF output replaced by time_since_reference_point.
     51! Output of netCDF messages with aid of message handling routine.
    5252! Output of messages replaced by message handling routine.
    5353! Bugfix: to_be_resorted => s_av for time-averaged scalars
     
    7575! Description:
    7676! ------------
    77 ! Output of the 3D-arrays in NetCDF and/or AVS format.
     77! Output of the 3D-arrays in netCDF and/or AVS format.
    7878!------------------------------------------------------------------------------!
    7979
     
    113113!-- Open output file.
    114114!-- Also creates coordinate and fld-file for AVS.
    115 !-- For classic or 64bit NetCDF output or output of other (old) data formats,
     115!-- For classic or 64bit netCDF output or output of other (old) data formats,
    116116!-- for a run on more than one PE, each PE opens its own file and
    117117!-- writes the data of its subdomain in binary format (regardless of the format
     
    119119!-- file by combine_plot_fields in the format requested by the user (netcdf
    120120!-- and/or avs).
    121 !-- For NetCDF4/HDF5 output, data is written in parallel into one file.
     121!-- For netCDF4/HDF5 output, data is written in parallel into one file.
    122122    IF ( netcdf_output )  THEN
    123        IF ( netcdf_data_format < 3 )  THEN
     123       IF ( netcdf_data_format < 5 )  THEN
    124124          CALL check_open( 30 )
    125125          IF ( myid == 0 )  CALL check_open( 106+av*10 )
     
    136136
    137137!
    138 !-- Update the NetCDF time axis
     138!-- Update the netCDF time axis
    139139#if defined( __netcdf )
    140     IF ( myid == 0  .OR.  netcdf_data_format > 2 )  THEN
     140    IF ( myid == 0  .OR.  netcdf_data_format > 4 )  THEN
    141141       do3d_time_count(av) = do3d_time_count(av) + 1
    142142       IF ( netcdf_output )  THEN
     
    456456#if defined( __parallel )
    457457          IF ( netcdf_output )  THEN
    458              IF ( netcdf_data_format < 3 )  THEN
    459 !
    460 !--             Classic or 64bit format. Data is output in parallel in FORTRAN
    461 !--             binary format here, and later collected into one file by
     458             IF ( netcdf_data_format < 5 )  THEN
     459!
     460!--             Non-parallel netCDF output. Data is output in parallel in
     461!--             FORTRAN binary format here, and later collected into one file by
    462462!--             combine_plot_fields
    463463                IF ( myid == 0 )  THEN
     
    478478#if defined( __netcdf )
    479479!
    480 !--             Output in NetCDF4/HDF5 format.
     480!--             Parallel output in netCDF4/HDF5 format.
    481481!--             Do not output redundant ghost point data except for the
    482482!--             boundaries of the total domain.
  • palm/trunk/SOURCE/data_output_mask.f90

    r1008 r1031  
    44! Current revisions:
    55! -----------------
    6 !
     6! netCDF4 without parallel file support implemented
    77!
    88! Former revisions:
     
    3535! Description:
    3636! ------------
    37 ! Masked data output in NetCDF format for current mask (current value of mid).
     37! Masked data output in netCDF format for current mask (current value of mid).
    3838!------------------------------------------------------------------------------!
    3939
     
    7272!
    7373!-- Open output file.
    74     IF ( netcdf_output  .AND.  ( myid == 0  .OR.  netcdf_data_format > 2 ) ) &
     74    IF ( netcdf_output  .AND.  ( myid == 0  .OR.  netcdf_data_format > 4 ) ) &
    7575    THEN
    7676       CALL check_open( 200+mid+av*max_masks )
     
    8888
    8989!
    90 !-- Update the NetCDF time axis.
     90!-- Update the netCDF time axis.
    9191    domask_time_count(mid,av) = domask_time_count(mid,av) + 1
    92     IF ( netcdf_output  .AND.  ( myid == 0  .OR.  netcdf_data_format > 2 ) ) &
     92    IF ( netcdf_output  .AND.  ( myid == 0  .OR.  netcdf_data_format > 4 ) ) &
    9393    THEN
    9494       nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), id_var_time_mask(mid,av), &
     
    106106!
    107107!--    Reallocate local_pf on PE 0 since its shape changes during MPI exchange
    108        IF ( netcdf_data_format < 3   .AND.  myid == 0  .AND.  if > 1 )  THEN
     108       IF ( netcdf_data_format < 5   .AND.  myid == 0  .AND.  if > 1 )  THEN
    109109          DEALLOCATE( local_pf )
    110110          ALLOCATE( local_pf(mask_size_l(mid,1),mask_size_l(mid,2), &
     
    366366!--    I/O block. I/O methods are implemented
    367367!--    (1) for parallel execution
    368 !--     a. with NetCDF 4 parallel I/O-enabled library
    369 !--     b. with NetCDF 3 library
     368!--     a. with netCDF 4 parallel I/O-enabled library
     369!--     b. with netCDF 3 library
    370370!--    (2) for serial execution.
    371371!--    The choice of method depends on the correct setting of preprocessor
    372 !--    directives __parallel and __netcdf4 as well as on the parameter
     372!--    directives __parallel and __netcdf4_parallel as well as on the parameter
    373373!--    netcdf_data_format.
    374374#if defined( __parallel )
    375 #if defined( __netcdf4 )
    376        IF ( netcdf_data_format > 2 )  THEN
    377 !
    378 !--       (1) a. Parallel I/O using NetCDF 4 (not yet tested)
     375#if defined( __netcdf4_parallel )
     376       IF ( netcdf_data_format > 4 )  THEN
     377!
     378!--       (1) a. Parallel I/O using netCDF 4 (not yet tested)
    379379          nc_stat = NF90_PUT_VAR( id_set_mask(mid,av),  &
    380380               id_var_domask(mid,av,if),  &
     
    463463!--       fast so that PE0 may receive wrong data on tag 0.
    464464          CALL MPI_BARRIER( comm2d, ierr )
    465 #if defined( __netcdf4 )
     465#if defined( __netcdf4_parallel )
    466466       ENDIF
    467467#endif
  • palm/trunk/SOURCE/header.f90

    r1017 r1031  
    44! Current revisions:
    55! -----------------
    6 !
     6! output of netCDF data format modified
    77!
    88! Former revisions:
     
    730730       output_format = ''
    731731       IF ( netcdf_output )  THEN
    732           IF ( netcdf_data_format == 1 )  THEN
    733              output_format = 'NetCDF classic'
    734           ELSE
    735              output_format = 'NetCDF 64bit offset'
    736           ENDIF
     732          output_format = output_format_netcdf
    737733       ENDIF
    738734       WRITE ( io, 344 )  output_format
     
    801797          output_format = ''
    802798          IF ( netcdf_output )  THEN
    803              IF ( netcdf_data_format == 1 )  THEN
    804                 output_format = 'NetCDF classic'
    805              ELSEIF ( netcdf_data_format == 2 )  THEN
    806                 output_format = 'NetCDF 64bit offset'
    807              ELSEIF ( netcdf_data_format == 3 )  THEN
    808                 output_format = 'NetCDF4/HDF5'
    809              ELSEIF ( netcdf_data_format == 4 )  THEN
    810                 output_format = 'NetCDF4/HDF5 clasic'
    811              ENDIF
     799             output_format = output_format_netcdf
    812800          ENDIF
    813801          IF ( iso2d_output )  THEN
    814802             IF ( netcdf_output )  THEN
    815                 output_format = TRIM( output_format ) // ' and iso2d'
     803                output_format = TRIM( output_format_netcdf ) // ' and iso2d'
    816804             ELSE
    817805                output_format = 'iso2d'
     
    962950          output_format = ''
    963951          IF ( netcdf_output )  THEN
    964              IF ( netcdf_data_format == 1 )  THEN
    965                 output_format = 'NetCDF classic'
    966              ELSEIF ( netcdf_data_format == 2 )  THEN
    967                 output_format = 'NetCDF 64bit offset'
    968              ELSEIF ( netcdf_data_format == 3 )  THEN
    969                 output_format = 'NetCDF4/HDF5'
    970              ELSEIF ( netcdf_data_format == 4 )  THEN
    971                 output_format = 'NetCDF4/HDF5 clasic'
    972              ENDIF
     952             output_format = output_format_netcdf
    973953          ENDIF
    974954          IF ( avs_output )  THEN
    975955             IF ( netcdf_output )  THEN
    976                 output_format = TRIM( output_format ) // ' and avs'
     956                output_format = TRIM( output_format_netcdf ) // ' and avs'
    977957             ELSE
    978958                output_format = 'avs'
     
    10581038             ENDIF
    10591039
    1060              output_format = ''
     1040             output_format = ' '
    10611041             IF ( netcdf_output )  THEN
    1062                 IF ( netcdf_data_format == 1 )  THEN
    1063                    output_format = 'NetCDF classic'
    1064                 ELSEIF ( netcdf_data_format == 2 )  THEN
    1065                    output_format = 'NetCDF 64bit offset'
    1066                 ELSEIF ( netcdf_data_format == 3 )  THEN
    1067                    output_format = 'NetCDF4/HDF5'
    1068                 ELSEIF ( netcdf_data_format == 4 )  THEN
    1069                    output_format = 'NetCDF4/HDF5 clasic'
    1070                 ENDIF
     1042                output_format = output_format_netcdf
    10711043             ENDIF
    10721044             WRITE ( io, 344 )  output_format
     
    11221094       output_format = ''
    11231095       IF ( netcdf_output )  THEN
    1124           IF ( netcdf_data_format == 1 )  THEN
    1125              output_format = 'NetCDF classic'
    1126           ELSE
    1127              output_format = 'NetCDF 64bit offset'
    1128           ENDIF
     1096          output_format = output_format_netcdf
    11291097       ENDIF
    11301098       WRITE ( io, 344 )  output_format
     
    11901158       WRITE ( io, 370 )
    11911159
    1192        output_format = ''
     1160       output_format = ' '
    11931161       IF ( netcdf_output )  THEN
    1194           IF ( netcdf_data_format == 1 )  THEN
    1195              output_format = 'NetCDF classic'
    1196           ELSE
    1197              output_format = 'NetCDF 64bit offset'
    1198           ENDIF
     1162          output_format = output_format_netcdf
    11991163       ENDIF
    12001164       WRITE ( io, 344 )  output_format
     
    15321496       IF ( dt_write_particle_data /= 9999999.9 )  THEN
    15331497          WRITE ( io, 485 )  dt_write_particle_data
    1534           output_format = ''
     1498          output_format = ' '
    15351499          IF ( netcdf_output )  THEN
    15361500             IF ( netcdf_data_format > 1 )  THEN
  • palm/trunk/SOURCE/init_masks.f90

    r997 r1031  
    44! Current revisions:
    55! -----------------
    6 !
     6! netCDF4 without parallel file support implemented
    77!
    88! Former revisions:
     
    8282!
    8383!-- Parallel mask output not yet tested
    84     IF ( netcdf_data_format > 2 )  THEN
     84    IF ( netcdf_data_format > 4 )  THEN
    8585       message_string = 'netCDF file formats '//                         &
    8686                        '3 (netCDF 4) and 4 (netCDF 4 Classic model)'//  &
     
    127127!
    128128!-- Global arrays are required by define_netcdf_header.
    129     IF ( myid == 0  .OR.  netcdf_data_format > 2 )  THEN
     129    IF ( myid == 0  .OR.  netcdf_data_format > 4 )  THEN
    130130       ALLOCATE( mask_i_global(max_masks,nx+1), &
    131131                 mask_j_global(max_masks,ny+1), &
     
    412412       CALL MPI_BARRIER( comm2d, ierr )
    413413       
    414        IF ( netcdf_data_format > 2 )  THEN 
     414       IF ( netcdf_data_format > 4 )  THEN
    415415         
    416416          CALL MPI_BCAST( mask_i_global(mid,:), nx+1, MPI_INTEGER, 0, comm2d, &
  • palm/trunk/SOURCE/modules.f90

    r1017 r1031  
    44! Current revisions:
    55! -----------------
    6 !
     6! +output_format_netcdf
    77!
    88! Former revisions:
     
    523523                             return_addres, return_username, &
    524524                             timestep_scheme = 'runge-kutta-3'
    525     CHARACTER (LEN=40)   ::  avs_data_file, topography = 'flat'
     525    CHARACTER (LEN=40)   ::  avs_data_file, output_format_netcdf, &
     526                             topography = 'flat'
    526527    CHARACTER (LEN=64)   ::  host = ' '
    527528    CHARACTER (LEN=80)   ::  log_message, run_identifier
  • palm/trunk/SOURCE/netcdf.f90

    r993 r1031  
    77! Current revisions:
    88! ------------------
    9 !
     9! netCDF4 without parallel file support implemented, new routines
     10! create_netcdf_file and open_write_netcdf_file at end
    1011!
    1112! Former revisions:
     
    2728!
    2829! 951 2012-07-19 14:22:52Z hoffmann
    29 ! cross_profiles, profile_rows, profile_columns are written to NetCDF header
     30! cross_profiles, profile_rows, profile_columns are written to netCDF header
    3031!
    3132! 771 2011-10-27 10:56:21Z heinze
     
    4142!
    4243! 519 2010-03-19 05:30:02Z raasch
    43 ! particle number defined as unlimited dimension in case of NetCDF4 output,
    44 ! special characters like * and " are now allowed for NetCDF variable names,
     44! particle number defined as unlimited dimension in case of netCDF4 output,
     45! special characters like * and " are now allowed for netCDF variable names,
    4546! replacement of these characters removed, routine clean_netcdf_varname
    4647! removed
    4748!
    4849! 493 2010-03-01 08:30:24Z raasch
    49 ! Extensions for NetCDF4 output
     50! Extensions for netCDF4 output
    5051!
    5152! 410 2009-12-04 17:05:40Z letzel
     
    5354!
    5455! 359 2009-08-19 16:56:44Z letzel
    55 ! for extended NetCDF files, the updated title attribute includes an update of
     56! for extended netCDF files, the updated title attribute includes an update of
    5657! time_average_text where appropriate.
    57 ! Bugfix for extended NetCDF files: In order to avoid 'data mode' errors if
     58! Bugfix for extended netCDF files: In order to avoid 'data mode' errors if
    5859! updated attributes are larger than their original size, NF90_PUT_ATT is called
    5960! in 'define mode' enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a
    6061! possible performance loss; an alternative strategy would be to ensure equal
    6162! attribute size in a job chain.
    62 ! NetCDF unit attribute in timeseries output in case of statistic
     63! netCDF unit attribute in timeseries output in case of statistic
    6364! regions added.
    64 ! Output of NetCDF messages with aid of message handling routine.
     65! Output of netCDF messages with aid of message handling routine.
    6566! Output of messages replaced by message handling routine.
    6667! Typographical errors fixed.
     
    9596! In case of extend = .FALSE.:
    9697! Define all necessary dimensions, axes and variables for the different
    97 ! NetCDF datasets. This subroutine is called from check_open after a new
    98 ! dataset is created. It leaves the open NetCDF files ready to write.
     98! netCDF datasets. This subroutine is called from check_open after a new
     99! dataset is created. It leaves the open netCDF files ready to write.
    99100!
    100101! In case of extend = .TRUE.:
     
    163164    IF ( .NOT. init_netcdf )  THEN
    164165!
    165 !--    Check and set accuracy for NetCDF output. First set default value
     166!--    Check and set accuracy for netCDF output. First set default value
    166167       nc_precision = NF90_REAL4
    167168
     
    547548
    548549!
    549 !--       Leave NetCDF define mode
     550!--       Leave netCDF define mode
    550551          nc_stat = NF90_ENDDEF( id_set_mask(mid,av) )
    551552          CALL handle_netcdf_error( 'netcdf', 498 )
     
    683684
    684685          IF ( TRIM( var_list ) /= TRIM( var_list_old ) )  THEN
    685              WRITE ( message_string, * ) 'NetCDF file for ', TRIM( var ), &
     686             WRITE ( message_string, * ) 'netCDF file for ', TRIM( var ), &
    686687                  ' data for mask', mid, ' from previous run found,', &
    687688                  '&but this file cannot be extended due to variable ', &
     
    710711
    711712          IF ( mask_size(mid,3) /= nz_old )  THEN
    712              WRITE ( message_string, * ) 'NetCDF file for ', TRIM( var ), &
     713             WRITE ( message_string, * ) 'netCDF file for ', TRIM( var ), &
    713714                  ' data for mask', mid, ' from previous run found,', &
    714715                  '&but this file cannot be extended due to mismatch in ', &
     
    748749
    749750          IF ( last_time_coordinate(1) >= simulated_time )  THEN
    750              WRITE ( message_string, * ) 'NetCDF file for ', TRIM( var ), &
     751             WRITE ( message_string, * ) 'netCDF file for ', TRIM( var ), &
    751752                  ' data for mask', mid, ' from previous run found,', &
    752753                  '&but this file cannot be extended because the current ', &
     
    792793          nc_stat = NF90_ENDDEF( id_set_mask(mid,av) )
    793794          CALL handle_netcdf_error( 'netcdf', 518 )
    794           WRITE ( message_string, * ) 'NetCDF file for ', TRIM( var ), &
     795          WRITE ( message_string, * ) 'netCDF file for ', TRIM( var ), &
    795796               ' data for mask', mid, ' from previous run found.', &
    796797               '&This file will be extended.'
     
    10551056                                     'units', TRIM( do3d_unit(av,i) ) )
    10561057             CALL handle_netcdf_error( 'netcdf', 357 )
    1057 #if defined( __netcdf4 )
     1058#if defined( __netcdf4_parallel )
    10581059!
    10591060!--          Set collective io operations for parallel io
    1060              IF ( netcdf_data_format > 2 )  THEN
     1061             IF ( netcdf_data_format > 4 )  THEN
    10611062                nc_stat = NF90_VAR_PAR_ACCESS( id_set_3d(av),     &
    10621063                                               id_var_do3d(av,i), &
     
    10811082
    10821083!
    1083 !--       Leave NetCDF define mode
     1084!--       Leave netCDF define mode
    10841085          nc_stat = NF90_ENDDEF( id_set_3d(av) )
    10851086          CALL handle_netcdf_error( 'netcdf', 82 )
     
    11881189
    11891190          IF ( TRIM( var_list ) /= TRIM( var_list_old ) )  THEN
    1190              message_string = 'NetCDF file for volume data ' //             & 
     1191             message_string = 'netCDF file for volume data ' //             &
    11911192                              TRIM( var ) // ' from previous run found,' // &
    11921193                              '&but this file cannot be extended due to' // &
     
    12131214
    12141215          IF ( nz_do3d-nzb+1 /= nz_old )  THEN
    1215               message_string = 'NetCDF file for volume data ' //             &
     1216              message_string = 'netCDF file for volume data ' //             &
    12161217                               TRIM( var ) // ' from previous run found,' // &
    12171218                               '&but this file cannot be extended due to' // &
     
    12491250
    12501251          IF ( last_time_coordinate(1) >= simulated_time )  THEN
    1251              message_string = 'NetCDF file for volume data ' // &
     1252             message_string = 'netCDF file for volume data ' // &
    12521253                              TRIM( var ) // ' from previous run found,' // &
    12531254                              '&but this file cannot be extended becaus' // &
     
    12701271                                       id_var_do3d(av,i) )
    12711272             CALL handle_netcdf_error( 'netcdf', 95 )
    1272 #if defined( __netcdf4 )
     1273#if defined( __netcdf4_parallel )
    12731274!
    12741275!--          Set collective io operations for parallel io
    1275              IF ( netcdf_data_format > 2 )  THEN
     1276             IF ( netcdf_data_format > 4 )  THEN
    12761277                nc_stat = NF90_VAR_PAR_ACCESS( id_set_3d(av),     &
    12771278                                               id_var_do3d(av,i), &
     
    13041305          nc_stat = NF90_ENDDEF( id_set_3d(av) )
    13051306          CALL handle_netcdf_error( 'netcdf', 430 )
    1306           message_string = 'NetCDF file for volume data ' //             &
     1307          message_string = 'netCDF file for volume data ' //             &
    13071308                           TRIM( var ) // ' from previous run found.' // &
    13081309                           '&This file will be extended.'
     
    16211622                                        'units', TRIM( do2d_unit(av,i) ) )
    16221623                CALL handle_netcdf_error( 'netcdf', 354 )
    1623 #if defined( __netcdf4 )
     1624#if defined( __netcdf4_parallel )
    16241625!
    16251626!--             Set collective io operations for parallel io
    1626                 IF ( netcdf_data_format > 2 )  THEN
     1627                IF ( netcdf_data_format > 4 )  THEN
    16271628                   nc_stat = NF90_VAR_PAR_ACCESS( id_set_xy(av),     &
    16281629                                                  id_var_do2d(av,i), &
     
    16491650
    16501651!
    1651 !--       Leave NetCDF define mode
     1652!--       Leave netCDF define mode
    16521653          nc_stat = NF90_ENDDEF( id_set_xy(av) )
    16531654          CALL handle_netcdf_error( 'netcdf', 122 )
     
    17941795
    17951796          IF ( TRIM( var_list ) /= TRIM( var_list_old ) )  THEN
    1796              message_string = 'NetCDF file for cross-sections ' //           &
     1797             message_string = 'netCDF file for cross-sections ' //           &
    17971798                              TRIM( var ) // ' from previous run found,' //  &
    17981799                              '& but this file cannot be extended due to' // &
     
    18271828
    18281829          IF ( ns /= ns_old )  THEN
    1829              message_string = 'NetCDF file for cross-sections ' //          &
     1830             message_string = 'netCDF file for cross-sections ' //          &
    18301831                              TRIM( var ) // ' from previous run found,' // &
    18311832                              '&but this file cannot be extended due to' // &
     
    18481849             IF ( section(i,1) /= -1 )  THEN
    18491850                IF ( zu(section(i,1)) /= netcdf_data(i) )  THEN
    1850                    message_string = 'NetCDF file for cross-sections ' //     &
     1851                   message_string = 'netCDF file for cross-sections ' //     &
    18511852                               TRIM( var ) // ' from previous run found,' // &
    18521853                               '&but this file cannot be extended' //        &
     
    18611862             ELSE
    18621863                IF ( -1.0 /= netcdf_data(i) )  THEN
    1863                    message_string = 'NetCDF file for cross-sections ' //     &
     1864                   message_string = 'netCDF file for cross-sections ' //     &
    18641865                               TRIM( var ) // ' from previous run found,' // &
    18651866                               '&but this file cannot be extended' //        &
     
    19011902
    19021903          IF ( last_time_coordinate(1) >= simulated_time )  THEN
    1903              message_string = 'NetCDF file for cross sections ' //          &
     1904             message_string = 'netCDF file for cross sections ' //          &
    19041905                              TRIM( var ) // ' from previous run found,' // &
    19051906                              '&but this file cannot be extended becaus' // &
     
    19231924                                          id_var_do2d(av,i) )
    19241925                CALL handle_netcdf_error( 'netcdf', 138 )
    1925 #if defined( __netcdf4 )
     1926#if defined( __netcdf4_parallel )
    19261927!
    19271928!--             Set collective io operations for parallel io
    1928                 IF ( netcdf_data_format > 2 )  THEN
     1929                IF ( netcdf_data_format > 4 )  THEN
    19291930                   nc_stat = NF90_VAR_PAR_ACCESS( id_set_xy(av),     &
    19301931                                                  id_var_do2d(av,i), &
     
    19581959          nc_stat = NF90_ENDDEF( id_set_xy(av) )
    19591960          CALL handle_netcdf_error( 'netcdf', 432 )
    1960           message_string = 'NetCDF file for cross-sections ' //           &
     1961          message_string = 'netCDF file for cross-sections ' //           &
    19611962                            TRIM( var ) // ' from previous run found.' // &
    19621963                           '&This file will be extended.'
     
    22052206                                        'units', TRIM( do2d_unit(av,i) ) )
    22062207                CALL handle_netcdf_error( 'netcdf', 355 )
    2207 #if defined( __netcdf4 )
     2208#if defined( __netcdf4_parallel )
    22082209!
    22092210!--             Set independent io operations for parallel io. Collective io
    22102211!--             is only allowed in case of a 1d-decomposition along x, because
    22112212!--             otherwise, not all PEs have output data.
    2212                 IF ( netcdf_data_format > 2 )  THEN
     2213                IF ( netcdf_data_format > 4 )  THEN
    22132214                   IF ( npey == 1 )  THEN
    22142215                      nc_stat = NF90_VAR_PAR_ACCESS( id_set_xz(av),     &
     
    22172218                   ELSE
    22182219!
    2219 !--                   ATTENTION: Due to a probable bug in the NetCDF4
     2220!--                   ATTENTION: Due to a probable bug in the netCDF4
    22202221!--                              installation, independet output does not work
    22212222!--                              A workaround is used in data_output_2d on those
     
    22492250
    22502251!
    2251 !--       Leave NetCDF define mode
     2252!--       Leave netCDF define mode
    22522253          nc_stat = NF90_ENDDEF( id_set_xz(av) )
    22532254          CALL handle_netcdf_error( 'netcdf', 162 )
     
    23642365
    23652366          IF ( TRIM( var_list ) /= TRIM( var_list_old ) )  THEN
    2366              message_string = 'NetCDF file for cross-sections ' //           &
     2367             message_string = 'netCDF file for cross-sections ' //           &
    23672368                              TRIM( var ) // ' from previous run found,' //  &
    23682369                              '& but this file cannot be extended due to' // &
     
    23972398
    23982399          IF ( ns /= ns_old )  THEN
    2399              message_string = 'NetCDF file for cross-sections ' //          &
     2400             message_string = 'netCDF file for cross-sections ' //          &
    24002401                              TRIM( var ) // ' from previous run found,' // &
    24012402                              '&but this file cannot be extended due to' // &
     
    24182419             IF ( section(i,2) /= -1 )  THEN
    24192420                IF ( ( ( section(i,2) + 0.5 ) * dy ) /= netcdf_data(i) )  THEN
    2420                    message_string = 'NetCDF file for cross-sections ' //     &
     2421                   message_string = 'netCDF file for cross-sections ' //     &
    24212422                               TRIM( var ) // ' from previous run found,' // &
    24222423                               '&but this file cannot be extended' //        &
     
    24312432             ELSE
    24322433                IF ( -1.0 /= netcdf_data(i) )  THEN
    2433                    message_string = 'NetCDF file for cross-sections ' //     &
     2434                   message_string = 'netCDF file for cross-sections ' //     &
    24342435                               TRIM( var ) // ' from previous run found,' // &
    24352436                               '&but this file cannot be extended' //        &
     
    24712472
    24722473          IF ( last_time_coordinate(1) >= simulated_time )  THEN
    2473              message_string = 'NetCDF file for cross sections ' //          &
     2474             message_string = 'netCDF file for cross sections ' //          &
    24742475                              TRIM( var ) // ' from previous run found,' // &
    24752476                              '&but this file cannot be extended becaus' // &
     
    24932494                                          id_var_do2d(av,i) )
    24942495                CALL handle_netcdf_error( 'netcdf', 177 )
    2495 #if defined( __netcdf4 )
     2496#if defined( __netcdf4_parallel )
    24962497!
    24972498!--             Set independent io operations for parallel io. Collective io
    24982499!--             is only allowed in case of a 1d-decomposition along x, because
    24992500!--             otherwise, not all PEs have output data.
    2500                 IF ( netcdf_data_format > 2 )  THEN
     2501                IF ( netcdf_data_format > 4 )  THEN
    25012502                   IF ( npey == 1 )  THEN
    25022503                      nc_stat = NF90_VAR_PAR_ACCESS( id_set_xz(av),     &
     
    25052506                   ELSE
    25062507!
    2507 !--                   ATTENTION: Due to a probable bug in the NetCDF4
     2508!--                   ATTENTION: Due to a probable bug in the netCDF4
    25082509!--                              installation, independet output does not work
    25092510!--                              A workaround is used in data_output_2d on those
     
    25442545          nc_stat = NF90_ENDDEF( id_set_xz(av) )
    25452546          CALL handle_netcdf_error( 'netcdf', 434 )
    2546           message_string = 'NetCDF file for cross-sections ' //           &
     2547          message_string = 'netCDF file for cross-sections ' //           &
    25472548                            TRIM( var ) // ' from previous run found.' // &
    25482549                           '&This file will be extended.'
     
    27912792                                        'units', TRIM( do2d_unit(av,i) ) )
    27922793                CALL handle_netcdf_error( 'netcdf', 356 )
    2793 #if defined( __netcdf4 )
     2794#if defined( __netcdf4_parallel )
    27942795!
    27952796!--             Set independent io operations for parallel io. Collective io
    27962797!--             is only allowed in case of a 1d-decomposition along y, because
    27972798!--             otherwise, not all PEs have output data.
    2798                 IF ( netcdf_data_format > 2 )  THEN
     2799                IF ( netcdf_data_format > 4 )  THEN
    27992800                   IF ( npex == 1 )  THEN
    28002801                      nc_stat = NF90_VAR_PAR_ACCESS( id_set_yz(av),     &
     
    28032804                   ELSE
    28042805!
    2805 !--                   ATTENTION: Due to a probable bug in the NetCDF4
     2806!--                   ATTENTION: Due to a probable bug in the netCDF4
    28062807!--                              installation, independet output does not work
    28072808!--                              A workaround is used in data_output_2d on those
     
    28352836
    28362837!
    2837 !--       Leave NetCDF define mode
     2838!--       Leave netCDF define mode
    28382839          nc_stat = NF90_ENDDEF( id_set_yz(av) )
    28392840          CALL handle_netcdf_error( 'netcdf', 201 )
     
    29482949
    29492950          IF ( TRIM( var_list ) /= TRIM( var_list_old ) )  THEN
    2950              message_string = 'NetCDF file for cross-sections ' //           &
     2951             message_string = 'netCDF file for cross-sections ' //           &
    29512952                              TRIM( var ) // ' from previous run found,' //  &
    29522953                              '& but this file cannot be extended due to' // &
     
    29812982
    29822983          IF ( ns /= ns_old )  THEN
    2983              message_string = 'NetCDF file for cross-sections ' //          &
     2984             message_string = 'netCDF file for cross-sections ' //          &
    29842985                              TRIM( var ) // ' from previous run found,' // &
    29852986                              '&but this file cannot be extended due to' // &
     
    30023003             IF ( section(i,3) /= -1 )  THEN
    30033004                IF ( ( ( section(i,3) + 0.5 ) * dx ) /= netcdf_data(i) )  THEN
    3004                    message_string = 'NetCDF file for cross-sections ' //    &
     3005                   message_string = 'netCDF file for cross-sections ' //    &
    30053006                              TRIM( var ) // ' from previous run found,' // &
    30063007                              '&but this file cannot be extended' //        &
     
    30153016             ELSE
    30163017                IF ( -1.0 /= netcdf_data(i) )  THEN
    3017                    message_string = 'NetCDF file for cross-sections ' //    &
     3018                   message_string = 'netCDF file for cross-sections ' //    &
    30183019                              TRIM( var ) // ' from previous run found,' // &
    30193020                              '&but this file cannot be extended' //        &
     
    30553056
    30563057          IF ( last_time_coordinate(1) >= simulated_time )  THEN
    3057              message_string = 'NetCDF file for cross sections ' //          &
     3058             message_string = 'netCDF file for cross sections ' //          &
    30583059                              TRIM( var ) // ' from previous run found,' // &
    30593060                              '&but this file cannot be extended becaus' // &
     
    30773078                                          id_var_do2d(av,i) )
    30783079                CALL handle_netcdf_error( 'netcdf', 216 )
    3079 #if defined( __netcdf4 )
     3080#if defined( __netcdf4_parallel )
    30803081!
    30813082!--             Set independent io operations for parallel io. Collective io
    30823083!--             is only allowed in case of a 1d-decomposition along y, because
    30833084!--             otherwise, not all PEs have output data.
    3084                 IF ( netcdf_data_format > 2 )  THEN
     3085                IF ( netcdf_data_format > 4 )  THEN
    30853086                   IF ( npex == 1 )  THEN
    30863087                      nc_stat = NF90_VAR_PAR_ACCESS( id_set_yz(av),     &
     
    30893090                   ELSE
    30903091!
    3091 !--                   ATTENTION: Due to a probable bug in the NetCDF4
     3092!--                   ATTENTION: Due to a probable bug in the netCDF4
    30923093!--                              installation, independet output does not work
    30933094!--                              A workaround is used in data_output_2d on those
     
    31283129          nc_stat = NF90_ENDDEF( id_set_yz(av) )
    31293130          CALL handle_netcdf_error( 'netcdf', 436 )
    3130           message_string = 'NetCDF file for cross-sections ' //           &
     3131          message_string = 'netCDF file for cross-sections ' //           &
    31313132                            TRIM( var ) // ' from previous run found.' // &
    31323133                           '&This file will be extended.'
     
    34323433
    34333434!
    3434 !--       Leave NetCDF define mode
     3435!--       Leave netCDF define mode
    34353436          nc_stat = NF90_ENDDEF( id_set_pr )
    34363437          CALL handle_netcdf_error( 'netcdf', 238 )
     
    34783479
    34793480          IF ( TRIM( var_list ) /= TRIM( var_list_old ) )  THEN
    3480              message_string = 'NetCDF file for vertical profiles ' //        &
     3481             message_string = 'netCDF file for vertical profiles ' //        &
    34813482                              'from previous run found,' //                  &
    34823483                              '& but this file cannot be extended due to' // &
     
    35123513
    35133514          IF ( last_time_coordinate(1) >= simulated_time )  THEN
    3514              message_string = 'NetCDF file for vertical profiles ' //       &
     3515             message_string = 'netCDF file for vertical profiles ' //       &
    35153516                              'from previous run found,' //                 &
    35163517                              '&but this file cannot be extended becaus' // &
     
    35783579          nc_stat = NF90_ENDDEF( id_set_pr )
    35793580          CALL handle_netcdf_error( 'netcdf', 438 )
    3580           message_string = 'NetCDF file for vertical profiles ' // &
     3581          message_string = 'netCDF file for vertical profiles ' // &
    35813582                           'from previous run found.' //           &
    35823583                           '&This file will be extended.'
     
    36673668
    36683669!
    3669 !--       Leave NetCDF define mode
     3670!--       Leave netCDF define mode
    36703671          nc_stat = NF90_ENDDEF( id_set_ts )
    36713672          CALL handle_netcdf_error( 'netcdf', 259 )
     
    37003701
    37013702          IF ( TRIM( var_list ) /= TRIM( var_list_old ) )  THEN
    3702              message_string = 'NetCDF file for time series ' //              &
     3703             message_string = 'netCDF file for time series ' //              &
    37033704                              'from previous run found,' //                  &
    37043705                              '& but this file cannot be extended due to' // &
     
    37343735
    37353736          IF ( last_time_coordinate(1) >= simulated_time )  THEN
    3736              message_string = 'NetCDF file for time series ' //             &
     3737             message_string = 'netCDF file for time series ' //             &
    37373738                              'from previous run found,' //                 &
    37383739                              '&but this file cannot be extended becaus' // &
     
    37833784          nc_stat = NF90_ENDDEF( id_set_ts )
    37843785          CALL handle_netcdf_error( 'netcdf', 440 )
    3785           message_string = 'NetCDF file for time series ' // &
     3786          message_string = 'netCDF file for time series ' // &
    37863787                           'from previous run found.' //     &
    37873788                           '&This file will be extended.'
     
    39823983
    39833984!
    3984 !--       Leave NetCDF define mode
     3985!--       Leave netCDF define mode
    39853986          nc_stat = NF90_ENDDEF( id_set_sp )
    39863987          CALL handle_netcdf_error( 'netcdf', 292 )
     
    40604061
    40614062          IF ( TRIM( var_list ) /= TRIM( var_list_old ) )  THEN
    4062              message_string = 'NetCDF file for spectra  ' //                 &
     4063             message_string = 'netCDF file for spectra  ' //                 &
    40634064                              'from previous run found,' //                  &
    40644065                              '& but this file cannot be extended due to' // &
     
    40944095
    40954096          IF ( ns /= ns_old )  THEN
    4096              message_string = 'NetCDF file for spectra ' //                 &
     4097             message_string = 'netCDF file for spectra ' //                 &
    40974098                              ' from previous run found,' //                &
    40984099                              '&but this file cannot be extended due to' // &
     
    41144115          DO  i = 1, ns
    41154116             IF ( zu(comp_spectra_level(i)) /= netcdf_data(i) )  THEN
    4116                 message_string = 'NetCDF file for spectra ' //                 &
     4117                message_string = 'netCDF file for spectra ' //                 &
    41174118                                 ' from previous run found,' //                &
    41184119                                 '&but this file cannot be extended due to' // &
     
    41524153
    41534154          IF ( last_time_coordinate(1) >= simulated_time )  THEN
    4154              message_string = 'NetCDF file for spectra ' //                 &
     4155             message_string = 'netCDF file for spectra ' //                 &
    41554156                              'from previous run found,' //                 &
    41564157                              '&but this file cannot be extended becaus' // &
     
    42164217          nc_stat = NF90_ENDDEF( id_set_sp )
    42174218          CALL handle_netcdf_error( 'netcdf', 442 )
    4218           message_string = 'NetCDF file for spectra ' //     &
     4219          message_string = 'netCDF file for spectra ' //     &
    42194220                           'from previous run found.' //     &
    42204221                           '&This file will be extended.'
     
    42514252          ELSE
    42524253!
    4253 !--          NetCDF4 allows more than one unlimited dimension
     4254!--          netCDF4 allows more than one unlimited dimension
    42544255             nc_stat = NF90_DEF_DIM( id_set_prt, 'particle_number', &
    42554256                                     NF90_UNLIMITED, id_dim_prtnum)
     
    42964297
    42974298!
    4298 !--       Leave NetCDF define mode
     4299!--       Leave netCDF define mode
    42994300          nc_stat = NF90_ENDDEF( id_set_prt )
    43004301          CALL handle_netcdf_error( 'netcdf', 322 )
     
    43274328
    43284329          IF ( last_time_coordinate(1) >= simulated_time )  THEN
    4329              message_string = 'NetCDF file for particles ' //               &
     4330             message_string = 'netCDF file for particles ' //               &
    43304331                              'from previous run found,' //                 &
    43314332                              '&but this file cannot be extended becaus' // &
     
    43554356          ENDDO
    43564357
    4357           message_string = 'NetCDF file for particles ' // &
     4358          message_string = 'netCDF file for particles ' // &
    43584359                           'from previous run found.' //   &
    43594360                           '&This file will be extended.'
     
    44394440
    44404441!
    4441 !--       Leave NetCDF define mode
     4442!--       Leave netCDF define mode
    44424443          nc_stat = NF90_ENDDEF( id_set_pts )
    44434444          CALL handle_netcdf_error( 'netcdf', 404 )
     
    44774478
    44784479          IF ( TRIM( var_list ) /= TRIM( var_list_old ) )  THEN
    4479              message_string = 'NetCDF file for particle time series ' //     &
     4480             message_string = 'netCDF file for particle time series ' //     &
    44804481                              'from previous run found,' //                  &
    44814482                              '& but this file cannot be extended due to' // &
     
    45114512
    45124513          IF ( last_time_coordinate(1) >= simulated_time )  THEN
    4513              message_string = 'NetCDF file for particle time series ' //    &
     4514             message_string = 'netCDF file for particle time series ' //    &
    45144515                              'from previous run found,' //                 &
    45154516                              '&but this file cannot be extended becaus' // &
     
    45644565          nc_stat = NF90_ENDDEF( id_set_pts )
    45654566          CALL handle_netcdf_error( 'netcdf', 444 )
    4566           message_string = 'NetCDF file for particle time series ' // &
     4567          message_string = 'netCDF file for particle time series ' // &
    45674568                           'from previous run found.' //              &
    45684569                           '&This file will be extended.'
     
    45814582
    45824583
    4583 SUBROUTINE handle_netcdf_error( routine_name, errno )
     4584 SUBROUTINE create_netcdf_file( filename , id, parallel, errno )
    45844585#if defined( __netcdf )
    45854586
    45864587!------------------------------------------------------------------------------!
    4587 !
     4588! Description:
     4589! ------------
     4590! Creates a netCDF file and give back the id. The parallel flag has to be TRUE
     4591! for parallel netCDF output support.
     4592!------------------------------------------------------------------------------!
     4593
     4594    USE control_parameters
     4595    USE netcdf
     4596    USE netcdf_control
     4597    USE pegrid
     4598
     4599    IMPLICIT NONE
     4600
     4601    CHARACTER (LEN=*), INTENT(IN) :: filename
     4602    INTEGER, INTENT(IN)           :: errno
     4603    INTEGER, INTENT(OUT)          :: id
     4604    LOGICAL, INTENT(IN)           :: parallel
     4605
     4606
     4607!
     4608!-- Create a new netCDF output file with requested netCDF format
     4609    IF ( netcdf_data_format == 1 )  THEN
     4610!
     4611!-- Classic netCDF format
     4612    nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id )
     4613
     4614    ELSEIF ( netcdf_data_format == 2 )  THEN
     4615!
     4616!--    64bit-offset format
     4617       nc_stat = NF90_CREATE( filename,                                        &
     4618                              OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ), id )
     4619
     4620#if defined( __netcdf4 )
     4621    ELSEIF ( netcdf_data_format == 3  .OR.                                     &
     4622             ( .NOT. parallel  .AND.  netcdf_data_format == 5 ) )  THEN
     4623!
     4624!--    netCDF4/HDF5 format
     4625       nc_stat = NF90_CREATE( filename, OR( NF90_NOCLOBBER, NF90_NETCDF4 ), id )
     4626
     4627    ELSEIF ( netcdf_data_format == 4  .OR.                                     &
     4628             ( .NOT. parallel  .AND.  netcdf_data_format == 6 ) )  THEN
     4629!
     4630!--    netCDF4/HDF5 format with classic model flag
     4631       nc_stat = NF90_CREATE( filename,                                        &
     4632                              OR( NF90_NOCLOBBER,                              &
     4633                              OR( NF90_CLASSIC_MODEL, NF90_HDF5 ) ), id )
     4634
     4635#if defined( __netcdf4_parallel )
     4636    ELSEIF ( netcdf_data_format == 5  .AND.  parallel )  THEN
     4637!
     4638!--    netCDF4/HDF5 format, parallel
     4639       nc_stat = NF90_CREATE( filename, OR( NF90_NOCLOBBER, NF90_NETCDF4 ),    &
     4640                              id, COMM = comm2d, INFO = MPI_INFO_NULL )
     4641
     4642    ELSEIF ( netcdf_data_format == 6  .AND.  parallel )  THEN
     4643!
     4644!--    netCDF4/HDF5 format with classic model flag, parallel
     4645       nc_stat = NF90_CREATE( filename,                                        &
     4646                              OR( NF90_NOCLOBBER,                              &
     4647                              OR( NF90_CLASSIC_MODEL, NF90_HDF5 ) ),           &
     4648                              id, COMM = comm2d, INFO = MPI_INFO_NULL )
     4649
     4650#endif
     4651#endif
     4652    ENDIF
     4653
     4654    CALL handle_netcdf_error( 'create_netcdf_file', errno )
     4655#endif
     4656 END SUBROUTINE create_netcdf_file
     4657
     4658
     4659 SUBROUTINE open_write_netcdf_file( filename, id, parallel, errno )
     4660#if defined( __netcdf )
     4661
     4662!------------------------------------------------------------------------------!
     4663! Description:
     4664! ------------
     4665! Opens an existing netCDF file for writing and gives back the id.
     4666! The parallel flag has to be TRUE for parallel netCDF output support.
     4667!------------------------------------------------------------------------------!
     4668
     4669    USE control_parameters
     4670    USE netcdf
     4671    USE netcdf_control
     4672    USE pegrid
     4673
     4674    IMPLICIT NONE
     4675
     4676    CHARACTER (LEN=*), INTENT(IN) :: filename
     4677    INTEGER, INTENT(IN)           :: errno
     4678    INTEGER, INTENT(OUT)          :: id
     4679    LOGICAL, INTENT(IN)           :: parallel
     4680
     4681
     4682    IF ( netcdf_data_format < 5  .OR.  .NOT. parallel )  THEN
     4683       nc_stat = NF90_OPEN( filename, NF90_WRITE, id )
     4684#if defined( __netcdf4 )
     4685#if defined( __netcdf4par )
     4686    ELSEIF ( netcdf_data_format > 4  .AND.  parallel )  THEN
     4687       nc_stat = NF90_OPEN( filename, NF90_WRITE, id, COMM = comm2d, &
     4688                            INFO = MPI_INFO_NULL )
     4689#endif
     4690#endif
     4691    ENDIF
     4692
     4693    CALL handle_netcdf_error( 'open_write_netcdf_file', errno )
     4694#endif
     4695 END SUBROUTINE open_write_netcdf_file
     4696
     4697
     4698 SUBROUTINE handle_netcdf_error( routine_name, errno )
     4699#if defined( __netcdf )
     4700
     4701!------------------------------------------------------------------------------!
    45884702! Description:
    45894703! ------------
Note: See TracChangeset for help on using the changeset viewer.