Changeset 493 for palm/trunk/SOURCE
- Timestamp:
- Mar 1, 2010 8:30:24 AM (15 years ago)
- Location:
- palm/trunk/SOURCE
- Files:
-
- 1 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/check_open.f90
r449 r493 4 4 ! Current revisions: 5 5 ! ----------------- 6 ! 6 ! NetCDF4 support (parallel output) 7 7 ! 8 8 ! Former revisions: … … 125 125 SELECT CASE ( file_id ) 126 126 127 CASE ( 15, 16, 17, 18, 19, 40:49, 50:59, 81:84, 101:107, 109, 111:113, & 128 116, 121:160 ) 127 CASE ( 15, 16, 17, 18, 19, 40:49, 50:59, 81:84, 104:105, 107, 109 ) 129 128 130 IF ( .NOT. format_parallel_io) THEN 129 IF ( myid /= 0 ) THEN 130 WRITE( message_string, * ) 'opening file-id ',file_id, & 131 ' not allowed for PE ',myid 132 CALL message( 'check_open', 'PA0167', 2, 2, -1, 6, 1 ) 133 ENDIF 134 135 CASE ( 101:103, 106, 111:113, 116, 121:160 ) 136 137 IF ( netcdf_data_format < 3 ) THEN 131 138 132 139 IF ( myid /= 0 ) THEN … … 136 143 ENDIF 137 144 138 145 ENDIF 139 146 140 147 CASE ( 21, 22, 23 ) … … 705 712 IF ( netcdf_extend ) THEN 706 713 ! 707 !-- Open an existing NetCDF file for output 714 !-- Open an existing NetCDF file for output 715 #if defined( __netcdf4 ) 716 nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_xy(av), & 717 COMM = comm2d, INFO = MPI_INFO_NULL ) 718 #else 708 719 nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_xy(av) ) 720 #endif 709 721 710 722 CALL handle_netcdf_error( 'check_open', 20 ) … … 720 732 nc_stat = NF90_CLOSE( id_set_xy(av) ) 721 733 CALL handle_netcdf_error( 'check_open', 21 ) 722 CALL local_system( 'rm ' // TRIM( filename ) )734 IF ( myid == 0 ) CALL local_system( 'rm ' // TRIM( filename ) ) 723 735 ENDIF 724 736 … … 727 739 IF ( .NOT. netcdf_extend ) THEN 728 740 ! 729 !-- Create a new NetCDF output file 730 IF ( netcdf_64bit ) THEN 731 #if defined( __netcdf_64bit ) 741 !-- Create a new NetCDF output file with requested NetCDF format 742 IF ( netcdf_data_format == 1 ) THEN 743 ! 744 !-- Classic NetCDF format 745 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_xy(av) ) 746 747 ELSEIF ( netcdf_data_format == 2 ) THEN 748 ! 749 !-- 64bit-offset format 732 750 nc_stat = NF90_CREATE( filename, & 733 751 OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),& 734 752 id_set_xy(av) ) 735 #else 736 message_string = 'NetCDF: no 64-bit offset allowed ' // & 737 'on this machine' 738 CALL message( 'check_open', 'PA0171', 0, 1, 0, 6, 0 ) 739 740 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_xy(av) ) 741 #endif 742 ELSE 743 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_xy(av) ) 744 ENDIF 753 754 #if defined( __netcdf4 ) 755 ELSEIF ( netcdf_data_format == 3 ) THEN 756 ! 757 !-- NetCDF4/HDF5 format 758 nc_stat = NF90_CREATE( filename, & 759 OR( NF90_NOCLOBBER, NF90_NETCDF4 ), & 760 id_set_xy(av), COMM = comm2d, & 761 INFO = MPI_INFO_NULL ) 762 763 ELSEIF ( netcdf_data_format == 4 ) THEN 764 ! 765 !-- NetCDF4/HDF5 format with classic model flag 766 nc_stat = NF90_CREATE( filename, & 767 OR( NF90_NOCLOBBER, & 768 OR( NF90_CLASSIC_MODEL, NF90_HDF5 ) ), & 769 id_set_xy(av), COMM = comm2d, & 770 INFO = MPI_INFO_NULL ) 771 #endif 772 ENDIF 773 745 774 CALL handle_netcdf_error( 'check_open', 22 ) 775 746 776 ! 747 777 !-- Define the header 748 778 CALL define_netcdf_header( 'xy', netcdf_extend, av ) 779 780 ! 781 !-- In case of parallel NetCDF output, create flag file which tells 782 !-- combine_plot_fields that nothing is to do. 783 IF ( myid == 0 .AND. netcdf_data_format > 2 ) THEN 784 OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_XY' ) 785 WRITE ( 99, '(A)' ) 'no combine_plot_fields.x neccessary' 786 CLOSE( 99 ) 787 ENDIF 749 788 750 789 ENDIF … … 769 808 ! 770 809 !-- Open an existing NetCDF file for output 810 #if defined( __netcdf4 ) 811 nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_xz(av), & 812 COMM = comm2d, INFO = MPI_INFO_NULL ) 813 #else 771 814 nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_xz(av) ) 815 #endif 772 816 CALL handle_netcdf_error( 'check_open', 23 ) 773 817 ! … … 782 826 nc_stat = NF90_CLOSE( id_set_xz(av) ) 783 827 CALL handle_netcdf_error( 'check_open', 24 ) 784 CALL local_system( 'rm ' // TRIM( filename ) )828 IF ( myid == 0 ) CALL local_system( 'rm ' // TRIM( filename ) ) 785 829 ENDIF 786 830 … … 789 833 IF ( .NOT. netcdf_extend ) THEN 790 834 ! 791 !-- Create a new NetCDF output file 792 IF ( netcdf_64bit ) THEN 793 #if defined( __netcdf_64bit ) 835 !-- Create a new NetCDF output file with requested NetCDF format 836 IF ( netcdf_data_format == 1 ) THEN 837 ! 838 !-- Classic NetCDF format 839 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_xz(av) ) 840 841 ELSEIF ( netcdf_data_format == 2 ) THEN 842 ! 843 !-- 64bit-offset format 794 844 nc_stat = NF90_CREATE( filename, & 795 845 OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),& 796 846 id_set_xz(av) ) 797 #else 798 message_string = 'NetCDF: no 64-bit offset allowed ' // & 799 'on this machine' 800 CALL message( 'check_open', 'PA0171', 0, 1, 0, 6, 0 ) 801 802 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_xz(av) ) 803 #endif 804 ELSE 805 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_xz(av) ) 806 ENDIF 847 848 #if defined( __netcdf4 ) 849 ELSEIF ( netcdf_data_format == 3 ) THEN 850 ! 851 !-- NetCDF4/HDF5 format 852 nc_stat = NF90_CREATE( filename, & 853 OR( NF90_NOCLOBBER, NF90_NETCDF4 ), & 854 id_set_xz(av), COMM = comm2d, & 855 INFO = MPI_INFO_NULL ) 856 857 ELSEIF ( netcdf_data_format == 4 ) THEN 858 ! 859 !-- NetCDF4/HDF5 format with classic model flag 860 nc_stat = NF90_CREATE( filename, & 861 OR( NF90_NOCLOBBER, & 862 OR( NF90_CLASSIC_MODEL, NF90_HDF5 ) ), & 863 id_set_xz(av), COMM = comm2d, & 864 INFO = MPI_INFO_NULL ) 865 #endif 866 ENDIF 867 807 868 CALL handle_netcdf_error( 'check_open', 25 ) 869 808 870 ! 809 871 !-- Define the header 810 872 CALL define_netcdf_header( 'xz', netcdf_extend, av ) 873 874 ! 875 !-- In case of parallel NetCDF output, create flag file which tells 876 !-- combine_plot_fields that nothing is to do. 877 IF ( myid == 0 .AND. netcdf_data_format > 2 ) THEN 878 OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_XZ' ) 879 WRITE ( 99, '(A)' ) 'no combine_plot_fields.x neccessary' 880 CLOSE( 99 ) 881 ENDIF 811 882 812 883 ENDIF … … 831 902 ! 832 903 !-- Open an existing NetCDF file for output 904 #if defined( __netcdf4 ) 905 nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_yz(av), & 906 COMM = comm2d, INFO = MPI_INFO_NULL ) 907 #else 833 908 nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_yz(av) ) 909 #endif 834 910 CALL handle_netcdf_error( 'check_open', 26 ) 835 911 ! … … 844 920 nc_stat = NF90_CLOSE( id_set_yz(av) ) 845 921 CALL handle_netcdf_error( 'check_open', 27 ) 846 CALL local_system( 'rm ' // TRIM( filename ) )922 IF ( myid == 0 ) CALL local_system( 'rm ' // TRIM( filename ) ) 847 923 ENDIF 848 924 … … 851 927 IF ( .NOT. netcdf_extend ) THEN 852 928 ! 853 !-- Create a new NetCDF output file 854 IF ( netcdf_64bit ) THEN 855 #if defined( __netcdf_64bit ) 856 nc_stat = NF90_CREATE( filename, & 857 OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET), & 929 !-- Create a new NetCDF output file with requested NetCDF format 930 IF ( netcdf_data_format == 1 ) THEN 931 ! 932 !-- Classic NetCDF format 933 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_yz(av) ) 934 935 ELSEIF ( netcdf_data_format == 2 ) THEN 936 ! 937 !-- 64bit-offset format 938 nc_stat = NF90_CREATE( filename, & 939 OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),& 858 940 id_set_yz(av) ) 859 #else 860 message_string = 'NetCDF: no 64-bit offset allowed ' // & 861 'on this machine' 862 CALL message( 'check_open', 'PA0171', 0, 1, 0, 6, 0 ) 863 864 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_yz(av) ) 865 #endif 866 ELSE 867 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_yz(av) ) 868 ENDIF 941 942 #if defined( __netcdf4 ) 943 ELSEIF ( netcdf_data_format == 3 ) THEN 944 ! 945 !-- NetCDF4/HDF5 format 946 nc_stat = NF90_CREATE( filename, & 947 OR( NF90_NOCLOBBER, NF90_NETCDF4 ), & 948 id_set_yz(av), COMM = comm2d, & 949 INFO = MPI_INFO_NULL ) 950 951 ELSEIF ( netcdf_data_format == 4 ) THEN 952 ! 953 !-- NetCDF4/HDF5 format with classic model flag 954 nc_stat = NF90_CREATE( filename, & 955 OR( NF90_NOCLOBBER, & 956 OR( NF90_CLASSIC_MODEL, NF90_HDF5 ) ), & 957 id_set_yz(av), COMM = comm2d, & 958 INFO = MPI_INFO_NULL ) 959 #endif 960 ENDIF 961 869 962 CALL handle_netcdf_error( 'check_open', 28 ) 963 870 964 ! 871 965 !-- Define the header 872 966 CALL define_netcdf_header( 'yz', netcdf_extend, av ) 967 968 ! 969 !-- In case of parallel NetCDF output, create flag file which tells 970 !-- combine_plot_fields that nothing is to do. 971 IF ( myid == 0 .AND. netcdf_data_format > 2 ) THEN 972 OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_YZ' ) 973 WRITE ( 99, '(A)' ) 'no combine_plot_fields.x neccessary' 974 CLOSE( 99 ) 975 ENDIF 873 976 874 977 ENDIF … … 908 1011 ! 909 1012 !-- Create a new NetCDF output file 910 IF ( netcdf_64bit ) THEN 911 #if defined( __netcdf_64bit ) 1013 IF ( netcdf_data_format > 1 ) THEN 912 1014 nc_stat = NF90_CREATE( filename, & 913 1015 OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),& 914 1016 id_set_pr ) 915 #else916 message_string = 'NetCDF: no 64-bit offset allowed ' // &917 'on this machine'918 CALL message( 'check_open', 'PA0171', 0, 1, 0, 6, 0 )919 920 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_pr )921 #endif922 1017 ELSE 923 1018 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_pr ) … … 964 1059 ! 965 1060 !-- Create a new NetCDF output file 966 IF ( netcdf_64bit ) THEN 967 #if defined( __netcdf_64bit ) 1061 IF ( netcdf_data_format > 1 ) THEN 968 1062 nc_stat = NF90_CREATE( filename, & 969 1063 OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),& 970 1064 id_set_ts ) 971 #else972 message_string = 'NetCDF: no 64-bit offset allowed ' // &973 'on this machine'974 CALL message( 'check_open', 'PA0171', 0, 1, 0, 6, 0 )975 976 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_ts )977 #endif978 1065 ELSE 979 1066 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_ts ) … … 998 1085 ENDIF 999 1086 ! 1000 !-- Inquire, if there is a NetCDF file from a previ uos run. This should1087 !-- Inquire, if there is a NetCDF file from a previous run. This should 1001 1088 !-- be opened for extension, if its dimensions and variables match the 1002 1089 !-- actual run. … … 1005 1092 IF ( netcdf_extend ) THEN 1006 1093 ! 1007 !-- Open an existing NetCDF file for output 1094 !-- Open an existing NetCDF file for output 1095 #if defined( __netcdf4 ) 1096 nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_3d(av), & 1097 COMM = comm2d, INFO = MPI_INFO_NULL ) 1098 #else 1008 1099 nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_3d(av) ) 1100 #endif 1009 1101 CALL handle_netcdf_error( 'check_open', 35 ) 1010 1102 ! … … 1026 1118 IF ( .NOT. netcdf_extend ) THEN 1027 1119 ! 1028 !-- Create a new NetCDF output file 1029 IF ( netcdf_64bit_3d ) THEN 1030 #if defined( __netcdf_64bit ) 1120 !-- Create a new NetCDF output file with requested NetCDF format 1121 IF ( netcdf_data_format == 1 ) THEN 1122 ! 1123 !-- Classic NetCDF format 1124 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_3d(av) ) 1125 1126 ELSEIF ( netcdf_data_format == 2 ) THEN 1127 ! 1128 !-- 64bit-offset format 1031 1129 nc_stat = NF90_CREATE( filename, & 1032 1130 OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),& 1033 1131 id_set_3d(av) ) 1034 #else 1035 message_string = 'NetCDF: no 64-bit offset allowed ' // & 1036 'on this machine' 1037 CALL message( 'check_open', 'PA0171', 0, 1, 0, 6, 0 ) 1038 1039 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_3d(av) ) 1040 #endif 1041 ELSE 1042 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_3d(av) ) 1043 ENDIF 1132 1133 #if defined( __netcdf4 ) 1134 ELSEIF ( netcdf_data_format == 3 ) THEN 1135 ! 1136 !-- NetCDF4/HDF5 format 1137 nc_stat = NF90_CREATE( filename, & 1138 OR( NF90_NOCLOBBER, NF90_NETCDF4 ), & 1139 id_set_3d(av), COMM = comm2d, & 1140 INFO = MPI_INFO_NULL ) 1141 1142 ELSEIF ( netcdf_data_format == 4 ) THEN 1143 ! 1144 !-- NetCDF4/HDF5 format with classic model flag 1145 nc_stat = NF90_CREATE( filename, & 1146 OR( NF90_NOCLOBBER, & 1147 OR( NF90_CLASSIC_MODEL, NF90_HDF5 ) ), & 1148 id_set_3d(av), COMM = comm2d, & 1149 INFO = MPI_INFO_NULL ) 1150 #endif 1151 ENDIF 1152 1044 1153 CALL handle_netcdf_error( 'check_open', 37 ) 1154 1045 1155 ! 1046 1156 !-- Define the header 1047 1157 CALL define_netcdf_header( '3d', netcdf_extend, av ) 1158 1159 ! 1160 !-- In case of parallel NetCDF output, create flag file which tells 1161 !-- combine_plot_fields that nothing is to do. 1162 IF ( myid == 0 .AND. netcdf_data_format > 2 ) THEN 1163 OPEN( 99, FILE='NO_COMBINE_PLOT_FIELDS_3D' ) 1164 WRITE ( 99, '(A)' ) 'no combine_plot_fields.x neccessary' 1165 CLOSE( 99 ) 1166 ENDIF 1048 1167 1049 1168 ENDIF … … 1085 1204 ! 1086 1205 !-- Create a new NetCDF output file 1087 IF ( netcdf_64bit ) THEN 1088 #if defined( __netcdf_64bit ) 1206 IF ( netcdf_data_format > 1 ) THEN 1089 1207 nc_stat = NF90_CREATE( filename, & 1090 1208 OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),& 1091 1209 id_set_sp ) 1092 #else1093 message_string = 'NetCDF: no 64-bit offset allowed ' // &1094 'on this machine'1095 CALL message( 'check_open', 'PA0171', 0, 1, 0, 6, 0 )1096 1097 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_sp )1098 #endif1099 1210 ELSE 1100 1211 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_sp ) … … 1162 1273 ! 1163 1274 !-- Create a new NetCDF output file 1164 IF ( netcdf_64bit ) THEN 1165 #if defined( __netcdf_64bit ) 1275 IF ( netcdf_data_format > 1 ) THEN 1166 1276 nc_stat = NF90_CREATE( filename, & 1167 1277 OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),& 1168 1278 id_set_prt ) 1169 #else1170 message_string = 'NetCDF: no 64-bit offset allowed ' // &1171 'on this machine'1172 CALL message( 'check_open', 'PA0171', 0, 1, 0, 6, 0 )1173 1174 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_prt )1175 #endif1176 1279 ELSE 1177 1280 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_prt ) … … 1219 1322 ! 1220 1323 !-- Create a new NetCDF output file 1221 IF ( netcdf_64bit ) THEN 1222 #if defined( __netcdf_64bit ) 1324 IF ( netcdf_data_format > 1 ) THEN 1223 1325 nc_stat = NF90_CREATE( filename, & 1224 1326 OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),& 1225 1327 id_set_pts ) 1226 #else1227 message_string = 'NetCDF: no 64-bit offset allowed ' // &1228 'on this machine'1229 CALL message( 'check_open', 'PA0171', 0, 1, 0, 6, 0 )1230 1231 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_pts )1232 #endif1233 1328 ELSE 1234 1329 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, id_set_pts ) … … 1266 1361 !-- Open an existing NetCDF file for output 1267 1362 #if defined( __netcdf4 ) 1268 nc_stat = NF90_OPEN _PAR( filename, NF90_WRITE, comm2d, &1269 MPI_INFO_NULL, id_set_mask(mid,av))1363 nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_mask(mid,av), & 1364 COMM = comm2d, INFO = MPI_INFO_NULL ) 1270 1365 #else 1271 1366 nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_mask(mid,av) ) … … 1290 1385 IF ( .NOT. netcdf_extend ) THEN 1291 1386 ! 1292 !-- Create a new NetCDF output file 1293 SELECT CASE ( nc_format_mask(mid,av) ) 1294 1295 CASE ( 1 ) 1296 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, & 1297 id_set_mask(mid,av) ) 1298 1299 CASE ( 2 ) 1300 #if defined( __netcdf_64bit ) 1301 nc_stat = NF90_CREATE( filename, OR( NF90_NOCLOBBER, & 1302 NF90_64BIT_OFFSET ), id_set_mask(mid,av) ) 1303 #else 1304 WRITE( message_string, * ) 'NetCDF: no 64-bit ', & 1305 'offset format allowed on this machine' 1306 CALL message( 'check_open', 'PA9998', 0, 1, 0, 6, 0 ) 1307 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, & 1308 id_set_mask(mid,av) ) 1309 #endif 1310 1311 CASE ( 3 ) 1387 !-- Create a new NetCDF output file with requested NetCDF format 1388 IF ( netcdf_data_format == 1 ) THEN 1389 ! 1390 !-- Classic NetCDF format 1391 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, & 1392 id_set_mask(mid,av) ) 1393 1394 ELSEIF ( netcdf_data_format == 2 ) THEN 1395 ! 1396 !-- 64bit-offset format 1397 nc_stat = NF90_CREATE( filename, & 1398 OR( NF90_NOCLOBBER, NF90_64BIT_OFFSET ),& 1399 id_set_mask(mid,av) ) 1400 1401 1312 1402 #if defined( __netcdf4 ) 1313 nc_stat = NF90_CREATE_PAR( filename, OR( NF90_NOCLOBBER, & 1314 NF90_NETCDF4 ), comm2d, MPI_INFO_NULL, & 1315 id_set_mask(mid,av) ) 1316 #else 1317 WRITE( message_string, * ) 'NetCDF: no NetCDF 4 ', & 1318 'format allowed on this machine' 1319 CALL message( 'check_open', 'PA9998', 0, 1, 0, 6, 0 ) 1320 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, & 1321 id_set_mask(mid,av) ) 1322 #endif 1323 1324 CASE ( 4 ) 1325 #if defined( __netcdf4 ) 1326 nc_stat = NF90_CREATE_PAR( filename, OR( NF90_NOCLOBBER, & 1327 NF90_CLASSIC_MODEL ), comm2d, & 1328 MPI_INFO_NULL, id_set_mask(mid,av) ) 1329 #else 1330 WRITE( message_string, * ) 'NetCDF: no NetCDF 4 (Classic ', & 1331 'model) format allowed on this machine' 1332 CALL message( 'check_open', 'PA9998', 0, 1, 0, 6, 0 ) 1333 nc_stat = NF90_CREATE( filename, NF90_NOCLOBBER, & 1334 id_set_mask(mid,av) ) 1335 #endif 1336 1337 CASE DEFAULT 1338 WRITE( message_string, * ) 'illegal NetCDF file format: ', & 1339 'nc_format_mask(mid=',mid,',av=',av,')=', & 1340 nc_format_mask(mid,av) 1341 CALL message( 'check_open', 'PA9998', 2, 2, 0, 6, 0 ) 1342 1343 END SELECT 1403 ELSEIF ( netcdf_data_format == 3 ) THEN 1404 ! 1405 !-- NetCDF4/HDF5 format 1406 nc_stat = NF90_CREATE( filename, & 1407 OR( NF90_NOCLOBBER, NF90_NETCDF4 ), & 1408 id_set_mask(mid,av), COMM = comm2d, & 1409 INFO = MPI_INFO_NULL ) 1410 1411 ELSEIF ( netcdf_data_format == 4 ) THEN 1412 ! 1413 !-- NetCDF4/HDF5 format with classic model flag 1414 nc_stat = NF90_CREATE( filename, & 1415 OR( NF90_NOCLOBBER, & 1416 OR( NF90_CLASSIC_MODEL, NF90_HDF5 ) ), & 1417 id_set_mask(mid,av), COMM = comm2d, & 1418 INFO = MPI_INFO_NULL ) 1419 #endif 1420 ENDIF 1421 1344 1422 CALL handle_netcdf_error( 'check_open', 9998 ) 1345 1423 ! -
palm/trunk/SOURCE/check_parameters.f90
r484 r493 4 4 ! Current revisions: 5 5 ! ----------------- 6 ! 6 ! netcdf_data_format is checked 7 7 ! 8 8 ! Former revisions: … … 2692 2692 2693 2693 ! 2694 !-- Check the NetCDF data format 2695 IF ( netcdf_data_format > 2 ) THEN 2696 #if defined( __netcdf4 ) 2697 CONTINUE 2698 #else 2699 message_string = 'NetCDF: NetCDF4 format requested but no ' // & 2700 'cpp-directive __netcdf4 given & switch ' // & 2701 'back to 64-bit offset format' 2702 CALL message( 'check_parameters', 'PA0171', 0, 1, 0, 6, 0 ) 2703 netcdf_data_format = 2 2704 #endif 2705 ENDIF 2706 2707 ! 2694 2708 !-- Check netcdf precison 2695 2709 ldum = .FALSE. -
palm/trunk/SOURCE/close_file.f90
r449 r493 4 4 ! Current revisions: 5 5 ! ----------------- 6 ! 6 ! Adjustments for NetCDF parallel data output 7 7 ! 8 8 ! Former revisions: … … 409 409 CASE ( 101 ) 410 410 411 IF ( myid == 0 .AND. netcdf_output ) THEN 411 IF ( netcdf_output .AND. & 412 ( myid == 0 .OR. netcdf_data_format > 2 ) ) THEN 412 413 nc_stat = NF90_CLOSE( id_set_xy(0) ) 413 414 CALL handle_netcdf_error( 'close_file', 44 ) … … 416 417 CASE ( 102 ) 417 418 418 IF ( myid == 0 .AND. netcdf_output ) THEN 419 IF ( netcdf_output .AND. & 420 ( myid == 0 .OR. netcdf_data_format > 2 ) ) THEN 419 421 nc_stat = NF90_CLOSE( id_set_xz(0) ) 420 422 CALL handle_netcdf_error( 'close_file', 45 ) … … 423 425 CASE ( 103 ) 424 426 425 IF ( myid == 0 .AND. netcdf_output ) THEN 427 IF ( netcdf_output .AND. & 428 ( myid == 0 .OR. netcdf_data_format > 2 ) ) THEN 426 429 nc_stat = NF90_CLOSE( id_set_yz(0) ) 427 430 CALL handle_netcdf_error( 'close_file', 46 ) … … 444 447 CASE ( 106 ) 445 448 446 IF ( myid == 0 .AND. netcdf_output ) THEN 449 IF ( netcdf_output .AND. & 450 ( myid == 0 .OR. netcdf_data_format > 2 ) ) THEN 447 451 nc_stat = NF90_CLOSE( id_set_3d(0) ) 448 452 CALL handle_netcdf_error( 'close_file', 49 ) … … 472 476 CASE ( 111 ) 473 477 474 IF ( myid == 0 .AND. netcdf_output ) THEN 478 IF ( netcdf_output .AND. & 479 ( myid == 0 .OR. netcdf_data_format > 2 ) ) THEN 475 480 nc_stat = NF90_CLOSE( id_set_xy(1) ) 476 481 CALL handle_netcdf_error( 'close_file', 52 ) … … 479 484 CASE ( 112 ) 480 485 481 IF ( myid == 0 .AND. netcdf_output ) THEN 486 IF ( netcdf_output .AND. & 487 ( myid == 0 .OR. netcdf_data_format > 2 ) ) THEN 482 488 nc_stat = NF90_CLOSE( id_set_xz(1) ) 483 489 CALL handle_netcdf_error( 'close_file', 352 ) … … 486 492 CASE ( 113 ) 487 493 488 IF ( myid == 0 .AND. netcdf_output ) THEN 494 IF ( netcdf_output .AND. & 495 ( myid == 0 .OR. netcdf_data_format > 2 ) ) THEN 489 496 nc_stat = NF90_CLOSE( id_set_yz(1) ) 490 497 CALL handle_netcdf_error( 'close_file', 353 ) … … 493 500 CASE ( 116 ) 494 501 495 IF ( myid == 0 .AND. netcdf_output ) THEN 502 IF ( netcdf_output .AND. & 503 ( myid == 0 .OR. netcdf_data_format > 2 ) ) THEN 496 504 nc_stat = NF90_CLOSE( id_set_3d(1) ) 497 505 CALL handle_netcdf_error( 'close_file', 353 ) … … 500 508 CASE ( 121:160 ) 501 509 502 IF ( format_parallel_io ) THEN 510 IF ( netcdf_output .AND. & 511 ( myid == 0 .OR. netcdf_data_format > 2 ) ) THEN 503 512 ! 504 513 !-- decompose fid into mid and av … … 513 522 CALL handle_netcdf_error( 'close_file', 9998 ) 514 523 515 ELSEIF ( myid == 0 .AND. netcdf_output ) THEN516 !517 !-- decompose fid into mid and av518 IF ( fid <= 140 ) THEN519 mid = fid - 120520 av = 0521 ELSE522 mid = fid - 140523 av = 1524 ENDIF525 nc_stat = NF90_CLOSE( id_set_mask(mid,av) )526 CALL handle_netcdf_error( 'close_file', 9998 )527 528 524 ENDIF 529 525 -
palm/trunk/SOURCE/data_output_2d.f90
r392 r493 73 73 CHARACTER (LEN=25) :: section_chr 74 74 CHARACTER (LEN=50) :: rtext 75 INTEGER :: av, ngp, file_id, i, if, is, j, k, l, layer_xy, n, psi, s, &76 s ender, &75 INTEGER :: av, ngp, file_id, i, if, is, iis, j, k, l, layer_xy, n, psi, & 76 s, sender, & 77 77 ind(4) 78 78 LOGICAL :: found, resorted, two_d … … 110 110 ALLOCATE( level_z(0:nzt+1), local_2d(nxl-1:nxr+1,nys-1:nyn+1) ) 111 111 112 #if defined( __netcdf ) 113 IF ( myid == 0 .AND. netcdf_output ) CALL check_open( 101+av*10 ) 114 #endif 112 ! 113 !-- Classic and 64bit offset NetCDF output is done only on PE0. 114 !-- netCDF4/HDF5 output is done in parallel on all PEs. 115 IF ( netcdf_output .AND. ( myid == 0 .OR. netcdf_data_format > 2 ) ) & 116 THEN 117 CALL check_open( 101+av*10 ) 118 ENDIF 115 119 116 120 IF ( data_output_2d_on_each_pe ) THEN … … 130 134 ALLOCATE( local_2d(nxl-1:nxr+1,nzb:nzt+1) ) 131 135 132 #if defined( __netcdf ) 133 IF ( myid == 0 .AND. netcdf_output ) CALL check_open( 102+av*10 ) 134 #endif 136 ! 137 !-- Classic and 64bit offset NetCDF output is done only on PE0. 138 !-- netCDF4/HDF5 output may be done in parallel on all PEs. 139 IF ( netcdf_output .AND. ( myid == 0 .OR. netcdf_data_format > 2 ) ) & 140 THEN 141 CALL check_open( 102+av*10 ) 142 ENDIF 135 143 136 144 IF ( data_output_2d_on_each_pe ) THEN … … 150 158 ALLOCATE( local_2d(nys-1:nyn+1,nzb:nzt+1) ) 151 159 152 #if defined( __netcdf ) 153 IF ( myid == 0 .AND. netcdf_output ) CALL check_open( 103+av*10 ) 154 #endif 160 ! 161 !-- Classic and 64bit offset NetCDF output is done only on PE0. 162 !-- netCDF4/HDF5 output may be done in parallel on all PEs. 163 IF ( netcdf_output .AND. ( myid == 0 .OR. netcdf_data_format > 2 ) ) & 164 THEN 165 CALL check_open( 103+av*10 ) 166 ENDIF 155 167 156 168 IF ( data_output_2d_on_each_pe ) THEN … … 603 615 ! 604 616 !-- Update the NetCDF xy cross section time axis 605 IF ( myid == 0 ) THEN617 IF ( myid == 0 .OR. netcdf_data_format > 2 ) THEN 606 618 IF ( simulated_time /= do2d_xy_last_time(av) ) THEN 607 619 do2d_xy_time_count(av) = do2d_xy_time_count(av) + 1 608 620 do2d_xy_last_time(av) = simulated_time 609 IF ( .NOT. data_output_2d_on_each_pe .AND. & 610 netcdf_output ) THEN 621 IF ( ( .NOT. data_output_2d_on_each_pe .AND. & 622 netcdf_output ) .OR. netcdf_data_format > 2 ) & 623 THEN 611 624 #if defined( __netcdf ) 612 625 nc_stat = NF90_PUT_VAR( id_set_xy(av), & … … 615 628 start = (/ do2d_xy_time_count(av) /), & 616 629 count = (/ 1 /) ) 617 CALL handle_netcdf_error( 'data_output_2d', 53 )630 CALL handle_netcdf_error( 'data_output_2d', 53 ) 618 631 #endif 619 632 ENDIF … … 645 658 646 659 #if defined( __parallel ) 647 IF ( data_output_2d_on_each_pe ) THEN 648 ! 649 !-- Output of partial arrays on each PE 660 IF ( netcdf_output .AND. netcdf_data_format > 2 ) THEN 661 ! 662 !-- Output in NetCDF4/HDF5 format. 663 !-- Do not output redundant ghost point data except for the 664 !-- boundaries of the total domain. 665 IF ( two_d ) THEN 666 iis = 1 667 ELSE 668 iis = is 669 ENDIF 670 650 671 #if defined( __netcdf ) 651 IF ( netcdf_output .AND. myid == 0 ) THEN 652 WRITE ( 21 ) simulated_time, do2d_xy_time_count(av), & 653 av 654 ENDIF 655 #endif 656 WRITE ( 21 ) nxl-1, nxr+1, nys-1, nyn+1 657 WRITE ( 21 ) local_2d 658 672 IF ( nxr == nx .AND. nyn /= ny ) THEN 673 nc_stat = NF90_PUT_VAR( id_set_xy(av), & 674 id_var_do2d(av,if), & 675 local_2d(nxl:nxr+1,nys:nyn), & 676 start = (/ nxl+1, nys+1, iis, & 677 do2d_xy_time_count(av) /), & 678 count = (/ nxr-nxl+2, & 679 nyn-nys+1, 1, 1 /) ) 680 ELSEIF ( nxr /= nx .AND. nyn == ny ) THEN 681 nc_stat = NF90_PUT_VAR( id_set_xy(av), & 682 id_var_do2d(av,if), & 683 local_2d(nxl:nxr,nys:nyn+1), & 684 start = (/ nxl+1, nys+1, iis, & 685 do2d_xy_time_count(av) /), & 686 count = (/ nxr-nxl+1, & 687 nyn-nys+2, 1, 1 /) ) 688 ELSEIF ( nxr == nx .AND. nyn == ny ) THEN 689 nc_stat = NF90_PUT_VAR( id_set_xy(av), & 690 id_var_do2d(av,if), & 691 local_2d(nxl:nxr+1,nys:nyn+1),& 692 start = (/ nxl+1, nys+1, iis, & 693 do2d_xy_time_count(av) /), & 694 count = (/ nxr-nxl+2, & 695 nyn-nys+2, 1, 1 /) ) 696 ELSE 697 nc_stat = NF90_PUT_VAR( id_set_xy(av), & 698 id_var_do2d(av,if), & 699 local_2d(nxl:nxr,nys:nyn), & 700 start = (/ nxl+1, nys+1, iis, & 701 do2d_xy_time_count(av) /), & 702 count = (/ nxr-nxl+1, & 703 nyn-nys+1, 1, 1 /) ) 704 ENDIF 705 706 CALL handle_netcdf_error( 'data_output_2d', 55 ) 707 #endif 659 708 ELSE 660 ! 661 !-- PE0 receives partial arrays from all processors and then 662 !-- outputs them. Here a barrier has to be set, because 663 !-- otherwise "-MPI- FATAL: Remote protocol queue full" may 664 !-- occur. 665 CALL MPI_BARRIER( comm2d, ierr ) 666 667 ngp = ( nxr-nxl+3 ) * ( nyn-nys+3 ) 668 IF ( myid == 0 ) THEN 669 ! 670 !-- Local array can be relocated directly. 671 total_2d(nxl-1:nxr+1,nys-1:nyn+1) = local_2d 672 ! 673 !-- Receive data from all other PEs. 674 DO n = 1, numprocs-1 675 ! 676 !-- Receive index limits first, then array. 677 !-- Index limits are received in arbitrary order from 678 !-- the PEs. 679 CALL MPI_RECV( ind(1), 4, MPI_INTEGER, & 680 MPI_ANY_SOURCE, 0, comm2d, status, & 681 ierr ) 682 sender = status(MPI_SOURCE) 709 710 IF ( data_output_2d_on_each_pe ) THEN 711 ! 712 !-- Output of partial arrays on each PE 713 #if defined( __netcdf ) 714 IF ( netcdf_output .AND. myid == 0 ) THEN 715 WRITE ( 21 ) simulated_time, & 716 do2d_xy_time_count(av), av 717 ENDIF 718 #endif 719 WRITE ( 21 ) nxl-1, nxr+1, nys-1, nyn+1 720 WRITE ( 21 ) local_2d 721 722 ELSE 723 ! 724 !-- PE0 receives partial arrays from all processors and 725 !-- then outputs them. Here a barrier has to be set, 726 !-- because otherwise "-MPI- FATAL: Remote protocol queue 727 !-- full" may occur. 728 CALL MPI_BARRIER( comm2d, ierr ) 729 730 ngp = ( nxr-nxl+3 ) * ( nyn-nys+3 ) 731 IF ( myid == 0 ) THEN 732 ! 733 !-- Local array can be relocated directly. 734 total_2d(nxl-1:nxr+1,nys-1:nyn+1) = local_2d 735 ! 736 !-- Receive data from all other PEs. 737 DO n = 1, numprocs-1 738 ! 739 !-- Receive index limits first, then array. 740 !-- Index limits are received in arbitrary order from 741 !-- the PEs. 742 CALL MPI_RECV( ind(1), 4, MPI_INTEGER, & 743 MPI_ANY_SOURCE, 0, comm2d, & 744 status, ierr ) 745 sender = status(MPI_SOURCE) 746 DEALLOCATE( local_2d ) 747 ALLOCATE( local_2d(ind(1):ind(2),ind(3):ind(4)) ) 748 CALL MPI_RECV( local_2d(ind(1),ind(3)), ngp, & 749 MPI_REAL, sender, 1, comm2d, & 750 status, ierr ) 751 total_2d(ind(1):ind(2),ind(3):ind(4)) = local_2d 752 ENDDO 753 ! 754 !-- Output of the total cross-section. 755 IF ( iso2d_output ) THEN 756 WRITE (21) total_2d(0:nx+1,0:ny+1) 757 ENDIF 758 ! 759 !-- Relocate the local array for the next loop increment 683 760 DEALLOCATE( local_2d ) 684 ALLOCATE( local_2d(ind(1):ind(2),ind(3):ind(4)) ) 685 CALL MPI_RECV( local_2d(ind(1),ind(3)), ngp, & 686 MPI_REAL, sender, 1, comm2d, & 687 status, ierr ) 688 total_2d(ind(1):ind(2),ind(3):ind(4)) = local_2d 689 ENDDO 690 ! 691 !-- Output of the total cross-section. 692 IF ( iso2d_output ) WRITE (21) total_2d(0:nx+1,0:ny+1) 693 ! 694 !-- Relocate the local array for the next loop increment 695 DEALLOCATE( local_2d ) 696 ALLOCATE( local_2d(nxl-1:nxr+1,nys-1:nyn+1) ) 761 ALLOCATE( local_2d(nxl-1:nxr+1,nys-1:nyn+1) ) 697 762 698 763 #if defined( __netcdf ) 699 IF ( netcdf_output ) THEN700 IF ( two_d ) THEN701 nc_stat = NF90_PUT_VAR( id_set_xy(av),&702 id_var_do2d(av,if),&764 IF ( netcdf_output ) THEN 765 IF ( two_d ) THEN 766 nc_stat = NF90_PUT_VAR( id_set_xy(av), & 767 id_var_do2d(av,if), & 703 768 total_2d(0:nx+1,0:ny+1), & 704 769 start = (/ 1, 1, 1, do2d_xy_time_count(av) /), & 705 770 count = (/ nx+2, ny+2, 1, 1 /) ) 706 ELSE707 nc_stat = NF90_PUT_VAR( id_set_xy(av),&708 id_var_do2d(av,if),&771 ELSE 772 nc_stat = NF90_PUT_VAR( id_set_xy(av), & 773 id_var_do2d(av,if), & 709 774 total_2d(0:nx+1,0:ny+1), & 710 775 start = (/ 1, 1, is, do2d_xy_time_count(av) /), & 711 776 count = (/ nx+2, ny+2, 1, 1 /) ) 777 ENDIF 778 CALL handle_netcdf_error( 'data_output_2d', 54 ) 712 779 ENDIF 713 CALL handle_netcdf_error( 'data_output_2d', 54 ) 714 ENDIF 715 #endif 716 717 ELSE 718 ! 719 !-- First send the local index limits to PE0 720 ind(1) = nxl-1; ind(2) = nxr+1721 ind(3) = nys-1; ind(4) = nyn+1722 CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0, comm2d, & 723 ierr ) 724 ! 725 !-- Send data to PE0 726 CALL MPI_SEND( local_2d(nxl-1,nys-1), ngp, MPI_REAL, &727 0, 1, comm2d, ierr ) 728 ENDIF 729 ! 730 !-- A barrier has to be set, because otherwise some PEs may731 !-- proceed too fast so that PE0 may receive wrong data on 732 !-- tag 0 733 CALL MPI_BARRIER( comm2d, ierr ) 780 #endif 781 782 ELSE 783 ! 784 !-- First send the local index limits to PE0 785 ind(1) = nxl-1; ind(2) = nxr+1 786 ind(3) = nys-1; ind(4) = nyn+1 787 CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0, & 788 comm2d, ierr ) 789 ! 790 !-- Send data to PE0 791 CALL MPI_SEND( local_2d(nxl-1,nys-1), ngp, & 792 MPI_REAL, 0, 1, comm2d, ierr ) 793 ENDIF 794 ! 795 !-- A barrier has to be set, because otherwise some PEs may 796 !-- proceed too fast so that PE0 may receive wrong data on 797 !-- tag 0 798 CALL MPI_BARRIER( comm2d, ierr ) 799 ENDIF 800 734 801 ENDIF 735 802 #else … … 752 819 count = (/ nx+2, ny+2, 1, 1 /) ) 753 820 ENDIF 754 CALL handle_netcdf_error( 'data_output_2d', 55)821 CALL handle_netcdf_error( 'data_output_2d', 447 ) 755 822 ENDIF 756 823 #endif … … 789 856 ! 790 857 !-- Update the NetCDF xz cross section time axis 791 IF ( myid == 0 ) THEN 858 IF ( myid == 0 .OR. netcdf_data_format > 2 ) THEN 859 792 860 IF ( simulated_time /= do2d_xz_last_time(av) ) THEN 793 861 do2d_xz_time_count(av) = do2d_xz_time_count(av) + 1 794 862 do2d_xz_last_time(av) = simulated_time 795 IF ( .NOT. data_output_2d_on_each_pe .AND. & 796 netcdf_output ) THEN 863 IF ( ( .NOT. data_output_2d_on_each_pe .AND. & 864 netcdf_output ) .OR. netcdf_data_format > 2 ) & 865 THEN 797 866 #if defined( __netcdf ) 798 867 nc_stat = NF90_PUT_VAR( id_set_xz(av), & … … 801 870 start = (/ do2d_xz_time_count(av) /), & 802 871 count = (/ 1 /) ) 803 CALL handle_netcdf_error( 'data_output_2d', 56 ) 804 #endif 805 ENDIF 806 ENDIF 872 CALL handle_netcdf_error( 'data_output_2d', 56 ) 873 #endif 874 ENDIF 875 ENDIF 876 807 877 ENDIF 808 878 ! … … 848 918 849 919 #if defined( __parallel ) 850 IF ( data_output_2d_on_each_pe ) THEN 851 ! 852 !-- Output of partial arrays on each PE. If the cross section 853 !-- does not reside on the PE, output special index values. 920 IF ( netcdf_output .AND. netcdf_data_format > 2 ) THEN 921 ! 922 !-- ATTENTION: The following lines are a workaround, because 923 !-- independet output does not work with the 924 !-- current NetCDF4 installation. Therefore, data 925 !-- are transferred from PEs having the cross 926 !-- sections to other PEs along y having no cross 927 !-- section data. Some of these data are the 928 !-- output. 929 !-- BEGIN WORKAROUND--------------------------------------- 930 IF ( npey /= 1 .AND. section(is,s) /= -1) THEN 931 ALLOCATE( local_2d_l(nxl-1:nxr+1,nzb:nzt+1) ) 932 local_2d_l = 0.0 933 IF ( section(is,s) >= nys .AND. section(is,s) <= nyn )& 934 THEN 935 local_2d_l = local_2d 936 ENDIF 937 #if defined( __parallel ) 938 ! 939 !-- Distribute data over all PEs along y 940 ngp = ( nxr-nxl+3 ) * ( nzt-nzb+2 ) 941 CALL MPI_ALLREDUCE( local_2d_l(nxl-1,nzb), & 942 local_2d(nxl-1,nzb), ngp, & 943 MPI_REAL, MPI_SUM, comm1dy, ierr ) 944 #else 945 local_2d = local_2d_l 946 #endif 947 DEALLOCATE( local_2d_l ) 948 ENDIF 949 !-- END WORKAROUND----------------------------------------- 950 951 ! 952 !-- Output in NetCDF4/HDF5 format. 953 !-- Output only on those PEs where the respective cross 954 !-- sections reside. Cross sections averaged along y are 955 !-- output on the respective first PE along y (myidy=0). 956 IF ( ( section(is,s) >= nys .AND. & 957 section(is,s) <= nyn ) .OR. & 958 ( section(is,s) == -1 .AND. myidy == 0 ) ) THEN 959 ! 960 !-- Do not output redundant ghost point data except for the 961 !-- boundaries of the total domain. 854 962 #if defined( __netcdf ) 855 IF ( netcdf_output .AND. myid == 0 ) THEN 856 WRITE ( 22 ) simulated_time, do2d_xz_time_count(av), & 857 av 858 ENDIF 859 #endif 860 IF ( ( section(is,s)>=nys .AND. section(is,s)<=nyn ) .OR.& 861 ( section(is,s) == -1 .AND. nys-1 == -1 ) ) & 862 THEN 863 WRITE (22) nxl-1, nxr+1, nzb, nzt+1 864 WRITE (22) local_2d 963 IF ( nxr == nx ) THEN 964 nc_stat = NF90_PUT_VAR( id_set_xz(av), & 965 id_var_do2d(av,if), & 966 local_2d(nxl:nxr+1,nzb:nzt+1), & 967 start = (/ nxl+1, is, 1, & 968 do2d_xz_time_count(av) /), & 969 count = (/ nxr-nxl+2, 1, & 970 nzt+2, 1 /) ) 971 ELSE 972 nc_stat = NF90_PUT_VAR( id_set_xz(av), & 973 id_var_do2d(av,if), & 974 local_2d(nxl:nxr,nzb:nzt+1), & 975 start = (/ nxl+1, is, 1, & 976 do2d_xz_time_count(av) /), & 977 count = (/ nxr-nxl+1, 1, & 978 nzt+2, 1 /) ) 979 ENDIF 980 981 CALL handle_netcdf_error( 'data_output_2d', 57 ) 982 865 983 ELSE 866 WRITE (22) -1, -1, -1, -1 984 ! 985 !-- Output on other PEs. Only one point is output!! 986 !-- ATTENTION: This is a workaround (see above)!! 987 IF ( npey /= 1 ) THEN 988 nc_stat = NF90_PUT_VAR( id_set_xz(av), & 989 id_var_do2d(av,if), & 990 local_2d(nxl:nxl,nzb:nzb), & 991 start = (/ nxl+1, is, 1, & 992 do2d_xz_time_count(av) /), & 993 count = (/ 1, 1, 1, 1 /) ) 994 CALL handle_netcdf_error( 'data_output_2d', 451 ) 995 ENDIF 996 #endif 867 997 ENDIF 868 998 869 999 ELSE 870 ! 871 !-- PE0 receives partial arrays from all processors of the 872 !-- respective cross section and outputs them. Here a 873 !-- barrier has to be set, because otherwise 874 !-- "-MPI- FATAL: Remote protocol queue full" may occur. 875 CALL MPI_BARRIER( comm2d, ierr ) 876 877 ngp = ( nxr-nxl+3 ) * ( nzt-nzb+2 ) 878 IF ( myid == 0 ) THEN 879 ! 880 !-- Local array can be relocated directly. 881 IF ( ( section(is,s)>=nys .AND. section(is,s)<=nyn ) & 882 .OR. ( section(is,s) == -1 .AND. nys-1 == -1 ) ) & 1000 1001 IF ( data_output_2d_on_each_pe ) THEN 1002 ! 1003 !-- Output of partial arrays on each PE. If the cross 1004 !-- section does not reside on the PE, output special 1005 !-- index values. 1006 #if defined( __netcdf ) 1007 IF ( netcdf_output .AND. myid == 0 ) THEN 1008 WRITE ( 22 ) simulated_time, & 1009 do2d_xz_time_count(av), av 1010 ENDIF 1011 #endif 1012 IF ( ( section(is,s) >= nys .AND. & 1013 section(is,s) <= nyn ) .OR. & 1014 ( section(is,s) == -1 .AND. nys-1 == -1 ) ) & 883 1015 THEN 884 total_2d(nxl-1:nxr+1,nzb:nzt+1) = local_2d 885 ENDIF 886 ! 887 !-- Receive data from all other PEs. 888 DO n = 1, numprocs-1 889 ! 890 !-- Receive index limits first, then array. 891 !-- Index limits are received in arbitrary order from 892 !-- the PEs. 893 CALL MPI_RECV( ind(1), 4, MPI_INTEGER, & 894 MPI_ANY_SOURCE, 0, comm2d, status, & 895 ierr ) 896 ! 897 !-- Not all PEs have data for XZ-cross-section. 898 IF ( ind(1) /= -9999 ) THEN 899 sender = status(MPI_SOURCE) 900 DEALLOCATE( local_2d ) 901 ALLOCATE( local_2d(ind(1):ind(2),ind(3):ind(4)) ) 902 CALL MPI_RECV( local_2d(ind(1),ind(3)), ngp, & 903 MPI_REAL, sender, 1, comm2d, & 1016 WRITE (22) nxl-1, nxr+1, nzb, nzt+1 1017 WRITE (22) local_2d 1018 ELSE 1019 WRITE (22) -1, -1, -1, -1 1020 ENDIF 1021 1022 ELSE 1023 ! 1024 !-- PE0 receives partial arrays from all processors of the 1025 !-- respective cross section and outputs them. Here a 1026 !-- barrier has to be set, because otherwise 1027 !-- "-MPI- FATAL: Remote protocol queue full" may occur. 1028 CALL MPI_BARRIER( comm2d, ierr ) 1029 1030 ngp = ( nxr-nxl+3 ) * ( nzt-nzb+2 ) 1031 IF ( myid == 0 ) THEN 1032 ! 1033 !-- Local array can be relocated directly. 1034 IF ( ( section(is,s) >= nys .AND. & 1035 section(is,s) <= nyn ) .OR. & 1036 ( section(is,s) == -1 .AND. nys-1 == -1 ) ) & 1037 THEN 1038 total_2d(nxl-1:nxr+1,nzb:nzt+1) = local_2d 1039 ENDIF 1040 ! 1041 !-- Receive data from all other PEs. 1042 DO n = 1, numprocs-1 1043 ! 1044 !-- Receive index limits first, then array. 1045 !-- Index limits are received in arbitrary order from 1046 !-- the PEs. 1047 CALL MPI_RECV( ind(1), 4, MPI_INTEGER, & 1048 MPI_ANY_SOURCE, 0, comm2d, & 904 1049 status, ierr ) 905 total_2d(ind(1):ind(2),ind(3):ind(4)) = local_2d 1050 ! 1051 !-- Not all PEs have data for XZ-cross-section. 1052 IF ( ind(1) /= -9999 ) THEN 1053 sender = status(MPI_SOURCE) 1054 DEALLOCATE( local_2d ) 1055 ALLOCATE( local_2d(ind(1):ind(2), & 1056 ind(3):ind(4)) ) 1057 CALL MPI_RECV( local_2d(ind(1),ind(3)), ngp, & 1058 MPI_REAL, sender, 1, comm2d, & 1059 status, ierr ) 1060 total_2d(ind(1):ind(2),ind(3):ind(4)) = & 1061 local_2d 1062 ENDIF 1063 ENDDO 1064 ! 1065 !-- Output of the total cross-section. 1066 IF ( iso2d_output ) THEN 1067 WRITE (22) total_2d(0:nx+1,nzb:nzt+1) 906 1068 ENDIF 907 ENDDO 908 ! 909 !-- Output of the total cross-section. 910 IF ( iso2d_output ) THEN 911 WRITE (22) total_2d(0:nx+1,nzb:nzt+1) 912 ENDIF 913 ! 914 !-- Relocate the local array for the next loop increment 915 DEALLOCATE( local_2d ) 916 ALLOCATE( local_2d(nxl-1:nxr+1,nzb:nzt+1) ) 1069 ! 1070 !-- Relocate the local array for the next loop increment 1071 DEALLOCATE( local_2d ) 1072 ALLOCATE( local_2d(nxl-1:nxr+1,nzb:nzt+1) ) 917 1073 918 1074 #if defined( __netcdf ) 919 IF ( netcdf_output ) THEN920 nc_stat = NF90_PUT_VAR( id_set_xz(av),&1075 IF ( netcdf_output ) THEN 1076 nc_stat = NF90_PUT_VAR( id_set_xz(av), & 921 1077 id_var_do2d(av,if), & 922 1078 total_2d(0:nx+1,nzb:nzt+1),& 923 1079 start = (/ 1, is, 1, do2d_xz_time_count(av) /), & 924 1080 count = (/ nx+2, 1, nz+2, 1 /) ) 925 CALL handle_netcdf_error( 'data_output_2d', 57 ) 926 ENDIF 927 #endif 928 929 ELSE 930 ! 931 !-- If the cross section resides on the PE, send the 932 !-- local index limits, otherwise send -9999 to PE0. 933 IF ( ( section(is,s)>=nys .AND. section(is,s)<=nyn ) & 934 .OR. ( section(is,s) == -1 .AND. nys-1 == -1 ) ) & 935 THEN 936 ind(1) = nxl-1; ind(2) = nxr+1 937 ind(3) = nzb; ind(4) = nzt+1 1081 CALL handle_netcdf_error( 'data_output_2d', 58 ) 1082 ENDIF 1083 #endif 1084 938 1085 ELSE 939 ind(1) = -9999; ind(2) = -9999 940 ind(3) = -9999; ind(4) = -9999 941 ENDIF 942 CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0, comm2d, & 943 ierr ) 944 ! 945 !-- If applicable, send data to PE0. 946 IF ( ind(1) /= -9999 ) THEN 947 CALL MPI_SEND( local_2d(nxl-1,nzb), ngp, MPI_REAL, & 948 0, 1, comm2d, ierr ) 949 ENDIF 950 ENDIF 951 ! 952 !-- A barrier has to be set, because otherwise some PEs may 953 !-- proceed too fast so that PE0 may receive wrong data on 954 !-- tag 0 955 CALL MPI_BARRIER( comm2d, ierr ) 1086 ! 1087 !-- If the cross section resides on the PE, send the 1088 !-- local index limits, otherwise send -9999 to PE0. 1089 IF ( ( section(is,s) >= nys .AND. & 1090 section(is,s) <= nyn ) .OR. & 1091 ( section(is,s) == -1 .AND. nys-1 == -1 ) ) & 1092 THEN 1093 ind(1) = nxl-1; ind(2) = nxr+1 1094 ind(3) = nzb; ind(4) = nzt+1 1095 ELSE 1096 ind(1) = -9999; ind(2) = -9999 1097 ind(3) = -9999; ind(4) = -9999 1098 ENDIF 1099 CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0, & 1100 comm2d, ierr ) 1101 ! 1102 !-- If applicable, send data to PE0. 1103 IF ( ind(1) /= -9999 ) THEN 1104 CALL MPI_SEND( local_2d(nxl-1,nzb), ngp, & 1105 MPI_REAL, 0, 1, comm2d, ierr ) 1106 ENDIF 1107 ENDIF 1108 ! 1109 !-- A barrier has to be set, because otherwise some PEs may 1110 !-- proceed too fast so that PE0 may receive wrong data on 1111 !-- tag 0 1112 CALL MPI_BARRIER( comm2d, ierr ) 1113 ENDIF 1114 956 1115 ENDIF 957 1116 #else … … 966 1125 start = (/ 1, is, 1, do2d_xz_time_count(av) /), & 967 1126 count = (/ nx+2, 1, nz+2, 1 /) ) 968 CALL handle_netcdf_error( 'data_output_2d', 58)1127 CALL handle_netcdf_error( 'data_output_2d', 451 ) 969 1128 ENDIF 970 1129 #endif … … 995 1154 CASE ( 'yz' ) 996 1155 ! 997 !-- Update the NetCDF xy cross section time axis 998 IF ( myid == 0 ) THEN 1156 !-- Update the NetCDF yz cross section time axis 1157 IF ( myid == 0 .OR. netcdf_data_format > 2 ) THEN 1158 999 1159 IF ( simulated_time /= do2d_yz_last_time(av) ) THEN 1000 1160 do2d_yz_time_count(av) = do2d_yz_time_count(av) + 1 1001 1161 do2d_yz_last_time(av) = simulated_time 1002 IF ( .NOT. data_output_2d_on_each_pe .AND. & 1003 netcdf_output ) THEN 1162 IF ( ( .NOT. data_output_2d_on_each_pe .AND. & 1163 netcdf_output ) .OR. netcdf_data_format > 2 ) & 1164 THEN 1004 1165 #if defined( __netcdf ) 1005 1166 nc_stat = NF90_PUT_VAR( id_set_yz(av), & … … 1012 1173 ENDIF 1013 1174 ENDIF 1175 1014 1176 ENDIF 1015 1177 ! … … 1055 1217 1056 1218 #if defined( __parallel ) 1057 IF ( data_output_2d_on_each_pe ) THEN 1058 ! 1059 !-- Output of partial arrays on each PE. If the cross section 1060 !-- does not reside on the PE, output special index values. 1219 IF ( netcdf_output .AND. netcdf_data_format > 2 ) THEN 1220 ! 1221 !-- ATTENTION: The following lines are a workaround, because 1222 !-- independet output does not work with the 1223 !-- current NetCDF4 installation. Therefore, data 1224 !-- are transferred from PEs having the cross 1225 !-- sections to other PEs along y having no cross 1226 !-- section data. Some of these data are the 1227 !-- output. 1228 !-- BEGIN WORKAROUND--------------------------------------- 1229 IF ( npex /= 1 .AND. section(is,s) /= -1) THEN 1230 ALLOCATE( local_2d_l(nys-1:nyn+1,nzb:nzt+1) ) 1231 local_2d_l = 0.0 1232 IF ( section(is,s) >= nxl .AND. section(is,s) <= nxr )& 1233 THEN 1234 local_2d_l = local_2d 1235 ENDIF 1236 #if defined( __parallel ) 1237 ! 1238 !-- Distribute data over all PEs along x 1239 ngp = ( nyn-nys+3 ) * ( nzt-nzb+2 ) 1240 CALL MPI_ALLREDUCE( local_2d_l(nys-1,nzb), & 1241 local_2d(nys-1,nzb), ngp, & 1242 MPI_REAL, MPI_SUM, comm1dx, ierr ) 1243 #else 1244 local_2d = local_2d_l 1245 #endif 1246 DEALLOCATE( local_2d_l ) 1247 ENDIF 1248 !-- END WORKAROUND----------------------------------------- 1249 1250 ! 1251 !-- Output in NetCDF4/HDF5 format. 1252 !-- Output only on those PEs where the respective cross 1253 !-- sections reside. Cross sections averaged along x are 1254 !-- output on the respective first PE along x (myidx=0). 1255 IF ( ( section(is,s) >= nxl .AND. & 1256 section(is,s) <= nxr ) .OR. & 1257 ( section(is,s) == -1 .AND. myidx == 0 ) ) THEN 1258 ! 1259 !-- Do not output redundant ghost point data except for the 1260 !-- boundaries of the total domain. 1061 1261 #if defined( __netcdf ) 1062 IF ( netcdf_output .AND. myid == 0 ) THEN 1063 WRITE ( 23 ) simulated_time, do2d_yz_time_count(av), & 1064 av 1065 ENDIF 1066 #endif 1067 IF ( ( section(is,s)>=nxl .AND. section(is,s)<=nxr ) .OR.& 1068 ( section(is,s) == -1 .AND. nxl-1 == -1 ) ) & 1069 THEN 1070 WRITE (23) nys-1, nyn+1, nzb, nzt+1 1071 WRITE (23) local_2d 1262 IF ( nyn == ny ) THEN 1263 nc_stat = NF90_PUT_VAR( id_set_yz(av), & 1264 id_var_do2d(av,if), & 1265 local_2d(nys:nyn+1,nzb:nzt+1), & 1266 start = (/ is, nys+1, 1, & 1267 do2d_yz_time_count(av) /), & 1268 count = (/ 1, nyn-nys+2, & 1269 nzt+2, 1 /) ) 1270 ELSE 1271 nc_stat = NF90_PUT_VAR( id_set_yz(av), & 1272 id_var_do2d(av,if), & 1273 local_2d(nys:nyn,nzb:nzt+1), & 1274 start = (/ is, nys+1, 1, & 1275 do2d_yz_time_count(av) /), & 1276 count = (/ 1, nyn-nys+1, & 1277 nzt+2, 1 /) ) 1278 ENDIF 1279 1280 CALL handle_netcdf_error( 'data_output_2d', 60 ) 1281 1072 1282 ELSE 1073 WRITE (23) -1, -1, -1, -1 1283 ! 1284 !-- Output on other PEs. Only one point is output!! 1285 !-- ATTENTION: This is a workaround (see above)!! 1286 IF ( npex /= 1 ) THEN 1287 nc_stat = NF90_PUT_VAR( id_set_yz(av), & 1288 id_var_do2d(av,if), & 1289 local_2d(nys:nys,nzb:nzb), & 1290 start = (/ is, nys+1, 1, & 1291 do2d_yz_time_count(av) /), & 1292 count = (/ 1, 1, 1, 1 /) ) 1293 CALL handle_netcdf_error( 'data_output_2d', 452 ) 1294 ENDIF 1295 #endif 1074 1296 ENDIF 1075 1297 1076 1298 ELSE 1077 ! 1078 !-- PE0 receives partial arrays from all processors of the 1079 !-- respective cross section and outputs them. Here a 1080 !-- barrier has to be set, because otherwise 1081 !-- "-MPI- FATAL: Remote protocol queue full" may occur. 1082 CALL MPI_BARRIER( comm2d, ierr ) 1083 1084 ngp = ( nyn-nys+3 ) * ( nzt-nzb+2 ) 1085 IF ( myid == 0 ) THEN 1086 ! 1087 !-- Local array can be relocated directly. 1088 IF ( ( section(is,s)>=nxl .AND. section(is,s)<=nxr ) & 1089 .OR. ( section(is,s) == -1 .AND. nxl-1 == -1 ) ) & 1299 1300 IF ( data_output_2d_on_each_pe ) THEN 1301 ! 1302 !-- Output of partial arrays on each PE. If the cross 1303 !-- section does not reside on the PE, output special 1304 !-- index values. 1305 #if defined( __netcdf ) 1306 IF ( netcdf_output .AND. myid == 0 ) THEN 1307 WRITE ( 23 ) simulated_time, & 1308 do2d_yz_time_count(av), av 1309 ENDIF 1310 #endif 1311 IF ( ( section(is,s) >= nxl .AND. & 1312 section(is,s) <= nxr ) .OR. & 1313 ( section(is,s) == -1 .AND. nxl-1 == -1 ) ) & 1090 1314 THEN 1091 total_2d(nys-1:nyn+1,nzb:nzt+1) = local_2d 1092 ENDIF 1093 ! 1094 !-- Receive data from all other PEs. 1095 DO n = 1, numprocs-1 1096 ! 1097 !-- Receive index limits first, then array. 1098 !-- Index limits are received in arbitrary order from 1099 !-- the PEs. 1100 CALL MPI_RECV( ind(1), 4, MPI_INTEGER, & 1101 MPI_ANY_SOURCE, 0, comm2d, status, & 1102 ierr ) 1103 ! 1104 !-- Not all PEs have data for YZ-cross-section. 1105 IF ( ind(1) /= -9999 ) THEN 1106 sender = status(MPI_SOURCE) 1107 DEALLOCATE( local_2d ) 1108 ALLOCATE( local_2d(ind(1):ind(2),ind(3):ind(4)) ) 1109 CALL MPI_RECV( local_2d(ind(1),ind(3)), ngp, & 1110 MPI_REAL, sender, 1, comm2d, & 1315 WRITE (23) nys-1, nyn+1, nzb, nzt+1 1316 WRITE (23) local_2d 1317 ELSE 1318 WRITE (23) -1, -1, -1, -1 1319 ENDIF 1320 1321 ELSE 1322 ! 1323 !-- PE0 receives partial arrays from all processors of the 1324 !-- respective cross section and outputs them. Here a 1325 !-- barrier has to be set, because otherwise 1326 !-- "-MPI- FATAL: Remote protocol queue full" may occur. 1327 CALL MPI_BARRIER( comm2d, ierr ) 1328 1329 ngp = ( nyn-nys+3 ) * ( nzt-nzb+2 ) 1330 IF ( myid == 0 ) THEN 1331 ! 1332 !-- Local array can be relocated directly. 1333 IF ( ( section(is,s) >= nxl .AND. & 1334 section(is,s) <= nxr ) .OR. & 1335 ( section(is,s) == -1 .AND. nxl-1 == -1 ) ) & 1336 THEN 1337 total_2d(nys-1:nyn+1,nzb:nzt+1) = local_2d 1338 ENDIF 1339 ! 1340 !-- Receive data from all other PEs. 1341 DO n = 1, numprocs-1 1342 ! 1343 !-- Receive index limits first, then array. 1344 !-- Index limits are received in arbitrary order from 1345 !-- the PEs. 1346 CALL MPI_RECV( ind(1), 4, MPI_INTEGER, & 1347 MPI_ANY_SOURCE, 0, comm2d, & 1111 1348 status, ierr ) 1112 total_2d(ind(1):ind(2),ind(3):ind(4)) = local_2d 1349 ! 1350 !-- Not all PEs have data for YZ-cross-section. 1351 IF ( ind(1) /= -9999 ) THEN 1352 sender = status(MPI_SOURCE) 1353 DEALLOCATE( local_2d ) 1354 ALLOCATE( local_2d(ind(1):ind(2), & 1355 ind(3):ind(4)) ) 1356 CALL MPI_RECV( local_2d(ind(1),ind(3)), ngp, & 1357 MPI_REAL, sender, 1, comm2d, & 1358 status, ierr ) 1359 total_2d(ind(1):ind(2),ind(3):ind(4)) = & 1360 local_2d 1361 ENDIF 1362 ENDDO 1363 ! 1364 !-- Output of the total cross-section. 1365 IF ( iso2d_output ) THEN 1366 WRITE (23) total_2d(0:ny+1,nzb:nzt+1) 1113 1367 ENDIF 1114 ENDDO 1115 ! 1116 !-- Output of the total cross-section. 1117 IF ( iso2d_output ) THEN 1118 WRITE (23) total_2d(0:ny+1,nzb:nzt+1) 1119 ENDIF 1120 ! 1121 !-- Relocate the local array for the next loop increment 1122 DEALLOCATE( local_2d ) 1123 ALLOCATE( local_2d(nys-1:nyn+1,nzb:nzt+1) ) 1368 ! 1369 !-- Relocate the local array for the next loop increment 1370 DEALLOCATE( local_2d ) 1371 ALLOCATE( local_2d(nys-1:nyn+1,nzb:nzt+1) ) 1124 1372 1125 1373 #if defined( __netcdf ) 1126 IF ( netcdf_output ) THEN1127 nc_stat = NF90_PUT_VAR( id_set_yz(av),&1374 IF ( netcdf_output ) THEN 1375 nc_stat = NF90_PUT_VAR( id_set_yz(av), & 1128 1376 id_var_do2d(av,if), & 1129 1377 total_2d(0:ny+1,nzb:nzt+1),& 1130 1378 start = (/ is, 1, 1, do2d_yz_time_count(av) /), & 1131 1379 count = (/ 1, ny+2, nz+2, 1 /) ) 1132 CALL handle_netcdf_error( 'data_output_2d', 60 ) 1133 ENDIF 1134 #endif 1135 1136 ELSE 1137 ! 1138 !-- If the cross section resides on the PE, send the 1139 !-- local index limits, otherwise send -9999 to PE0. 1140 IF ( ( section(is,s)>=nxl .AND. section(is,s)<=nxr ) & 1141 .OR. ( section(is,s) == -1 .AND. nxl-1 == -1 ) ) & 1142 THEN 1143 ind(1) = nys-1; ind(2) = nyn+1 1144 ind(3) = nzb; ind(4) = nzt+1 1380 CALL handle_netcdf_error( 'data_output_2d', 61 ) 1381 ENDIF 1382 #endif 1383 1145 1384 ELSE 1146 ind(1) = -9999; ind(2) = -9999 1147 ind(3) = -9999; ind(4) = -9999 1148 ENDIF 1149 CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0, comm2d, & 1150 ierr ) 1151 ! 1152 !-- If applicable, send data to PE0. 1153 IF ( ind(1) /= -9999 ) THEN 1154 CALL MPI_SEND( local_2d(nys-1,nzb), ngp, MPI_REAL, & 1155 0, 1, comm2d, ierr ) 1156 ENDIF 1157 ENDIF 1158 ! 1159 !-- A barrier has to be set, because otherwise some PEs may 1160 !-- proceed too fast so that PE0 may receive wrong data on 1161 !-- tag 0 1162 CALL MPI_BARRIER( comm2d, ierr ) 1385 ! 1386 !-- If the cross section resides on the PE, send the 1387 !-- local index limits, otherwise send -9999 to PE0. 1388 IF ( ( section(is,s) >= nxl .AND. & 1389 section(is,s) <= nxr ) .OR. & 1390 ( section(is,s) == -1 .AND. nxl-1 == -1 ) ) & 1391 THEN 1392 ind(1) = nys-1; ind(2) = nyn+1 1393 ind(3) = nzb; ind(4) = nzt+1 1394 ELSE 1395 ind(1) = -9999; ind(2) = -9999 1396 ind(3) = -9999; ind(4) = -9999 1397 ENDIF 1398 CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0, & 1399 comm2d, ierr ) 1400 ! 1401 !-- If applicable, send data to PE0. 1402 IF ( ind(1) /= -9999 ) THEN 1403 CALL MPI_SEND( local_2d(nys-1,nzb), ngp, & 1404 MPI_REAL, 0, 1, comm2d, ierr ) 1405 ENDIF 1406 ENDIF 1407 ! 1408 !-- A barrier has to be set, because otherwise some PEs may 1409 !-- proceed too fast so that PE0 may receive wrong data on 1410 !-- tag 0 1411 CALL MPI_BARRIER( comm2d, ierr ) 1412 ENDIF 1413 1163 1414 ENDIF 1164 1415 #else … … 1173 1424 start = (/ is, 1, 1, do2d_xz_time_count(av) /), & 1174 1425 count = (/ 1, ny+2, nz+2, 1 /) ) 1175 CALL handle_netcdf_error( 'data_output_2d', 61)1426 CALL handle_netcdf_error( 'data_output_2d', 452 ) 1176 1427 ENDIF 1177 1428 #endif -
palm/trunk/SOURCE/data_output_3d.f90
r392 r493 76 76 !-- Open output file. 77 77 !-- Also creates coordinate and fld-file for AVS. 78 !-- In case of a run on more than one PE, each PE opens its own file and 78 !-- For classic or 64bit NetCDF output or output of other (old) data formats, 79 !-- for a run on more than one PE, each PE opens its own file and 79 80 !-- writes the data of its subdomain in binary format (regardless of the format 80 81 !-- the user has requested). After the run, these files are combined to one 81 82 !-- file by combine_plot_fields in the format requested by the user (netcdf 82 !-- and/or avs). 83 IF ( avs_output .OR. ( numprocs > 1 ) ) CALL check_open( 30 ) 84 85 #if defined( __netcdf ) 86 IF ( myid == 0 .AND. netcdf_output ) CALL check_open( 106+av*10 ) 87 #endif 83 !-- and/or avs). 84 !-- For NetCDF4/HDF5 output, data is written in parallel into one file. 85 IF ( netcdf_output ) THEN 86 IF ( netcdf_data_format < 3 ) THEN 87 CALL check_open( 30 ) 88 IF ( myid == 0 ) CALL check_open( 106+av*10 ) 89 ELSE 90 CALL check_open( 106+av*10 ) 91 ENDIF 92 ELSE 93 IF ( avs_output .OR. ( numprocs > 1 ) ) CALL check_open( 30 ) 94 ENDIF 88 95 89 96 ! … … 94 101 !-- Update the NetCDF time axis 95 102 #if defined( __netcdf ) 96 do3d_time_count(av) = do3d_time_count(av) + 1 97 IF ( myid == 0 .AND. netcdf_output ) THEN 98 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_time_3d(av), & 99 (/ time_since_reference_point /), & 100 start = (/ do3d_time_count(av) /), & 101 count = (/ 1 /) ) 102 CALL handle_netcdf_error( 'data_output_3d', 376 ) 103 IF ( myid == 0 .OR. netcdf_data_format > 2 ) THEN 104 do3d_time_count(av) = do3d_time_count(av) + 1 105 IF ( netcdf_output ) THEN 106 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_time_3d(av), & 107 (/ time_since_reference_point /), & 108 start = (/ do3d_time_count(av) /), & 109 count = (/ 1 /) ) 110 CALL handle_netcdf_error( 'data_output_3d', 376 ) 111 ENDIF 103 112 ENDIF 104 113 #endif … … 376 385 !-- Uncompressed output. 377 386 #if defined( __parallel ) 378 IF ( netcdf_output .AND. myid == 0 ) THEN 379 WRITE ( 30 ) simulated_time, do3d_time_count(av), av 387 IF ( netcdf_output ) THEN 388 IF ( netcdf_data_format < 3 ) THEN 389 ! 390 !-- Classic or 64bit format. Data is output in parallel in FORTRAN 391 !-- binary format here, and later collected into one file by 392 !-- combine_plot_fields 393 IF ( myid == 0 ) THEN 394 WRITE ( 30 ) simulated_time, do3d_time_count(av), av 395 ENDIF 396 WRITE ( 30 ) nxl-1, nxr+1, nys-1, nyn+1, nzb, nz_do3d 397 WRITE ( 30 ) local_pf 398 399 ELSE 400 ! 401 !-- Output in NetCDF4/HDF5 format. 402 !-- Do not output redundant ghost point data except for the 403 !-- boundaries of the total domain. 404 IF ( nxr == nx .AND. nyn /= ny ) THEN 405 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & 406 local_pf(nxl:nxr+1,nys:nyn,nzb:nz_do3d), & 407 start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), & 408 count = (/ nxr-nxl+2, nyn-nys+1, nz_do3d-nzb+1, 1 /) ) 409 ELSEIF ( nxr /= nx .AND. nyn == ny ) THEN 410 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & 411 local_pf(nxl:nxr,nys:nyn+1,nzb:nz_do3d), & 412 start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), & 413 count = (/ nxr-nxl+1, nyn-nys+2, nz_do3d-nzb+1, 1 /) ) 414 ELSEIF ( nxr == nx .AND. nyn == ny ) THEN 415 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & 416 local_pf(nxl:nxr+1,nys:nyn+1,nzb:nz_do3d), & 417 start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), & 418 count = (/ nxr-nxl+2, nyn-nys+2, nz_do3d-nzb+1, 1 /) ) 419 ELSE 420 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & 421 local_pf(nxl:nxr,nys:nyn,nzb:nz_do3d), & 422 start = (/ nxl+1, nys+1, nzb+1, do3d_time_count(av) /), & 423 count = (/ nxr-nxl+1, nyn-nys+1, nz_do3d-nzb+1, 1 /) ) 424 ENDIF 425 CALL handle_netcdf_error( 'data_output_3d', 386 ) 426 ENDIF 380 427 ENDIF 381 WRITE ( 30 ) nxl-1, nxr+1, nys-1, nyn+1, nzb, nz_do3d382 WRITE ( 30 ) local_pf383 428 #else 384 429 IF ( avs_output ) THEN … … 387 432 #if defined( __netcdf ) 388 433 IF ( netcdf_output ) THEN 389 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & 390 local_pf(nxl:nxr+1,nys:nyn+1,nzb:nz_do3d), & 391 start = (/ 1, 1, 1, do3d_time_count(av) /), & 392 count = (/ nx+2, ny+2, nz_do3d-nzb+1, 1 /) ) 393 CALL handle_netcdf_error( 'data_output_3d', 386 ) 434 435 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if), & 436 local_pf(nxl:nxr+1,nys:nyn+1,nzb:nz_do3d), & 437 start = (/ 1, 1, 1, do3d_time_count(av) /), & 438 count = (/ nx+2, ny+2, nz_do3d-nzb+1, 1 /) ) 439 CALL handle_netcdf_error( 'data_output_3d', 446 ) 440 394 441 ENDIF 395 442 #endif -
palm/trunk/SOURCE/data_output_mask.f90
r484 r493 53 53 CALL cpu_log (log_point(49),'data_output_mask','start') 54 54 55 ! !55 ! 56 56 !-- Open output file. 57 IF ( format_parallel_io .AND. netcdf_output ) THEN 58 CALL check_open( 120+mid+av*max_masks ) 59 ELSEIF (myid == 0 .AND. netcdf_output ) THEN 57 IF ( netcdf_output .AND. ( myid == 0 .OR. netcdf_data_format > 2 ) ) & 58 THEN 60 59 CALL check_open( 120+mid+av*max_masks ) 61 60 ENDIF … … 74 73 !-- Update the NetCDF time axis. 75 74 domask_time_count(mid,av) = domask_time_count(mid,av) + 1 76 IF ( format_parallel_io .AND. netcdf_output ) THEN 77 nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), id_var_time_mask(mid,av), & 78 (/ simulated_time /), & 79 start = (/ domask_time_count(mid,av) /), & 80 count = (/ 1 /) ) 81 CALL handle_netcdf_error( 'data_output_mask', 9998 ) 82 ELSEIF ( myid == 0 .AND. netcdf_output ) THEN 75 IF ( netcdf_output .AND. ( myid == 0 .OR. netcdf_data_format > 2 ) ) & 76 THEN 83 77 nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), id_var_time_mask(mid,av), & 84 78 (/ simulated_time /), & … … 95 89 ! 96 90 !-- Reallocate local_pf on PE 0 since its shape changes during MPI exchange 97 IF ( .NOT. format_parallel_io .AND. myid == 0 .AND.if > 1 ) THEN91 IF ( netcdf_data_format < 3 .AND. myid == 0 .AND. if > 1 ) THEN 98 92 DEALLOCATE( local_pf ) 99 93 ALLOCATE( local_pf(mask_size_l(mid,1),mask_size_l(mid,2), & … … 329 323 !-- The choice of method depends on the correct setting of preprocessor 330 324 !-- directives __parallel and __netcdf4 as well as on the parameter 331 !-- n c_format_mask(mid,av).325 !-- netcdf_data_format. 332 326 #if defined( __parallel ) 333 327 #if defined( __netcdf4 ) 334 IF ( n c_format_mask(mid,av) == 3 .OR. nc_format_mask(mid,av) == 4) THEN328 IF ( netcdf_data_format > 2 ) THEN 335 329 ! 336 330 !-- (1) a. Parallel I/O using NetCDF 4 (not yet tested) -
palm/trunk/SOURCE/header.f90
r482 r493 4 4 ! Current revisions: 5 5 ! ----------------- 6 ! 6 ! NetCDF data output format extendend for NetCDF4/HDF5 7 7 ! 8 8 ! Former revisions: … … 16 16 ! 410 2009-12-04 17:05:40Z letzel 17 17 ! Masked data output: + dt_domask, mask_01~20_x|y|z, mask_01~20_x|y|z_loop, 18 ! mask_scale|_x|y|z, masks, netcdf_format_mask[_av],skip_time_domask18 ! mask_scale|_x|y|z, masks, skip_time_domask 19 19 ! 20 20 ! 346 2009-07-06 10:13:41Z raasch … … 700 700 output_format = '' 701 701 IF ( netcdf_output ) THEN 702 IF ( netcdf_ 64bit) THEN703 output_format = ' netcdf (64 bit offset)'702 IF ( netcdf_data_format == 1 ) THEN 703 output_format = 'NetCDF classic' 704 704 ELSE 705 output_format = ' netcdf'705 output_format = 'NetCDF 64bit offset' 706 706 ENDIF 707 707 ENDIF … … 778 778 output_format = '' 779 779 IF ( netcdf_output ) THEN 780 IF ( netcdf_64bit ) THEN 781 output_format = 'netcdf (64 bit offset)' 782 ELSE 783 output_format = 'netcdf' 780 IF ( netcdf_data_format == 1 ) THEN 781 output_format = 'NetCDF classic' 782 ELSEIF ( netcdf_data_format == 2 ) THEN 783 output_format = 'NetCDF 64bit offset' 784 ELSEIF ( netcdf_data_format == 3 ) THEN 785 output_format = 'NetCDF4/HDF5' 786 ELSEIF ( netcdf_data_format == 4 ) THEN 787 output_format = 'NetCDF4/HDF5 clasic' 784 788 ENDIF 785 789 ENDIF … … 935 939 output_format = '' 936 940 IF ( netcdf_output ) THEN 937 IF ( netcdf_64bit_3d ) THEN 938 output_format = 'netcdf (64 bit offset)' 939 ELSE 940 output_format = 'netcdf' 941 IF ( netcdf_data_format == 1 ) THEN 942 output_format = 'NetCDF classic' 943 ELSEIF ( netcdf_data_format == 2 ) THEN 944 output_format = 'NetCDF 64bit offset' 945 ELSEIF ( netcdf_data_format == 3 ) THEN 946 output_format = 'NetCDF4/HDF5' 947 ELSEIF ( netcdf_data_format == 4 ) THEN 948 output_format = 'NetCDF4/HDF5 clasic' 941 949 ENDIF 942 950 ENDIF … … 1029 1037 output_format = '' 1030 1038 IF ( netcdf_output ) THEN 1031 SELECT CASE ( nc_format_mask(mid,av) ) 1032 CASE ( 1 ) 1033 output_format = 'netcdf (classic format)' 1034 CASE ( 2 ) 1035 output_format = 'netcdf (64bit offset format)' 1036 CASE ( 3 ) 1037 output_format = 'netcdf (NetCDF 4 format)' 1038 CASE ( 4 ) 1039 output_format = 'netcdf (NetCDF 4 classic model format)' 1040 END SELECT 1039 IF ( netcdf_data_format == 1 ) THEN 1040 output_format = 'NetCDF classic' 1041 ELSEIF ( netcdf_data_format == 2 ) THEN 1042 output_format = 'NetCDF 64bit offset' 1043 ELSEIF ( netcdf_data_format == 3 ) THEN 1044 output_format = 'NetCDF4/HDF5' 1045 ELSEIF ( netcdf_data_format == 4 ) THEN 1046 output_format = 'NetCDF4/HDF5 clasic' 1047 ENDIF 1041 1048 ENDIF 1042 1049 WRITE ( io, 344 ) output_format … … 1092 1099 output_format = '' 1093 1100 IF ( netcdf_output ) THEN 1094 IF ( netcdf_ 64bit) THEN1095 output_format = ' netcdf (64 bit offset)'1101 IF ( netcdf_data_format == 1 ) THEN 1102 output_format = 'NetCDF classic' 1096 1103 ELSE 1097 output_format = ' netcdf'1104 output_format = 'NetCDF 64bit offset' 1098 1105 ENDIF 1099 1106 ENDIF … … 1169 1176 output_format = '' 1170 1177 IF ( netcdf_output ) THEN 1171 IF ( netcdf_ 64bit) THEN1172 output_format = ' netcdf (64 bit offset)'1178 IF ( netcdf_data_format == 1 ) THEN 1179 output_format = 'NetCDF classic' 1173 1180 ELSE 1174 output_format = ' netcdf'1181 output_format = 'NetCDF 64bit offset' 1175 1182 ENDIF 1176 1183 ENDIF … … 1493 1500 output_format = '' 1494 1501 IF ( netcdf_output ) THEN 1495 IF ( netcdf_ 64bit) THEN1502 IF ( netcdf_data_format > 1 ) THEN 1496 1503 output_format = 'netcdf (64 bit offset) and binary' 1497 1504 ELSE -
palm/trunk/SOURCE/init_masks.f90
r484 r493 48 48 ALLOCATE( mask(max_masks,3,mask_xyz_dimension), & 49 49 mask_loop(max_masks,3,3) ) 50 !51 !-- Store netcdf file formats for masked data output in one shared array52 nc_format_mask(:,0) = netcdf_format_mask53 nc_format_mask(:,1) = netcdf_format_mask_av54 50 55 IF ( ANY( nc_format_mask == 3 ) .OR. ANY( nc_format_mask == 4 )) THEN 56 format_parallel_io = .TRUE. 57 ENDIF 58 59 IF ( ANY( nc_format_mask < 1 ) .OR. ANY( nc_format_mask > 4 ) ) THEN 60 WRITE( message_string, * ) 'illegal value: netcdf_format_mask and ', & 61 'netcdf_format_mask_av must be either 1, 2, 3 or 4' 62 IF ( ANY( nc_format_mask == 3 ) .OR. ANY( nc_format_mask == 4 ) ) THEN 63 message_string = TRIM( message_string ) // '&NetCDF file formats '// & 64 '3 (NetCDF 4) and 4 (NetCDF 4 Classic model)'// & 65 '&are currently not supported (not yet tested).' 66 ENDIF 51 ! 52 !-- Parallel mask output not yet tested 53 IF ( netcdf_data_format > 2 ) THEN 54 message_string = 'NetCDF file formats '// & 55 '3 (NetCDF 4) and 4 (NetCDF 4 Classic model)'// & 56 '&are currently not supported (not yet tested).' 67 57 CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 ) 68 58 ENDIF … … 162 152 ! 163 153 !-- Global arrays are required by define_netcdf_header. 164 IF ( format_parallel_io ) THEN 165 ALLOCATE( mask_i_global(max_masks,nx+1), & 166 mask_j_global(max_masks,ny+1), & 167 mask_k_global(max_masks,nz+1) ) 168 mask_i_global = -1; mask_j_global = -1; mask_k_global = -1 169 ELSEIF ( myid == 0 ) THEN 154 IF ( myid == 0 .OR. netcdf_data_format > 2 ) THEN 170 155 ALLOCATE( mask_i_global(max_masks,nx+1), & 171 156 mask_j_global(max_masks,ny+1), & … … 472 457 CALL MPI_BARRIER( comm2d, ierr ) 473 458 474 IF ( format_parallel_io) THEN459 IF ( netcdf_data_format > 2 ) THEN 475 460 476 CALL MPI_BCAST( mask_i_global(mid,:), nx+1, MPI_INTEGER, 0, comm2d, ierr ) 477 CALL MPI_BCAST( mask_j_global(mid,:), ny+1, MPI_INTEGER, 0, comm2d, ierr ) 478 CALL MPI_BCAST( mask_k_global(mid,:), nz+1, MPI_INTEGER, 0, comm2d, ierr ) 461 CALL MPI_BCAST( mask_i_global(mid,:), nx+1, MPI_INTEGER, 0, comm2d, & 462 ierr ) 463 CALL MPI_BCAST( mask_j_global(mid,:), ny+1, MPI_INTEGER, 0, comm2d, & 464 ierr ) 465 CALL MPI_BCAST( mask_k_global(mid,:), nz+1, MPI_INTEGER, 0, comm2d, & 466 ierr ) 479 467 480 468 ENDIF … … 496 484 497 485 CONTAINS 486 498 487 SUBROUTINE set_mask_locations( dim, dxyz, dxyz_string, nxyz, nxyz_string, & 499 488 lb, ub ) -
palm/trunk/SOURCE/modules.f90
r486 r493 5 5 ! Current revisions: 6 6 ! ----------------- 7 ! 7 ! +netcdf_data_format, -netcdf_64bit, -netcdf_64bit_3d 8 8 ! 9 9 ! Former revisions: … … 23 23 ! 410 2009-12-04 17:05:40Z letzel 24 24 ! masked data output: + dt_domask, mask_01~20_x|y|z, mask_01~20_x|y|z_loop, 25 ! mask_scale|_x|y|z, masks, netcdf_format_mask[_av],skip_time_domask25 ! mask_scale|_x|y|z, masks, skip_time_domask 26 26 ! 27 27 ! 388 2009-09-23 09:40:33Z raasch … … 379 379 intermediate_timestep_count, intermediate_timestep_count_max, & 380 380 iran = -1234567, last_dt_change = 0, masks = 0, & 381 maximum_grid_level, &382 m ax_pr_user = 0, mgcycles = 0, mg_cycles = -1, &383 mg_switch_to_pe0_level = 0, mid, ngsrb = 2, nsor = 20, &381 maximum_grid_level, max_pr_user = 0, mgcycles = 0, & 382 mg_cycles = -1, mg_switch_to_pe0_level = 0, mid, & 383 netcdf_data_format = 2, ngsrb = 2, nsor = 20, & 384 384 nsor_ini = 100, n_sor, normalizing_region = 0, & 385 385 nz_do1d, nz_do3d = -9999, outflow_damping_width = -1, & … … 396 396 mask_size(max_masks,3) = -1, mask_size_l(max_masks,3) = -1, & 397 397 mask_start_l(max_masks,3) = -1, & 398 nc_format_mask(1:max_masks,0:1), &399 netcdf_format_mask(1:max_masks) = 1, &400 netcdf_format_mask_av(1:max_masks) = 1, &401 398 pt_vertical_gradient_level_ind(10) = -9999, & 402 399 q_vertical_gradient_level_ind(10) = -9999, & … … 430 427 disturbance_created = .FALSE., & 431 428 first_call_advec_particles = .TRUE., & 432 force_print_header = .FALSE., format_parallel_io = .FALSE., & 433 galilei_transformation = .FALSE.,& 429 force_print_header = .FALSE., galilei_transformation = .FALSE.,& 434 430 humidity = .FALSE., humidity_remote = .FALSE., & 435 431 inflow_l = .FALSE., inflow_n = .FALSE., & … … 437 433 iso2d_output = .FALSE., large_scale_subsidence = .FALSE., & 438 434 mg_switch_to_pe0 = .FALSE., & 439 netcdf_output = .FALSE., netcdf_64bit = .FALSE., & 440 netcdf_64bit_3d = .TRUE., ocean = .FALSE., & 435 netcdf_output = .FALSE., ocean = .FALSE., & 441 436 outflow_l = .FALSE., outflow_n = .FALSE., outflow_r = .FALSE., & 442 437 outflow_s = .FALSE., passive_scalar = .FALSE., & -
palm/trunk/SOURCE/netcdf.f90
r449 r493 7 7 ! Current revisions: 8 8 ! ------------------ 9 ! 9 ! Extensions for NetCDF4 output 10 10 ! 11 11 ! Former revisions: … … 1093 1093 'units', TRIM( do3d_unit(av,i) ) ) 1094 1094 CALL handle_netcdf_error( 'netcdf', 357 ) 1095 1095 #if defined( __netcdf4 ) 1096 ! 1097 !-- Set collective io operations for parallel io 1098 IF ( netcdf_data_format > 2 ) THEN 1099 nc_stat = NF90_VAR_PAR_ACCESS( id_set_3d(av), & 1100 id_var_do3d(av,i), & 1101 NF90_COLLECTIVE ) 1102 CALL handle_netcdf_error( 'netcdf', 445 ) 1103 ENDIF 1104 #endif 1096 1105 i = i + 1 1097 1106 … … 1299 1308 id_var_do3d(av,i) ) 1300 1309 CALL handle_netcdf_error( 'netcdf', 95 ) 1310 #if defined( __netcdf4 ) 1311 ! 1312 !-- Set collective io operations for parallel io 1313 IF ( netcdf_data_format > 2 ) THEN 1314 nc_stat = NF90_VAR_PAR_ACCESS( id_set_3d(av), & 1315 id_var_do3d(av,i), & 1316 NF90_COLLECTIVE ) 1317 CALL handle_netcdf_error( 'netcdf', 453 ) 1318 ENDIF 1319 #endif 1301 1320 i = i + 1 1302 1321 ENDDO … … 1644 1663 'units', TRIM( do2d_unit(av,i) ) ) 1645 1664 CALL handle_netcdf_error( 'netcdf', 354 ) 1665 #if defined( __netcdf4 ) 1666 ! 1667 !-- Set collective io operations for parallel io 1668 IF ( netcdf_data_format > 2 ) THEN 1669 nc_stat = NF90_VAR_PAR_ACCESS( id_set_xy(av), & 1670 id_var_do2d(av,i), & 1671 NF90_COLLECTIVE ) 1672 CALL handle_netcdf_error( 'netcdf', 448 ) 1673 ENDIF 1674 #endif 1646 1675 ENDIF 1647 1676 … … 1940 1969 id_var_do2d(av,i) ) 1941 1970 CALL handle_netcdf_error( 'netcdf', 138 ) 1971 #if defined( __netcdf4 ) 1972 ! 1973 !-- Set collective io operations for parallel io 1974 IF ( netcdf_data_format > 2 ) THEN 1975 nc_stat = NF90_VAR_PAR_ACCESS( id_set_xy(av), & 1976 id_var_do2d(av,i), & 1977 NF90_COLLECTIVE ) 1978 CALL handle_netcdf_error( 'netcdf', 454 ) 1979 ENDIF 1980 #endif 1942 1981 ENDIF 1943 1982 i = i + 1 … … 2212 2251 'units', TRIM( do2d_unit(av,i) ) ) 2213 2252 CALL handle_netcdf_error( 'netcdf', 355 ) 2253 #if defined( __netcdf4 ) 2254 ! 2255 !-- Set independent io operations for parallel io. Collective io 2256 !-- is only allowed in case of a 1d-decomposition along x, because 2257 !-- otherwise, not all PEs have output data. 2258 IF ( netcdf_data_format > 2 ) THEN 2259 IF ( npey == 1 ) THEN 2260 nc_stat = NF90_VAR_PAR_ACCESS( id_set_xz(av), & 2261 id_var_do2d(av,i), & 2262 NF90_COLLECTIVE ) 2263 ELSE 2264 ! 2265 !-- ATTENTION: Due to a probable bug in the NetCDF4 2266 !-- installation, independet output does not work 2267 !-- A workaround is used in data_output_2d on those 2268 !-- PEs having no data 2269 nc_stat = NF90_VAR_PAR_ACCESS( id_set_xz(av), & 2270 id_var_do2d(av,i), & 2271 NF90_COLLECTIVE ) 2272 ! nc_stat = NF90_VAR_PAR_ACCESS( id_set_xz(av), & 2273 ! id_var_do2d(av,i), & 2274 ! NF90_INDEPENDENT ) 2275 ENDIF 2276 CALL handle_netcdf_error( 'netcdf', 449 ) 2277 ENDIF 2278 #endif 2214 2279 ENDIF 2215 2280 … … 2478 2543 id_var_do2d(av,i) ) 2479 2544 CALL handle_netcdf_error( 'netcdf', 177 ) 2545 #if defined( __netcdf4 ) 2546 ! 2547 !-- Set independent io operations for parallel io. Collective io 2548 !-- is only allowed in case of a 1d-decomposition along x, because 2549 !-- otherwise, not all PEs have output data. 2550 IF ( netcdf_data_format > 2 ) THEN 2551 IF ( npey == 1 ) THEN 2552 nc_stat = NF90_VAR_PAR_ACCESS( id_set_xz(av), & 2553 id_var_do2d(av,i), & 2554 NF90_COLLECTIVE ) 2555 ELSE 2556 ! 2557 !-- ATTENTION: Due to a probable bug in the NetCDF4 2558 !-- installation, independet output does not work 2559 !-- A workaround is used in data_output_2d on those 2560 !-- PEs having no data 2561 nc_stat = NF90_VAR_PAR_ACCESS( id_set_xz(av), & 2562 id_var_do2d(av,i), & 2563 NF90_COLLECTIVE ) 2564 ! nc_stat = NF90_VAR_PAR_ACCESS( id_set_xz(av), & 2565 ! id_var_do2d(av,i), & 2566 ! NF90_INDEPENDENT ) 2567 ENDIF 2568 CALL handle_netcdf_error( 'netcdf', 455 ) 2569 ENDIF 2570 #endif 2480 2571 ENDIF 2481 2572 i = i + 1 … … 2750 2841 'units', TRIM( do2d_unit(av,i) ) ) 2751 2842 CALL handle_netcdf_error( 'netcdf', 356 ) 2843 #if defined( __netcdf4 ) 2844 ! 2845 !-- Set independent io operations for parallel io. Collective io 2846 !-- is only allowed in case of a 1d-decomposition along y, because 2847 !-- otherwise, not all PEs have output data. 2848 IF ( netcdf_data_format > 2 ) THEN 2849 IF ( npex == 1 ) THEN 2850 nc_stat = NF90_VAR_PAR_ACCESS( id_set_yz(av), & 2851 id_var_do2d(av,i), & 2852 NF90_COLLECTIVE ) 2853 ELSE 2854 ! 2855 !-- ATTENTION: Due to a probable bug in the NetCDF4 2856 !-- installation, independet output does not work 2857 !-- A workaround is used in data_output_2d on those 2858 !-- PEs having no data 2859 nc_stat = NF90_VAR_PAR_ACCESS( id_set_yz(av), & 2860 id_var_do2d(av,i), & 2861 NF90_COLLECTIVE ) 2862 ! nc_stat = NF90_VAR_PAR_ACCESS( id_set_yz(av), & 2863 ! id_var_do2d(av,i), & 2864 ! NF90_INDEPENDENT ) 2865 ENDIF 2866 CALL handle_netcdf_error( 'netcdf', 450 ) 2867 ENDIF 2868 #endif 2752 2869 ENDIF 2753 2870 … … 3014 3131 id_var_do2d(av,i) ) 3015 3132 CALL handle_netcdf_error( 'netcdf', 216 ) 3133 #if defined( __netcdf4 ) 3134 ! 3135 !-- Set independent io operations for parallel io. Collective io 3136 !-- is only allowed in case of a 1d-decomposition along y, because 3137 !-- otherwise, not all PEs have output data. 3138 IF ( netcdf_data_format > 2 ) THEN 3139 IF ( npex == 1 ) THEN 3140 nc_stat = NF90_VAR_PAR_ACCESS( id_set_yz(av), & 3141 id_var_do2d(av,i), & 3142 NF90_COLLECTIVE ) 3143 ELSE 3144 ! 3145 !-- ATTENTION: Due to a probable bug in the NetCDF4 3146 !-- installation, independet output does not work 3147 !-- A workaround is used in data_output_2d on those 3148 !-- PEs having no data 3149 nc_stat = NF90_VAR_PAR_ACCESS( id_set_yz(av), & 3150 id_var_do2d(av,i), & 3151 NF90_COLLECTIVE ) 3152 ! nc_stat = NF90_VAR_PAR_ACCESS( id_set_yz(av), & 3153 ! id_var_do2d(av,i), & 3154 ! NF90_INDEPENDENT ) 3155 ENDIF 3156 CALL handle_netcdf_error( 'netcdf', 450 ) 3157 ENDIF 3158 #endif 3016 3159 ENDIF 3017 3160 i = i + 1 -
palm/trunk/SOURCE/parin.f90
r482 r493 4 4 ! Current revisions: 5 5 ! ----------------- 6 ! 6 ! +netcdf_data_format in d3par, -netcdf_64bit, -netcdf_64bit_3d 7 7 ! 8 8 ! Former revisions: … … 16 16 ! 410 2009-12-04 17:05:40Z letzel 17 17 ! masked data output: + dt_domask, mask_01~20_x|y|z, mask_01~20_x|y|z_loop, 18 ! mask_scale_x|y|z, masks, netcdf_format_mask[_av],skip_time_domask18 ! mask_scale_x|y|z, masks, skip_time_domask 19 19 ! 20 20 ! 291 2009-04-16 12:07:26Z raasch … … 61 61 ! 20 2007-02-26 00:12:32Z raasch 62 62 ! +top_heatflux, use_top_fluxes in inipar 63 !64 ! -netcdf_64bit_3d65 63 ! 66 64 ! 3 2007-02-13 11:30:58Z raasch … … 208 206 mask_19_z_loop, mask_20_z_loop, & 209 207 mg_cycles, mg_switch_to_pe0_level, & 210 netcdf_64bit, netcdf_64bit_3d, & 211 netcdf_format_mask, netcdf_format_mask_av, & 208 netcdf_data_format, & 212 209 ngsrb, normalizing_region, npex, npey, nsor, nz_do3d, & 213 210 omega_sor, & -
palm/trunk/SOURCE/user_statistics.f90
r484 r493 4 4 ! Current revisions: 5 5 ! ----------------- 6 ! 6 ! Bugfix: timeseries data have to be collected by PE0 7 7 ! 8 8 ! Former revisions: … … 25 25 USE arrays_3d 26 26 USE indices 27 USE netcdf_control 27 28 USE statistics 28 29 USE user … … 33 34 34 35 INTEGER :: i, j, k, sr, tn 36 37 REAL, DIMENSION(dots_num_palm+1:dots_max) :: ts_value_l 35 38 36 39 … … 70 73 !-- creates two time series for the absolut values of the horizontal 71 74 !-- velocities u and v. 72 ! ts_value(dots_num_palm+1,sr) = ABS( u_max ) 73 ! ts_value(dots_num_palm+2,sr) = ABS( v_max ) 75 ! ts_value_l = 0.0 76 ! ts_value_l(dots_num_palm+1,sr) = ABS( u_max ) 77 ! ts_value_l(dots_num_palm+2,sr) = ABS( v_max ) 78 ! 79 !-- Collect / send values to PE0, because only PE0 outputs the time series. 80 !-- CAUTION: Collection is done by taking the sum over all processors. 81 !-- You may have to normalize this sum, depending on the quantity 82 !-- that you like to calculate. For serial runs, nothing has to be 83 !-- done. 84 !-- HINT: If the time series value that you are calculating has the same 85 !-- value on all PEs, you can omit the MPI_ALLREDUCE call and 86 !-- assign ts_value(dots_num_palm+1:,sr) = ts_value_l directly. 87 !#if defined( __parallel ) 88 ! CALL MPI_ALLREDUCE( ts_value_l(dots_num_palm+1), & 89 ! ts_value(dots_num_palm+1,sr), & 90 ! dots_max-dots_num_palm, MPI_REAL, MPI_SUM, comm2d, & 91 ! ierr ) 92 !#else 93 ! ts_value(dots_num_palm+1:,sr) = ts_value_l 94 !#endif 74 95 75 96 ENDIF
Note: See TracChangeset
for help on using the changeset viewer.